Received: from eggs.gnu.org ([2001:4830:134:3::10]:42753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeMh3-0002Zo-Po for qemu-devel@nongnu.org; Tue, 22 Sep 2015 08:29:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeMgz-00030L-1m for qemu-devel@nongnu.org; Tue, 22 Sep 2015 08:29:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeMgy-00030C-Tj for qemu-devel@nongnu.org; Tue, 22 Sep 2015 08:29:05 -0400 Date: Tue, 22 Sep 2015 14:29:01 +0200 From: Igor Mammedov Message-ID: <20150922142901.444bfd35@nial.brq.redhat.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v12 2/5] apic: use per CPU AS to map APIC MMIO for TCG List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhu Guihua Cc: ehabkost@redhat.com, qemu-devel@nongnu.org, izumi.taku@jp.fujitsu.com, chen.fan.fnst@cn.fujitsu.com, pbonzini@redhat.com, afaerber@suse.de On Wed, 16 Sep 2015 17:19:12 +0800 Zhu Guihua wrote: > TCG supports per CPU address space, and the emulation quality is > a bit better with it. > So use per CPU address space to map APIC MMIO area. This allows the > APIC base address of each cpu to be moved independent of others. > > Signed-off-by: Zhu Guihua Reviewed-by: Igor Mammedov > --- > target-i386/cpu.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 050ce11..692a284 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -2759,9 +2759,18 @@ static void x86_cpu_apic_realize(X86CPU *cpu, Error **errp) > object_property_set_bool(OBJECT(cpu->apic_state), true, "realized", > errp); > > - /* Map APIC MMIO area */ > + /* Map APIC MMIO area, use per-CPU address space if available (TCG > + * supports it, KVM doesn't). This allows the APIC base address of > + * each CPU to be moved independently. > + */ > apic = APIC_COMMON(cpu->apic_state); > - if (!apic_mmio_map_once) { > + if (tcg_enabled()) { > + memory_region_add_subregion_overlap(cpu->cpu_as_root, > + apic->apicbase & > + MSR_IA32_APICBASE_BASE, > + &apic->io_memory, > + 0x1000); > + } else if (!apic_mmio_map_once) { > memory_region_add_subregion_overlap(get_system_memory(), > apic->apicbase & > MSR_IA32_APICBASE_BASE,