Message ID | 20180716172712.20294-8-julien.grall@arm.com |
---|---|
State | New |
Headers | show |
Series | xen/arm: Bunch of clean-up/improvement | expand |
On Mon, 16 Jul 2018, Julien Grall wrote: > Currently, lpae_table can only work on entry from any level other than > 3. Make it work with any level by extending the prototype to pass the > level. > > At the same time, rename the function to lpae_is_mapping so naming stay > consistent accross all lpae_* helpers. > > Signed-off-by: Julien Grall <julien.grall@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > xen/arch/arm/mm.c | 2 +- > xen/include/asm-arm/lpae.h | 9 ++------- > 2 files changed, 3 insertions(+), 8 deletions(-) > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index d234c46e41..b7f2dabd05 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -996,7 +996,7 @@ static int create_xen_entries(enum xenmap_operation op, > for(; addr < addr_end; addr += PAGE_SIZE, mfn = mfn_add(mfn, 1)) > { > entry = &xen_second[second_linear_offset(addr)]; > - if ( !lpae_table(*entry) ) > + if ( !lpae_is_table(*entry, 2) ) > { > rc = create_xen_table(entry); > if ( rc < 0 ) { > diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h > index 4cf188ff82..c803569c2d 100644 > --- a/xen/include/asm-arm/lpae.h > +++ b/xen/include/asm-arm/lpae.h > @@ -133,14 +133,9 @@ static inline bool lpae_valid(lpae_t pte) > return pte.walk.valid; > } > > -/* > - * This one can only be used on L0..L2 ptes because L3 mappings set > - * the table bit and therefore these would return the opposite to what > - * you would expect. > - */ > -static inline bool lpae_table(lpae_t pte) > +static inline bool lpae_is_table(lpae_t pte, unsigned int level) > { > - return lpae_valid(pte) && pte.walk.table; > + return (level < 3) && lpae_valid(pte) && pte.walk.table; > } > > static inline bool lpae_is_mapping(lpae_t pte, unsigned int level)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index d234c46e41..b7f2dabd05 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -996,7 +996,7 @@ static int create_xen_entries(enum xenmap_operation op, for(; addr < addr_end; addr += PAGE_SIZE, mfn = mfn_add(mfn, 1)) { entry = &xen_second[second_linear_offset(addr)]; - if ( !lpae_table(*entry) ) + if ( !lpae_is_table(*entry, 2) ) { rc = create_xen_table(entry); if ( rc < 0 ) { diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h index 4cf188ff82..c803569c2d 100644 --- a/xen/include/asm-arm/lpae.h +++ b/xen/include/asm-arm/lpae.h @@ -133,14 +133,9 @@ static inline bool lpae_valid(lpae_t pte) return pte.walk.valid; } -/* - * This one can only be used on L0..L2 ptes because L3 mappings set - * the table bit and therefore these would return the opposite to what - * you would expect. - */ -static inline bool lpae_table(lpae_t pte) +static inline bool lpae_is_table(lpae_t pte, unsigned int level) { - return lpae_valid(pte) && pte.walk.table; + return (level < 3) && lpae_valid(pte) && pte.walk.table; } static inline bool lpae_is_mapping(lpae_t pte, unsigned int level)
Currently, lpae_table can only work on entry from any level other than 3. Make it work with any level by extending the prototype to pass the level. At the same time, rename the function to lpae_is_mapping so naming stay consistent accross all lpae_* helpers. Signed-off-by: Julien Grall <julien.grall@arm.com> --- xen/arch/arm/mm.c | 2 +- xen/include/asm-arm/lpae.h | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-)