Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75B8FD2D8D4 for ; Tue, 27 Jan 2026 10:15:28 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1214156.1524528 (Exim 4.92) (envelope-from ) id 1vkg66-0003R4-D4; Tue, 27 Jan 2026 10:14:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1214156.1524528; Tue, 27 Jan 2026 10:14:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vkg66-0003Qx-9x; Tue, 27 Jan 2026 10:14:58 +0000 Received: by outflank-mailman (input) for mailman id 1214156; Tue, 27 Jan 2026 10:14:57 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vkg65-0003Qn-GN for xen-devel@lists.xenproject.org; Tue, 27 Jan 2026 10:14:57 +0000 Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazlp170120001.outbound.protection.outlook.com [2a01:111:f403:c10d::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 06373b51-fb69-11f0-9ccf-f158ae23cfc8; Tue, 27 Jan 2026 11:14:54 +0100 (CET) Received: from BN0PR04CA0197.namprd04.prod.outlook.com (2603:10b6:408:e9::22) by MW6PR12MB8705.namprd12.prod.outlook.com (2603:10b6:303:24c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.15; Tue, 27 Jan 2026 10:14:48 +0000 Received: from BN3PEPF0000B06A.namprd21.prod.outlook.com (2603:10b6:408:e9:cafe::19) by BN0PR04CA0197.outlook.office365.com (2603:10b6:408:e9::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9499.7 via Frontend Transport; Tue, 27 Jan 2026 10:14:12 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BN3PEPF0000B06A.mail.protection.outlook.com (10.167.243.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9587.0 via Frontend Transport; Tue, 27 Jan 2026 10:14:47 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Tue, 27 Jan 2026 04:14:47 -0600 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb09.amd.com (10.181.42.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Tue, 27 Jan 2026 02:14:47 -0800 Received: from [10.252.147.171] (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Tue, 27 Jan 2026 02:14:45 -0800 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 06373b51-fb69-11f0-9ccf-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=b4oLx+KqwiW5o186j+fhOAOfIdKq/CgCR6v1oDdyqLvmgkKrfqvQhcFV4YRTc8Qp9tt3mwnW0SXhZeVxlZ3bcpjONFCvgp+BkfHI+vyHJc+i9VBJeLKUQGpWzUJ86vSfRPRkgrRrTyla0BbycdJCeDqVbWEV00HKNHZmSV59mz29mFYdWz25+mAAcclPzHc4c3GZcrzaxI5JJ1i1gYrVrLqt38wyL5BfCwY5GgwWpUVz3BT/jKu3zx/xYu/0oH9TWhLLQEmdobFTLkknyPtQ38Aw12b45rctQewSMtxin1ZMdo95j1aA6aB5ZQ5GkndBYNNnltiSZx6qpalpxmOn0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P6G/ev7DfkxLhti4nY1GLMsJL47FkmJv6/RKrOUycog=; b=A0Un7WMbWawPEYx6YahUuDyJl44A6A0xHyG8f4XLR2hJPjJG/Zf1J9gjlVJVB06K3+t0ZaQlxsXxzuuLLq56Typ0W2cZGbmBhEFL2C2K50cd0aifrj4DNCLq3Alx2kzU9F/23Zpb8UVWMjEmoxIFQQ6CQEkmATPEOgEDQnlpn0ixAQ5bf2Ntzf+vhgpIBY2Yv8pLAA9TQ5hR+V3DVxyLsVTHjyaqNK2Wx6BHK96+iVxmC9dLd8OkZ9Jt4s1ko+SNK8Z1G7s8BnhKSXpwvVlzr/EyXjWryT5Y4SxvASYXyrGzPX37Dso9qbD+1b7ld9cIA2RbBnyevmlA6apKCFWolQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=P6G/ev7DfkxLhti4nY1GLMsJL47FkmJv6/RKrOUycog=; b=1tD/se3x/G6IOyEgjn32xMVk8+xsCUMA8BfyiCQIo63YoOKOo8gJ3Rl5wsaVOqHmMaGU7M0Z/32Us18iq5Wbw3I5EhIdUI65FeTNpU6u/owMB0U9PYo0JSDms1O3cHJ186fTTXiKNtPn/Mra4vp72Pc6/6O0mMvNffu4LLNoSx0= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Message-ID: <899a572a-1ba6-4bc6-806e-d049b4ac3ce3@amd.com> Date: Tue, 27 Jan 2026 11:14:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] arm/mpu: implement setup_virt_paging for MPU system To: Harry Ramsey , CC: , Penny Zheng , "Stefano Stabellini" , Julien Grall , "Bertrand Marquis" , Volodymyr Babchuk , Wei Chen , Hari Limaye References: <20260119105022.3616126-1-harry.ramsey@arm.com> From: "Orzel, Michal" Content-Language: en-US In-Reply-To: <20260119105022.3616126-1-harry.ramsey@arm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B06A:EE_|MW6PR12MB8705:EE_ X-MS-Office365-Filtering-Correlation-Id: 32f64e59-26e8-4ffc-ee1c-08de5d8ce666 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014|7416014|7053199007; X-Microsoft-Antispam-Message-Info: =?utf-8?B?KzBhRVFJS1A0MmRsVTRQZlBsVjFOZitza2U3dDBxSGhzdk1lZk1zZ1g4YzAr?= =?utf-8?B?SjJMeVE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ZwZ2JEaVFZUk8zRmlFcUJsUnNY?= =?utf-8?B?TTMvKzRBazdWY3Z2NWdiR2RuVzRoY2ZyUXhyZG5NVWRXY0pTR3AxYXVINlpp?= =?utf-8?B?R1NKN0NIbWJGU1FhalREaFp3UlhLQWxwcDY2M3ZYelc1aXhXVytTakhzczdR?= =?utf-8?B?SDd4bWJ6enU0bGd6ZTBmY3BHcndKMndUOWxYaW5TRHZxZDNnczB1dVV6YXV0?= =?utf-8?B?K3p4SjFFaVRWRFJiczlCcDMvYk5nTDRGT0U1ajdPTWxYR1NtL0ZRR1VVZ2Zv?= =?utf-8?B?VG1yd1BJYzdJVnpLYm4wVWtHZkpqT3NXK1M0RkJqbHN6MFJmdk9kOXVDai9V?= =?utf-8?B?TUp3b0kycjVJY0xCQ0pBQmdIS2FEYWVBNzBMaTNMTjJ2YWhMbGlXanE0L2d4?= =?utf-8?B?WmJJNkZhK0F1TG0rMXdKQzU0VVl3PT0=?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014)(7416014)(7053199007);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2026 10:14:47.5067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32f64e59-26e8-4ffc-ee1c-08de5d8ce666 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN3PEPF0000B06A.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8705 On 19/01/2026 11:50, Harry Ramsey wrote: > From: Penny Zheng > > For MMU system, setup_virt_paging is used to configure stage 2 address > translation regime, like IPA bits, VMID allocator set up, etc. > Some could be inherited in MPU system, like VMID allocator set up, etc. The commit msg only mentions setup_virt_paging, so why do you implement other p2m functions in the same commit? I would split the patch in two for clarity and ease of review. I will focus on setup_virt_paging. > > For MPU system, we could have the following memory translation regime: > - PMSAv8-64 at both EL1/EL0 and EL2 > - VMSAv8-64 at EL1/EL0 and PMSAv8-64 at EL2 > The default option will be the second, unless the platform could not support, > which could be checked against MSA_frac bit in Memory Model Feature Register 0( > ID_AA64MMFR0_EL1). What's the reasoning behind it? Why do we prefer VMSA at EL1 rather than PMSA? AFAICT PMSA is a default and VMSA is optional, so logically PMSA should be preffered. We should also make it configurable I think, so that a user has a choice. > > Signed-off-by: Penny Zheng > Signed-off-by: Wei Chen > Signed-off-by: Luca Fancellu > Signed-off-by: Hari Limaye > Signed-off-by: Harry Ramsey > --- > xen/arch/arm/arm64/mpu/p2m.c | 90 +++++++++++++++++++++++- > xen/arch/arm/include/asm/arm32/mpu.h | 2 + > xen/arch/arm/include/asm/arm64/mpu.h | 2 + > xen/arch/arm/include/asm/arm64/sysregs.h | 5 ++ > xen/arch/arm/include/asm/cpufeature.h | 7 ++ > xen/arch/arm/include/asm/mpu.h | 7 +- > xen/arch/arm/include/asm/mpu/p2m.h | 12 ++++ > xen/arch/arm/include/asm/p2m.h | 5 ++ > xen/arch/arm/include/asm/processor.h | 13 ++++ > xen/arch/arm/mpu/p2m.c | 71 ++++++++++++++++++- > 10 files changed, 209 insertions(+), 5 deletions(-) > > diff --git a/xen/arch/arm/arm64/mpu/p2m.c b/xen/arch/arm/arm64/mpu/p2m.c > index b6d8b2777b..13b633d9fe 100644 > --- a/xen/arch/arm/arm64/mpu/p2m.c > +++ b/xen/arch/arm/arm64/mpu/p2m.c > @@ -2,11 +2,99 @@ > > #include > #include > +#include > #include > > void __init setup_virt_paging(void) > { > - BUG_ON("unimplemented"); > + uint64_t vtcr_el2 = 0, vstcr_el2 = 0; > + bool p2m_vmsa = true; > + > + /* PA size */ > + const unsigned int pa_range_info[] = { 32, 36, 40, 42, 44, 48, 52, 0, /* Invalid */ }; 80 chars exceeded. Do we still need 0 here to denote invalid value? > + > + /* > + * Restrict "p2m_ipa_bits" if needed. As P2M table is always configured > + * with IPA bits == PA bits, compare against "pabits". > + */ > + if ( pa_range_info[system_cpuinfo.mm64.pa_range] < p2m_ipa_bits ) > + p2m_ipa_bits = pa_range_info[system_cpuinfo.mm64.pa_range]; > + > + /* > + * Clear VTCR_EL2.NSA bit to configure non-secure stage 2 translation output > + * address space to access the Secure PA space. > + */ > + vtcr_el2 &= NSA_SEL2; This has no effect. > + > + /* > + * The MSA and MSA_frac fields in the ID_AA64MMFR0_EL1 register identify the > + * memory system configurations supported at EL1. In Armv8-R AArch64, the The spec mentions all translation regimes + specific configuration for EL1, so it's not EL1 only. > + * only permitted value for ID_AA64MMFR0_EL1.MSA is 0b1111. > + */ > + if ( system_cpuinfo.mm64.msa != MM64_MSA_PMSA_SUPPORT ) > + goto fault; > + > + /* Permitted values for ID_AA64MMFR0_EL1.MSA_frac are 0b0001 and 0b0010. */ > + if ( system_cpuinfo.mm64.msa_frac == MM64_MSA_FRAC_NONE_SUPPORT ) > + goto fault; > + > + /* > + * When ID_AA64MMFR0_EL1.MSA_frac is 0b0010 the stage 1 EL1&0 translation > + * regime supports both PMSAv8-64 and VMSAv8-64. > + */ > + if ( system_cpuinfo.mm64.msa_frac != MM64_MSA_FRAC_VMSA_SUPPORT ) > + { > + p2m_vmsa = false; > + warning_add("Be aware of that there is no support for VMSAv8-64 at EL1 on this platform\n"); I think we should make PMSA a default. If at all, a warning message could be made simpler e.g. "No support for VMSAv8-64 at EL1". Seeing a warning already means that user should be aware of sth and it's clear that the message is about this platform. > + } > + > + /* > + * If PE supports both PMSAv8-64 and VMSAv8-64 at EL1, then VTCR_EL2.MSA > + * determines the memory system architecture enabled at stage 1 of the > + * Secure EL1&0 translation regime. > + * > + * Normally, we set the initial VTCR_EL2.MSA value VMSAv8-64 support, > + * unless this platform only supports PMSAv8-64. > + */ > + if ( !p2m_vmsa ) > + vtcr_el2 &= VTCR_MSA_PMSA; > + else > + vtcr_el2 |= VTCR_MSA_VMSA; > + > + /* > + * cpuinfo sanitization makes sure we support 16bits VMID only if all cores > + * are supporting it. > + */ > + if ( system_cpuinfo.mm64.vmid_bits == MM64_VMID_16_BITS_SUPPORT ) > + max_vmid = MAX_VMID_16_BIT; > + > + /* Set the VS bit only if 16 bit VMID is supported. */ > + if ( MAX_VMID == MAX_VMID_16_BIT ) Instead of a macro, use max_vmid variable here > + vtcr_el2 |= VTCR_VS; > + > + p2m_vmid_allocator_init(); > + > + WRITE_SYSREG(vtcr_el2, VTCR_EL2); Where do we set NSA bit? > + > + /* > + * VSTCR_EL2.SA defines secure stage 2 translation output address space. > + * To make sure that all stage 2 translations for the Secure PA space access > + * the Secure PA space, we keep SA bit as 0. This says that we want to access secure PA space but not why. > + * > + * VSTCR_EL2.SC is NS check enable bit. To make sure that Stage 2 NS > + * configuration is checked against stage 1 NS configuration in EL1&0 > + * translation regime for the given address, and generates a fault if they > + * are different, we set SC bit 1. > + */ > + vstcr_el2 = 1 << VSTCR_EL2_RES1_SHIFT; Why are we setting the RES1 bit? > + vstcr_el2 &= VSTCR_EL2_SA; This has no effect because you initialized it to 0. > + vstcr_el2 |= VSTCR_EL2_SC; > + WRITE_SYSREG(vstcr_el2, VSTCR_EL2); > + > + return; > + > + fault: > + panic("Hardware with no PMSAv8-64 support in any translation regime\n"); > } > > /* > diff --git a/xen/arch/arm/include/asm/arm32/mpu.h b/xen/arch/arm/include/asm/arm32/mpu.h > index 2cf0f8cbac..d565230f84 100644 > --- a/xen/arch/arm/include/asm/arm32/mpu.h > +++ b/xen/arch/arm/include/asm/arm32/mpu.h > @@ -11,6 +11,8 @@ > */ > #define MPU_REGION_RES0 0x0 > > +#define VSCTLR_VMID_SHIFT 16 > + > /* Hypervisor Protection Region Base Address Register */ > typedef union { > struct { > diff --git a/xen/arch/arm/include/asm/arm64/mpu.h b/xen/arch/arm/include/asm/arm64/mpu.h > index 4f694190a8..8b86a03fee 100644 > --- a/xen/arch/arm/include/asm/arm64/mpu.h > +++ b/xen/arch/arm/include/asm/arm64/mpu.h > @@ -7,6 +7,8 @@ > > #define MPU_REGION_RES0 (0xFFFFULL << 48) > > +#define VSCTLR_VMID_SHIFT 48 > + > /* Protection Region Base Address Register */ > typedef union { > struct __packed { > diff --git a/xen/arch/arm/include/asm/arm64/sysregs.h b/xen/arch/arm/include/asm/arm64/sysregs.h > index 19d409d3eb..4ed8ac0440 100644 > --- a/xen/arch/arm/include/asm/arm64/sysregs.h > +++ b/xen/arch/arm/include/asm/arm64/sysregs.h > @@ -462,6 +462,11 @@ > #define ZCR_ELx_LEN_SIZE 9 > #define ZCR_ELx_LEN_MASK 0x1ff > > +/* Virtualization Secure Translation Control Register */ > +#define VSTCR_EL2_RES1_SHIFT 31 > +#define VSTCR_EL2_SA ~(_AC(0x1,UL)<<30) > +#define VSTCR_EL2_SC (_AC(0x1,UL)<<20) > + > #ifdef CONFIG_MPU > /* > * The Armv8-R AArch64 architecture always executes code in Secure > diff --git a/xen/arch/arm/include/asm/cpufeature.h b/xen/arch/arm/include/asm/cpufeature.h > index 13353c8e1a..677cb2b96d 100644 > --- a/xen/arch/arm/include/asm/cpufeature.h > +++ b/xen/arch/arm/include/asm/cpufeature.h > @@ -248,6 +248,12 @@ struct cpuinfo_arm { > unsigned long tgranule_16K:4; > unsigned long tgranule_64K:4; > unsigned long tgranule_4K:4; > +#if !defined(CONFIG_MMU) Why not #ifdef CONFIG_MPU here and elsewhere? > + unsigned long __res:16; If there are multiple RES0 fields, we usually start from __res0 and iterate the number with each occurence of RES0. ~Michal