Received: from eggs.gnu.org ([2001:4830:134:3::10]:60152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzVtZ-0001Wr-Md for qemu-devel@nongnu.org; Mon, 01 Jun 2015 16:01:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YzVtU-00046g-Ht for qemu-devel@nongnu.org; Mon, 01 Jun 2015 16:01:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzVtU-00046Z-CB for qemu-devel@nongnu.org; Mon, 01 Jun 2015 16:01:08 -0400 Date: Mon, 1 Jun 2015 17:01:03 -0300 From: Eduardo Habkost Message-ID: <20150601200103.GB3410@thinpad.lan.raisama.net> References: <1432922664-15129-1-git-send-email-ehabkost@redhat.com> <1432922664-15129-3-git-send-email-ehabkost@redhat.com> <5568BD97.8030703@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5568BD97.8030703@redhat.com> 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: Paolo Bonzini Cc: Peter Maydell , qemu-devel@nongnu.org, Chen Fan , Igor Mammedov , Andreas =?iso-8859-1?Q?F=E4rber?= , Richard Henderson On Fri, May 29, 2015 at 09:27:19PM +0200, Paolo Bonzini wrote: > On 29/05/2015 20:04, Eduardo Habkost wrote: > > static int apic_no; > > - static bool mmio_registered; > > + CPUState *cpu = CPU(s->cpu); > > + MemoryRegion *root; > > > > if (apic_no >= MAX_APICS) { > > error_setg(errp, "%s initialization failed.", > > @@ -307,11 +308,12 @@ static void apic_common_realize(DeviceState *dev, Error **errp) > > > > info = APIC_COMMON_GET_CLASS(s); > > info->realize(dev, errp); > > - if (!mmio_registered) { > > - ICCBus *b = ICC_BUS(qdev_get_parent_bus(dev)); > > - memory_region_add_subregion(b->apic_address_space, 0, &s->io_memory); > > - mmio_registered = true; > > - } > > + > > + 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())". I am removing this from the queue. I guess I should have waited for some feedback from the memory API maintainer before committing. -- Eduardo