From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z044u-0000dn-LF for qemu-devel@nongnu.org; Wed, 03 Jun 2015 04:31:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z044h-00038j-PO for qemu-devel@nongnu.org; Wed, 03 Jun 2015 04:31:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z044h-00036r-Bs for qemu-devel@nongnu.org; Wed, 03 Jun 2015 04:30:59 -0400 Message-ID: <556EBB3E.5020202@redhat.com> Date: Wed, 03 Jun 2015 10:30:54 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1432922664-15129-1-git-send-email-ehabkost@redhat.com> <1432922664-15129-3-git-send-email-ehabkost@redhat.com> <5568BD97.8030703@redhat.com> <20150603102924.7b8c9fe8@nial.brq.redhat.com> In-Reply-To: <20150603102924.7b8c9fe8@nial.brq.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 2/5] apic: map APIC's MMIO region at each CPU's address space List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Peter Maydell , Eduardo Habkost , qemu-devel@nongnu.org, Chen Fan , =?windows-1252?Q?Andreas_F=E4?= =?windows-1252?Q?rber?= , Richard Henderson 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