]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen: iommu: Define PAGE_{SHIFT, SIZE, ALIGN, MASK)_64K
authorJulien Grall <julien.grall@linaro.org>
Mon, 19 May 2014 16:23:58 +0000 (17:23 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 21 May 2014 12:53:32 +0000 (13:53 +0100)
Also add IOMMU_PAGE_* helper macros to help creating PAGE_* defines.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/include/xen/iommu.h

index 2ec7834eee524dc2c7a5bbce02673fed76764bb2..8eb764a001c2f6ed3e1db824022fd456dc07daee 100644 (file)
@@ -35,10 +35,19 @@ extern bool_t iommu_hap_pt_share;
 extern bool_t iommu_debug;
 extern bool_t amd_iommu_perdev_intremap;
 
+#define IOMMU_PAGE_SIZE(sz) (1UL << PAGE_SHIFT_##sz)
+#define IOMMU_PAGE_MASK(sz) (~(u64)0 << PAGE_SHIFT_##sz)
+#define IOMMU_PAGE_ALIGN(sz, addr)  (((addr) + ~PAGE_MASK_##sz) & PAGE_MASK_##sz)
+
 #define PAGE_SHIFT_4K       (12)
-#define PAGE_SIZE_4K        (1UL << PAGE_SHIFT_4K)
-#define PAGE_MASK_4K        (((u64)-1) << PAGE_SHIFT_4K)
-#define PAGE_ALIGN_4K(addr) (((addr) + PAGE_SIZE_4K - 1) & PAGE_MASK_4K)
+#define PAGE_SIZE_4K        IOMMU_PAGE_SIZE(4K)
+#define PAGE_MASK_4K        IOMMU_PAGE_MASK(4K)
+#define PAGE_ALIGN_4K(addr) IOMMU_PAGE_ALIGN(4K, addr)
+
+#define PAGE_SHIFT_64K          (16)
+#define PAGE_SIZE_64K           IOMMU_PAGE_SIZE(64K)
+#define PAGE_MASK_64K           IOMMU_PAGE_MASK(64K)
+#define PAGE_ALIGN_64K(addr)    IOMMU_PAGE_ALIGN(64K, addr)
 
 int iommu_setup(void);