From nobody Mon Feb 9 09:35:57 2026 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 149447685661541.67420173694711; Wed, 10 May 2017 21:27:36 -0700 (PDT) Received: from localhost ([::1]:45923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8fhP-00007V-38 for importer@patchew.org; Thu, 11 May 2017 00:27:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8fUz-0005Ot-W2 for qemu-devel@nongnu.org; Thu, 11 May 2017 00:14:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8fUx-0001Vl-26 for qemu-devel@nongnu.org; Thu, 11 May 2017 00:14:45 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:52439) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8fUw-0001Rb-J8; Thu, 11 May 2017 00:14:42 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3wNfrR6L8jz9sNT; 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=1494476071; bh=LFLodYMco7+DFmyshus5YnRZNrQW3/wjbRqAaE3fE7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nQlP5+pS/wR89b4us0pJ4LryO/145Q8p97X5W483unNR0a4qaAzVABE9k1ReHAWCJ e5n+NA5KwpHc+8rD3SUA833CknGsOgUITRtc+/c0+jP6vpwpJDt+ITWYayS3GRma24 Kw8H2n/GeRW/FxCi4Pf88GJnDK4C3jpQBTOfu9eU= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 11 May 2017 14:14:21 +1000 Message-Id: <20170511041426.6488-19-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 18/23] target/ppc: Enable RADIX mmu mode for pseries TCG guest 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+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" From: Suraj Jitindar Singh Now that we have added all the infrastructure we can enable a pseries TCG guest to use radix. In order to do this we have to add the appropriate bits to the ibm,arch-vec-5-platform-support vector to represent that we support both hash and radix mmu models. A radix guest can now be booted in pseries tcg mode by specifying: -cpu POWER9 Note that we assume hash, that is we allocate a hpt, until a guest tells us otherwise via a H_REGISTER_PROCESS_TABLE call with radix specified - in which case we free the hpt. If we were right and the guest is hash then there's nothing for us to do. Signed-off-by: Suraj Jitindar Singh Reviewed-by: David Gibson Signed-off-by: David Gibson --- hw/ppc/spapr.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 80d12d0..e2dc77c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -855,6 +855,8 @@ static void spapr_dt_rtas(sPAPRMachineState *spapr, voi= d *fdt) * option vector 5: */ static void spapr_dt_ov5_platform_support(void *fdt, int chosen) { + PowerPCCPU *first_ppc_cpu =3D POWERPC_CPU(first_cpu); + char val[2 * 3] =3D { 24, 0x00, /* Hash/Radix, filled in below. */ 25, 0x00, /* Hash options: Segment Tables =3D=3D no, GTSE =3D=3D n= o. */ @@ -870,8 +872,13 @@ static void spapr_dt_ov5_platform_support(void *fdt, i= nt chosen) val[1] =3D 0x00; /* Hash */ } } else { - /* TODO: TCG case, hash */ - val[1] =3D 0x00; + if (first_ppc_cpu->env.mmu_model & POWERPC_MMU_V3) { + /* V3 MMU supports both hash and radix (with dynamic switching= ) */ + val[1] =3D 0xC0; + } else { + /* Otherwise we can only do hash */ + val[1] =3D 0x00; + } } _FDT(fdt_setprop(fdt, chosen, "ibm,arch-vec-5-platform-support", val, sizeof(val))); @@ -2101,8 +2108,8 @@ static void ppc_spapr_init(MachineState *machine) } =20 spapr_ovec_set(spapr->ov5, OV5_FORM1_AFFINITY); - if (kvmppc_has_cap_mmu_radix()) { - /* KVM always allows GTSE with radix... */ + if (!kvm_enabled() || kvmppc_has_cap_mmu_radix()) { + /* KVM and TCG always allow GTSE with radix... */ spapr_ovec_set(spapr->ov5, OV5_MMU_RADIX_GTSE); } /* ... but not with hash (currently). */ --=20 2.9.3