[PATCH v3 2/6] xen/arm: mpu: Introduce choice between MMU and MPU

Ayan Kumar Halder posted 6 patches 5 months ago
There is a newer version of this series
[PATCH v3 2/6] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Ayan Kumar Halder 5 months ago
There are features in the forthcoming patches which are dependent on
MPU. For eg fixed start address.
Also, some of the Xen features (eg STATIC_MEMORY) will be selected
by the MPU configuration.

Thus, this patch introduces a choice between MMU and MPU for the type
of memory management system. By default, MMU is selected.
MPU is now gated by UNSUPPORTED.

Update SUPPORT.md to state that the support for MPU is experimental.

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

v1 - 1. Reworded the help messages.
2. Updated Support.md.

v2 - 1. Reworded the help message.

 SUPPORT.md                     |  1 +
 xen/arch/arm/Kconfig           | 17 ++++++++++++++++-
 xen/arch/arm/platforms/Kconfig |  2 +-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 23dd7e6424..3f6d788a43 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -40,6 +40,7 @@ supported in this document.
 
     Status, Xen in AArch64 mode: Supported
     Status, Xen in AArch32 mode: Tech Preview
+    Status, Xen with MPU: Experimental
     Status, Cortex A57 r0p0-r1p1: Supported, not security supported
     Status, Cortex A77 r0p0-r1p0: Supported, not security supported
 
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 323c967361..ed92eb67cb 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -58,10 +58,25 @@ config PADDR_BITS
 	default 40 if ARM_PA_BITS_40
 	default 48 if ARM_64
 
+choice
+	prompt "Memory management system"
+	default MMU
+	help
+	  User can choose between the different forms of memory management system.
+
 config MMU
-	def_bool y
+	bool "MMU"
 	select HAS_PMAP
 	select HAS_VMAP
+	help
+	  Select it if you plan to run Xen on A-profile Armv7+
+
+config MPU
+	bool "MPU" if UNSUPPORTED
+	help
+	  Memory Protection Unit (MPU). Select if you plan to run Xen on ARMv8-R
+	  systems supporting EL2. (UNSUPPORTED)
+endchoice
 
 source "arch/Kconfig"
 
diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
index 76f7e76b1b..02322c259c 100644
--- a/xen/arch/arm/platforms/Kconfig
+++ b/xen/arch/arm/platforms/Kconfig
@@ -1,5 +1,5 @@
 choice
-	prompt "Platform Support"
+	prompt "Platform Support" if MMU
 	default ALL_PLAT
 	help
 	Choose which hardware platform to enable in Xen.
-- 
2.25.1
Re: [PATCH v3 2/6] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Julien Grall 4 months, 3 weeks ago
Hi,

On 10/10/2024 15:03, Ayan Kumar Halder wrote:
> There are features in the forthcoming patches which are dependent on
> MPU. For eg fixed start address.
> Also, some of the Xen features (eg STATIC_MEMORY) will be selected
> by the MPU configuration.
> 
> Thus, this patch introduces a choice between MMU and MPU for the type
> of memory management system. By default, MMU is selected.
> MPU is now gated by UNSUPPORTED.
> 
> Update SUPPORT.md to state that the support for MPU is experimental.
> 
> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>

With one remark below:

Acked-by: Julien Grall <jgrall@amazon.com>

> ---
> Changes from :-
> 
> v1 - 1. Reworded the help messages.
> 2. Updated Support.md.
> 
> v2 - 1. Reworded the help message.
> 
>   SUPPORT.md                     |  1 +
>   xen/arch/arm/Kconfig           | 17 ++++++++++++++++-
>   xen/arch/arm/platforms/Kconfig |  2 +-
>   3 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/SUPPORT.md b/SUPPORT.md
> index 23dd7e6424..3f6d788a43 100644
> --- a/SUPPORT.md
> +++ b/SUPPORT.md
> @@ -40,6 +40,7 @@ supported in this document.
>   
>       Status, Xen in AArch64 mode: Supported
>       Status, Xen in AArch32 mode: Tech Preview
> +    Status, Xen with MPU: Experimental

Maybe mention Armv8-R?

