From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bARZy-0002Rz-8U for qemu-devel@nongnu.org; Tue, 07 Jun 2016 20:42:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bARZn-00022z-Pi for qemu-devel@nongnu.org; Tue, 07 Jun 2016 20:42:41 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:57746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bARZn-00022W-Hy for qemu-devel@nongnu.org; Tue, 07 Jun 2016 20:42:31 -0400 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Jun 2016 18:42:29 -0600 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1465313980-31281-4-git-send-email-thuth@redhat.com> References: <1465313980-31281-1-git-send-email-thuth@redhat.com> <1465313980-31281-4-git-send-email-thuth@redhat.com> Message-ID: <20160608003818.713.80897@loki> Date: Tue, 07 Jun 2016 19:38:18 -0500 Subject: Re: [Qemu-devel] [PATCH 3/5] ppc: Provide function to get CPU class of the host CPU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth , qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Cc: Alexey Kardashevskiy , agraf@suse.de, qemu-devel@nongnu.org Quoting Thomas Huth (2016-06-07 10:39:38) > When running with KVM, we might be interested in some details > of the host CPU class, too, so provide a function to get the > corresponding CPU class. > = > Signed-off-by: Thomas Huth Reviewed-by: Michael Roth > --- > target-ppc/kvm.c | 19 ++++++++++++++----- > target-ppc/kvm_ppc.h | 7 +++++++ > 2 files changed, 21 insertions(+), 5 deletions(-) > = > diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c > index 24d6032..6c15361 100644 > --- a/target-ppc/kvm.c > +++ b/target-ppc/kvm.c > @@ -2329,6 +2329,19 @@ static PowerPCCPUClass *ppc_cpu_get_family_class(P= owerPCCPUClass *pcc) > return POWERPC_CPU_CLASS(oc); > } > = > +PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void) > +{ > + uint32_t host_pvr =3D mfpvr(); > + PowerPCCPUClass *pvr_pcc; > + > + pvr_pcc =3D ppc_cpu_class_by_pvr(host_pvr); > + if (pvr_pcc =3D=3D NULL) { > + pvr_pcc =3D ppc_cpu_class_by_pvr_mask(host_pvr); > + } > + > + return pvr_pcc; > +} > + > static int kvm_ppc_register_host_cpu_type(void) > { > TypeInfo type_info =3D { > @@ -2336,14 +2349,10 @@ static int kvm_ppc_register_host_cpu_type(void) > .instance_init =3D kvmppc_host_cpu_initfn, > .class_init =3D kvmppc_host_cpu_class_init, > }; > - uint32_t host_pvr =3D mfpvr(); > PowerPCCPUClass *pvr_pcc; > DeviceClass *dc; > = > - pvr_pcc =3D ppc_cpu_class_by_pvr(host_pvr); > - if (pvr_pcc =3D=3D NULL) { > - pvr_pcc =3D ppc_cpu_class_by_pvr_mask(host_pvr); > - } > + pvr_pcc =3D kvm_ppc_get_host_cpu_class(); > if (pvr_pcc =3D=3D NULL) { > return -1; > } > diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h > index 3b2090e..20bfb59 100644 > --- a/target-ppc/kvm_ppc.h > +++ b/target-ppc/kvm_ppc.h > @@ -56,6 +56,7 @@ void kvmppc_hash64_write_pte(CPUPPCState *env, target_u= long pte_index, > bool kvmppc_has_cap_fixup_hcalls(void); > int kvmppc_enable_hwrng(void); > int kvmppc_put_books_sregs(PowerPCCPU *cpu); > +PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void); > = > #else > = > @@ -252,6 +253,12 @@ static inline int kvmppc_put_books_sregs(PowerPCCPU = *cpu) > { > abort(); > } > + > +static inline PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void) > +{ > + return NULL; > +} > + > #endif > = > #ifndef CONFIG_KVM > -- = > 1.8.3.1 > = >=20