From nobody Sun Apr 28 02:04:03 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; 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 1494301588048253.86223886896607; Mon, 8 May 2017 20:46:28 -0700 (PDT) Received: from localhost ([::1]:34787 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7w6S-0001pb-Ay for importer@patchew.org; Mon, 08 May 2017 23:46:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7w5f-0001Yb-7S for qemu-devel@nongnu.org; Mon, 08 May 2017 23:45:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d7w5a-0003Gb-Kz for qemu-devel@nongnu.org; Mon, 08 May 2017 23:45:35 -0400 Received: from ozlabs.org ([103.22.144.67]:34451) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d7w5Z-0003GE-PM; Mon, 08 May 2017 23:45:30 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3wMQHn2Ykpz9s75; Tue, 9 May 2017 13:45:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1494301525; bh=DJpSp+lHCWdPlJrQ/YuQflB/XS26BWh5iVMfN9VNoco=; h=From:To:Cc:Subject:Date:From; b=TRex533U5T2xrMFuOZ7yX57BE2G/cxl6Q3M2clH1rTqlsE2aDLtDAa02oqTDAVKer xPfQy/L4fzl5X4JtM7zaAfQ7fC5ZBJM0se2zPqN5wrOseUZotH48iQP2hckMwhnuSP AtP5U/Q87/hL+5X9Q2Du2VwgQ/56zyQ8BI+FQ4r0= From: David Gibson To: thuth@redhat.com, lvivier@redhat.com, mdroth@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com, sjitindarsingh@gmail.com, sam.bobroff@au1.ibm.com Date: Tue, 9 May 2017 13:45:19 +1000 Message-Id: <20170509034519.16291-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 103.22.144.67 Subject: [Qemu-devel] [PATCH] 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: David Gibson , qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de 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/kvm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 8574c36..591b5b5 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 0x004e0100) { + /* + * 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