>       Status, Cortex A57 r0p0-r1p1: Supported, not security supported
>       Status, Cortex A77 r0p0-r1p0: Supported, not security supported
>   
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index 323c967361..ed92eb67cb 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -58,10 +58,25 @@ config PADDR_BITS
>   	default 40 if ARM_PA_BITS_40
>   	default 48 if ARM_64
>   
> +choice
> +	prompt "Memory management system"
> +	default MMU
> +	help
> +	  User can choose between the different forms of memory management system.
> +
>   config MMU
> -	def_bool y
> +	bool "MMU"
>   	select HAS_PMAP
>   	select HAS_VMAP
> +	help
> +	  Select it if you plan to run Xen on A-profile Armv7+
> +
> +config MPU
> +	bool "MPU" if UNSUPPORTED
> +	help
> +	  Memory Protection Unit (MPU). Select if you plan to run Xen on ARMv8-R
> +	  systems supporting EL2. (UNSUPPORTED)
> +endchoice
>   
>   source "arch/Kconfig"
>   
> diff --git a/xen/arch/arm/platforms/Kconfig b/xen/arch/arm/platforms/Kconfig
> index 76f7e76b1b..02322c259c 100644
> --- a/xen/arch/arm/platforms/Kconfig
> +++ b/xen/arch/arm/platforms/Kconfig
> @@ -1,5 +1,5 @@
>   choice
> -	prompt "Platform Support"
> +	prompt "Platform Support" if MMU
>   	default ALL_PLAT
>   	help
>   	Choose which hardware platform to enable in Xen.

-- 
Julien Grall
Re: [PATCH v3 2/6] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Ayan Kumar Halder 4 months, 3 weeks ago
On 18/10/2024 15:08, Julien Grall wrote:
> Hi,
Hi,
>
> On 10/10/2024 15:03, Ayan Kumar Halder wrote:
>> There are features in the forthcoming patches which are dependent on
>> MPU. For eg fixed start address.
>> Also, some of the Xen features (eg STATIC_MEMORY) will be selected
>> by the MPU configuration.
>>
>> Thus, this patch introduces a choice between MMU and MPU for the type
>> of memory management system. By default, MMU is selected.
>> MPU is now gated by UNSUPPORTED.
>>
>> Update SUPPORT.md to state that the support for MPU is experimental.
>>
>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
>
> With one remark below:
>
> Acked-by: Julien Grall <jgrall@amazon.com>
Thanks.
>
>> ---
>> Changes from :-
>>
>> v1 - 1. Reworded the help messages.
>> 2. Updated Support.md.
>>
>> v2 - 1. Reworded the help message.
>>
>>   SUPPORT.md                     |  1 +
>>   xen/arch/arm/Kconfig           | 17 ++++++++++++++++-
>>   xen/arch/arm/platforms/Kconfig |  2 +-
>>   3 files changed, 18 insertions(+), 2 deletions(-)
>>
>> diff --git a/SUPPORT.md b/SUPPORT.md
>> index 23dd7e6424..3f6d788a43 100644
>> --- a/SUPPORT.md
>> +++ b/SUPPORT.md
>> @@ -40,6 +40,7 @@ supported in this document.
>>         Status, Xen in AArch64 mode: Supported
>>       Status, Xen in AArch32 mode: Tech Preview
>> +    Status, Xen with MPU: Experimental
>
> Maybe mention Armv8-R?

Yes.

I propose this change be done on commit as well.

And then I can respin the next 4 patches.

- Ayan


Re: [PATCH v3 2/6] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Julien Grall 4 months, 3 weeks ago
Hi Ayan,

