[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v4 6/6] xen/arm: mpu: Implement a dummy enable_secondary_cpu_mm


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • Date: Mon, 28 Oct 2024 12:45:47 +0000
  • 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)
  • 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=E4ilOMJ0iLFTChx6I4m08V3KKvqq6Suvoj0IUas/+dk=; b=JYsAo6pMSsfH6oKIT+t8oa6d/CiV9K6hO0R5jgx7Bq17pA70QNunhRsBR80Csn9Hejy1tnTSBglQvlV7dBsSjUXZY9HtTDCbhxwtpCpi+xTfmDxPPS3PBv4mi7vAHCTatkDWc7nDrIKAU8wIJeDR8HnWumwtOcyZXBJmABpu9KdHg6CUqqmUaKAi2TXYIThI+A2qd0I9TkaBNLFg1wzMoh3plOLeds9JpR4i98w6qmzcbtMZqL/gkiyF38O8mPeFDM4o1XfD4RUGBHOKKTZTr1XpZUTTP/aksb7BAViC92QGG82T9lk91ccVM2ZhiBjqPKVvD8lidVbEtfE9M7riPQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=utYT/0/qj3Y5kKAeBTKBkaobdm9di9wZ6AL4r1e98rLqo8jMasPm39+cv0A7gcq72dxJY2HHL+Qs26W0Figbgn3EMhcI3/CqOJX2PBPiBxp4qEat17jTJxmyfsmCDPVkTfN9Ebf/lSgAaZ9CT8D5qNzIFFOPGF1tm41vuoO0inwrxmduGPxbn8Fbyxj8Ry92PvUycwnshopdK3iBT+SJzer+3hiNSS5na+3NwauNQe4CxsDU6rd34bIjFGVmq8jmj+t1QdsrR8LHwK6IZU290jeDa+fcDUfXiBEkuDnH8s636+qDDy+ClP3pn1ZrDv3oFiPQSnCC3+3vklJfhHRJlw==
  • Cc: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Bertrand Marquis" <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 28 Oct 2024 12:46:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Secondary cpus initialization is not yet supported. Thus, we print an
appropriate message and put the secondary cpus in WFE state.
And we introduce to BUILD_BUG_ON to prevent users using from building Xen
on multiprocessor based MPU systems.

In Arm, there is no clean way to disable SMP. As of now, we wish to support
MPU on UNP only. So, we have defined the default range of NR_CPUs to be 1 for
MPU.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
---
Changes from :-

v1 - 1. NR_CPUS is defined as 1 for MPU

2. Added a message in enable_secondary_cpu_mm()

v2 - 1. Added the range

2. Clarified in the commit message why/how we have disabled SMP.

v3 - 1. BUILD_BUG_ON() is moved to smp.c.

 xen/arch/Kconfig              |  2 ++
 xen/arch/arm/arm64/mpu/head.S | 10 ++++++++++
 xen/arch/arm/smp.c            | 11 +++++++++++
 3 files changed, 23 insertions(+)

diff --git a/xen/arch/Kconfig b/xen/arch/Kconfig
index 308ce129a8..aa383577a4 100644
--- a/xen/arch/Kconfig
+++ b/xen/arch/Kconfig
@@ -6,11 +6,13 @@ config PHYS_ADDR_T_32
 
 config NR_CPUS
        int "Maximum number of CPUs"
+       range 1 1 if ARM && MPU
        range 1 16383
        default "256" if X86
        default "8" if ARM && RCAR3
        default "4" if ARM && QEMU
        default "4" if ARM && MPSOC
+       default "1" if ARM && MPU
        default "128" if ARM
        help
          Controls the build-time size of various arrays and bitmaps
diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
index 0edadb009c..5a6aaf47cd 100644
--- a/xen/arch/arm/arm64/mpu/head.S
+++ b/xen/arch/arm/arm64/mpu/head.S
@@ -140,6 +140,16 @@ FUNC(enable_boot_cpu_mm)
     ret
 END(enable_boot_cpu_mm)
 
+/*
+ * We don't yet support secondary CPUs bring-up. Implement a dummy helper to
+ * please the common code.
+ */
+ENTRY(enable_secondary_cpu_mm)
+    PRINT("- SMP not enabled yet -\r\n")
+1:  wfe
+    b 1b
+ENDPROC(enable_secondary_cpu_mm)
+
 /*
  * Local variables:
  * mode: ASM
diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
index c11bba93ad..b372472188 100644
--- a/xen/arch/arm/smp.c
+++ b/xen/arch/arm/smp.c
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
+#include <xen/init.h>
 #include <xen/mm.h>
 #include <asm/system.h>
 #include <asm/smp.h>
@@ -6,6 +7,16 @@
 #include <asm/gic.h>
 #include <asm/flushtlb.h>
 
+static void __init __maybe_unused build_assertions(void)
+{
+#ifdef CONFIG_MPU
+    /*
+     * Currently, SMP is not enabled on MPU based systems.
+     */
+    BUILD_BUG_ON(NR_CPUS > 1);
+#endif
+}
+
 void arch_flush_tlb_mask(const cpumask_t *mask)
 {
     /* No need to IPI other processors on ARM, the processor takes care of it. 
*/
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.