From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUJeN-0002yF-Ov for qemu-devel@nongnu.org; Mon, 22 Apr 2013 12:31:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUJeK-0002De-Ug for qemu-devel@nongnu.org; Mon, 22 Apr 2013 12:31:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUJeK-0002Co-KE for qemu-devel@nongnu.org; Mon, 22 Apr 2013 12:31:28 -0400 Date: Mon, 22 Apr 2013 19:30:18 +0300 From: Gleb Natapov Message-ID: <20130422163018.GC16740@redhat.com> References: <1366063976-4909-1-git-send-email-imammedo@redhat.com> <1366063976-4909-3-git-send-email-imammedo@redhat.com> <51753F3D.2060608@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <51753F3D.2060608@suse.de> Subject: Re: [Qemu-devel] [PATCH 02/16] cpu: call cpu_synchronize_post_init() from CPUClass.realize() if hotplugged List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?utf-8?Q?F=C3=A4rber?= Cc: aliguori@us.ibm.com, ehabkost@redhat.com, mst@redhat.com, jan.kiszka@siemens.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, aderumier@odiso.com, lcapitulino@redhat.com, jfrei@linux.vnet.ibm.com, pbonzini@redhat.com, yang.z.zhang@intel.com, Igor Mammedov , lig.fnst@cn.fujitsu.com, rth@twiddle.net On Mon, Apr 22, 2013 at 03:46:37PM +0200, Andreas F=C3=A4rber wrote: > Am 16.04.2013 00:12, schrieb Igor Mammedov: > > ... to synchronize CPU state to KVM > >=20 > > Signed-off-by: Igor Mammedov > > --- > > v2: > > * linking kvm-stub.o to *-user target moved in separate patch > > --- > > include/sysemu/kvm.h | 18 ++++++++++-------- > > kvm-all.c | 1 + > > kvm-stub.c | 1 + > > qom/cpu.c | 4 ++++ > > vl.c | 1 - > > 5 files changed, 16 insertions(+), 9 deletions(-) >=20 > Looks okay to me. Gleb, can you ack? >=20 Yes, looks good to me. > Andreas >=20 > > diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h > > index 93cef28..8fb2489 100644 > > --- a/include/sysemu/kvm.h > > +++ b/include/sysemu/kvm.h > > @@ -250,8 +250,6 @@ int kvm_check_extension(KVMState *s, unsigned int e= xtension); > > uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function, > > uint32_t index, int reg); > > void kvm_cpu_synchronize_state(CPUArchState *env); > > -void kvm_cpu_synchronize_post_reset(CPUState *cpu); > > -void kvm_cpu_synchronize_post_init(CPUState *cpu); > > =20 > > /* generic hooks - to be moved/refactored once there are more users */ > > =20 > > @@ -262,6 +260,16 @@ static inline void cpu_synchronize_state(CPUArchSt= ate *env) > > } > > } > > =20 > > +#if !defined(CONFIG_USER_ONLY) > > +int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr, > > + hwaddr *phys_addr); > > +#endif > > + > > +#endif /* NEED_CPU_H */ > > + > > +void kvm_cpu_synchronize_post_reset(CPUState *cpu); > > +void kvm_cpu_synchronize_post_init(CPUState *cpu); > > + > > static inline void cpu_synchronize_post_reset(CPUState *cpu) > > { > > if (kvm_enabled()) { > > @@ -277,12 +285,6 @@ static inline void cpu_synchronize_post_init(CPUSt= ate *cpu) > > } > > =20 > > =20 > > -#if !defined(CONFIG_USER_ONLY) > > -int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr, > > - hwaddr *phys_addr); > > -#endif > > - > > -#endif > > int kvm_set_ioeventfd_mmio(int fd, uint32_t adr, uint32_t val, bool as= sign, > > uint32_t size); > > =20 > > diff --git a/kvm-all.c b/kvm-all.c > > index fc4e17c..1d17128 100644 > > --- a/kvm-all.c > > +++ b/kvm-all.c > > @@ -109,6 +109,7 @@ bool kvm_async_interrupts_allowed; > > bool kvm_irqfds_allowed; > > bool kvm_msi_via_irqfd_allowed; > > bool kvm_gsi_routing_allowed; > > +bool kvm_allowed; > > =20 > > static const KVMCapabilityInfo kvm_required_capabilites[] =3D { > > KVM_CAP_INFO(USER_MEMORY), > > diff --git a/kvm-stub.c b/kvm-stub.c > > index a131305..4282e09 100644 > > --- a/kvm-stub.c > > +++ b/kvm-stub.c > > @@ -23,6 +23,7 @@ bool kvm_async_interrupts_allowed; > > bool kvm_irqfds_allowed; > > bool kvm_msi_via_irqfd_allowed; > > bool kvm_gsi_routing_allowed; > > +bool kvm_allowed; > > =20 > > int kvm_init_vcpu(CPUState *cpu) > > { > > diff --git a/qom/cpu.c b/qom/cpu.c > > index e242dcb..0c76712 100644 > > --- a/qom/cpu.c > > +++ b/qom/cpu.c > > @@ -20,6 +20,7 @@ > > =20 > > #include "qom/cpu.h" > > #include "qemu-common.h" > > +#include "sysemu/kvm.h" > > =20 > > void cpu_reset_interrupt(CPUState *cpu, int mask) > > { > > @@ -57,6 +58,9 @@ static ObjectClass *cpu_common_class_by_name(const ch= ar *cpu_model) > > =20 > > static void cpu_common_realizefn(DeviceState *dev, Error **errp) > > { > > + if (dev->hotplugged) { > > + cpu_synchronize_post_init(CPU(dev)); > > + } > > } > > =20 > > static void cpu_class_init(ObjectClass *klass, void *data) > > diff --git a/vl.c b/vl.c > > index dd94549..bc9c016 100644 > > --- a/vl.c > > +++ b/vl.c > > @@ -267,7 +267,6 @@ static NotifierList machine_init_done_notifiers =3D > > NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers); > > =20 > > static bool tcg_allowed =3D true; > > -bool kvm_allowed; > > bool xen_allowed; > > uint32_t xen_domid; > > enum xen_mode xen_mode =3D XEN_EMULATE; > >=20 >=20 >=20 > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3= =BCrnberg -- Gleb.