On 21/10/2024 12:25, Ayan Kumar Halder wrote:
> 
> On 18/10/2024 15:08, Julien Grall wrote:
>> Hi,
> Hi,
>>
>> On 10/10/2024 15:03, Ayan Kumar Halder wrote:
>>> There are features in the forthcoming patches which are dependent on
>>> MPU. For eg fixed start address.
>>> Also, some of the Xen features (eg STATIC_MEMORY) will be selected
>>> by the MPU configuration.
>>>
>>> Thus, this patch introduces a choice between MMU and MPU for the type
>>> of memory management system. By default, MMU is selected.
>>> MPU is now gated by UNSUPPORTED.
>>>
>>> Update SUPPORT.md to state that the support for MPU is experimental.
>>>
>>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
>>
>> With one remark below:
>>
>> Acked-by: Julien Grall <jgrall@amazon.com>
> Thanks.
>>
>>> ---
>>> Changes from :-
>>>
>>> v1 - 1. Reworded the help messages.
>>> 2. Updated Support.md.
>>>
>>> v2 - 1. Reworded the help message.
>>>
>>>   SUPPORT.md                     |  1 +
>>>   xen/arch/arm/Kconfig           | 17 ++++++++++++++++-
>>>   xen/arch/arm/platforms/Kconfig |  2 +-
>>>   3 files changed, 18 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/SUPPORT.md b/SUPPORT.md
>>> index 23dd7e6424..3f6d788a43 100644
>>> --- a/SUPPORT.md
>>> +++ b/SUPPORT.md
>>> @@ -40,6 +40,7 @@ supported in this document.
>>>         Status, Xen in AArch64 mode: Supported
>>>       Status, Xen in AArch32 mode: Tech Preview
>>> +    Status, Xen with MPU: Experimental
>>
>> Maybe mention Armv8-R?
> 
> Yes.
> 
> I propose this change be done on commit as well.

Unless Stefano wants to do, I would rather not as you are going to send 
a new version of the series. Same applies for patch #1.

Cheers,

-- 
Julien Grall


Re: [PATCH v3 2/6] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Luca Fancellu 4 months, 4 weeks ago
Hi Ayan,

> On 10 Oct 2024, at 15:03, Ayan Kumar Halder <ayan.kumar.halder@amd.com> wrote:
> 
> There are features in the forthcoming patches which are dependent on
> MPU. For eg fixed start address.
> Also, some of the Xen features (eg STATIC_MEMORY) will be selected
> by the MPU configuration.
> 
> Thus, this patch introduces a choice between MMU and MPU for the type
> of memory management system. By default, MMU is selected.
> MPU is now gated by UNSUPPORTED.
> 
> Update SUPPORT.md to state that the support for MPU is experimental.

Maybe I’m wrong, but shouldn’t we add this only when MPU is supported?
In this case we are just having the Kconfig setting.

Apart from that, the rest looks good to me:

Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>



Re: [PATCH v3 2/6] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Julien Grall 4 months, 3 weeks ago

On 14/10/2024 19:43, Luca Fancellu wrote:
> Hi Ayan,
> 
>> On 10 Oct 2024, at 15:03, Ayan Kumar Halder <ayan.kumar.halder@amd.com> wrote:
>>
>> There are features in the forthcoming patches which are dependent on
>> MPU. For eg fixed start address.
>> Also, some of the Xen features (eg STATIC_MEMORY) will be selected
>> by the MPU configuration.
>>
>> Thus, this patch introduces a choice between MMU and MPU for the type
>> of memory management system. By default, MMU is selected.
>> MPU is now gated by UNSUPPORTED.
>>
>> Update SUPPORT.md to state that the support for MPU is experimental.
> 
> Maybe I’m wrong, but shouldn’t we add this only when MPU is supported?

The support of the MPU will happen quite a long way down the line. We 
will first start with experimental (which implies the code may or may 
not work) and I think this is correct to do that now.

Cheers,

-- 
Julien Grall


Re: [PATCH v3 2/6] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Ayan Kumar Halder 4 months, 3 weeks ago
On 14/10/2024 19:43, Luca Fancellu wrote:
> Hi Ayan,
Hi Luca,
>
>> On 10 Oct 2024, at 15:03, Ayan Kumar Halder <ayan.kumar.halder@amd.com> wrote:
>>
>> There are features in the forthcoming patches which are dependent on
>> MPU. For eg fixed start address.
>> Also, some of the Xen features (eg STATIC_MEMORY) will be selected
>> by the MPU configuration.
>>
>> Thus, this patch introduces a choice between MMU and MPU for the type
>> of memory management system. By default, MMU is selected.
>> MPU is now gated by UNSUPPORTED.
>>
>> Update SUPPORT.md to state that the support for MPU is experimental.
> Maybe I’m wrong, but shouldn’t we add this only when MPU is supported?
> In this case we are just having the Kconfig setting.

Actually we need this config option for the subsequent patches. I am 
assuming 'UNSUPPORTED' also means work in progress or partially supported.

- Ayan