diff options
Diffstat (limited to 'xen/include/asm-arm/p2m.h')
-rw-r--r-- | xen/include/asm-arm/p2m.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/asm-arm/p2m.h new file mode 100644 index 0000000000..aec52f77a4 --- /dev/null +++ b/xen/include/asm-arm/p2m.h @@ -0,0 +1,88 @@ +#ifndef _XEN_P2M_H +#define _XEN_P2M_H + +#include <xen/mm.h> + +struct domain; + +/* Per-p2m-table state */ +struct p2m_domain { + /* Lock that protects updates to the p2m */ + spinlock_t lock; + + /* Pages used to construct the p2m */ + struct page_list_head pages; + + /* Root of p2m page tables, 2 contiguous pages */ + struct page_info *first_level; + + /* Current VMID in use */ + uint8_t vmid; +}; + +/* Init the datastructures for later use by the p2m code */ +int p2m_init(struct domain *d); + +/* Allocate a new p2m table for a domain. + * + * Returns 0 for success or -errno. + */ +int p2m_alloc_table(struct domain *d); + +/* */ +void p2m_load_VTTBR(struct domain *d); + +/* Setup p2m RAM mapping for domain d from start-end. */ +int p2m_populate_ram(struct domain *d, paddr_t start, paddr_t end); +/* Map MMIO regions in the p2m: start_gaddr and end_gaddr is the range + * in the guest physical address space to map, starting from the machine + * address maddr. */ +int map_mmio_regions(struct domain *d, paddr_t start_gaddr, + paddr_t end_gaddr, paddr_t maddr); + +unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn); + +/* + * Populate-on-demand + */ + +/* Call when decreasing memory reservation to handle PoD entries properly. + * Will return '1' if all entries were handled and nothing more need be done.*/ +int +p2m_pod_decrease_reservation(struct domain *d, + xen_pfn_t gpfn, + unsigned int order); + +/* Compatibility function exporting the old untyped interface */ +static inline unsigned long get_gfn_untyped(struct domain *d, unsigned long gpfn) +{ + return gmfn_to_mfn(d, gpfn); +} + +int get_page_type(struct page_info *page, unsigned long type); +int is_iomem_page(unsigned long mfn); +static inline int get_page_and_type(struct page_info *page, + struct domain *domain, + unsigned long type) +{ + int rc = get_page(page, domain); + + if ( likely(rc) && unlikely(!get_page_type(page, type)) ) + { + put_page(page); + rc = 0; + } + + return rc; +} + +#endif /* _XEN_P2M_H */ + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ |