On Mon, May 14, 2012 at 4:05 PM, Marc Zyngier <marc.zyngier at arm.com> wrote: > The KVM hypervisor mmu code requires requires access to the > mem_type prot_pte field when setting up page tables pointing > to a device. Unfortunately, the mem_type structure is opaque. > > Add an accessor (get_mem_type_prot_pte()) to retrieve the > prot_pte value. > > Signed-off-by: Marc Zyngier <marc.zyngier at arm.com> > --- > ?arch/arm/include/asm/mach/map.h | ? ?1 + > ?arch/arm/mm/mmu.c ? ? ? ? ? ? ? | ? ?6 ++++++ > ?2 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h > index b36f365..9de40a7 100644 > --- a/arch/arm/include/asm/mach/map.h > +++ b/arch/arm/include/asm/mach/map.h > @@ -36,6 +36,7 @@ extern void iotable_init(struct map_desc *, int); > > ?struct mem_type; > ?extern const struct mem_type *get_mem_type(unsigned int type); > +extern pteval_t get_mem_type_prot_pte(unsigned int type); > ?/* > ?* external interface to remap single page with appropriate type > ?*/ > diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c > index 825a8a2..26b3cda 100644 > --- a/arch/arm/mm/mmu.c > +++ b/arch/arm/mm/mmu.c > @@ -298,6 +298,12 @@ const struct mem_type *get_mem_type(unsigned int type) > ?} > ?EXPORT_SYMBOL(get_mem_type); > > +pteval_t get_mem_type_prot_pte(unsigned int type) > +{ > + ? ? ? return get_mem_type(type)->prot_pte; > +} > +EXPORT_SYMBOL(get_mem_type_prot_pte); > + > ?/* > ?* Adjust the PMD section entries according to the CPU in use. > ?*/ > -- fine with me, I'll include it as a preparatory independent patch before the KVM series. -Christoffer