From patchwork Fri Aug 23 16:31:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayan Kumar Halder X-Patchwork-Id: 13775551 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 00129C52D7C for ; Fri, 23 Aug 2024 16:32:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.782450.1191946 (Exim 4.92) (envelope-from ) id 1shXCa-0003xf-KX; Fri, 23 Aug 2024 16:31:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 782450.1191946; Fri, 23 Aug 2024 16:31:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1shXCa-0003xW-HS; Fri, 23 Aug 2024 16:31:52 +0000 Received: by outflank-mailman (input) for mailman id 782450; Fri, 23 Aug 2024 16:31:51 +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 1shXCZ-0003wy-Cz for xen-devel@lists.xenproject.org; Fri, 23 Aug 2024 16:31:51 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20617.outbound.protection.outlook.com [2a01:111:f403:2416::617]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 320fd403-616d-11ef-8776-851b0ebba9a2; Fri, 23 Aug 2024 18:31:49 +0200 (CEST) Received: from DS7PR03CA0005.namprd03.prod.outlook.com (2603:10b6:5:3b8::10) by CH0PR12MB8507.namprd12.prod.outlook.com (2603:10b6:610:189::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Fri, 23 Aug 2024 16:31:42 +0000 Received: from DS3PEPF0000C37A.namprd04.prod.outlook.com (2603:10b6:5:3b8:cafe::53) by DS7PR03CA0005.outlook.office365.com (2603:10b6:5:3b8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21 via Frontend Transport; Fri, 23 Aug 2024 16:31:42 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DS3PEPF0000C37A.mail.protection.outlook.com (10.167.23.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7897.11 via Frontend Transport; Fri, 23 Aug 2024 16:31:42 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 23 Aug 2024 11:31:41 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 23 Aug 2024 11:31:41 -0500 Received: from xcbayankuma40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 23 Aug 2024 11:31:40 -0500 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: 320fd403-616d-11ef-8776-851b0ebba9a2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lQ4k1SLFw4OR+hAEQv1VLlhoG38JSAWdEWDYMipMNMOl8pbqvZdmRjVW6f82is2QPvtm0aSM3xYmFgXHAhNiRVxEedRI6zhN8kxgpt0HmlpJnsA0pSt9RdA32qr5vqTyBflepRtmX0ghYZyUQSiEtLD6mVfvAnpX+OR3v9ucK9ifxtBNs+2T4CQEtdM+3x8u4eWz3FfYQ+Ot3EP4P2hnYAoAwWbHbTLPsf2sL7LQHSXIUqc7rqdWP54OdRSwzz4Wn/M+p58dsJsgtzvAPq/1UENd33rJH0WNVX31O15XuaNQkM+78k1QC1TF91QyvriKaCgzuyyz7FOwAIcZnOkLLA== 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=Nx/VzbkSyae2KVO1umnmm7DGWwCikaMWrTbOm87/DJ8=; b=PYmUhQ+VnfEE/IsznSkowyTVxjQEDqLEqxKcUJ8yzLcJ/pZBqsYrJdJhH2R9n9pGf9YEAS3f+kuoEADMGB+NPihvoeJfy9jGegNdtFivCjuMfOWGJtZUqKOMfh2w48RIEDIq5XA76DhIkZNYF0cgIQuf5PMUcKpAupztKxFL3YofadCEtwFHUQuVDJ1bgiXR0CX9A4OlhnahbI9a49SxSxWNOBHrNt2c2aWTOAFNOBNjEdRr50fq25QsumUkIoyDewZvap7xjhMJwX64vivf6Sm9Ulf3A829UrbRuNWic3DozqfcqyZGBPohqh8MlVyHNE8Xbl1f5leNheRt/DtVAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org 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=Nx/VzbkSyae2KVO1umnmm7DGWwCikaMWrTbOm87/DJ8=; b=TJWvUDy+OU297FwLEEx/+TkAaZHb0CDhrmsBZjqJZCO6J7WUYzpOyGiHJqa+TCEgyqQPjXEQm3YxKY8md3RzDIB36w1fsZJQNb/bei7zMPijUYdhKNxT3IkYaGcu096paNc3bD7Au9kUZKex6bJiXygbwdeMReetZ15gad3pwV4= 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=SATLEXMB03.amd.com; pr=C From: Ayan Kumar Halder To: CC: Ayan Kumar Halder , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" Subject: [PATCH v1 1/4] xen/arm: mpu: Introduce choice between MMU and MPU Date: Fri, 23 Aug 2024 17:31:24 +0100 Message-ID: <20240823163127.3443404-2-ayan.kumar.halder@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823163127.3443404-1-ayan.kumar.halder@amd.com> References: <20240823163127.3443404-1-ayan.kumar.halder@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: ayan.kumar.halder@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37A:EE_|CH0PR12MB8507:EE_ X-MS-Office365-Filtering-Correlation-Id: 9087873e-ac76-4140-ea5d-08dcc3911219 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Micros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YujvX5eYmxzB/0SNfY3wCz1Mq64fdiG/6zjyhJ02fiuVwWq2u5EQoYdPbT/uNx+B4kBO8NAiV0rv/p6Rx6QJUum4zf/zdEYtWHEnuzxJhHGt/x8BnqaKf6aOPFBe8tTYzYhxCyuDAYKRJ9mMHCxPOghu+thQlLdsBRcBotCCroVMKw3tYM90D5MJkGHgqajQXaantKQfKpJghUmYilf81w0DQCrzGbrXaxsG8dz1PQtk5sWAtWsAvGliVhY1ESN0fKQ4WsoIhe4fVb0PRvL0FX2F+oi+I61IE00qnoZkyW7cC+j+50WuqEczPvmkbbtuee0bZAJ9INQvM12gJJUJbB0bDSVQbadEncgo6lhyravCeA5iV+4NBZOIM83QP/nqwpvB17hbH1cQxzFp7eaCctK X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 16:31:42.0036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9087873e-ac76-4140-ea5d-08dcc3911219 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB8507 There are features in the forthcoming patches which are dependent on MPU. For eg fixed start address. Also, some of the Xen features (eg STATIC_MEMORY) will be selected by the MPU configuration. Thus, this patch introduces a choice between MMU and MPU for the type of memory management system. By default, MMU is selected. All the current platforms are now made dependent on MMU. Signed-off-by: Ayan Kumar Halder --- xen/arch/arm/Kconfig | 17 ++++++++++++++++- xen/arch/arm/platforms/Kconfig | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 323c967361..686948cefd 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -58,10 +58,25 @@ config PADDR_BITS default 40 if ARM_PA_BITS_40 default 48 if ARM_64 +choice + prompt "Memory management system" + default MMU if ARM + help + User can choose between the different forms of memory management system. + Most of the Arm based systems support MMU. + config MMU - def_bool y + bool "MMU" select HAS_PMAP select HAS_VMAP + help + Memory management unit is supported on most Arm based systems. + +config MPU + bool "MPU" + help + Memory protection unit is supported on some Cortex-R systems. +endchoice source "arch/Kconfig" diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig index 76f7e76b1b..02322c259c 100644 --- a/xen/arch/arm/platforms/Kconfig +++ b/xen/arch/arm/platforms/Kconfig @@ -1,5 +1,5 @@ choice - prompt "Platform Support" + prompt "Platform Support" if MMU default ALL_PLAT help Choose which hardware platform to enable in Xen. From patchwork Fri Aug 23 16:31:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayan Kumar Halder X-Patchwork-Id: 13775554 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 85436C52D7C for ; Fri, 23 Aug 2024 16:32:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.782452.1191961 (Exim 4.92) (envelope-from ) id 1shXCh-0004LZ-BL; Fri, 23 Aug 2024 16:31:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 782452.1191961; Fri, 23 Aug 2024 16:31:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1shXCh-0004K3-6O; Fri, 23 Aug 2024 16:31:59 +0000 Received: by outflank-mailman (input) for mailman id 782452; Fri, 23 Aug 2024 16:31: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 1shXCf-0003wy-Rl for xen-devel@lists.xenproject.org; Fri, 23 Aug 2024 16:31:57 +0000 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on20615.outbound.protection.outlook.com [2a01:111:f403:2405::615]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3528e294-616d-11ef-8776-851b0ebba9a2; Fri, 23 Aug 2024 18:31:56 +0200 (CEST) Received: from SJ0PR03CA0001.namprd03.prod.outlook.com (2603:10b6:a03:33a::6) by PH7PR12MB6812.namprd12.prod.outlook.com (2603:10b6:510:1b6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.20; Fri, 23 Aug 2024 16:31:49 +0000 Received: from SJ1PEPF000023CF.namprd02.prod.outlook.com (2603:10b6:a03:33a:cafe::7b) by SJ0PR03CA0001.outlook.office365.com (2603:10b6:a03:33a::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21 via Frontend Transport; Fri, 23 Aug 2024 16:31:49 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF000023CF.mail.protection.outlook.com (10.167.244.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7897.11 via Frontend Transport; Fri, 23 Aug 2024 16:31:47 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 23 Aug 2024 11:31:46 -0500 Received: from xcbayankuma40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 23 Aug 2024 11:31:45 -0500 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: 3528e294-616d-11ef-8776-851b0ebba9a2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YJSwoZ3cPZbUFIfJrMhDAY1/QmBfUBRHnoNeXNCtgXjdexP0SqcYudYe4f5GNwK3bYKsyOq1CgqJdJLIiHnan90h+MyRqiPJa1Yw/3JGyKZ02i/Bf+but8Bc4Jh98PYb3dgF6t785xDVmf0Rt2fAtxnqxXf4CIPuBIFw0s6c2KMUHPoapcJ8b6oOxyEHzmr6loc38pVwJgJkuj+UvzXZb+uSFrhIC0IMASHx+hgTKj0t8XR5G4MORe5TpTZ/u5KhBfC1CrpM3G2baS1lcUhMVCgFrV/y9xm8FCfNBI8PbHeFldHM4pV41QZXLUdA8IjzAECEcgbPrS8plkA0HS9F1w== 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=Nr9rHx3YRb1ioBThg6/mHfFwNo227Uz+gT46derpfBU=; b=Tw6qrhOghLPL/11ZTNK3O3EZG8tXpLKpKz8d/DuSN0vTTsi7XqTbV32U3yRwfZtLsOh+gwcxgyLxExiB11YvyOP/fr458ZUtaa9leICX00E6QNoxx70h+FcpMm/EyE1qUEX6UB8GZoKd+CNxnc0QXqDK383XDuoXuax6EBeIgvqFSM7nyCGOblosOSVugMDw95ky/mgHmR/RXrnhle9kd7t1tfksaQ96gY4rXj7P/cU7UX2E5H2xJzoWif+7+tJg8Yr3wfnlxSw4M7XllwRCItWGKdyPhuuOxkSP4skmxfXHinTxU2Hv2ZQ7jxQ8Op0irHDh14A7UvtXHpW/8b7BPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org 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=Nr9rHx3YRb1ioBThg6/mHfFwNo227Uz+gT46derpfBU=; b=UDW4zK9cjOI1y66eux3xmcnKQFFN4X8YpA44YDAzUw8v4/ZINiRj5r7TAB4eLhYD6SvOVLRMe4+rm+tIXiLwhoyLcVNpQZCXtJ0bVRp9G8mR+RLhp5Bq2iaCCSNeDEwsD449ZRMyKIe7rqzxLBckYQKI27XDBerE+2tr1r8q2ZQ= 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=SATLEXMB04.amd.com; pr=C From: Ayan Kumar Halder To: CC: Wei Chen , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , "Jiamei . Xie" , "Ayan Kumar Halder" Subject: [PATCH v1 2/4] xen/arm: mpu: Define Xen start address for MPU systems Date: Fri, 23 Aug 2024 17:31:25 +0100 Message-ID: <20240823163127.3443404-3-ayan.kumar.halder@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823163127.3443404-1-ayan.kumar.halder@amd.com> References: <20240823163127.3443404-1-ayan.kumar.halder@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: ayan.kumar.halder@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000023CF:EE_|PH7PR12MB6812:EE_ X-MS-Office365-Filtering-Correlation-Id: a5601d19-ca2f-46f3-d9a5-08dcc3911580 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: ARmCeBXfk6QRFpEG4jk0AIjOUPHmrXb0p+E30Mj7a1K2tFxRiJtMQ/3MD9dJfF8QDWR69s+cBuSpyloRiCAB8TMkcClsPpplcL7lykHYjRTFX9cwqP6FDuUrF1w447t/1KUktXFjsNJkHXfY5Oattz9FsFLT0CgqrgTWaiT63bCscLG0VetV33RFdNoJpIjM96gA188aKYpAYhWyQqx19ZdQ+U8BFc52QGsFyaUwuoCPADomBN7Yg3qrqdgIXyjoHMojXXqrX7wShL9VuYCcWHPndfKajdGCKQpg4M9UItBABhv+v7ISdodHSibwbXp9DT/LbxxMgzE0eGd+HpnE1d3/0bDa3IPNMvTOQ3DB/xnO6j9/08jte0V3npyM18BvXYcLXRWTDBc2m9Z3fMYqfDjVBN6xVS536lkrF2nNMJq0eVMv/sii9WqSadGLjqdmNkgnApwk5d72qPFrS5RqbLYPgRZ12+p/GcVwmaGP/cfXR6bcUL2R9hG34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E;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 16:31:47.6645 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5601d19-ca2f-46f3-d9a5-08dcc3911580 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF000023CF.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6812 From: Wei Chen On Armv8-A, Xen has a fixed virtual start address (link address too) for all Armv8-A platforms. In an MMU based system, Xen can map its loaded address to this virtual start address. So, on Armv8-A platforms, the Xen start address does not need to be configurable. But on Armv8-R platforms, there is no MMU to map loaded address to a fixed virtual address and different platforms will have very different address space layout. So Xen cannot use a fixed physical address on MPU based system and need to have it configurable. So in this patch, we reuse the existing arm/platforms to store Armv8-R platforms' parameters. And `XEN_START_ADDRESS` is one kind of MPU based platform's parameters. So we define default `XEN_START_ADDRESS` in the MPU specific header file. We also introduce one Kconfig option for users to override the default Xen start address of selected platform, if they think the default address doesn't suit their scenarios. For this Kconfig option, we use an unaligned address "0xffffffff" as the default value to indicate that users haven't used a customized Xen start address. Signed-off-by: Wei Chen Signed-off-by: Jiamei.Xie Signed-off-by: Ayan Kumar Halder --- xen/arch/arm/Kconfig | 11 +++++++++++ xen/arch/arm/include/asm/mpu/layout.h | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 xen/arch/arm/include/asm/mpu/layout.h diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 686948cefd..d722ca690c 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -23,6 +23,17 @@ config ARCH_DEFCONFIG default "arch/arm/configs/arm32_defconfig" if ARM_32 default "arch/arm/configs/arm64_defconfig" if ARM_64 +config XEN_START_ADDRESS + hex "Xen start address: keep default to use platform defined address" + default 0xFFFFFFFF + depends on MPU + help + This option is allowed to set customized address at which Xen will be + linked on MPU systems. This address must be aligned to a page size. + Use 0xFFFFFFFF as the default value to indicate that user hasn't + customized this address, and Xen use use the default value that has + been defined in platform files. + menu "Architecture Features" choice diff --git a/xen/arch/arm/include/asm/mpu/layout.h b/xen/arch/arm/include/asm/mpu/layout.h new file mode 100644 index 0000000000..82a74b8b5b --- /dev/null +++ b/xen/arch/arm/include/asm/mpu/layout.h @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * config_mpu.h: A Linux-style configuration list for Arm MPU systems, + * only can be included by config.h + */ + +#ifndef __ARM_CONFIG_MPU_H__ +#define __ARM_CONFIG_MPU_H__ + + +#define XEN_START_ADDRESS CONFIG_XEN_START_ADDRESS + +/* + * All MPU platforms need to provide a XEN_START_ADDRESS for linker. This + * address indicates where Xen image will be loaded and run from. This + * address must be aligned to a PAGE_SIZE. + */ +#if (XEN_START_ADDRESS % PAGE_SIZE) != 0 +#error "XEN_START_ADDRESS must be aligned to PAGE_SIZE" +#endif + +#define XEN_VIRT_START _AT(paddr_t, XEN_START_ADDRESS) + +#endif /* __ARM_CONFIG_MPU_H__ */ + From patchwork Fri Aug 23 16:31:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayan Kumar Halder X-Patchwork-Id: 13775553 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 CDF17C5472F for ; Fri, 23 Aug 2024 16:32:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.782451.1191956 (Exim 4.92) (envelope-from ) id 1shXCg-0004Gx-WA; Fri, 23 Aug 2024 16:31:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 782451.1191956; Fri, 23 Aug 2024 16:31: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 1shXCg-0004G0-QJ; Fri, 23 Aug 2024 16:31:58 +0000 Received: by outflank-mailman (input) for mailman id 782451; Fri, 23 Aug 2024 16:31:57 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1shXCf-0003gP-DM for xen-devel@lists.xenproject.org; Fri, 23 Aug 2024 16:31:57 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2061e.outbound.protection.outlook.com [2a01:111:f403:2414::61e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 36157c30-616d-11ef-a50a-bb4a2ccca743; Fri, 23 Aug 2024 18:31:56 +0200 (CEST) Received: from CH0PR08CA0001.namprd08.prod.outlook.com (2603:10b6:610:33::6) by MN0PR12MB5740.namprd12.prod.outlook.com (2603:10b6:208:373::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.20; Fri, 23 Aug 2024 16:31:53 +0000 Received: from DS3PEPF0000C37C.namprd04.prod.outlook.com (2603:10b6:610:33:cafe::f8) by CH0PR08CA0001.outlook.office365.com (2603:10b6:610:33::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19 via Frontend Transport; Fri, 23 Aug 2024 16:31:52 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DS3PEPF0000C37C.mail.protection.outlook.com (10.167.23.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7897.11 via Frontend Transport; Fri, 23 Aug 2024 16:31:52 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 23 Aug 2024 11:31:52 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 23 Aug 2024 11:31:51 -0500 Received: from xcbayankuma40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 23 Aug 2024 11:31:50 -0500 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: 36157c30-616d-11ef-a50a-bb4a2ccca743 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=l4+HfeVHXna29Bt1oGg4sA5thuBZqa7ZEsRCrBqjhLvf2iWnS2awtK4LNJXpcUsgtUb95IQzrCUbyDYg8IgLSTZVV0yNCJJwMFcqNi/zPqNN+3jRzsB9pH7nnDvQ5+XjKD4U8L0rmA7TsjGr/NW84Mjx8r7rjVUWqWy8XpLLcwBVPatnHierVc67141Faa5pw+0wV6hburHYKgnpwMv1BfBGeTUpTTo4UaNrJ+Hc+qgdnl5GvntIaLs7pV5glCS6wCONhH9JZGTfdTl98imH2qFqFWjqCpgZ8Xvw1HKnFY8oUFP7ldWbumPzII1GvqHBtCcPvgkdLnKYjf9UdR0+TQ== 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=/VX6RV1GAbIb7gcCEfNz4iYXOrRrxcVBayyRtnGLtkc=; b=mARlzjV1Wm7aNdI5H8DzZ9rEYC1RdQvrqBI4MrrlXStkCkn+YEHl0uvqQWFFfsyI7T0ukCKsG2GtjKrTgAIEn+Q3OgEEKh2F2XZPbViblkg/qdCaOKHoiac16FCj3mG5ql5S54oXVmhOG0VaBM0tcelZ0VhnQsK6PsOFxSW6qbHiG1dDpixQ3cF/Al68LyVy63zOLzYh78fUjH3/jwt4e7ueKEv///n3ao9r7GJ5JxxiwNGIeGV+bA80JUJuaFopaU630KtV5Pn/CWnU7fmxUZZyGRpMiTELwLfz3/rjaB26Li9mj+bamRtCWDa4ZQTRo8tp1c38v7hZzBcws1meuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org 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=/VX6RV1GAbIb7gcCEfNz4iYXOrRrxcVBayyRtnGLtkc=; b=d9iDxmaJNkHxVXgBeR1j1H0lnCLudFfiee3SyUale4LVCiD9lA3gthJOR/adQW6iiGIE9H/zPIvb4mDTsq33/bMDGrPxqP0o437o3g49maMrbXoESy4Nkk2FWjHb99a42MIknqE87SLwLtNn1LQ3w2l0AE/ocwKFPPL/uCLYzOk= 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=SATLEXMB03.amd.com; pr=C From: Ayan Kumar Halder To: CC: Ayan Kumar Halder , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" Subject: [PATCH v1 3/4] xen/arm: mpu: Create boot-time MPU protection regions Date: Fri, 23 Aug 2024 17:31:26 +0100 Message-ID: <20240823163127.3443404-4-ayan.kumar.halder@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823163127.3443404-1-ayan.kumar.halder@amd.com> References: <20240823163127.3443404-1-ayan.kumar.halder@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37C:EE_|MN0PR12MB5740:EE_ X-MS-Office365-Filtering-Correlation-Id: 706a318d-5ef2-49a3-932d-08dcc391185e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: Aq4WSqIn+vHBBrofc+8j9mYjH6bfw95pAshSbAaWpwHd3zO/DI8Ae+fXrA1y48v1jIzK2Tn5XwYoVTXu9OiME/+YMIjQLDTPagWh3CkIX08MJmO3kQrES3Zk4p6i0jD8ekfkKsauREz5uYrLs8fNkoYVdJqnRwamhm/xjiyQJRQzaZehDwQ71ht/izG3oGzE6c/+YwoYommm7V4xgSsEC8vfe310Xe5gCu5HyXPIco0uBU4habWM+flc79qXmNq+3c7CBj0+DTh69Aui9beQTpO4b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12S1RehP02/3BYhx5fmpi1yUy9s+tKBbJapE/9jVSpQCiF1FfrTq8Sh3HtFUubarKRuDiXZvgJTbrpAASvG4SeHM51tc7PqL83MFUTmbfkZ X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 16:31:52.5668 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 706a318d-5ef2-49a3-932d-08dcc391185e 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5740 Define enable_boot_cpu_mm() for the AArch64-V8R system. Like boot-time page table in MMU system, we need a boot-time MPU protection region configuration in MPU system so Xen can fetch code and data from normal memory. START_ADDRESS + 2MB memory is mapped to contain the text and data required for early boot of Xen. One can refer to ARM DDI 0600B.a ID062922 G1.3 "General System Control Registers", to get the definitions of PRBAR_EL2, PRLAR_EL2 and PRSELR_EL2 registers. Also, refer to G1.2 "Accessing MPU memory region registers", the following ``` The MPU provides two register interfaces to program the MPU regions: - Access to any of the MPU regions via PRSELR_ELx, PRBAR_ELx, and PRLAR_ELx. ``` We use the above mechanism to configure the MPU memory regions. Signed-off-by: Ayan Kumar Halder --- xen/arch/arm/Makefile | 1 + xen/arch/arm/arm64/mpu/Makefile | 1 + xen/arch/arm/arm64/mpu/head.S | 70 ++++++++++++++++++++++++ xen/arch/arm/include/asm/arm64/sysregs.h | 50 +++++++++++++++++ xen/arch/arm/include/asm/mpu/arm64/mm.h | 13 +++++ xen/arch/arm/include/asm/mpu/mm.h | 18 ++++++ 6 files changed, 153 insertions(+) create mode 100644 xen/arch/arm/arm64/mpu/Makefile create mode 100644 xen/arch/arm/arm64/mpu/head.S create mode 100644 xen/arch/arm/include/asm/mpu/arm64/mm.h create mode 100644 xen/arch/arm/include/asm/mpu/mm.h diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 7792bff597..aebccec63a 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -1,6 +1,7 @@ obj-$(CONFIG_ARM_32) += arm32/ obj-$(CONFIG_ARM_64) += arm64/ obj-$(CONFIG_MMU) += mmu/ +obj-$(CONFIG_MPU) += mpu/ obj-$(CONFIG_ACPI) += acpi/ obj-$(CONFIG_HAS_PCI) += pci/ ifneq ($(CONFIG_NO_PLAT),y) diff --git a/xen/arch/arm/arm64/mpu/Makefile b/xen/arch/arm/arm64/mpu/Makefile new file mode 100644 index 0000000000..3340058c08 --- /dev/null +++ b/xen/arch/arm/arm64/mpu/Makefile @@ -0,0 +1 @@ +obj-y += head.o diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S new file mode 100644 index 0000000000..2b023c346a --- /dev/null +++ b/xen/arch/arm/arm64/mpu/head.S @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Start-of-day code for an Armv8-R MPU system. + */ + +#include +#include +#include + +/* + * From the requirements of head.S we know that Xen image should + * be linked at XEN_START_ADDRESS, and all of text + data + bss + * must fit in 2MB. On MPU systems, XEN_START_ADDRESS is also the + * address that Xen image should be loaded at. So for initial MPU + * regions setup, we use 2MB for Xen data memory to setup boot + * region, or the create boot regions code below will need adjustment. + */ +#define XEN_START_MEM_SIZE 0x200000 + +/* + * In boot stage, we will use 1 MPU region: + * Region#0: Normal memory for Xen text + data + bss (2MB) + */ +#define BOOT_NORMAL_REGION_IDX 0x0 + +/* MPU normal memory attributes. */ +#define PRBAR_NORMAL_MEM 0x30 /* SH=11 AP=00 XN=00 */ +#define PRLAR_NORMAL_MEM 0x0f /* NS=0 ATTR=111 EN=1 */ + +.macro write_pr, sel, prbar, prlar + msr PRSELR_EL2, \sel + dsb sy + msr PRBAR_EL2, \prbar + msr PRLAR_EL2, \prlar + dsb sy + isb +.endm + +.section .text.header, "ax", %progbits + +/* + * Static start-of-day EL2 MPU memory layout. + * + * It has a very simple structure, including: + * - 2MB normal memory mappings of xen at XEN_START_ADDRESS, which + * is the address where Xen was loaded by the bootloader. + */ +ENTRY(enable_boot_cpu_mm) + /* Map Xen start memory to a normal memory region. */ + mov x0, #BOOT_NORMAL_REGION_IDX + ldr x1, =XEN_START_ADDRESS + and x1, x1, #MPU_REGION_MASK + mov x3, #PRBAR_NORMAL_MEM + orr x1, x1, x3 + + ldr x2, =XEN_START_ADDRESS + mov x3, #(XEN_START_MEM_SIZE - 1) + add x2, x2, x3 + and x2, x2, #MPU_REGION_MASK + mov x3, #PRLAR_NORMAL_MEM + orr x2, x2, x3 + + /* + * Write to MPU protection region: + * x0 for pr_sel, x1 for prbar x2 for prlar + */ + write_pr x0, x1, x2 + + ret +ENDPROC(enable_boot_cpu_mm) diff --git a/xen/arch/arm/include/asm/arm64/sysregs.h b/xen/arch/arm/include/asm/arm64/sysregs.h index b593e4028b..0d122e1fa6 100644 --- a/xen/arch/arm/include/asm/arm64/sysregs.h +++ b/xen/arch/arm/include/asm/arm64/sysregs.h @@ -462,6 +462,56 @@ #define ZCR_ELx_LEN_SIZE 9 #define ZCR_ELx_LEN_MASK 0x1ff +/* System registers for AArch64 with PMSA */ +#ifdef CONFIG_MPU + +/* EL2 MPU Protection Region Base Address Register encode */ +#define PRBAR_EL2 S3_4_C6_C8_0 +#define PRBAR1_EL2 S3_4_C6_C8_4 +#define PRBAR2_EL2 S3_4_C6_C9_0 +#define PRBAR3_EL2 S3_4_C6_C9_4 +#define PRBAR4_EL2 S3_4_C6_C10_0 +#define PRBAR5_EL2 S3_4_C6_C10_4 +#define PRBAR6_EL2 S3_4_C6_C11_0 +#define PRBAR7_EL2 S3_4_C6_C11_4 +#define PRBAR8_EL2 S3_4_C6_C12_0 +#define PRBAR9_EL2 S3_4_C6_C12_4 +#define PRBAR10_EL2 S3_4_C6_C13_0 +#define PRBAR11_EL2 S3_4_C6_C13_4 +#define PRBAR12_EL2 S3_4_C6_C14_0 +#define PRBAR13_EL2 S3_4_C6_C14_4 +#define PRBAR14_EL2 S3_4_C6_C15_0 +#define PRBAR15_EL2 S3_4_C6_C15_4 + +/* EL2 MPU Protection Region Limit Address Register encode */ +#define PRLAR_EL2 S3_4_C6_C8_1 +#define PRLAR1_EL2 S3_4_C6_C8_5 +#define PRLAR2_EL2 S3_4_C6_C9_1 +#define PRLAR3_EL2 S3_4_C6_C9_5 +#define PRLAR4_EL2 S3_4_C6_C10_1 +#define PRLAR5_EL2 S3_4_C6_C10_5 +#define PRLAR6_EL2 S3_4_C6_C11_1 +#define PRLAR7_EL2 S3_4_C6_C11_5 +#define PRLAR8_EL2 S3_4_C6_C12_1 +#define PRLAR9_EL2 S3_4_C6_C12_5 +#define PRLAR10_EL2 S3_4_C6_C13_1 +#define PRLAR11_EL2 S3_4_C6_C13_5 +#define PRLAR12_EL2 S3_4_C6_C14_1 +#define PRLAR13_EL2 S3_4_C6_C14_5 +#define PRLAR14_EL2 S3_4_C6_C15_1 +#define PRLAR15_EL2 S3_4_C6_C15_5 + +/* MPU Protection Region Enable Register encode */ +#define PRENR_EL2 S3_4_C6_C1_1 + +/* MPU Protection Region Selection Register encode */ +#define PRSELR_EL2 S3_4_C6_C2_1 + +/* MPU Type registers encode */ +#define MPUIR_EL2 S3_4_C0_C0_4 + +#endif + /* Access to system registers */ #define WRITE_SYSREG64(v, name) do { \ diff --git a/xen/arch/arm/include/asm/mpu/arm64/mm.h b/xen/arch/arm/include/asm/mpu/arm64/mm.h new file mode 100644 index 0000000000..d209eef6db --- /dev/null +++ b/xen/arch/arm/include/asm/mpu/arm64/mm.h @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * mpu.h: Arm Memory Protection Unit definitions. + */ + +#ifndef __ARM64_MPU_H__ +#define __ARM64_MPU_H__ + +#define MPU_REGION_SHIFT 6 +#define MPU_REGION_ALIGN (_AC(1, UL) << MPU_REGION_SHIFT) +#define MPU_REGION_MASK (~(MPU_REGION_ALIGN - 1)) + +#endif /* __ARM64_MPU_H__ */ diff --git a/xen/arch/arm/include/asm/mpu/mm.h b/xen/arch/arm/include/asm/mpu/mm.h new file mode 100644 index 0000000000..f5ebca8261 --- /dev/null +++ b/xen/arch/arm/include/asm/mpu/mm.h @@ -0,0 +1,18 @@ +#ifndef __ARCH_ARM_MPU__ +#define __ARCH_ARM_MPU__ + +#if defined(CONFIG_ARM_64) +# include +#else +# error "unknown ARM variant" +#endif + +#endif /* __ARCH_ARM_MPU__ */ +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ From patchwork Fri Aug 23 16:31:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayan Kumar Halder X-Patchwork-Id: 13775555 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 2DDC8C531DC for ; Fri, 23 Aug 2024 16:32:16 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.782457.1191976 (Exim 4.92) (envelope-from ) id 1shXCo-0004zf-HH; Fri, 23 Aug 2024 16:32:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 782457.1191976; Fri, 23 Aug 2024 16:32:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1shXCo-0004zY-Dh; Fri, 23 Aug 2024 16:32:06 +0000 Received: by outflank-mailman (input) for mailman id 782457; Fri, 23 Aug 2024 16:32:05 +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 1shXCn-0003wy-CL for xen-devel@lists.xenproject.org; Fri, 23 Aug 2024 16:32:05 +0000 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2060b.outbound.protection.outlook.com [2a01:111:f403:2408::60b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3a357554-616d-11ef-8776-851b0ebba9a2; Fri, 23 Aug 2024 18:32:03 +0200 (CEST) Received: from DS7PR06CA0050.namprd06.prod.outlook.com (2603:10b6:8:54::32) by IA0PR12MB8896.namprd12.prod.outlook.com (2603:10b6:208:493::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.16; Fri, 23 Aug 2024 16:31:58 +0000 Received: from DS3PEPF0000C37D.namprd04.prod.outlook.com (2603:10b6:8:54:cafe::d6) by DS7PR06CA0050.outlook.office365.com (2603:10b6:8:54::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18 via Frontend Transport; Fri, 23 Aug 2024 16:31:58 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by DS3PEPF0000C37D.mail.protection.outlook.com (10.167.23.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7897.11 via Frontend Transport; Fri, 23 Aug 2024 16:31:57 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 23 Aug 2024 11:31:56 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 23 Aug 2024 11:31:56 -0500 Received: from xcbayankuma40.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 23 Aug 2024 11:31:54 -0500 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: 3a357554-616d-11ef-8776-851b0ebba9a2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WShjWix8mPVqDTbOruTRH2UCLY54m6OB3SEmP9idjbVD/VjSNeY4GkZ8kq5kNV8Xghu7K/+WbKopdOWXpTsHS8C+6gxlUnSyRVIMtuS9alpr8njh+wcdo5exFSOIdUTQCtIHPr9ZHW7zX4dbV7DfpL/QPi9qw9wat5qGuLe4y8tyxBr4usjMtBkj9ZoadJemVyL7mKfJOmSVUZJl4tEZf5VrAz3kF5tGwY9Rsvl0x9Nx04GoBnJPLFCsx8rWHVvB6NrsBBNSuzuME+wp5EoSzS2VOJ0y3VUfRmCDfPoecOjDK2Y0SjWSgSmb/r8S4jzy0F0ixut8JCBIQyewG7ye7Q== 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=wuiEdftCCb5GGJkxnNH4L0uhS/yjDJbyX+vbFvef+Cw=; b=ASn2yW3XmcglQmdTikTAT3b1VJl+x9cTtdEootr9ekLwsuX65Se2HmOvTlc2RBGN4rSR8pzM2PCCE/BtwF41X8aAikV/twY+4/hpiBEyOz0cBqN+BxWCpk09/I0Ote0nnARayAK7SHMzDdNXHK+cqV8tmhP0EUPnm+aaFfKQfAC7H5hEcNayZVkhUHGUBT+SW+UFyytIzT63OJbSE0pwPzqDaOlhWaUCMAIZmUFshHbIVc/YaRwTkoU8lF/1ouFyAsxyPNrjtfVlTranevJj2J7fddzpKm4x9OU1IjY0xrerrqI+WhLd/9X7tRTa+ql/yC60hSVC1/bJiFFvgIjUcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org 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=wuiEdftCCb5GGJkxnNH4L0uhS/yjDJbyX+vbFvef+Cw=; b=WMiFWJiBtZyORFY8u9yaGD8ury1VgxcGoSM0aZ6jPN+gJzs1qsOd/FyWbBwwrnZhnEFttwz75Oz+Aphb2JffT0Nzve0bn5rnSwXrCq1+bQBdHxxX9OgFNUyp2gk0wu/JYeYt8X4khqK2zSMUbuHCK9bF3qMm/Cn3/KUr2O8uLOU= 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=SATLEXMB03.amd.com; pr=C From: Ayan Kumar Halder To: CC: Ayan Kumar Halder , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" Subject: [PATCH v1 4/4] xen/arm: mpu: Disable secondary cpu bringup Date: Fri, 23 Aug 2024 17:31:27 +0100 Message-ID: <20240823163127.3443404-5-ayan.kumar.halder@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240823163127.3443404-1-ayan.kumar.halder@amd.com> References: <20240823163127.3443404-1-ayan.kumar.halder@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: ayan.kumar.halder@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37D:EE_|IA0PR12MB8896:EE_ X-MS-Office365-Filtering-Correlation-Id: 68002031-1f55-4867-dcb0-08dcc3911b96 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: FZ5/pK0Hc63yveCg6QXKSUl4Owa+dq/mxDh4sXoEGNYv8ZumJpfq9Ho2fCbBikHgKK9CZf6ymqGRDbxX9WenvAT4W7eGel0oBmdTyuLiNrC+C2Q064knUDmiQGvzb3GqoZ0/LBblXPJI5AsA+30mQTB7Xay5wbkeSMiFsfKEeRcmFyDbSsM10MtcVgK4UVAWR1p5Y8s+22IWFObUGTXPSr74BOxhdSlglG4cFLEcg/DHI+kUW78QfLDk+BWdz3+vsJn7VpQ7kuDc9/bDbCyflHUKqAOMXYrihwYxsBLJDsCGckg7nhycA/Rv4Zc1gtaV9kRlzqKF/ARfM5NM4Tx4OcLRLFKf2yperL38X3qYMy2rrZRhVfzjzgIv91b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Y6Io969zJY6cGo8b65ioF5zr X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2024 16:31:57.9220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68002031-1f55-4867-dcb0-08dcc3911b96 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8896 Secondary cpus are put in WFE state. We do not support SMP at this time. Signed-off-by: Ayan Kumar Halder --- xen/arch/arm/arm64/mpu/head.S | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S index 2b023c346a..1579ac0408 100644 --- a/xen/arch/arm/arm64/mpu/head.S +++ b/xen/arch/arm/arm64/mpu/head.S @@ -68,3 +68,12 @@ ENTRY(enable_boot_cpu_mm) ret ENDPROC(enable_boot_cpu_mm) + +/* + * Secondary cpu has not yet been supported on MPU systems. We will block the + * secondary cpu bringup at this stage. + */ +ENTRY(enable_secondary_cpu_mm) +1: wfe + b 1b +ENDPROC(enable_secondary_cpu_mm)