From nobody Fri Dec 19 18:59:16 2025 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; dkim=fail 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 1494400475322158.7362253406551; Wed, 10 May 2017 00:14:35 -0700 (PDT) Received: from localhost ([::1]:40770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8LpR-0005Xl-Uz for importer@patchew.org; Wed, 10 May 2017 03:14:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8Lct-0002Wl-O1 for qemu-devel@nongnu.org; Wed, 10 May 2017 03:01:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8Lcr-0007sH-Vg for qemu-devel@nongnu.org; Wed, 10 May 2017 03:01:35 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:45421) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8Lcr-0007pE-ES; Wed, 10 May 2017 03:01:33 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3wN6bS17f4z9sCZ; Wed, 10 May 2017 17:01:22 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1494399684; bh=bWFEgCbF+iBjHQa+gwPqVmXETPMBKjdEREPmvaGVNQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nur4ya0NjlCVsqGNIPepDOXShV1k6MMNHMIrR+FtxMzS4vlxjsrepy7UXPPtLraup 3Qu/ye2pUO1HH3DLbroxmgwqNa+NGgTm/o6PnoIovgmbJPxd9xSZ3vqlDkvs5HgACq BdebW1TT5sDMd0W/sdE8hyp4Dp2vV6N+yD6cQ778= From: David Gibson To: peter.maydell@linaro.org Date: Wed, 10 May 2017 17:01:14 +1000 Message-Id: <20170510070115.13063-22-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170510070115.13063-1-david@gibson.dropbear.id.au> References: <20170510070115.13063-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 21/22] target/ppc: Allow workarounds for 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: mdroth@linux.vnet.ibm.com, nikunj@linux.vnet.ibm.com, aik@ozlabs.ru, mark.cave-ayland@ilande.co.uk, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.org, sjitindarsingh@gmail.com, bharata@linux.vnet.ibm.com, sam.bobroff@au1.ibm.com, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" POWER9 DD1 silicon has some bugs which mean it a) isn't really compliant with the ISA v3.00 and b) require a number of special workarounds in the kernel. At the moment, qemu isn't aware of DD1. For TCG we don't really want it to be (why bother emulating buggy silicon). But with KVM, the guest does need to be aware of DD1 so it can apply the necessary workarounds. Meanwhile, the feature negotiation between qemu and the guest strongly favours architected compatibility modes to "raw" CPU modes. In combination with the above, this means the guest sees architected POWER9 mode, and doesn't apply the DD1 workarounds. Well, unless it has yet another workaround to partially ignore what qemu tells it. This patch addresses this by disabling support for compatibility modes when using KVM on a POWER9 DD1 host. Signed-off-by: David Gibson --- target/ppc/cpu-models.h | 1 + target/ppc/kvm.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h index d587e69..b563c45 100644 --- a/target/ppc/cpu-models.h +++ b/target/ppc/cpu-models.h @@ -561,6 +561,7 @@ enum { CPU_POWERPC_POWER8NVL_BASE =3D 0x004C0000, CPU_POWERPC_POWER8NVL_v10 =3D 0x004C0100, CPU_POWERPC_POWER9_BASE =3D 0x004E0000, + CPU_POWERPC_POWER9_DD1 =3D 0x004E0100, CPU_POWERPC_970_v22 =3D 0x00390202, CPU_POWERPC_970FX_v10 =3D 0x00391100, CPU_POWERPC_970FX_v20 =3D 0x003C0200, diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 8574c36..cb2cf2b 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2380,6 +2380,17 @@ 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 --=20 2.9.3