Received: from eggs.gnu.org ([2001:4830:134:3::10]:40699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTofA-0003al-Tb for qemu-devel@nongnu.org; Fri, 06 Mar 2015 04:35:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTof6-00073x-AT for qemu-devel@nongnu.org; Fri, 06 Mar 2015 04:35:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42453) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTof6-00073o-1c for qemu-devel@nongnu.org; Fri, 06 Mar 2015 04:35:16 -0500 Date: Fri, 6 Mar 2015 10:35:01 +0100 From: Igor Mammedov Message-ID: <20150306103501.3925c4c6@nial.brq.redhat.com> In-Reply-To: <51c47e4ac4982ecb323ac0ef2bf65bba48646cfb.1423821709.git.zhugh.fnst@cn.fujitsu.com> References: <51c47e4ac4982ecb323ac0ef2bf65bba48646cfb.1423821709.git.zhugh.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 01/10] cpu/apic: drop icc bus/bridge/ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhu Guihua Cc: qemu-devel@nongnu.org, tangchen@cn.fujitsu.com, chen.fan.fnst@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com, guz.fnst@cn.fujitsu.com, anshul.makkar@profitbricks.com, afaerber@suse.de On Fri, 13 Feb 2015 18:25:24 +0800 Zhu Guihua wrote: > From: Chen Fan > > ICC bus was invented only to provide hotplug capability to > CPU and APIC because at the time being hotplug was available only for > BUS attached devices. > > Now this patch is to drop ICC bus impl, and switch to bus-less > CPU+APIC hotplug, handling them in the same manner as pc-dimm. > > Signed-off-by: Chen Fan > Signed-off-by: Zhu Guihua > --- > hw/i386/kvm/apic.c | 10 ++++++++-- > hw/i386/pc.c | 21 +++++---------------- > hw/i386/pc_piix.c | 9 +-------- > hw/i386/pc_q35.c | 9 +-------- > hw/intc/apic.c | 16 +++++++++++----- > hw/intc/apic_common.c | 14 +++++++++----- > include/hw/i386/apic_internal.h | 6 ++---- > include/hw/i386/pc.h | 3 ++- > target-i386/cpu.c | 19 +++---------------- > target-i386/cpu.h | 3 +-- > 10 files changed, 43 insertions(+), 67 deletions(-) > > diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c > index 5b47056..4b7ce57 100644 > --- a/hw/i386/kvm/apic.c > +++ b/hw/i386/kvm/apic.c > @@ -10,6 +10,7 @@ > * See the COPYING file in the top-level directory. > */ > #include "hw/i386/apic_internal.h" > +#include "hw/i386/pc.h" > #include "hw/pci/msi.h" > #include "sysemu/kvm.h" > > @@ -180,9 +181,14 @@ static void kvm_apic_reset(APICCommonState *s) > static void kvm_apic_realize(DeviceState *dev, Error **errp) > { > APICCommonState *s = APIC_COMMON(dev); > + PCMachineState *pcms = PC_MACHINE(qdev_get_machine()); > + static bool mmio_registered; > > - memory_region_init_io(&s->io_memory, NULL, &kvm_apic_io_ops, s, "kvm-apic-msi", > - APIC_SPACE_SIZE); > + if (!mmio_registered) { > + memory_region_init_io(&pcms->apic_mmio, NULL, &kvm_apic_io_ops, s, > + "kvm-apic-msi", APIC_SPACE_SIZE); APIC shouldn't access MachineState let alone modify it, so keep io_memory in APICCommonState and export method something like: apic_register_mmio(AddressSpace *as, hwaddr addr); and use it in pc_machine_device_plug_cb() but it would be better to use per CPU AddressSpace added by 09daed848c if it works with KVM. Then you could map APIC into it x86_cpu_realize().