From nobody Sun Nov 9 23:46:11 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552447508067339.2925340605507; Tue, 12 Mar 2019 20:25:08 -0700 (PDT) Received: from localhost ([127.0.0.1]:37470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3uVq-0007dF-8w for importer@patchew.org; Tue, 12 Mar 2019 23:25:02 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3uUT-0006Vp-61 for qemu-devel@nongnu.org; Tue, 12 Mar 2019 23:23:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3uRU-0007vh-7V for qemu-devel@nongnu.org; Tue, 12 Mar 2019 23:20:33 -0400 Received: from ozlabs.org ([203.11.71.1]:59797) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h3uRT-0007s2-6G; Tue, 12 Mar 2019 23:20:32 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 44JxtM4jBrz9s47; Wed, 13 Mar 2019 14:20:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1552447227; bh=wW1e70OL3FdnAMCDw+uhBSJ5zhigLyxmgCiO/2wzI80=; h=From:To:Cc:Subject:Date:From; b=HsW5tVEpMUfhbFC66fpEx9dYuoU3pl71OS0/CisVzeb1EG7aIWdzqF7w5Kzjy3Mej Duq46tIpMsvQMnW71nb1/f7J65ziuV+5y/t2j29oNqAOJqYOOFiuRrmblzQZTqd2iw DFFgV47qgixYuZyzSFO9JWWsYxSNFLGCXWt3SCAI= From: David Gibson To: crosa@redhat.com, clg@kaod.org, sjitindarsingh@gmail.com Date: Wed, 13 Mar 2019 14:20:20 +1100 Message-Id: <20190313032020.4934-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PATCH] spapr: Correctly set LPCR[GTSE] in H_REGISTER_PROCESS_TABLE 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, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 176dccee "target/ppc/spapr: Clear partition table entry when allocating hash table" reworked the H_REGISTER_PROCESS_TABLE hypercall, but unfortunately due to a small error no longer correctly sets the LPCR[GTSE] bit which allows the guest to directly execute (some types of) tlbie (TLB flush) instructions without involving the hypervisor. We got away with this, initially, because POWER9 did not have hypervisor mode enabled in its msr_mask, which meant we didn't actually run hypervisor privilege checks in TCG at all. However, da874d90 "target/ppc: add HV support for POWER9" turned on HV support on POWER9 for the benefit of the powernv machine type. This exposed the earlier bug in H_REGISTER_PROCESS_TABLE, and causes guests which rely on LPCR[GTSE] (i.e. basically all of them) to crash during early boot when their first tlbie instruction causes an unexpected trap. Fixes: 176dccee target/ppc/spapr: Clear partition table entry when allocati= ng hash table Signed-off-by: David Gibson Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Greg Kurz Tested-by: Cleber Rosa --- hw/ppc/spapr_hcall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 0761e10142..8a736797b9 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1400,7 +1400,8 @@ static target_ulong h_register_process_table(PowerPCC= PU *cpu, else if (flags & FLAG_HASH_PROC_TBL) /* Hash with process tables */ update_lpcr |=3D LPCR_UPRT; if (flags & FLAG_GTSE) /* Guest translation shootdown enable */ - update_lpcr |=3D FLAG_GTSE; + update_lpcr |=3D LPCR_GTSE; + spapr_set_all_lpcrs(update_lpcr, LPCR_UPRT | LPCR_HR | LPCR_GTSE); =20 if (kvm_enabled()) { --=20 2.20.1