Skip to content

Commit e0973e4

Browse files
shiqingglijinxia
authored andcommitted
hv: ioapic: convert some MACROs to inline functions
Convert GSI_MASK_IRQ and GSI_UNMASK_IRQ to inline functions. v1 -> v2: After changing GSI_MASK_IRQ and GSI_UNMASK_IRQ from MACROs to functions, 'gsi_(mask|unmask)_irq' are the exposed APIs and 'irq_gsi_mask_unmask' becomes internal. In order to reflect this change, - change 'irq_gsi_mask_unmask' as internal function in ioapic.c - declare 'gsi_(mask|unmask)_irq' in ioapic.h - define 'gsi_(mask|unmask)_irq' in ioapic.c Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
1 parent 99ed546 commit e0973e4

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

hypervisor/arch/x86/assign.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static void remove_intx_remapping(struct vm *vm, uint8_t virt_pin, bool pic_pin)
324324
if (is_entry_active(entry)) {
325325
phys_irq = entry->allocated_pirq;
326326
/* disable interrupt */
327-
GSI_MASK_IRQ(phys_irq);
327+
gsi_mask_irq(phys_irq);
328328

329329
ptdev_deactivate_entry(entry);
330330
dev_dbg(ACRN_DBG_IRQ,
@@ -472,7 +472,7 @@ void ptdev_intx_ack(struct vm *vm, uint8_t virt_pin,
472472

473473
dev_dbg(ACRN_DBG_PTIRQ, "dev-assign: irq=0x%x acked vr: 0x%x",
474474
phys_irq, irq_to_vector(phys_irq));
475-
GSI_UNMASK_IRQ(phys_irq);
475+
gsi_unmask_irq(phys_irq);
476476
}
477477

478478
/* Main entry for PCI device assignment with MSI and MSI-X
@@ -548,7 +548,7 @@ static void activate_physical_ioapic(struct vm *vm,
548548
bool is_lvl_trigger = false;
549549

550550
/* disable interrupt */
551-
GSI_MASK_IRQ(phys_irq);
551+
gsi_mask_irq(phys_irq);
552552

553553
/* build physical IOAPIC RTE */
554554
rte = ptdev_build_physical_rte(vm, entry);
@@ -565,7 +565,7 @@ static void activate_physical_ioapic(struct vm *vm,
565565
ioapic_set_rte(phys_irq, rte);
566566

567567
if (intr_mask == IOAPIC_RTE_INTMCLR) {
568-
GSI_UNMASK_IRQ(phys_irq);
568+
gsi_unmask_irq(phys_irq);
569569
}
570570
}
571571

hypervisor/arch/x86/ioapic.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ uint32_t pin_to_irq(uint8_t pin)
286286
return IRQ_INVALID;
287287
}
288288

289-
void
289+
static void
290290
irq_gsi_mask_unmask(uint32_t irq, bool mask)
291291
{
292292
void *addr;
@@ -311,6 +311,16 @@ irq_gsi_mask_unmask(uint32_t irq, bool mask)
311311
irq, pin, rte.full);
312312
}
313313

314+
void gsi_mask_irq(uint32_t irq)
315+
{
316+
irq_gsi_mask_unmask(irq, true);
317+
}
318+
319+
void gsi_unmask_irq(uint32_t irq)
320+
{
321+
irq_gsi_mask_unmask(irq, false);
322+
}
323+
314324
static uint8_t
315325
ioapic_nr_pins(void *ioapic_base)
316326
{

hypervisor/arch/x86/irq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ static inline void handle_irq(struct irq_desc *desc)
302302
irq_action_t action = desc->action;
303303

304304
if (irq_need_mask(desc)) {
305-
GSI_MASK_IRQ(desc->irq);
305+
gsi_mask_irq(desc->irq);
306306
}
307307

308308
/* Send EOI to LAPIC/IOAPIC IRR */
@@ -313,7 +313,7 @@ static inline void handle_irq(struct irq_desc *desc)
313313
}
314314

315315
if (irq_need_unmask(desc)) {
316-
GSI_UNMASK_IRQ(desc->irq);
316+
gsi_unmask_irq(desc->irq);
317317
}
318318
}
319319

hypervisor/include/arch/x86/ioapic.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,20 @@
1616
#define NR_LEGACY_PIN NR_LEGACY_IRQ
1717
#define NR_MAX_GSI (CONFIG_NR_IOAPICS * IOAPIC_MAX_LINES)
1818

19-
#define GSI_MASK_IRQ(irq) irq_gsi_mask_unmask((irq), true)
20-
#define GSI_UNMASK_IRQ(irq) irq_gsi_mask_unmask((irq), false)
21-
2219
void setup_ioapic_irqs(void);
2320

2421
bool irq_is_gsi(uint32_t irq);
2522
uint8_t irq_to_pin(uint32_t irq);
2623
uint32_t pin_to_irq(uint8_t pin);
27-
void irq_gsi_mask_unmask(uint32_t irq, bool mask);
2824
void ioapic_set_rte(uint32_t irq, union ioapic_rte rte);
2925
void ioapic_get_rte(uint32_t irq, union ioapic_rte *rte);
3026

3127
void suspend_ioapic(void);
3228
void resume_ioapic(void);
3329

30+
void gsi_mask_irq(uint32_t irq);
31+
void gsi_unmask_irq(uint32_t irq);
32+
3433
extern uint8_t pic_ioapic_pin_map[NR_LEGACY_PIN];
3534

3635
#ifdef HV_DEBUG

0 commit comments

Comments
 (0)