mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-03 01:44:55 +00:00
hv: irq: clean up HV_DEBUG usage
remove the usage of HV_DEBUG in irq.c Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -10,8 +10,7 @@
|
||||
static spinlock_t exception_spinlock = { .head = 0U, .tail = 0U, };
|
||||
static spinlock_t irq_alloc_spinlock = { .head = 0U, .tail = 0U, };
|
||||
|
||||
#define IRQ_ALLOC_BITMAP_SIZE INT_DIV_ROUNDUP(NR_IRQS, 64U)
|
||||
static uint64_t irq_alloc_bitmap[IRQ_ALLOC_BITMAP_SIZE];
|
||||
uint64_t irq_alloc_bitmap[IRQ_ALLOC_BITMAP_SIZE];
|
||||
struct irq_desc irq_desc_array[NR_IRQS];
|
||||
static uint32_t vector_to_irq[NR_MAX_VECTOR + 1];
|
||||
|
||||
@@ -402,60 +401,6 @@ void partition_mode_dispatch_interrupt(struct intr_excp_ctx *ctx)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HV_DEBUG
|
||||
void get_cpu_interrupt_info(char *str_arg, size_t str_max)
|
||||
{
|
||||
char *str = str_arg;
|
||||
uint16_t pcpu_id;
|
||||
uint32_t irq, vector;
|
||||
size_t len, size = str_max;
|
||||
|
||||
len = snprintf(str, size, "\r\nIRQ\tVECTOR");
|
||||
if (len >= size) {
|
||||
goto overflow;
|
||||
}
|
||||
size -= len;
|
||||
str += len;
|
||||
|
||||
for (pcpu_id = 0U; pcpu_id < phys_cpu_num; pcpu_id++) {
|
||||
len = snprintf(str, size, "\tCPU%d", pcpu_id);
|
||||
if (len >= size) {
|
||||
goto overflow;
|
||||
}
|
||||
size -= len;
|
||||
str += len;
|
||||
}
|
||||
|
||||
for (irq = 0U; irq < NR_IRQS; irq++) {
|
||||
vector = irq_to_vector(irq);
|
||||
if (bitmap_test((uint16_t)(irq & 0x3FU),
|
||||
irq_alloc_bitmap + (irq >> 6U))
|
||||
&& (vector != VECTOR_INVALID)) {
|
||||
len = snprintf(str, size, "\r\n%d\t0x%X", irq, vector);
|
||||
if (len >= size) {
|
||||
goto overflow;
|
||||
}
|
||||
size -= len;
|
||||
str += len;
|
||||
|
||||
for (pcpu_id = 0U; pcpu_id < phys_cpu_num; pcpu_id++) {
|
||||
len = snprintf(str, size, "\t%d", per_cpu(irq_count, pcpu_id)[irq]);
|
||||
if (len >= size) {
|
||||
goto overflow;
|
||||
}
|
||||
size -= len;
|
||||
str += len;
|
||||
}
|
||||
}
|
||||
}
|
||||
snprintf(str, size, "\r\n");
|
||||
return;
|
||||
|
||||
overflow:
|
||||
printf("buffer size could not be enough! please check!\n");
|
||||
}
|
||||
#endif /* HV_DEBUG */
|
||||
|
||||
static void init_irq_descs(void)
|
||||
{
|
||||
uint32_t i;
|
||||
|
@@ -841,6 +841,66 @@ static int shell_to_sos_console(__unused int argc, __unused char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the interrupt statistics
|
||||
*
|
||||
* It's for debug only.
|
||||
*
|
||||
* @param[in] str_max The max size of the string containing interrupt info
|
||||
* @param[inout] str_arg Pointer to the output interrupt info
|
||||
*/
|
||||
static void get_cpu_interrupt_info(char *str_arg, size_t str_max)
|
||||
{
|
||||
char *str = str_arg;
|
||||
uint16_t pcpu_id;
|
||||
uint32_t irq, vector;
|
||||
size_t len, size = str_max;
|
||||
|
||||
len = snprintf(str, size, "\r\nIRQ\tVECTOR");
|
||||
if (len >= size) {
|
||||
goto overflow;
|
||||
}
|
||||
size -= len;
|
||||
str += len;
|
||||
|
||||
for (pcpu_id = 0U; pcpu_id < phys_cpu_num; pcpu_id++) {
|
||||
len = snprintf(str, size, "\tCPU%d", pcpu_id);
|
||||
if (len >= size) {
|
||||
goto overflow;
|
||||
}
|
||||
size -= len;
|
||||
str += len;
|
||||
}
|
||||
|
||||
for (irq = 0U; irq < NR_IRQS; irq++) {
|
||||
vector = irq_to_vector(irq);
|
||||
if (bitmap_test((uint16_t)(irq & 0x3FU),
|
||||
irq_alloc_bitmap + (irq >> 6U))
|
||||
&& (vector != VECTOR_INVALID)) {
|
||||
len = snprintf(str, size, "\r\n%d\t0x%X", irq, vector);
|
||||
if (len >= size) {
|
||||
goto overflow;
|
||||
}
|
||||
size -= len;
|
||||
str += len;
|
||||
|
||||
for (pcpu_id = 0U; pcpu_id < phys_cpu_num; pcpu_id++) {
|
||||
len = snprintf(str, size, "\t%d", per_cpu(irq_count, pcpu_id)[irq]);
|
||||
if (len >= size) {
|
||||
goto overflow;
|
||||
}
|
||||
size -= len;
|
||||
str += len;
|
||||
}
|
||||
}
|
||||
}
|
||||
snprintf(str, size, "\r\n");
|
||||
return;
|
||||
|
||||
overflow:
|
||||
printf("buffer size could not be enough! please check!\n");
|
||||
}
|
||||
|
||||
static int shell_show_cpu_int(__unused int argc, __unused char **argv)
|
||||
{
|
||||
get_cpu_interrupt_info(shell_log_buf, SHELL_LOG_BUF_SIZE);
|
||||
|
@@ -52,6 +52,8 @@
|
||||
#define DEFAULT_DELIVERY_MODE IOAPIC_RTE_DELLOPRI
|
||||
#define ALL_CPUS_MASK ((1U << phys_cpu_num) - 1U)
|
||||
|
||||
#define IRQ_ALLOC_BITMAP_SIZE INT_DIV_ROUNDUP(NR_IRQS, 64U)
|
||||
|
||||
/*
|
||||
* Definition of the stack frame layout
|
||||
*/
|
||||
@@ -243,19 +245,8 @@ void interrupt_init(uint16_t pcpu_id);
|
||||
|
||||
void cancel_event_injection(struct acrn_vcpu *vcpu);
|
||||
|
||||
#ifdef HV_DEBUG
|
||||
/**
|
||||
* @brief Get the interupt statistics
|
||||
*
|
||||
* It's for debug only.
|
||||
*
|
||||
* @param[in] str_max The max size of the string containing interrupt info
|
||||
* @param[inout] str_arg Pointer to the output interrupt info
|
||||
*/
|
||||
void get_cpu_interrupt_info(char *str_arg, size_t str_max);
|
||||
#endif /* HV_DEBUG */
|
||||
|
||||
extern uint32_t acrn_vhm_vector;
|
||||
extern uint64_t irq_alloc_bitmap[IRQ_ALLOC_BITMAP_SIZE];
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
Reference in New Issue
Block a user