diff options
Diffstat (limited to 'arch/arm/include/asm/xen')
| -rw-r--r-- | arch/arm/include/asm/xen/hypercall.h | 16 | ||||
| -rw-r--r-- | arch/arm/include/asm/xen/hypervisor.h | 2 | ||||
| -rw-r--r-- | arch/arm/include/asm/xen/interface.h | 2 | ||||
| -rw-r--r-- | arch/arm/include/asm/xen/page-coherent.h | 50 | ||||
| -rw-r--r-- | arch/arm/include/asm/xen/page.h | 63 | 
5 files changed, 110 insertions, 23 deletions
diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h index 7704e28c348..712b50e0a6d 100644 --- a/arch/arm/include/asm/xen/hypercall.h +++ b/arch/arm/include/asm/xen/hypercall.h @@ -34,6 +34,7 @@  #define _ASM_ARM_XEN_HYPERCALL_H  #include <xen/interface/xen.h> +#include <xen/interface/sched.h>  long privcmd_call(unsigned call, unsigned long a1,  		unsigned long a2, unsigned long a3, @@ -48,6 +49,16 @@ int HYPERVISOR_memory_op(unsigned int cmd, void *arg);  int HYPERVISOR_physdev_op(int cmd, void *arg);  int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);  int HYPERVISOR_tmem_op(void *arg); +int HYPERVISOR_multicall(struct multicall_entry *calls, uint32_t nr); + +static inline int +HYPERVISOR_suspend(unsigned long start_info_mfn) +{ +	struct sched_shutdown r = { .reason = SHUTDOWN_suspend }; + +	/* start_info_mfn is unused on ARM */ +	return HYPERVISOR_sched_op(SCHEDOP_shutdown, &r); +}  static inline void  MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va, @@ -63,9 +74,4 @@ MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,  	BUG();  } -static inline int -HYPERVISOR_multicall(void *call_list, int nr_calls) -{ -	BUG(); -}  #endif /* _ASM_ARM_XEN_HYPERCALL_H */ diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h index d7ab99a0c9e..1317ee40f4d 100644 --- a/arch/arm/include/asm/xen/hypervisor.h +++ b/arch/arm/include/asm/xen/hypervisor.h @@ -16,4 +16,6 @@ static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void)  	return PARAVIRT_LAZY_NONE;  } +extern struct dma_map_ops *xen_dma_ops; +  #endif /* _ASM_ARM_XEN_HYPERVISOR_H */ diff --git a/arch/arm/include/asm/xen/interface.h b/arch/arm/include/asm/xen/interface.h index 1151188bcd8..50066006e6b 100644 --- a/arch/arm/include/asm/xen/interface.h +++ b/arch/arm/include/asm/xen/interface.h @@ -40,6 +40,8 @@ typedef uint64_t xen_pfn_t;  #define PRI_xen_pfn "llx"  typedef uint64_t xen_ulong_t;  #define PRI_xen_ulong "llx" +typedef int64_t xen_long_t; +#define PRI_xen_long "llx"  /* Guest handles for primitive C types. */  __DEFINE_GUEST_HANDLE(uchar, unsigned char);  __DEFINE_GUEST_HANDLE(uint,  unsigned int); diff --git a/arch/arm/include/asm/xen/page-coherent.h b/arch/arm/include/asm/xen/page-coherent.h new file mode 100644 index 00000000000..1109017499e --- /dev/null +++ b/arch/arm/include/asm/xen/page-coherent.h @@ -0,0 +1,50 @@ +#ifndef _ASM_ARM_XEN_PAGE_COHERENT_H +#define _ASM_ARM_XEN_PAGE_COHERENT_H + +#include <asm/page.h> +#include <linux/dma-attrs.h> +#include <linux/dma-mapping.h> + +static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, +		dma_addr_t *dma_handle, gfp_t flags, +		struct dma_attrs *attrs) +{ +	return __generic_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs); +} + +static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, +		void *cpu_addr, dma_addr_t dma_handle, +		struct dma_attrs *attrs) +{ +	__generic_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs); +} + +static inline void xen_dma_map_page(struct device *hwdev, struct page *page, +	     unsigned long offset, size_t size, enum dma_data_direction dir, +	     struct dma_attrs *attrs) +{ +	__generic_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs); +} + +static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, +		size_t size, enum dma_data_direction dir, +		struct dma_attrs *attrs) +{ +	if (__generic_dma_ops(hwdev)->unmap_page) +		__generic_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs); +} + +static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, +		dma_addr_t handle, size_t size, enum dma_data_direction dir) +{ +	if (__generic_dma_ops(hwdev)->sync_single_for_cpu) +		__generic_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir); +} + +static inline void xen_dma_sync_single_for_device(struct device *hwdev, +		dma_addr_t handle, size_t size, enum dma_data_direction dir) +{ +	if (__generic_dma_ops(hwdev)->sync_single_for_device) +		__generic_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir); +} +#endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h index 359a7b50b15..ded062f9b35 100644 --- a/arch/arm/include/asm/xen/page.h +++ b/arch/arm/include/asm/xen/page.h @@ -6,12 +6,12 @@  #include <linux/pfn.h>  #include <linux/types.h> +#include <linux/dma-mapping.h> +#include <xen/xen.h>  #include <xen/interface/grant_table.h> -#define pfn_to_mfn(pfn)			(pfn)  #define phys_to_machine_mapping_valid(pfn) (1) -#define mfn_to_pfn(mfn)			(mfn)  #define mfn_to_virt(m)			(__va(mfn_to_pfn(m) << PAGE_SHIFT))  #define pte_mfn	    pte_pfn @@ -32,6 +32,38 @@ typedef struct xpaddr {  #define INVALID_P2M_ENTRY      (~0UL) +unsigned long __pfn_to_mfn(unsigned long pfn); +unsigned long __mfn_to_pfn(unsigned long mfn); +extern struct rb_root phys_to_mach; + +static inline unsigned long pfn_to_mfn(unsigned long pfn) +{ +	unsigned long mfn; + +	if (phys_to_mach.rb_node != NULL) { +		mfn = __pfn_to_mfn(pfn); +		if (mfn != INVALID_P2M_ENTRY) +			return mfn; +	} + +	return pfn; +} + +static inline unsigned long mfn_to_pfn(unsigned long mfn) +{ +	unsigned long pfn; + +	if (phys_to_mach.rb_node != NULL) { +		pfn = __mfn_to_pfn(mfn); +		if (pfn != INVALID_P2M_ENTRY) +			return pfn; +	} + +	return mfn; +} + +#define mfn_to_local_pfn(mfn) mfn_to_pfn(mfn) +  static inline xmaddr_t phys_to_machine(xpaddr_t phys)  {  	unsigned offset = phys.paddr & ~PAGE_MASK; @@ -45,7 +77,6 @@ static inline xpaddr_t machine_to_phys(xmaddr_t machine)  }  /* VIRT <-> MACHINE conversion */  #define virt_to_machine(v)	(phys_to_machine(XPADDR(__pa(v)))) -#define virt_to_pfn(v)          (PFN_DOWN(__pa(v)))  #define virt_to_mfn(v)		(pfn_to_mfn(virt_to_pfn(v)))  #define mfn_to_virt(m)		(__va(mfn_to_pfn(m) << PAGE_SHIFT)) @@ -65,28 +96,24 @@ static inline pte_t *lookup_address(unsigned long address, unsigned int *level)  	return NULL;  } -static inline int m2p_add_override(unsigned long mfn, struct page *page, -		struct gnttab_map_grant_ref *kmap_op) -{ -	return 0; -} +extern int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, +				   struct gnttab_map_grant_ref *kmap_ops, +				   struct page **pages, unsigned int count); -static inline int m2p_remove_override(struct page *page, bool clear_pte) -{ -	return 0; -} +extern int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops, +				     struct gnttab_map_grant_ref *kmap_ops, +				     struct page **pages, unsigned int count); -static inline bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) -{ -	BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY); -	return true; -} +bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn); +bool __set_phys_to_machine_multi(unsigned long pfn, unsigned long mfn, +		unsigned long nr_pages);  static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)  {  	return __set_phys_to_machine(pfn, mfn);  } -#define xen_remap(cookie, size) ioremap_cached((cookie), (size)); +#define xen_remap(cookie, size) ioremap_cache((cookie), (size)) +#define xen_unmap(cookie) iounmap((cookie))  #endif /* _ASM_ARM_XEN_PAGE_H */  | 
