[PATCH v2 28/34] ARM: mmu32: Add pte_flags_to_pmd()

Sascha Hauer s.hauer at pengutronix.de
Wed May 17 07:44:06 PDT 2023


On Wed, May 17, 2023 at 03:43:51PM +0200, Ahmad Fatoum wrote:
> On 17.05.23 11:03, Sascha Hauer wrote:
> > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > ---
> >  arch/arm/cpu/mmu_32.c | 35 +++++++++++++++++++++++++++++------
> >  1 file changed, 29 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/arm/cpu/mmu_32.c b/arch/arm/cpu/mmu_32.c
> > index 4abaab7d87..0af89ac39c 100644
> > --- a/arch/arm/cpu/mmu_32.c
> > +++ b/arch/arm/cpu/mmu_32.c
> > @@ -187,30 +187,53 @@ static u32 pmd_flags_to_pte(u32 pmd)
> >  	return pte;
> >  }
> >  
> > +static u32 pte_flags_to_pmd(u32 pte)
> > +{
> > +	u32 pmd = 0;
> > +
> > +	if (pte & PTE_BUFFERABLE)
> > +		pmd |= PMD_SECT_BUFFERABLE;
> > +	if (pte & PTE_CACHEABLE)
> > +		pmd |= PMD_SECT_CACHEABLE;
> > +
> > +	if (cpu_architecture() >= CPU_ARCH_ARMv7) {
> > +		if (pte & PTE_EXT_NG)
> > +			pmd |= PMD_SECT_nG;
> > +		if (pte & PTE_EXT_XN)
> > +			pmd |= PMD_SECT_XN;
> 
> Note that at least,  <asm/pgtable.h> claims these bits are v6+:
> 
> #define PTE_EXT_XN		(1 << 0)	/* v6 */
> #define PMD_SECT_nG		(1 << 17)	/* v6 */

Yes, I know. We only seem to use them on ARMv7+ though, so I decided to
honour these flags on ARMv7+ only.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list