From patchwork Thu May 11 04:14:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 760946 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wNg9y6N3lz9s2s for ; Thu, 11 May 2017 14:29:42 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.b="nHqnKohs"; dkim-atps=neutral Received: from localhost ([::1]:45936 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8fjQ-0001dS-JK for incoming@patchwork.ozlabs.org; Thu, 11 May 2017 00:29:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8fV1-0005RW-Ja for qemu-devel@nongnu.org; Thu, 11 May 2017 00:14:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8fV0-0001aU-9U for qemu-devel@nongnu.org; Thu, 11 May 2017 00:14:47 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:50055) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8fUz-0001Ws-PE; Thu, 11 May 2017 00:14:46 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3wNfrS5QzFz9sNg; Thu, 11 May 2017 14:14:31 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1494476072; bh=bWFEgCbF+iBjHQa+gwPqVmXETPMBKjdEREPmvaGVNQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nHqnKohsdSDnwgWqFDNY7jdeKs8YZHQ5CWfSfLnLJV7L91jIGofHaZwaQKdXinECq 0r9OGjC2/vRUGoIQ2bR1h8dJFnZBWpgBCFjVViCXQMEe+2vZhHFSQ4Vcfn8EjnJ6sN 38/YINcY+zfKUmRaNWLLEyjBo4FkanxVdjdA6JG4= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 11 May 2017 14:14:24 +1000 Message-Id: <20170511041426.6488-22-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170511041426.6488-1-david@gibson.dropbear.id.au> References: <20170511041426.6488-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/23] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 = 0x004C0000, CPU_POWERPC_POWER8NVL_v10 = 0x004C0100, CPU_POWERPC_POWER9_BASE = 0x004E0000, + CPU_POWERPC_POWER9_DD1 = 0x004E0100, CPU_POWERPC_970_v22 = 0x00390202, CPU_POWERPC_970FX_v10 = 0x00391100, CPU_POWERPC_970FX_v20 = 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) #if defined(TARGET_PPC64) pcc->radix_page_info = kvm_get_radix_page_info(); + + if ((pcc->pvr & 0xffffff00) == 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 &= ~(PCR_COMPAT_3_00 | PCR_COMPAT_2_07 + | PCR_COMPAT_2_06 | PCR_COMPAT_2_05); + } #endif /* defined(TARGET_PPC64) */ }