Skip to content

Commit 8f7fa50

Browse files
yonghuahwenlingz
authored andcommitted
hv: fix mapping between GSI Num#2 and PIC IRQ #0
route GSI number#2 to PIC IRQ#0, as by default IRQ for 8254 timer is connected to I/O APIC Pin #2 and PIC Pin #0 Tracked-On: #861 Signed-off-by: Yonghua Huang <yonghua.huang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent 96f8bec commit 8f7fa50

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

hypervisor/common/hypercall.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ int32_t hcall_set_vcpu_regs(struct vm *vm, uint16_t vmid, uint64_t param)
336336
int32_t hcall_set_irqline(const struct vm *vm, uint16_t vmid,
337337
struct acrn_irqline_ops *ops)
338338
{
339+
uint32_t irq_pic;
339340
struct vm *target_vm = get_vm_from_vmid(vmid);
340341

341342
if (target_vm == NULL) {
@@ -347,8 +348,13 @@ int32_t hcall_set_irqline(const struct vm *vm, uint16_t vmid,
347348
}
348349

349350
if (ops->nr_gsi < vpic_pincount()) {
350-
/* Call vpic for pic injection */
351-
vpic_set_irq(target_vm, ops->nr_gsi, ops->op);
351+
/*
352+
* IRQ line for 8254 timer is connected to
353+
* I/O APIC pin #2 but PIC pin #0,route GSI
354+
* number #2 to PIC IRQ #0.
355+
*/
356+
irq_pic = (ops->nr_gsi == 2U) ? 0U : ops->nr_gsi;
357+
vpic_set_irq(target_vm, irq_pic, ops->op);
352358
}
353359

354360
/* handle IOAPIC irqline */

0 commit comments

Comments
 (0)