All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
To: <xen-devel@lists.xenproject.org>
Cc: Ayan Kumar Halder <ayan.kumar.halder@amd.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	Michal Orzel <michal.orzel@amd.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: [PATCH v4 6/6] xen/arm: mpu: Implement a dummy enable_secondary_cpu_mm
Date: Mon, 28 Oct 2024 12:45:47 +0000	[thread overview]
Message-ID: <20241028124547.1371867-7-ayan.kumar.halder@amd.com> (raw)
In-Reply-To: <20241028124547.1371867-1-ayan.kumar.halder@amd.com>

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@amd.com>
---
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



  parent reply	other threads:[~2024-10-28 12:46 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-28 12:45 [PATCH v4 0/6] Enable early bootup of AArch64 MPU systems Ayan Kumar Halder
2024-10-28 12:45 ` [PATCH v4 1/6] xen/arm: Skip initializing the BSS section when it is empty Ayan Kumar Halder
2024-10-28 14:45   ` Luca Fancellu
2024-11-01 13:55   ` Julien Grall
2024-10-28 12:45 ` [PATCH v4 2/6] xen/arm: mpu: Introduce choice between MMU and MPU Ayan Kumar Halder
2024-10-29  9:53   ` Andrew Cooper
2024-10-29 16:49     ` oleksii.kurochko
2024-10-28 12:45 ` [PATCH v4 3/6] xen/arm: mpu: Define Xen start address for MPU systems Ayan Kumar Halder
2024-10-28 14:53   ` Luca Fancellu
2024-11-01 13:57   ` Julien Grall
2024-10-28 12:45 ` [PATCH v4 4/6] xen/arm: mpu: Create boot-time MPU protection regions Ayan Kumar Halder
2024-10-28 15:14   ` Luca Fancellu
2024-10-28 15:37     ` Luca Fancellu
2024-10-29 16:20     ` Ayan Kumar Halder
2024-10-29 16:25   ` Luca Fancellu
2024-10-30  9:16   ` Luca Fancellu
2024-10-30  9:52     ` Julien Grall
2024-10-30 10:08       ` Luca Fancellu
2024-10-30 10:32         ` Julien Grall
2024-10-30 10:51           ` Luca Fancellu
2024-10-31 16:16             ` Ayan Kumar Halder
2024-11-01 14:11   ` Julien Grall
2024-11-01 17:08     ` Ayan Kumar Halder
2024-11-01 17:11       ` Ayan Kumar Halder
2024-10-28 12:45 ` [PATCH v4 5/6] xen/arm: mpu: Enable MPU Ayan Kumar Halder
2024-10-28 15:39   ` Luca Fancellu
2024-11-01 14:19   ` Julien Grall
2024-10-28 12:45 ` Ayan Kumar Halder [this message]
2024-10-28 12:55   ` [PATCH v4 6/6] xen/arm: mpu: Implement a dummy enable_secondary_cpu_mm Jan Beulich
2024-10-28 14:39     ` Ayan Kumar Halder
2024-10-28 15:01       ` Jan Beulich
2024-10-28 17:38         ` Ayan Kumar Halder
2024-10-29  8:08           ` Jan Beulich
2024-10-29  9:30             ` Luca Fancellu
2024-10-29  9:41               ` Jan Beulich
2024-10-29  9:58                 ` Luca Fancellu
2024-11-01 14:22 ` [PATCH v4 0/6] Enable early bootup of AArch64 MPU systems Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241028124547.1371867-7-ayan.kumar.halder@amd.com \
    --to=ayan.kumar.halder@amd.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.