From 1fc10d514cf882d52f6240f1eb44cf136f9f38de Mon Sep 17 00:00:00 2001 From: Mingqiang Chi Date: Thu, 10 Jan 2019 17:03:34 +0800 Subject: [PATCH] hv:Unify the MACRO name for invalid interrupt pin There are the following definitions in hypervisor, define IOAPIC_INVALID_PIN 0xffU define VPIC_INVALID_PIN 0xffU define PTDEV_INVALID_PIN 0xffU this patch unify them to: define INVALID_INTERRUPT_PIN 0xffffffffU Tracked-On: #861 Signed-off-by: Mingqiang Chi --- hypervisor/arch/x86/ioapic.c | 7 +++---- hypervisor/debug/shell.c | 5 ++--- hypervisor/dm/vpic.c | 4 ++-- hypervisor/include/arch/x86/guest/vpic.h | 1 - hypervisor/include/arch/x86/irq.h | 2 ++ 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/hypervisor/arch/x86/ioapic.c b/hypervisor/arch/x86/ioapic.c index 479d7abb5..dafeef2d1 100644 --- a/hypervisor/arch/x86/ioapic.c +++ b/hypervisor/arch/x86/ioapic.c @@ -8,7 +8,6 @@ #include #define IOAPIC_MAX_PIN 240U -#define IOAPIC_INVALID_PIN 0xffU /* * IOAPIC_MAX_LINES is architecturally defined. @@ -86,7 +85,7 @@ static const uint32_t pic_ioapic_pin_map[NR_LEGACY_PIN] = { uint32_t get_pic_pin_from_ioapic_pin(uint32_t pin_index) { - uint32_t pin_id = IOAPIC_INVALID_PIN; + uint32_t pin_id = INVALID_INTERRUPT_PIN; if (pin_index < NR_LEGACY_PIN) { pin_id = pic_ioapic_pin_map[pin_index]; } @@ -284,7 +283,7 @@ uint32_t ioapic_irq_to_pin(uint32_t irq) if (ioapic_irq_is_gsi(irq)) { ret = gsi_table_data[irq].pin; } else { - ret = IOAPIC_INVALID_PIN; + ret = INVALID_INTERRUPT_PIN; } return ret; @@ -292,7 +291,7 @@ uint32_t ioapic_irq_to_pin(uint32_t irq) bool ioapic_is_pin_valid(uint32_t pin) { - return (pin != IOAPIC_INVALID_PIN); + return (pin != INVALID_INTERRUPT_PIN); } uint32_t ioapic_pin_to_irq(uint32_t pin) diff --git a/hypervisor/debug/shell.c b/hypervisor/debug/shell.c index f1b9e020a..c98a6205f 100644 --- a/hypervisor/debug/shell.c +++ b/hypervisor/debug/shell.c @@ -903,7 +903,6 @@ static int32_t shell_show_cpu_int(__unused int32_t argc, __unused char **argv) return 0; } -#define PTDEV_INVALID_PIN 0xffU static void get_entry_info(const struct ptirq_remapping_info *entry, char *type, uint32_t *irq, uint32_t *vector, uint64_t *dest, bool *lvl_tm, uint32_t *pin, uint32_t *vpin, uint32_t *bdf, uint32_t *vbdf) @@ -917,8 +916,8 @@ static void get_entry_info(const struct ptirq_remapping_info *entry, char *type, } else { *lvl_tm = false; } - *pin = PTDEV_INVALID_PIN; - *vpin = PTDEV_INVALID_PIN; + *pin = INVALID_INTERRUPT_PIN; + *vpin = INVALID_INTERRUPT_PIN; *bdf = entry->phys_sid.msi_id.bdf; *vbdf = entry->virt_sid.msi_id.bdf; } else { diff --git a/hypervisor/dm/vpic.c b/hypervisor/dm/vpic.c index bb67459e2..457b292d3 100644 --- a/hypervisor/dm/vpic.c +++ b/hypervisor/dm/vpic.c @@ -49,7 +49,7 @@ static inline bool master_pic(const struct acrn_vpic *vpic, struct i8259_reg_sta static inline uint32_t vpic_get_highest_isrpin(const struct i8259_reg_state *i8259) { uint32_t bit, pin, i; - uint32_t found_pin = VPIC_INVALID_PIN; + uint32_t found_pin = INVALID_INTERRUPT_PIN; pin = (i8259->lowprio + 1U) & 0x7U; @@ -79,7 +79,7 @@ static inline uint32_t vpic_get_highest_irrpin(const struct i8259_reg_state *i82 { uint8_t serviced; uint32_t bit, pin, tmp; - uint32_t found_pin = VPIC_INVALID_PIN; + uint32_t found_pin = INVALID_INTERRUPT_PIN; /* * In 'Special Fully-Nested Mode' when an interrupt request from diff --git a/hypervisor/include/arch/x86/guest/vpic.h b/hypervisor/include/arch/x86/guest/vpic.h index 67f82c5d6..fe80c8829 100644 --- a/hypervisor/include/arch/x86/guest/vpic.h +++ b/hypervisor/include/arch/x86/guest/vpic.h @@ -94,7 +94,6 @@ #define NR_VPIC_PINS_PER_CHIP 8U #define NR_VPIC_PINS_TOTAL 16U -#define VPIC_INVALID_PIN 0xffU enum vpic_trigger { EDGE_TRIGGER, diff --git a/hypervisor/include/arch/x86/irq.h b/hypervisor/include/arch/x86/irq.h index 92c478e68..d703528fe 100644 --- a/hypervisor/include/arch/x86/irq.h +++ b/hypervisor/include/arch/x86/irq.h @@ -54,6 +54,8 @@ #define IRQ_ALLOC_BITMAP_SIZE INT_DIV_ROUNDUP(NR_IRQS, 64U) +#define INVALID_INTERRUPT_PIN 0xffffffffU + /* * Definition of the stack frame layout */