[PATCH v1 1/4] xen/arm: mpu: Introduce choice between MMU and MPU

Ayan Kumar Halder posted 4 patches 3 months, 1 week ago
[PATCH v1 1/4] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Ayan Kumar Halder 3 months, 1 week 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.
All the current platforms are now made dependent on MMU.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
---
 xen/arch/arm/Kconfig           | 17 ++++++++++++++++-
 xen/arch/arm/platforms/Kconfig |  2 +-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 323c967361..686948cefd 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 if ARM
+	help
+	  User can choose between the different forms of memory management system.
+	  Most of the Arm based systems support MMU.
+
 config MMU
-	def_bool y
+	bool "MMU"
 	select HAS_PMAP
 	select HAS_VMAP
+	help
+	  Memory management unit is supported on most Arm based systems.
+
+config MPU
+	bool "MPU"
+	help
+	  Memory protection unit is supported on some Cortex-R systems.
+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 v1 1/4] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Julien Grall 3 months, 1 week ago
Hi,

On 23/08/2024 17:31, 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.
> All the current platforms are now made dependent on MMU.
> 
> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
> ---
>   xen/arch/arm/Kconfig           | 17 ++++++++++++++++-
>   xen/arch/arm/platforms/Kconfig |  2 +-
>   2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index 323c967361..686948cefd 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 if ARM
> +	help
> +	  User can choose between the different forms of memory management system.
> +	  Most of the Arm based systems support MMU.

I feel this is quite subjective. So I would drop it.

> +
>   config MMU
> -	def_bool y
> +	bool "MMU"
>   	select HAS_PMAP
>   	select HAS_VMAP
> +	help
> +	  Memory management unit is supported on most Arm based systems.

For this case, I would write "Select it you are plan to run Xen on 
Armv7-A or Armv8-A".


> +
> +config MPU
> +	bool "MPU"

I think it should be gated by UNSUPPORTED. SUPPORT.md also needs to be 
updated.

> +	help
> +	  Memory protection unit is supported on some Cortex-R systems.

Why do you make this specific to Cortex-R? Shouldn't this instead be 
Armv8-R?

> +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 v1 1/4] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Ayan Kumar Halder 3 months, 1 week ago
On 27/08/2024 11:37, Julien Grall wrote:
> Hi,
Hi Julien,
>
> On 23/08/2024 17:31, 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.
>> All the current platforms are now made dependent on MMU.
>>
>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
>> ---
>>   xen/arch/arm/Kconfig           | 17 ++++++++++++++++-
>>   xen/arch/arm/platforms/Kconfig |  2 +-
>>   2 files changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
>> index 323c967361..686948cefd 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 if ARM
>> +    help
>> +      User can choose between the different forms of memory 
>> management system.
>> +      Most of the Arm based systems support MMU.
>
> I feel this is quite subjective. So I would drop it.
Agreed.
>
>> +
>>   config MMU
>> -    def_bool y
>> +    bool "MMU"
>>       select HAS_PMAP
>>       select HAS_VMAP
>> +    help
>> +      Memory management unit is supported on most Arm based systems.
>
> For this case, I would write "Select it you are plan to run Xen on 
> Armv7-A or Armv8-A".
Ack.
>
>
>> +
>> +config MPU
>> +    bool "MPU"
>
> I think it should be gated by UNSUPPORTED. SUPPORT.md also needs to be 
> updated.
Ack.
>
>> +    help
>> +      Memory protection unit is supported on some Cortex-R systems.
>
> Why do you make this specific to Cortex-R? Shouldn't this instead be 
> Armv8-R?

Yes, you are correct. It should be Armv8-R. Otherwise, someone might 
think it is applicable for Cortex-R5, R7, etc.

- Ayan


Re: [PATCH v1 1/4] xen/arm: mpu: Introduce choice between MMU and MPU
Posted by Julien Grall 3 months, 1 week ago
Hi,

On 28/08/2024 15:44, Ayan Kumar Halder wrote:
> 
> On 27/08/2024 11:37, Julien Grall wrote:
>> Hi,
> Hi Julien,
>>
>> On 23/08/2024 17:31, 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.
>>> All the current platforms are now made dependent on MMU.
>>>
>>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
>>> ---
>>>   xen/arch/arm/Kconfig           | 17 ++++++++++++++++-
>>>   xen/arch/arm/platforms/Kconfig |  2 +-
>>>   2 files changed, 17 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
>>> index 323c967361..686948cefd 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 if ARM
>>> +    help
>>> +      User can choose between the different forms of memory 
>>> management system.
>>> +      Most of the Arm based systems support MMU.
>>
>> I feel this is quite subjective. So I would drop it.
> Agreed.
>>
>>> +
>>>   config MMU
>>> -    def_bool y
>>> +    bool "MMU"
>>>       select HAS_PMAP
>>>       select HAS_VMAP
>>> +    help
>>> +      Memory management unit is supported on most Arm based systems.
>>
>> For this case, I would write "Select it you are plan to run Xen on 
>> Armv7-A or Armv8-A".
> Ack.

Actually, thinking a bit more. We should be able to run Xen on Armv9. So 
maybe it would be beter to write:

"Select it if you plan to run Xen on A-profile Armv7+".

Cheers,

-- 
Julien Grall