Message ID | 20230801034419.2047541-3-Henry.Wang@arm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | xen/arm: Split MMU code as the prepration of MPU work | expand |
Hi Henry, On 01/08/2023 04:44, Henry Wang 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. > > > There are two types of memory system architectures available for > Arm-based systems, namely the Virtual Memory System Architecture (VMSA) > and the Protected Memory System Architecture (PMSA). According to > ARM DDI 0487G.a, A VMSA provides a Memory Management Unit (MMU) that > controls address translation, access permissions, and memory attribute > determination and checking, for memory accesses made by the PE. And > refer to ARM DDI 0600A.c, the PMSA supports a unified memory protection > scheme where an Memory Protection Unit (MPU) manages instruction and > data access. Currently, Xen only suuports VMSA. > > As a preparation of the Xen MPU (PMSA) support. Introduce a Kconfig > choice under the "Architecture Features" menu for user to choose the > memory system architecture for the system. Since currently only VMSA > is supported, only add the bool CONFIG_HAS_MMU to keep consistent with > the default behavior. User can choose either VMSA or PMSA but not both > in the future after PMSA/MPU is supported in Xen. > > Suggested-by: Julien Grall <jgrall@amazon.com> > Signed-off-by: Henry Wang <Henry.Wang@arm.com> The patch looks good, but it does not cleanly apply b4 mbox 20230801034419.2047541-3-Henry.Wang@arm.com git am ./20230801034419.2047541-3-Henry.Wang@arm.com.mbx Applying: xen/arm: Introduce 'choice' for memory system architecture error: xen/arch/arm/Kconfig: does not match index Patch failed at 0001 xen/arm: Introduce 'choice' for memory system architecture - Ayan > --- > v4: > - Completely rework "[v3,06/52] xen/arm: introduce CONFIG_HAS_MMU" > --- > xen/arch/arm/Kconfig | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig > index fd57a82dd2..0e38e9ba17 100644 > --- a/xen/arch/arm/Kconfig > +++ b/xen/arch/arm/Kconfig > @@ -59,6 +59,20 @@ config PADDR_BITS > default 40 if ARM_PA_BITS_40 > default 48 if ARM_64 > > +choice > + prompt "Memory system architecture" > + default HAS_MMU > + help > + User can choose the memory system architecture. > + A Virtual Memory System Architecture (VMSA) provides a Memory Management > + Unit (MMU) that controls address translation, access permissions, and > + memory attribute determination and checking, for memory accesses made by > + the PE. > + > +config HAS_MMU > + bool "MMU for a VMSA system" > +endchoice > + > source "arch/Kconfig" > > config ACPI > -- > 2.25.1 > >
Hi Ayan, > On Aug 7, 2023, at 21:17, Ayan Kumar Halder <ayankuma@amd.com> wrote: > > Hi Henry, > > On 01/08/2023 04:44, Henry Wang 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. >> >> >> There are two types of memory system architectures available for >> Arm-based systems, namely the Virtual Memory System Architecture (VMSA) >> and the Protected Memory System Architecture (PMSA). According to >> ARM DDI 0487G.a, A VMSA provides a Memory Management Unit (MMU) that >> controls address translation, access permissions, and memory attribute >> determination and checking, for memory accesses made by the PE. And >> refer to ARM DDI 0600A.c, the PMSA supports a unified memory protection >> scheme where an Memory Protection Unit (MPU) manages instruction and >> data access. Currently, Xen only suuports VMSA. >> >> As a preparation of the Xen MPU (PMSA) support. Introduce a Kconfig >> choice under the "Architecture Features" menu for user to choose the >> memory system architecture for the system. Since currently only VMSA >> is supported, only add the bool CONFIG_HAS_MMU to keep consistent with >> the default behavior. User can choose either VMSA or PMSA but not both >> in the future after PMSA/MPU is supported in Xen. >> >> Suggested-by: Julien Grall <jgrall@amazon.com> >> Signed-off-by: Henry Wang <Henry.Wang@arm.com> > > The patch looks good, but it does not cleanly apply > > b4 mbox 20230801034419.2047541-3-Henry.Wang@arm.com > > git am ./20230801034419.2047541-3-Henry.Wang@arm.com.mbx > > Applying: xen/arm: Introduce 'choice' for memory system architecture > error: xen/arch/arm/Kconfig: does not match index > Patch failed at 0001 xen/arm: Introduce 'choice' for memory system architecture This is weird, so I tried to apply this patch (by clicking the mbox button on the top right of [1]) on top of 65f0d6fc80 x86: Drop opt_pku entirely and below is what I have: $ git am ~/v4-02-13-xen-arm-Introduce-choice-for-memory-system-architecture.patch Applying: xen/arm: Introduce 'choice' for memory system architecture I suspect recently there is some Kconfig changes, so could you please clarify your base commit? Thanks! [1] https://patchwork.kernel.org/project/xen-devel/patch/20230801034419.2047541-3-Henry.Wang@arm.com/ Kind regards, Henry > > - Ayan
Hi Henry, On 01/08/2023 04:44, Henry Wang wrote: > There are two types of memory system architectures available for > Arm-based systems, namely the Virtual Memory System Architecture (VMSA) > and the Protected Memory System Architecture (PMSA). According to > ARM DDI 0487G.a, A VMSA provides a Memory Management Unit (MMU) that > controls address translation, access permissions, and memory attribute > determination and checking, for memory accesses made by the PE. And > refer to ARM DDI 0600A.c, the PMSA supports a unified memory protection > scheme where an Memory Protection Unit (MPU) manages instruction and > data access. Currently, Xen only suuports VMSA. > > As a preparation of the Xen MPU (PMSA) support. Introduce a Kconfig > choice under the "Architecture Features" menu for user to choose the > memory system architecture for the system. Since currently only VMSA > is supported, only add the bool CONFIG_HAS_MMU to keep consistent with > the default behavior. User can choose either VMSA or PMSA but not both > in the future after PMSA/MPU is supported in Xen. So in the long run I agree that we will want to have a choice. But this seems to be a bit premature to introduce it now as the user can't select the MPU and also can't deselect MMU. Therefore, I think it would be best if we introduce an unselectable config for now. Like: HAS_MMU def_bool y This could be turned to a choice once you introduce the MPU. Also, from my understanding, we are using the prefix HAS_ to indicate if an architecture support the given feature. In your case, you will want the user to select it, so I would just name the config MMU. Cheers,
Hi Julien, > On Aug 9, 2023, at 20:04, Julien Grall <julien@xen.org> wrote: > > Hi Henry, > > On 01/08/2023 04:44, Henry Wang wrote: >> There are two types of memory system architectures available for >> Arm-based systems, namely the Virtual Memory System Architecture (VMSA) >> and the Protected Memory System Architecture (PMSA). According to >> ARM DDI 0487G.a, A VMSA provides a Memory Management Unit (MMU) that >> controls address translation, access permissions, and memory attribute >> determination and checking, for memory accesses made by the PE. And >> refer to ARM DDI 0600A.c, the PMSA supports a unified memory protection >> scheme where an Memory Protection Unit (MPU) manages instruction and >> data access. Currently, Xen only suuports VMSA. >> As a preparation of the Xen MPU (PMSA) support. Introduce a Kconfig >> choice under the "Architecture Features" menu for user to choose the >> memory system architecture for the system. Since currently only VMSA >> is supported, only add the bool CONFIG_HAS_MMU to keep consistent with >> the default behavior. User can choose either VMSA or PMSA but not both >> in the future after PMSA/MPU is supported in Xen. > > So in the long run I agree that we will want to have a choice. But this seems to be a bit premature to introduce it now as the user can't select the MPU and also can't deselect MMU. > > Therefore, I think it would be best if we introduce an unselectable config for now. Like: > > HAS_MMU > def_bool y > > This could be turned to a choice once you introduce the MPU. > > Also, from my understanding, we are using the prefix HAS_ to indicate if an architecture support the given feature. In your case, you will want the user to select it, so I would just name the config MMU. Make sense, I will just introduce a MMU def_bool y in this patch and turn this to a choice between CONFIG_MMU and CONFIG_MPU in the last patch of the full MPU series where MPU is expected to be functional. Kind regards, Henry > > Cheers, > > -- > Julien Grall
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index fd57a82dd2..0e38e9ba17 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -59,6 +59,20 @@ config PADDR_BITS default 40 if ARM_PA_BITS_40 default 48 if ARM_64 +choice + prompt "Memory system architecture" + default HAS_MMU + help + User can choose the memory system architecture. + A Virtual Memory System Architecture (VMSA) provides a Memory Management + Unit (MMU) that controls address translation, access permissions, and + memory attribute determination and checking, for memory accesses made by + the PE. + +config HAS_MMU + bool "MMU for a VMSA system" +endchoice + source "arch/Kconfig" config ACPI
There are two types of memory system architectures available for Arm-based systems, namely the Virtual Memory System Architecture (VMSA) and the Protected Memory System Architecture (PMSA). According to ARM DDI 0487G.a, A VMSA provides a Memory Management Unit (MMU) that controls address translation, access permissions, and memory attribute determination and checking, for memory accesses made by the PE. And refer to ARM DDI 0600A.c, the PMSA supports a unified memory protection scheme where an Memory Protection Unit (MPU) manages instruction and data access. Currently, Xen only suuports VMSA. As a preparation of the Xen MPU (PMSA) support. Introduce a Kconfig choice under the "Architecture Features" menu for user to choose the memory system architecture for the system. Since currently only VMSA is supported, only add the bool CONFIG_HAS_MMU to keep consistent with the default behavior. User can choose either VMSA or PMSA but not both in the future after PMSA/MPU is supported in Xen. Suggested-by: Julien Grall <jgrall@amazon.com> Signed-off-by: Henry Wang <Henry.Wang@arm.com> --- v4: - Completely rework "[v3,06/52] xen/arm: introduce CONFIG_HAS_MMU" --- xen/arch/arm/Kconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+)