HV: treewide: drop debug-only helpers in release build

There are multiple helpers for collecting info to be printed on the ACRN uart
console. They are unreachable code in release builds in which the uart console
is removed.

To define a precise boundary for safety-related activities, this patch wraps the
declarations and definitions to these helpers with "#ifdef HV_DEBUG" so that
these unreachable APIs will be dropped in release builds.

v1 -> v2:

    * Fix coding style: no empty lines between #ifdef and the wrapped code.
    * Also drop get_rte_info() in ioapic.c, which is solely used by
      get_ioapic_info().

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Junjie Mao
2018-07-02 19:01:08 +08:00
committed by lijinxia
parent 8b1c5a7cba
commit cfc3811a0a
12 changed files with 38 additions and 6 deletions

View File

@@ -902,6 +902,7 @@ void ptdev_remove_msix_remapping(struct vm *vm, uint16_t virt_bdf,
remove_msix_remapping(vm, virt_bdf, i);
}
#ifdef HV_DEBUG
static void get_entry_info(struct ptdev_remapping_info *entry, char *type,
uint32_t *irq, uint32_t *vector, uint64_t *dest, bool *lvl_tm,
int *pin, int *vpin, int *bdf, int *vbdf)
@@ -1004,3 +1005,4 @@ void get_ptdev_info(char *str, int str_max)
snprintf(str, size, "\r\n");
}
#endif /* HV_DEBUG */

View File

@@ -608,6 +608,7 @@ bool vioapic_get_rte(struct vm *vm, int pin, void *rte)
return false;
}
#ifdef HV_DEBUG
void get_vioapic_info(char *str, int str_max, int vmid)
{
int pin, len, size = str_max, vector, delmode;
@@ -653,3 +654,4 @@ void get_vioapic_info(char *str, int str_max, int vmid)
END:
snprintf(str, size, "\r\n");
}
#endif /* HV_DEBUG */

View File

@@ -414,6 +414,7 @@ void resume_ioapic(void)
}
}
#ifdef HV_DEBUG
void get_rte_info(struct ioapic_rte *rte, bool *mask, bool *irr,
bool *phys, int *delmode, bool *level, int *vector, uint32_t *dest)
{
@@ -469,3 +470,4 @@ int get_ioapic_info(char *str, int str_max_len)
snprintf(str, size, "\r\n");
return 0;
}
#endif /* HV_DEBUG */

View File

@@ -664,6 +664,7 @@ pri_register_handler(uint32_t irq,
return common_register_handler(irq, &info);
}
#ifdef HV_DEBUG
void get_cpu_interrupt_info(char *str, int str_max)
{
uint16_t pcpu_id;
@@ -706,6 +707,7 @@ void get_cpu_interrupt_info(char *str, int str_max)
}
snprintf(str, size, "\r\n");
}
#endif /* HV_DEBUG */
int interrupt_init(uint32_t cpu_id)
{