[PATCH v1 1/4] xen: arm: Add an empty stub for update_identity_mapping()

Ayan Kumar Halder posted 4 patches 3 months, 3 weeks ago
There is a newer version of this series
[PATCH v1 1/4] xen: arm: Add an empty stub for update_identity_mapping()
Posted by Ayan Kumar Halder 3 months, 3 weeks ago
This is in continuation to commit
f661a20aa880: "Extract MMU-specific MM code".

update_identity_mapping() is defined for MMU specific logic.
It is invoked from smpboot.c. Thus, we add an empty stub to avoid
if-defery.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
---
 xen/arch/arm/include/asm/arm64/mm.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/arm/include/asm/arm64/mm.h b/xen/arch/arm/include/asm/arm64/mm.h
index e0bd23a6ed..f595205fa3 100644
--- a/xen/arch/arm/include/asm/arm64/mm.h
+++ b/xen/arch/arm/include/asm/arm64/mm.h
@@ -14,6 +14,7 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 
 void arch_setup_page_tables(void);
 
+#ifdef CONFIG_MMU
 /*
  * Enable/disable the identity mapping in the live page-tables (i.e.
  * the one pointed by TTBR_EL2).
@@ -22,6 +23,11 @@ void arch_setup_page_tables(void);
  * supported.
  */
 void update_identity_mapping(bool enable);
+#else /* CONFIG_MMU */
+static inline void update_identity_mapping(bool enable)
+{
+}
+#endif /* CONFIG_MMU */
 
 #endif /* __ARM_ARM64_MM_H__ */
 
-- 
2.25.1
Re: [PATCH v1 1/4] xen: arm: Add an empty stub for update_identity_mapping()
Posted by Julien Grall 3 months, 3 weeks ago
Hi Ayan,

On 02/08/2024 13:14, Ayan Kumar Halder wrote:
> This is in continuation to commit
> f661a20aa880: "Extract MMU-specific MM code".
> 
> update_identity_mapping() is defined for MMU specific logic.
> It is invoked from smpboot.c. Thus, we add an empty stub to avoid
> if-defery.
> 
> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
> ---
>   xen/arch/arm/include/asm/arm64/mm.h | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/xen/arch/arm/include/asm/arm64/mm.h b/xen/arch/arm/include/asm/arm64/mm.h
> index e0bd23a6ed..f595205fa3 100644
> --- a/xen/arch/arm/include/asm/arm64/mm.h
> +++ b/xen/arch/arm/include/asm/arm64/mm.h
> @@ -14,6 +14,7 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
>   
>   void arch_setup_page_tables(void);
>   
> +#ifdef CONFIG_MMU
>   /*
>    * Enable/disable the identity mapping in the live page-tables (i.e.
>    * the one pointed by TTBR_EL2).
> @@ -22,6 +23,11 @@ void arch_setup_page_tables(void);
>    * supported.
>    */
>   void update_identity_mapping(bool enable);
> +#else /* CONFIG_MMU */
> +static inline void update_identity_mapping(bool enable)
> +{
> +}
> +#endif /* CONFIG_MMU */

The name of the function reads a bit odd in the context of the MPU. How 
about providing a new helper called update_boot_mapping()? For MPU, it 
would still be empty (assuming this is the right approach) whereas for 
the MMU it would call update_identity_mapping().

Cheers,

-- 
Julien Grall