mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
apic: add send_msi() to APICCommonClass
The MMIO based interface to APIC doesn't work well with MSIs that have upper address bits set (remapped x2APIC MSIs). A specialized interface is a quick and dirty way to avoid the shortcoming. Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
2f114315dc
commit
267ee35715
4 changed files with 29 additions and 8 deletions
|
@ -169,6 +169,17 @@ static void kvm_apic_external_nmi(APICCommonState *s)
|
|||
run_on_cpu(CPU(s->cpu), do_inject_external_nmi, s);
|
||||
}
|
||||
|
||||
static void kvm_send_msi(MSIMessage *msg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = kvm_irqchip_send_msi(kvm_state, *msg);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "KVM: injection failed, MSI lost (%s)\n",
|
||||
strerror(-ret));
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t kvm_apic_mem_read(void *opaque, hwaddr addr,
|
||||
unsigned size)
|
||||
{
|
||||
|
@ -179,13 +190,8 @@ static void kvm_apic_mem_write(void *opaque, hwaddr addr,
|
|||
uint64_t data, unsigned size)
|
||||
{
|
||||
MSIMessage msg = { .address = addr, .data = data };
|
||||
int ret;
|
||||
|
||||
ret = kvm_irqchip_send_msi(kvm_state, msg);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "KVM: injection failed, MSI lost (%s)\n",
|
||||
strerror(-ret));
|
||||
}
|
||||
kvm_send_msi(&msg);
|
||||
}
|
||||
|
||||
static const MemoryRegionOps kvm_apic_io_ops = {
|
||||
|
@ -232,6 +238,7 @@ static void kvm_apic_class_init(ObjectClass *klass, void *data)
|
|||
k->enable_tpr_reporting = kvm_apic_enable_tpr_reporting;
|
||||
k->vapic_base_update = kvm_apic_vapic_base_update;
|
||||
k->external_nmi = kvm_apic_external_nmi;
|
||||
k->send_msi = kvm_send_msi;
|
||||
}
|
||||
|
||||
static const TypeInfo kvm_apic_info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue