From nobody Sat Nov 1 22:28:54 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.zohomail.com; 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 1527252937395123.46645209064229; Fri, 25 May 2018 05:55:37 -0700 (PDT) Received: from localhost ([::1]:43862 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMCFs-0005HO-BA for importer@patchew.org; Fri, 25 May 2018 08:55:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fMCEs-0004Zs-0f for qemu-devel@nongnu.org; Fri, 25 May 2018 08:54:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fMCEo-0000nL-3O for qemu-devel@nongnu.org; Fri, 25 May 2018 08:54:34 -0400 Received: from 12.mo4.mail-out.ovh.net ([178.33.104.253]:42318) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fMCEn-0000lH-T0 for qemu-devel@nongnu.org; Fri, 25 May 2018 08:54:30 -0400 Received: from player797.ha.ovh.net (unknown [10.109.122.227]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id A8760177F24 for ; Fri, 25 May 2018 14:54:27 +0200 (CEST) Received: from bahia.lan (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player797.ha.ovh.net (Postfix) with ESMTPA id 256172E00BF; Fri, 25 May 2018 14:54:18 +0200 (CEST) From: Greg Kurz To: qemu-devel@nongnu.org Date: Fri, 25 May 2018 14:54:12 +0200 Message-ID: <152725285229.537901.6934923933763529191.stgit@bahia.lan> User-Agent: StGit/0.17.1-46-g6855-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 541276381280246054 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedthedrhedtgdehjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.104.253 Subject: [Qemu-devel] [PATCH] spapr: don't call KVM_PPC_CONFIGURE_V3_MMU if HPT is in userspace 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: Laurent Vivier , qemu-stable@nongnu.org, Michael Roth , Paul Mackerras , qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Since the kernel commit "dbfcf3cb9c68 powerpc/64: Call H_REGISTER_PROC_TBL when running as a HPT guest on POWER9", a nested guest running with PR KVM hangs at boot: Preparing to boot Linux version 4.16.0-kvm-pr-hang-gku+ (greg@qemu2222.bost= on16) (gcc version 8.1.1 20180502 (Red Hat 8.1.1-1) (GCC)) #19 SMP Fri May = 25 08:41:55 CEST 2018 Detected machine type: 0000000000000101 command line: root=3DUUID=3D22128c5c-30b1-4e0a-ac16-95853df31131 ro rhgb co= nsole=3Dhvc0 early_printk disable-radix=3Don Max number of cores passed to firmware: 1024 (NR_CPUS =3D 1024) Calling ibm,client-architecture-support... done memory layout at init: memory_limit : 0000000000000000 (16 MB aligned) alloc_bottom : 0000000001b80000 alloc_top : 0000000030000000 alloc_top_hi : 0000000100000000 rmo_top : 0000000030000000 ram_top : 0000000100000000 instantiating rtas at 0x000000002fff0000... done prom_hold_cpus: skipped copying OF device tree... Building dt strings... Building dt structure... Device tree strings 0x0000000003d90000 -> 0x0000000003d90abb Device tree struct 0x0000000003da0000 -> 0x0000000003db0000 Quiescing Open Firmware ... Booting Linux via __start() @ 0x0000000000400000 ... This happens because the H_REGISTER_PROC_TBL implementation in QEMU always call KVM_PPC_CONFIGURE_V3_MMU when KVM is present. This fails in the case of PR KVM, which doesn't implement it, and QEMU returns H_PARAMETER to the guest, which is a BUG() condition in linux. In the case of PR, the HPT is allocated in userspace by QEMU, so it doesn't make sense to call KVM_PPC_CONFIGURE_V3_MMU in the first place. So, skip it in this case and let the guest boot. Signed-off-by: Greg Kurz Reviewed-by: Laurent Vivier --- Note that PR KVM requires this patch from Paul to work on POWER9: https://patchwork.ozlabs.org/patch/916766/ The original request was coming from people who want to run openQA in fedora28 under PowerVM on a POWER9 system. This requires PR KVM, which will be running in HPT-mode since pHyp doesn't do radix. Cc'ing stable because fedora28 ships QEMU 2.11.x. --- hw/ppc/spapr_hcall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 022f6d810182..12cbb317e5e8 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1420,7 +1420,7 @@ static target_ulong h_register_process_table(PowerPCC= PU *cpu, ((flags & FLAG_GTSE) ? LPCR_GTSE : 0), LPCR_UPRT | LPCR_GTSE); =20 - if (kvm_enabled()) { + if (kvm_enabled() && !spapr->htab) { return kvmppc_configure_v3_mmu(cpu, flags & FLAG_RADIX, flags & FLAG_GTSE, cproc); }