mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
xen: event channel remapping for emulated MSIs
Linux PV on HVM guests remap all the MSIs onto event channels, including MSIs corresponding to QEMU's emulated devices. This patch makes sure that we handle correctly the case of emulated MSI that have been remapped, sending a pirq to the guest instead. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Tested-by: Deep Debroy <ddebroy@gmail.com> Committed-by: Keir Fraser <keir@xen.org>
This commit is contained in:
1 parent
97d39c5fbf
commit
88fccdd11c
2 files changed
+26
No files matched your search
@@ -281,6 +281,31 @@ void hvm_inject_msi(struct domain *d, uint64_t addr, uint32_t data)
|
||||
>> MSI_DATA_TRIGGER_SHIFT;
|
||||
uint8_t vector = data & MSI_DATA_VECTOR_MASK;
|
||||
|
||||
if ( !vector )
|
||||
{
|
||||
int pirq = ((addr >> 32) & 0xffffff00) | ((addr >> 12) & 0xff);
|
||||
if ( pirq > 0 )
|
||||
{
|
||||
struct pirq *info = pirq_info(d, pirq);
|
||||
|
||||
/* if it is the first time, allocate the pirq */
|
||||
if (info->arch.hvm.emuirq == IRQ_UNBOUND)
|
||||
{
|
||||
spin_lock(&d->event_lock);
|
||||
map_domain_emuirq_pirq(d, pirq, IRQ_MSI_EMU);
|
||||
spin_unlock(&d->event_lock);
|
||||
} else if (info->arch.hvm.emuirq != IRQ_MSI_EMU)
|
||||
{
|
||||
printk("%s: pirq %d does not correspond to an emulated MSI\n", __func__, pirq);
|
||||
return;
|
||||
}
|
||||
send_guest_pirq(d, info);
|
||||
return;
|
||||
} else {
|
||||
printk("%s: error getting pirq from MSI: pirq = %d\n", __func__, pirq);
|
||||
}
|
||||
}
|
||||
|
||||
vmsi_deliver(d, vector, dest, dest_mode, delivery_mode, trig_mode);
|
||||
}
|
||||
|
||||
|
||||
@@ -188,6 +188,7 @@ void cleanup_domain_irq_mapping(struct domain *);
|
||||
})
|
||||
#define IRQ_UNBOUND -1
|
||||
#define IRQ_PT -2
|
||||
#define IRQ_MSI_EMU -3
|
||||
|
||||
bool_t cpu_has_pending_apic_eoi(void);
|
||||
|
||||
|
||||