From nobody Sat May 4 14:27:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499166197307594.1255282047101; Tue, 4 Jul 2017 04:03:17 -0700 (PDT) Received: from localhost ([::1]:40429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSLbu-0001iY-0x for importer@patchew.org; Tue, 04 Jul 2017 07:03:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSLaI-0000mN-Pb for qemu-devel@nongnu.org; Tue, 04 Jul 2017 07:01:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSLaH-0004Kr-W3 for qemu-devel@nongnu.org; Tue, 04 Jul 2017 07:01:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36308) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSLaH-0004K2-MV; Tue, 04 Jul 2017 07:01:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 73348C04D2EF; Tue, 4 Jul 2017 11:01:32 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-116-196.ams2.redhat.com [10.36.116.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id B03A26E8D6; Tue, 4 Jul 2017 11:01:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 73348C04D2EF Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lvivier@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 73348C04D2EF From: Laurent Vivier To: David Gibson Date: Tue, 4 Jul 2017 13:01:25 +0200 Message-Id: <20170704110126.26806-2-lvivier@redhat.com> In-Reply-To: <20170704110126.26806-1-lvivier@redhat.com> References: <20170704110126.26806-1-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 04 Jul 2017 11:01:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 1/2] target/ppc/cpu-models: set POWER9_v1.0 as POWER9 DD1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Suraj Singh , joserz@linux.vnet.ibm.com, qemu-devel@nongnu.org, Greg Kurz , qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sam Bobroff Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" CPU_POWERPC_POWER9_DD1 is 0x004E0100, so this is the POWER9 v1.0. When we run qemu on a POWER9 DD1 host, we must use either "-cpu host" or "-cpu POWER9", but in the latter case it fails with Unable to find sPAPR CPU Core definition because POWER9 DD1 doesn't appear in the list of known CPUs. This patch fixes this by defining POWER9_v1.0 with POWER9 DD1 PVR instead of CPU_POWERPC_POWER9_BASE. It also add POWER_v2.0 with POWER9 DD2 PVR to avoid to trigger kernel POWER9 DD1 workaround in TCG mode. Signed-off-by: Laurent Vivier Reviewed-by: Thomas Huth Reviewed-by: Greg Kurz --- hw/ppc/spapr_cpu_core.c | 1 + target/ppc/cpu-models.c | 6 ++++-- target/ppc/cpu-models.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index ea278ce..b5ecc7c 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -293,6 +293,7 @@ static const char *spapr_core_models[] =3D { =20 /* POWER9 */ "POWER9_v1.0", + "POWER9_v2.0", }; =20 static Property spapr_cpu_core_properties[] =3D { diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c index 4d3e635..ac7e299 100644 --- a/target/ppc/cpu-models.c +++ b/target/ppc/cpu-models.c @@ -1144,8 +1144,10 @@ POWERPC_DEF("970_v2.2", CPU_POWERPC_970_v22, 970, "PowerPC 970 v2.2") =20 - POWERPC_DEF("POWER9_v1.0", CPU_POWERPC_POWER9_BASE, POWER= 9, + POWERPC_DEF("POWER9_v1.0", CPU_POWERPC_POWER9_DD1, POWER= 9, "POWER9 v1.0") + POWERPC_DEF("POWER9_v2.0", CPU_POWERPC_POWER9_DD2, POWER= 9, + "POWER9 v2.0") =20 POWERPC_DEF("970fx_v1.0", CPU_POWERPC_970FX_v10, 970, "PowerPC 970FX v1.0 (G5)") @@ -1391,7 +1393,7 @@ PowerPCCPUAlias ppc_cpu_aliases[] =3D { { "POWER8E", "POWER8E_v2.1" }, { "POWER8", "POWER8_v2.0" }, { "POWER8NVL", "POWER8NVL_v1.0" }, - { "POWER9", "POWER9_v1.0" }, + { "POWER9", "POWER9_v2.0" }, { "970", "970_v2.2" }, { "970fx", "970fx_v3.1" }, { "970mp", "970mp_v1.1" }, diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h index b563c45..c10745e 100644 --- a/target/ppc/cpu-models.h +++ b/target/ppc/cpu-models.h @@ -562,6 +562,7 @@ enum { CPU_POWERPC_POWER8NVL_v10 =3D 0x004C0100, CPU_POWERPC_POWER9_BASE =3D 0x004E0000, CPU_POWERPC_POWER9_DD1 =3D 0x004E0100, + CPU_POWERPC_POWER9_DD2 =3D 0x004E1200, /* Scale out 24 cores */ CPU_POWERPC_970_v22 =3D 0x00390202, CPU_POWERPC_970FX_v10 =3D 0x00391100, CPU_POWERPC_970FX_v20 =3D 0x003C0200, --=20 2.9.4 From nobody Sat May 4 14:27:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14991662895847.059993849713237; Tue, 4 Jul 2017 04:04:49 -0700 (PDT) Received: from localhost ([::1]:40438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSLdM-0004O2-I3 for importer@patchew.org; Tue, 04 Jul 2017 07:04:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSLaN-0000qA-HF for qemu-devel@nongnu.org; Tue, 04 Jul 2017 07:01:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSLaM-0004P8-Fd for qemu-devel@nongnu.org; Tue, 04 Jul 2017 07:01:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36368) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSLaM-0004OZ-6J; Tue, 04 Jul 2017 07:01:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0604DC04D28D; Tue, 4 Jul 2017 11:01:37 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-116-196.ams2.redhat.com [10.36.116.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3DA46FB71; Tue, 4 Jul 2017 11:01:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0604DC04D28D Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lvivier@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0604DC04D28D From: Laurent Vivier To: David Gibson Date: Tue, 4 Jul 2017 13:01:26 +0200 Message-Id: <20170704110126.26806-3-lvivier@redhat.com> In-Reply-To: <20170704110126.26806-1-lvivier@redhat.com> References: <20170704110126.26806-1-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 04 Jul 2017 11:01:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 2/2] target/ppc: move POWER9 DD1 workaround to init_proc_POWER9() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Suraj Singh , joserz@linux.vnet.ibm.com, qemu-devel@nongnu.org, Greg Kurz , qemu-ppc@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Sam Bobroff Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Commit 5f3066d ("target/ppc: Allow workarounds for POWER9 DD1") disables compatibility mode for POWER9 DD1 to allow to boot on POWER9 DD1 host with KVM. As the workaround has been added in kvmppc_host_cpu_class_init(), it applies only on CPU created with "-cpu host". As we want to be able to use also "-cpu POWER9" on a POWER9 DD1 host, this patch moves the workaround from kvmppc_host_cpu_class_init() to init_proc_POWER9(). Signed-off-by: Laurent Vivier Reviewed-by: Thomas Huth --- target/ppc/kvm.c | 11 ----------- target/ppc/translate_init.c | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index f2f7c53..9d76817 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2381,17 +2381,6 @@ static void kvmppc_host_cpu_class_init(ObjectClass *= oc, void *data) =20 #if defined(TARGET_PPC64) pcc->radix_page_info =3D kvm_get_radix_page_info(); - - if ((pcc->pvr & 0xffffff00) =3D=3D CPU_POWERPC_POWER9_DD1) { - /* - * POWER9 DD1 has some bugs which make it not really ISA 3.00 - * compliant. More importantly, advertising ISA 3.00 - * architected mode may prevent guests from activating - * necessary DD1 workarounds. - */ - pcc->pcr_supported &=3D ~(PCR_COMPAT_3_00 | PCR_COMPAT_2_07 - | PCR_COMPAT_2_06 | PCR_COMPAT_2_05); - } #endif /* defined(TARGET_PPC64) */ } =20 diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 783bf98..a41fe66 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c @@ -8811,6 +8811,8 @@ static struct ppc_radix_page_info POWER9_radix_page_i= nfo =3D { =20 static void init_proc_POWER9(CPUPPCState *env) { + PowerPCCPU *cpu =3D ppc_env_get_cpu(env); + PowerPCCPUClass *pcc =3D POWERPC_CPU_GET_CLASS(cpu); /* Common Registers */ init_proc_book3s_common(env); gen_spr_book3s_207_dbg(env); @@ -8848,7 +8850,18 @@ static void init_proc_POWER9(CPUPPCState *env) =20 /* Allocate hardware IRQ controller */ init_excp_POWER8(env); - ppcPOWER7_irq_init(ppc_env_get_cpu(env)); + ppcPOWER7_irq_init(cpu); + + if ((pcc->pvr & 0xffffff00) =3D=3D CPU_POWERPC_POWER9_DD1) { + /* + * POWER9 DD1 has some bugs which make it not really ISA 3.00 + * compliant. More importantly, advertising ISA 3.00 + * architected mode may prevent guests from activating + * necessary DD1 workarounds. + */ + pcc->pcr_supported &=3D ~(PCR_COMPAT_3_00 | PCR_COMPAT_2_07 + | PCR_COMPAT_2_06 | PCR_COMPAT_2_05); + } } =20 static bool ppc_pvr_match_power9(PowerPCCPUClass *pcc, uint32_t pvr) --=20 2.9.4