From patchwork Fri Aug 2 12:14:41 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: 13751505 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 D9633C3DA4A for ; Fri, 2 Aug 2024 12:15:22 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.771054.1181646 (Exim 4.92) (envelope-from ) id 1sZrBg-0003NN-TM; Fri, 02 Aug 2024 12:15:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 771054.1181646; Fri, 02 Aug 2024 12:15:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sZrBg-0003ND-Qj; Fri, 02 Aug 2024 12:15:12 +0000 Received: by outflank-mailman (input) for mailman id 771054; Fri, 02 Aug 2024 12:15:11 +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 1sZrBf-0002qg-7n for xen-devel@lists.xenproject.org; Fri, 02 Aug 2024 12:15:11 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20625.outbound.protection.outlook.com [2a01:111:f403:2412::625]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id dd1c7229-50c8-11ef-bc03-fd08da9f4363; Fri, 02 Aug 2024 14:15:10 +0200 (CEST) Received: from PH7P220CA0072.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::31) by PH0PR12MB7485.namprd12.prod.outlook.com (2603:10b6:510:1e9::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.22; Fri, 2 Aug 2024 12:15:06 +0000 Received: from CY4PEPF0000E9CF.namprd03.prod.outlook.com (2603:10b6:510:32c:cafe::51) by PH7P220CA0072.outlook.office365.com (2603:10b6:510:32c::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.23 via Frontend Transport; Fri, 2 Aug 2024 12:15:03 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000E9CF.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7828.19 via Frontend Transport; Fri, 2 Aug 2024 12:15:02 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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, 2 Aug 2024 07:15:01 -0500 Received: from xcbayankuma40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 2 Aug 2024 07:15:00 -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: dd1c7229-50c8-11ef-bc03-fd08da9f4363 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UKrWA47OVwAZllrifdvyN+cgcSIDqdM1MG5hepUF9ujI2nffKoMNvzW5tVDz3KTpfndkhNj/9ftZ/PK0eKGv5QZREpTAJ54cVuspoyVGZ2/sLHsDnaPxxsLOeWiXijSfmrg3j8+DLr66d0/pxkZ+C+qUzUPnt7TAYRe1PLRmvNdZUtGQFKDi19Ul/ETadMnx9rx7lhOVxW73nroeqFrZInqXOLwfJcg/XXgpwcktGZxTgxwvgtqg10sd2Hpa/bxrJF8ngC83W6EAR2PEUc/Un4/OVyAEwcdy/0umRKmo+tzac0O7QZ6sSd4PwTD3JujrkszC+ydVSVF6v4NkxniG4g== 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=rcvevutIA8wF3Pys0d5aki/QrgNfXYtD6SWLs8zRKls=; b=s5Ci7QnURzu2TDqqaDr1RrFfgjmrZ9xIerqJbMEEBS9OOLA1rN8lw3s4cywh7UnV+sR9lPTUe7J6puKVb7YPa58od76QczKiNcrm5BMqOLcdc5ZbGZu3Nd+vVFFJ+uGOuOn+CzcVBq/gAUhk72kuEzCIHXzgB1rcSoUKUgjsVeo3A27c4rt++ewmFPEX5A903JBZJZ/d7Y6LWqj4QjNmpsPqov5UeYQ7cc1FxRmkYHigT8GYTYcMDQYOI/rMa96onn9flL7YEZou+XsO0aMhBTR5r6delas4vS4ow5wPNjHAZxuYx8zRu1XxyilEvCU+FrD0spZWRLWHtsXzi6i5bw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=rcvevutIA8wF3Pys0d5aki/QrgNfXYtD6SWLs8zRKls=; b=Vyj+iQVOPo/EgVYaK1RF0sf++A6GxKxq+5zhg3p8MWl0JwvdLRzpHFYFR4jd68O3RFc6swodpoDM6KuzpO63LzViKD4aVEQVIRojUzLk+fJDMNj8IKLvzrhyz+ZnBJkwlvpBpQc/qUSc4w/BDwN5GKBsoFXJ+OOYraQBqindlN8= 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: , Penny Zheng , "Wei Chen" Subject: [PATCH v1 2/4] xen: arm: make VMAP only support in MMU system Date: Fri, 2 Aug 2024 13:14:41 +0100 Message-ID: <20240802121443.1531693-3-ayan.kumar.halder@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240802121443.1531693-1-ayan.kumar.halder@amd.com> References: <20240802121443.1531693-1-ayan.kumar.halder@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB03.amd.com: ayan.kumar.halder@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9CF:EE_|PH0PR12MB7485:EE_ X-MS-Office365-Filtering-Correlation-Id: 35ae0cc8-dca4-4418-a24e-08dcb2ecbcd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: GFXWBsM7TeZL3KJ6/PAvM3bzy4UIo8R7A1yMUPyi1MhFPdvxRCO4etI0haQIR4bSLXAUYy1Lc4WGDoVUJfq/A1BNLylRUYFTocYL7jWwqC71BoSK83iYHdS3y8eFuO7J7/YKVIt+OLU8PxKoUhntEmKLVVLi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opK/ufgp+8D28eD6WmFPge2Chcm8VM5aVuRYupggh0NH/Uv+Bpqmo/iShrCOpqLbhB6mtixIBwkFBaS6Zf01fFsQrVi62hWUb+qa9nKCVKDBF+OyURIrYJrXYxmu90SMQTvLYSld5p2xyudb1xxtzFgosx5eUzBxrYRacltFrHrUP3kXy2dHAmDRR14vsfg== 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: 02 Aug 2024 12:15:02.8036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35ae0cc8-dca4-4418-a24e-08dcb2ecbcd5 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: CY4PEPF0000E9CF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7485 From: Penny Zheng VMAP is widely used in ALTERNATIVE feature, CPUERRATA feature, etc to remap a range of memory with new memory attributes. Since this is highly dependent on virtual address translation, we choose to fold VMAP in MMU system. In this patch, we introduce a new Kconfig CONFIG_HAS_VMAP, and make it only support in MMU system on ARM architecture. And we make features like ALTERNATIVE, CPUERRATA, etc, now depend on VMAP. Split "https://patchwork.kernel.org/project/xen-devel/patch/20230626033443.2943270-16-Penny.Zheng@arm.com/" into Arm specific Signed-off-by: Penny Zheng Signed-off-by: Wei Chen Signed-off-by: Ayan Kumar Halder --- xen/arch/arm/Kconfig | 6 +++++- xen/arch/arm/Makefile | 2 +- xen/arch/arm/setup.c | 4 ++++ xen/arch/arm/smpboot.c | 2 ++ xen/include/xen/vmap.h | 6 ++++++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 21d03d9f44..c8d417298c 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -12,7 +12,7 @@ config ARM_64 config ARM def_bool y select FUNCTION_ALIGNMENT_4B - select HAS_ALTERNATIVE + select HAS_ALTERNATIVE if HAS_VMAP select HAS_DEVICE_TREE select HAS_PASSTHROUGH select HAS_UBSAN @@ -58,9 +58,13 @@ config PADDR_BITS default 40 if ARM_PA_BITS_40 default 48 if ARM_64 +config HAS_VMAP + def_bool y + config MMU def_bool y select HAS_PMAP + select HAS_VMAP source "arch/Kconfig" diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 45dc29ea53..6882814d38 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -11,7 +11,7 @@ obj-$(CONFIG_HAS_VPCI) += vpci.o obj-$(CONFIG_HAS_ALTERNATIVE) += alternative.o obj-y += bootfdt.init.o -obj-y += cpuerrata.o +obj-$(CONFIG_HAS_VMAP) += cpuerrata.o obj-y += cpufeature.o obj-y += decode.o obj-y += device.o diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 0c2fdaceaf..9d34ac7f64 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -804,11 +804,13 @@ void asmlinkage __init start_xen(unsigned long boot_phys_offset, nr_cpu_ids = smp_get_max_cpus(); printk(XENLOG_INFO "SMP: Allowing %u CPUs\n", nr_cpu_ids); +#ifdef CONFIG_HAS_VMAP /* * Some errata relies on SMCCC version which is detected by psci_init() * (called from smp_init_cpus()). */ check_local_cpu_errata(); +#endif check_local_cpu_features(); @@ -879,8 +881,10 @@ void asmlinkage __init start_xen(unsigned long boot_phys_offset, * It needs to be called after do_initcalls to be able to use * stop_machine (tasklets initialized via an initcall). */ +#ifdef CONFIG_HAS_VMAP apply_alternatives_all(); enable_errata_workarounds(); +#endif enable_cpu_features(); /* Create initial domain 0. */ diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c index 04e363088d..999afc028e 100644 --- a/xen/arch/arm/smpboot.c +++ b/xen/arch/arm/smpboot.c @@ -406,7 +406,9 @@ void asmlinkage start_secondary(void) local_abort_enable(); +#ifdef CONFIG_HAS_VMAP check_local_cpu_errata(); +#endif check_local_cpu_features(); printk(XENLOG_DEBUG "CPU %u booted.\n", smp_processor_id()); diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h index fdae37e950..84797acfc0 100644 --- a/xen/include/xen/vmap.h +++ b/xen/include/xen/vmap.h @@ -138,10 +138,16 @@ static inline void iounmap(void __iomem *va) /* Pointer to 1 octet past the end of the VMAP_DEFAULT virtual area */ void *arch_vmap_virt_end(void); +#ifdef CONFIG_MMU /* Initialises the VMAP_DEFAULT virtual range */ static inline void vm_init(void) { vm_init_type(VMAP_DEFAULT, (void *)VMAP_VIRT_START, arch_vmap_virt_end()); } +#else +static inline void vm_init(void) +{ +} +#endif #endif /* __XEN_VMAP_H__ */