Skip to content

Commit 471082c

Browse files
JasonChenCJjren1
authored andcommitted
ptdev: refine function input parameters
functions ptdev_build_physical_rte & activate_physical_ioapic doesn't need to get parameters like phys_irq, ptdev_intx_info or vector from caller, instead they can derive from entry. Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
1 parent a8b3771 commit 471082c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

hypervisor/arch/x86/assign.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,18 @@ static void ptdev_build_physical_msi(struct vm *vm, struct ptdev_msi_info *info,
365365
}
366366

367367
static uint64_t ptdev_build_physical_rte(struct vm *vm,
368-
struct ptdev_intx_info *info, int vector)
368+
struct ptdev_remapping_info *entry)
369369
{
370370
uint64_t rte;
371+
int phys_irq = dev_to_irq(entry->node);
372+
int vector = dev_to_vector(entry->node);
371373

372-
if (info->vpin_src == PTDEV_VPIN_IOAPIC) {
374+
if (entry->intx.vpin_src == PTDEV_VPIN_IOAPIC) {
373375
uint64_t vdmask, pdmask;
374376
uint32_t dest, low, high, delmode;
375377
bool phys;
376378

377-
vioapic_get_rte(vm, info->virt_pin, &rte);
379+
vioapic_get_rte(vm, entry->intx.virt_pin, &rte);
378380
low = rte;
379381
high = rte >> 32;
380382

@@ -406,14 +408,13 @@ static uint64_t ptdev_build_physical_rte(struct vm *vm,
406408
rte = rte << 32 | low;
407409
} else {
408410
enum vpic_trigger trigger;
409-
int phys_irq = pin_to_irq(info->phys_pin);
410411
uint64_t physical_rte;
411412

412413
/* just update trigger mode */
413414
ioapic_get_rte(phys_irq, &physical_rte);
414415
rte = physical_rte;
415416
rte &= ~IOAPIC_RTE_TRGRMOD;
416-
vpic_get_irq_trigger(vm, info->virt_pin, &trigger);
417+
vpic_get_irq_trigger(vm, entry->intx.virt_pin, &trigger);
417418
if (trigger == LEVEL_TRIGGER)
418419
rte |= IOAPIC_RTE_TRGRLVL;
419420

@@ -729,17 +730,16 @@ static bool vpin_masked(struct vm *vm, uint8_t virt_pin,
729730
}
730731

731732
static void activate_physical_ioapic(struct vm *vm,
732-
struct ptdev_intx_info *info,
733-
struct ptdev_remapping_info *entry, int phys_irq)
733+
struct ptdev_remapping_info *entry)
734734
{
735735
uint64_t rte;
736+
int phys_irq = dev_to_irq(entry->node);
736737

737738
/* disable interrupt */
738739
GSI_MASK_IRQ(phys_irq);
739740

740741
/* build physical IOAPIC RTE, update to info->rte */
741-
rte = ptdev_build_physical_rte(vm, info,
742-
dev_to_vector(entry->node));
742+
rte = ptdev_build_physical_rte(vm, entry);
743743

744744
/* set rte entry */
745745
GSI_SET_RTE(phys_irq, rte | IOAPIC_RTE_INTMSET);
@@ -824,14 +824,14 @@ int ptdev_intx_pin_remap(struct vm *vm, struct ptdev_intx_info *info)
824824
goto END;
825825
} else {
826826
/*update rte*/
827-
activate_physical_ioapic(vm, info, entry, phys_irq);
827+
activate_physical_ioapic(vm, entry);
828828
}
829829
} else if (entry_is_active(entry)
830830
&& info->vpin_src == PTDEV_VPIN_PIC) {
831831
/* only update here
832832
* deactive vPIC entry when IOAPIC take it over
833833
*/
834-
activate_physical_ioapic(vm, info, entry, phys_irq);
834+
activate_physical_ioapic(vm, entry);
835835
} else {
836836
/*
837837
* both vIOAPIC & vPIC take physical IOAPIC path
@@ -844,7 +844,7 @@ int ptdev_intx_pin_remap(struct vm *vm, struct ptdev_intx_info *info)
844844
/* active entry */
845845
ptdev_activate_entry(entry, phys_irq, lowpri);
846846

847-
activate_physical_ioapic(vm, info, entry, phys_irq);
847+
activate_physical_ioapic(vm, entry);
848848

849849
dev_dbg(ACRN_DBG_IRQ,
850850
"IOAPIC pin=%d pirq=%d assigned to vm%d %s vpin=%d",

0 commit comments

Comments
 (0)