@@ -3,6 +3,7 @@ config PPC
select FUNCTION_ALIGNMENT_4B
select HAS_DEVICE_TREE
select HAS_VMAP
+ select HAS_PTE_ATTR_T
config PPC64
def_bool y
@@ -8,4 +8,6 @@ typedef unsigned long vaddr_t;
#define INVALID_PADDR (~0UL)
#define PRIpaddr "016lx"
+typedef unsigned long pte_attr_t;
+
#endif /* _ASM_PPC_TYPES_H */
@@ -265,7 +265,7 @@ int destroy_xen_mappings(unsigned long s, unsigned long e)
int map_pages_to_xen(unsigned long virt,
mfn_t mfn,
unsigned long nr_mfns,
- unsigned int flags)
+ pte_attr_t flags)
{
BUG_ON("unimplemented");
}
@@ -80,6 +80,9 @@ config HAS_PIRQ
config HAS_PMAP
bool
+config HAS_PTE_ATTR_T
+ bool
+
config HAS_SCHED_GRANULARITY
bool
@@ -1656,7 +1656,7 @@ void __init efi_init_memory(void)
struct rt_extra {
struct rt_extra *next;
unsigned long smfn, emfn;
- unsigned int prot;
+ pte_attr_t prot;
} *extra, *extra_head = NULL;
free_ebmalloc_unused_mem();
@@ -1671,7 +1671,7 @@ void __init efi_init_memory(void)
EFI_MEMORY_DESCRIPTOR *desc = efi_memmap + i;
u64 len = desc->NumberOfPages << EFI_PAGE_SHIFT;
unsigned long smfn, emfn;
- unsigned int prot = PAGE_HYPERVISOR_RWX;
+ pte_attr_t prot = PAGE_HYPERVISOR_RWX;
paddr_t mem_base;
unsigned long mem_npages;
@@ -222,7 +222,7 @@ static void vm_free(const void *va)
}
void *__vmap(const mfn_t *mfn, unsigned int granularity,
- unsigned int nr, unsigned int align, unsigned int flags,
+ unsigned int nr, unsigned int align, pte_attr_t flags,
enum vmap_region type)
{
void *va = vm_alloc(nr * granularity, align, type);
@@ -70,6 +70,10 @@
#include <xen/perfc.h>
#include <public/memory.h>
+#ifndef CONFIG_HAS_PTE_ATTR_T
+typedef unsigned int pte_attr_t;
+#endif
+
struct page_info;
extern bool using_static_heap;
@@ -113,9 +117,9 @@ int map_pages_to_xen(
unsigned long virt,
mfn_t mfn,
unsigned long nr_mfns,
- unsigned int flags);
+ pte_attr_t flags);
/* Alter the permissions of a range of Xen virtual address space. */
-int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf);
+int modify_xen_mappings(unsigned long s, unsigned long e, pte_attr_t nf);
void modify_xen_mappings_lite(unsigned long s, unsigned long e,
unsigned int nf);
int destroy_xen_mappings(unsigned long s, unsigned long e);
@@ -8,6 +8,7 @@
#ifndef __XEN_VMAP_H__
#define __XEN_VMAP_H__
+#include <xen/mm.h>
#include <xen/mm-frame.h>
#include <xen/page-size.h>
@@ -57,7 +58,7 @@ void vm_init_type(enum vmap_region type, void *start, void *end);
* @return Pointer to the mapped area on success; NULL otherwise.
*/
void *__vmap(const mfn_t *mfn, unsigned int granularity, unsigned int nr,
- unsigned int align, unsigned int flags, enum vmap_region type);
+ unsigned int align, pte_attr_t flags, enum vmap_region type);
/*
* Map an array of pages contiguously into the VMAP_DEFAULT vmap region
Xen's memory management APIs map_pages_to_xen, modify_xen_mappings, set_fixmap, ioremap_attr, and __vmap all use an unsigned int to represent architecture-dependent page table entry flags. This assumption does not work on PPC/radix where some flags go past 32-bits, so introduce the pte_attr_t type to allow architectures to opt in to larger types to store PTE flags. Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com> Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com> --- xen/arch/ppc/Kconfig | 1 + xen/arch/ppc/include/asm/types.h | 2 ++ xen/arch/ppc/mm-radix.c | 2 +- xen/common/Kconfig | 3 +++ xen/common/efi/boot.c | 4 ++-- xen/common/vmap.c | 2 +- xen/include/xen/mm.h | 8 ++++++-- xen/include/xen/vmap.h | 3 ++- 8 files changed, 18 insertions(+), 7 deletions(-)