From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: stefano.stabellini@citrix.com,
Julien Grall <julien.grall@linaro.org>,
tim@xen.org, ian.campbell@citrix.com,
Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v8 2/4] xen: iommu: Define PAGE_{SHIFT, SIZE, ALIGN, MASK)_64K
Date: Mon, 19 May 2014 17:23:58 +0100 [thread overview]
Message-ID: <1400516640-7175-3-git-send-email-julien.grall@linaro.org> (raw)
In-Reply-To: <1400516640-7175-1-git-send-email-julien.grall@linaro.org>
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>
---
Changes in v7:
- Drop pointless parentheses
Changes in v6:
- Patch added
---
xen/include/xen/iommu.h | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 2ec7834..8eb764a 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -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);
--
1.7.10.4
next prev parent reply other threads:[~2014-05-19 16:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-19 16:23 [PATCH v8 0/4] IOMMU support for ARM Julien Grall
2014-05-19 16:23 ` [PATCH v8 1/4] xen/arm: p2m: Clean cache PT when the IOMMU doesn't support coherent walk Julien Grall
2014-05-19 16:23 ` Julien Grall [this message]
2014-05-19 16:23 ` [PATCH v8 3/4] drivers/passthrough: arm: Add support for SMMU drivers Julien Grall
2014-05-19 16:24 ` [PATCH v8 4/4] xen/arm: grant: Add another entry to map MFN 1:1 in dom0 p2m Julien Grall
2014-05-20 7:46 ` Jan Beulich
2014-05-20 9:21 ` Ian Campbell
2014-05-20 10:48 ` Julien Grall
2014-05-21 13:27 ` Ian Campbell
2014-05-21 13:42 ` Julien Grall
2014-05-21 13:50 ` Ian Campbell
2014-05-21 14:01 ` Julien Grall
2014-05-21 14:40 ` Ian Campbell
2014-05-21 13:51 ` Ian Campbell
2014-05-21 13:54 ` Julien Grall
2014-05-21 14:04 ` Ian Campbell
2014-05-21 13:27 ` [PATCH v8 0/4] IOMMU support for ARM Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400516640-7175-3-git-send-email-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=jbeulich@suse.com \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).