Message ID | 20170619165753.25049-14-julien.grall@arm.com |
---|---|
State | Superseded |
Headers | show |
Series | xen/arm: Clean-up memory subsystems | expand |
On Mon, 19 Jun 2017, Julien Grall wrote: > lpae_* helpers can work on any LPAE translation tables. Move them in > lpae.h to allow other part of Xen to use them. > > Signed-off-by: Julien Grall <julien.grall@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > > Cc: proskurin@sec.in.tum.de > > Changes in v2: > - Patch added > --- > xen/arch/arm/p2m.c | 23 ----------------------- > xen/include/asm-arm/lpae.h | 25 +++++++++++++++++++++++++ > 2 files changed, 25 insertions(+), 23 deletions(-) > > diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c > index 1136d837fb..f9145f052f 100644 > --- a/xen/arch/arm/p2m.c > +++ b/xen/arch/arm/p2m.c > @@ -52,29 +52,6 @@ static const paddr_t level_masks[] = > static const uint8_t level_orders[] = > { ZEROETH_ORDER, FIRST_ORDER, SECOND_ORDER, THIRD_ORDER }; > > -static inline bool_t lpae_valid(lpae_t pte) > -{ > - return pte.walk.valid; > -} > -/* > - * These two 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_t lpae_table(lpae_t pte) > -{ > - return lpae_valid(pte) && pte.walk.table; > -} > -static inline bool_t lpae_mapping(lpae_t pte) > -{ > - return lpae_valid(pte) && !pte.walk.table; > -} > - > -static inline bool lpae_is_superpage(lpae_t pte, unsigned int level) > -{ > - return (level < 3) && lpae_mapping(pte); > -} > - > static void p2m_flush_tlb(struct p2m_domain *p2m); > > /* Unlock the flush and do a P2M TLB flush if necessary */ > diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h > index aa85cb8112..6fbf7c606c 100644 > --- a/xen/include/asm-arm/lpae.h > +++ b/xen/include/asm-arm/lpae.h > @@ -126,6 +126,31 @@ typedef union { > lpae_walk_t walk; > } lpae_t; > > +static inline bool_t lpae_valid(lpae_t pte) > +{ > + return pte.walk.valid; > +} > + > +/* > + * These two 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_t lpae_table(lpae_t pte) > +{ > + return lpae_valid(pte) && pte.walk.table; > +} > + > +static inline bool_t lpae_mapping(lpae_t pte) > +{ > + return lpae_valid(pte) && !pte.walk.table; > +} > + > +static inline bool lpae_is_superpage(lpae_t pte, unsigned int level) > +{ > + return (level < 3) && lpae_mapping(pte); > +} > + > #endif /* __ASSEMBLY__ */ > > /* > -- > 2.11.0 >
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 1136d837fb..f9145f052f 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -52,29 +52,6 @@ static const paddr_t level_masks[] = static const uint8_t level_orders[] = { ZEROETH_ORDER, FIRST_ORDER, SECOND_ORDER, THIRD_ORDER }; -static inline bool_t lpae_valid(lpae_t pte) -{ - return pte.walk.valid; -} -/* - * These two 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_t lpae_table(lpae_t pte) -{ - return lpae_valid(pte) && pte.walk.table; -} -static inline bool_t lpae_mapping(lpae_t pte) -{ - return lpae_valid(pte) && !pte.walk.table; -} - -static inline bool lpae_is_superpage(lpae_t pte, unsigned int level) -{ - return (level < 3) && lpae_mapping(pte); -} - static void p2m_flush_tlb(struct p2m_domain *p2m); /* Unlock the flush and do a P2M TLB flush if necessary */ diff --git a/xen/include/asm-arm/lpae.h b/xen/include/asm-arm/lpae.h index aa85cb8112..6fbf7c606c 100644 --- a/xen/include/asm-arm/lpae.h +++ b/xen/include/asm-arm/lpae.h @@ -126,6 +126,31 @@ typedef union { lpae_walk_t walk; } lpae_t; +static inline bool_t lpae_valid(lpae_t pte) +{ + return pte.walk.valid; +} + +/* + * These two 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_t lpae_table(lpae_t pte) +{ + return lpae_valid(pte) && pte.walk.table; +} + +static inline bool_t lpae_mapping(lpae_t pte) +{ + return lpae_valid(pte) && !pte.walk.table; +} + +static inline bool lpae_is_superpage(lpae_t pte, unsigned int level) +{ + return (level < 3) && lpae_mapping(pte); +} + #endif /* __ASSEMBLY__ */ /*
lpae_* helpers can work on any LPAE translation tables. Move them in lpae.h to allow other part of Xen to use them. Signed-off-by: Julien Grall <julien.grall@arm.com> --- Cc: proskurin@sec.in.tum.de Changes in v2: - Patch added --- xen/arch/arm/p2m.c | 23 ----------------------- xen/include/asm-arm/lpae.h | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 23 deletions(-)