From patchwork Tue May 9 03:45:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 9717001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C2AFA60365 for ; Tue, 9 May 2017 03:46:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB23822A68 for ; Tue, 9 May 2017 03:46:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F37A28338; Tue, 9 May 2017 03:46:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D95FD22A68 for ; Tue, 9 May 2017 03:46:14 +0000 (UTC) Received: from localhost ([::1]:34786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d7w6F-0001Yh-Ps for patchwork-qemu-devel@patchwork.kernel.org; Mon, 08 May 2017 23:46:11 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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) #if defined(TARGET_PPC64) pcc->radix_page_info = kvm_get_radix_page_info(); + + if ((pcc->pvr & 0xffffff00) == 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 &= ~(PCR_COMPAT_3_00 | PCR_COMPAT_2_07 + | PCR_COMPAT_2_06 | PCR_COMPAT_2_05); + } #endif /* defined(TARGET_PPC64) */ }