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

Re: [PATCH 7/9] arm/mpu: Introduce MPU memory mapping flags


  • To: Luca Fancellu <luca.fancellu@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Tue, 4 Mar 2025 11:55:45 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • 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=eXwtg9EEMj5gxg7k3BpEXUZcWMEIR7L206vfuRPdqnw=; b=YYaKreNQ0SY3+hX3nE7HgGSflZxcodXDWfLUZOHgIk35pvSBucmkiYNcP+1gSLy/JjTk5i1e9k9WChMaT8lteWy6TupGFDdwfYr56C28LB2alPrLM3RX+/X/0k15B+kxCxIuefTQIFi/tV5OySWE3tmEq0UI+mzrxNpkStME9olOgAHa4h9tJaLxz5leNmYq9YS4l/+oyNzs4wHDeoIqzjLYylnGUWUz1mI1xTFwKj09He72gMnJvCuf0kaTeaosyAfUhpjT9Qsi+ZxloTNiY/T7emOxGQIGKoeBEKjuT4QTn6dYs5gHMPJFqabViPrdCRw//rysa6wYXrq/72FY0w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sDBgHsKbtQQwW5sUAL/VDcQYktOO9gjRR17FBw9zu9T732fo6R5cf1arzlV0A8pwM3Nvjo0cg8qi6oR7hMeFwXylyQlGnGI5+6oCudubNAfVCp5bHRYhbqJzLj6MkfQdBVnCtUDOIZlEX1rtY6ApYC70TZkmgCJGAoXXK3HbsSDLo5p4H8VkrHYwcCZOyiWMjZ09EI/IqJCnGbPICWDsny0ddWhHmeMbSClnB/onEkgcEaDDbeuQDo/JxzLRh9K/vZqKPRNohCp6qj1wlwlnRNZh21FMh6z93+5PjvF0e2KUlPuJimg6c1zqPHh328XDI594o+VwW6HkmwbjoCvKig==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Tue, 04 Mar 2025 11:56:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Luca,

On 28/02/2025 16:18, Luca Fancellu wrote:
CAUTION: This message has originated from an External Source. Please use proper 
judgment and caution when opening attachments, clicking links, or responding to 
this email.


Introduce the MPU memory mapping flags in asm/page.h.

Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
---
  xen/arch/arm/include/asm/page.h | 25 +++++++++++++++++++++++++
  1 file changed, 25 insertions(+)

diff --git a/xen/arch/arm/include/asm/page.h b/xen/arch/arm/include/asm/page.h
index 69f817d1e68a..22f7d2c6cb30 100644
--- a/xen/arch/arm/include/asm/page.h
+++ b/xen/arch/arm/include/asm/page.h
@@ -62,6 +62,7 @@

  #define MAIRVAL (MAIR1VAL << 32 | MAIR0VAL)

+#ifdef CONFIG_MMU
  /*
   * Layout of the flags used for updating the hypervisor page tables
   *
@@ -90,6 +91,30 @@
  #define _PAGE_CONTIG_BIT    8
  #define _PAGE_CONTIG        (1U << _PAGE_CONTIG_BIT)

+#else /* !CONFIG_MMU */
+
+/*
+ * Layout of the flags used for updating MPU memory region attributes
+ * [0:2] Memory attribute Index
+ * [3:4] Execute Never
+ * [5:6] Access Permission
+ * [7]   Region Present
+ */
+#define _PAGE_AI_BIT            0
+#define _PAGE_XN_BIT            3
+#define _PAGE_AP_BIT            5
+#define _PAGE_PRESENT_BIT       7
+#define _PAGE_AI                (7U << _PAGE_AI_BIT)
+#define _PAGE_XN                (2U << _PAGE_XN_BIT)
+#define _PAGE_RO                (2U << _PAGE_AP_BIT)
+#define _PAGE_PRESENT           (1U << _PAGE_PRESENT_BIT)
+#define PAGE_AI_MASK(x)         (((x) >> _PAGE_AI_BIT) & 0x7U)
+#define PAGE_XN_MASK(x)         (((x) >> _PAGE_XN_BIT) & 0x3U)
+#define PAGE_AP_MASK(x)         (((x) >> _PAGE_AP_BIT) & 0x3U)
+#define PAGE_RO_MASK(x)         (((x) >> _PAGE_AP_BIT) & 0x2U)

Can you point out to the references (in some Arm doc or somewhere) from where you have picked these values ?

Also, AFAICS you are not using these macros in your current patch serie. So can you send this patch later (along with another patch showing the usage).

- Ayan

+
+#endif /* CONFIG_MMU */
+
  /*
   * _PAGE_DEVICE and _PAGE_NORMAL are convenience defines. They are not
   * meant to be used outside of this header.
--
2.34.1





 


Rackspace

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