On 03/06/2015 10:29, Igor Mammedov wrote: >>> > > + root = address_space_root_memory_region(cpu->as); >> > >> > I think just using cpu->as->root is okay. >> > >>> > > + memory_region_add_subregion_overlap(root, >>> > > + s->apicbase & >>> > > MSR_IA32_APICBASE_BASE, >>> > > + &s->io_memory, >>> > > + 0x1000); >> > >> > I think this patch is incorrect, because you do not install a separate >> > address space for each CPU. Also, the CPU address space is only used >> > with TCG so it should be guarded by "if (tcg_enabled())". > Don't we need it be mapped on for KVM for MSI to work > when using kvm-apic? > > kvm_apic_io_ops->write = kvm_apic_mem_write->kvm_irqchip_send_msi()
Yes, and the reason this patch worked is simply that by default cpu->as is &address_space_memory. The patch was just registering the same region once per VCPU instead of 1, in the same place as before. Paolo