From: Julien Grall <julien.grall@citrix.com> To: <xen-devel@lists.xenproject.org> Cc: <linux-arm-kernel@lists.infradead.org>, <ian.campbell@citrix.com>, <stefano.stabellini@eu.citrix.com>, <linux-kernel@vger.kernel.org>, "Julien Grall" <julien.grall@citrix.com>, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>, Boris Ostrovsky <boris.ostrovsky@oracle.com>, "David Vrabel" <david.vrabel@citrix.com> Subject: [PATCH v4 03/20] xen: Add Xen specific page definition Date: Mon, 7 Sep 2015 16:33:41 +0100 [thread overview] Message-ID: <1441640038-23615-4-git-send-email-julien.grall@citrix.com> (raw) In-Reply-To: <1441640038-23615-1-git-send-email-julien.grall@citrix.com> The Xen hypercall interface is always using 4K page granularity on ARM and x86 architecture. With the incoming support of 64K page granularity for ARM64 guest, it won't be possible to re-use the Linux page definition in Xen drivers. Introduce Xen page definition helpers based on the Linux page definition. They have exactly the same name but prefixed with XEN_/xen_ prefix. Also modify xen_page_to_gfn to use new Xen page definition. Signed-off-by: Julien Grall <julien.grall@citrix.com> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: David Vrabel <david.vrabel@citrix.com> Changes in v4: - Typoes - Rename xen_page_to_pfn to page_to_xen_pfn Changes in v3: - Fix errors reported by checkpatch.pl - Rename pfn to xen_pfn in xen_pfn_to_page - Add a comment that we assume PAGE_SIZE to be a multiple of XEN_PAGE_SIZE - s/MFN/GFN/ according to new naming - Add Stefano's reviewed-by Changes in v2: - Add XEN_PFN_UP - Add a comment describing the behavior of page_to_pfn --- include/xen/page.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/include/xen/page.h b/include/xen/page.h index 1daae48..96294ac 100644 --- a/include/xen/page.h +++ b/include/xen/page.h @@ -1,11 +1,36 @@ #ifndef _XEN_PAGE_H #define _XEN_PAGE_H +#include <asm/page.h> + +/* The hypercall interface supports only 4KB page */ +#define XEN_PAGE_SHIFT 12 +#define XEN_PAGE_SIZE (_AC(1, UL) << XEN_PAGE_SHIFT) +#define XEN_PAGE_MASK (~(XEN_PAGE_SIZE-1)) +#define xen_offset_in_page(p) ((unsigned long)(p) & ~XEN_PAGE_MASK) + +/* + * We assume that PAGE_SIZE is a multiple of XEN_PAGE_SIZE + * XXX: Add a BUILD_BUG_ON? + */ + +#define xen_pfn_to_page(xen_pfn) \ + ((pfn_to_page(((unsigned long)(xen_pfn) << XEN_PAGE_SHIFT) >> PAGE_SHIFT))) +#define page_to_xen_pfn(page) \ + (((page_to_pfn(page)) << PAGE_SHIFT) >> XEN_PAGE_SHIFT) + +#define XEN_PFN_PER_PAGE (PAGE_SIZE / XEN_PAGE_SIZE) + +#define XEN_PFN_DOWN(x) ((x) >> XEN_PAGE_SHIFT) +#define XEN_PFN_UP(x) (((x) + XEN_PAGE_SIZE-1) >> XEN_PAGE_SHIFT) +#define XEN_PFN_PHYS(x) ((phys_addr_t)(x) << XEN_PAGE_SHIFT) + #include <asm/xen/page.h> +/* Return the GFN associated to the first 4KB of the page */ static inline unsigned long xen_page_to_gfn(struct page *page) { - return pfn_to_gfn(page_to_pfn(page)); + return pfn_to_gfn(page_to_xen_pfn(page)); } struct xen_memory_region { -- 2.1.4
WARNING: multiple messages have this Message-ID (diff)
From: julien.grall@citrix.com (Julien Grall) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 03/20] xen: Add Xen specific page definition Date: Mon, 7 Sep 2015 16:33:41 +0100 [thread overview] Message-ID: <1441640038-23615-4-git-send-email-julien.grall@citrix.com> (raw) In-Reply-To: <1441640038-23615-1-git-send-email-julien.grall@citrix.com> The Xen hypercall interface is always using 4K page granularity on ARM and x86 architecture. With the incoming support of 64K page granularity for ARM64 guest, it won't be possible to re-use the Linux page definition in Xen drivers. Introduce Xen page definition helpers based on the Linux page definition. They have exactly the same name but prefixed with XEN_/xen_ prefix. Also modify xen_page_to_gfn to use new Xen page definition. Signed-off-by: Julien Grall <julien.grall@citrix.com> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> --- Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: David Vrabel <david.vrabel@citrix.com> Changes in v4: - Typoes - Rename xen_page_to_pfn to page_to_xen_pfn Changes in v3: - Fix errors reported by checkpatch.pl - Rename pfn to xen_pfn in xen_pfn_to_page - Add a comment that we assume PAGE_SIZE to be a multiple of XEN_PAGE_SIZE - s/MFN/GFN/ according to new naming - Add Stefano's reviewed-by Changes in v2: - Add XEN_PFN_UP - Add a comment describing the behavior of page_to_pfn --- include/xen/page.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/include/xen/page.h b/include/xen/page.h index 1daae48..96294ac 100644 --- a/include/xen/page.h +++ b/include/xen/page.h @@ -1,11 +1,36 @@ #ifndef _XEN_PAGE_H #define _XEN_PAGE_H +#include <asm/page.h> + +/* The hypercall interface supports only 4KB page */ +#define XEN_PAGE_SHIFT 12 +#define XEN_PAGE_SIZE (_AC(1, UL) << XEN_PAGE_SHIFT) +#define XEN_PAGE_MASK (~(XEN_PAGE_SIZE-1)) +#define xen_offset_in_page(p) ((unsigned long)(p) & ~XEN_PAGE_MASK) + +/* + * We assume that PAGE_SIZE is a multiple of XEN_PAGE_SIZE + * XXX: Add a BUILD_BUG_ON? + */ + +#define xen_pfn_to_page(xen_pfn) \ + ((pfn_to_page(((unsigned long)(xen_pfn) << XEN_PAGE_SHIFT) >> PAGE_SHIFT))) +#define page_to_xen_pfn(page) \ + (((page_to_pfn(page)) << PAGE_SHIFT) >> XEN_PAGE_SHIFT) + +#define XEN_PFN_PER_PAGE (PAGE_SIZE / XEN_PAGE_SIZE) + +#define XEN_PFN_DOWN(x) ((x) >> XEN_PAGE_SHIFT) +#define XEN_PFN_UP(x) (((x) + XEN_PAGE_SIZE-1) >> XEN_PAGE_SHIFT) +#define XEN_PFN_PHYS(x) ((phys_addr_t)(x) << XEN_PAGE_SHIFT) + #include <asm/xen/page.h> +/* Return the GFN associated to the first 4KB of the page */ static inline unsigned long xen_page_to_gfn(struct page *page) { - return pfn_to_gfn(page_to_pfn(page)); + return pfn_to_gfn(page_to_xen_pfn(page)); } struct xen_memory_region { -- 2.1.4
next prev parent reply other threads:[~2015-09-07 15:35 UTC|newest] Thread overview: 143+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-09-07 15:33 [PATCH v4 00/20] xen/arm64: Add support for 64KB page in Linux Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 01/20] net/xen-netback: xenvif_gop_frag_copy: move GSO check out of the loop Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 02/20] arm/xen: Drop pte_mfn and mfn_pte Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall [this message] 2015-09-07 15:33 ` [PATCH v4 03/20] xen: Add Xen specific page definition Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 04/20] xen/grant: Introduce helpers to split a page into grant Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 05/20] xen/grant: Add helper gnttab_page_grant_foreign_access_ref_one Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 06/20] block/xen-blkfront: Split blkif_queue_request in 2 Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 07/20] block/xen-blkfront: Store a page rather a pfn in the grant structure Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 08/20] block/xen-blkfront: split get_grant in 2 Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 09/20] xen/biomerge: Don't allow biovec's to be merged when Linux is not using 4KB pages Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 10/20] xen/xenbus: Use Xen page definition Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 11/20] tty/hvc: xen: Use xen " Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 12/20] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 16:39 ` Stefano Stabellini 2015-09-07 16:39 ` Stefano Stabellini 2015-09-07 16:39 ` Stefano Stabellini 2015-09-07 15:33 ` [PATCH v4 13/20] xen/events: fifo: Make it running on 64KB granularity Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 14/20] xen/grant-table: " Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 15/20] block/xen-blkfront: Make it running on 64KB page granularity Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 16/20] block/xen-blkback: " Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 17/20] net/xen-netfront: " Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 18/20] net/xen-netback: " Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 16:57 ` Wei Liu 2015-09-07 16:57 ` Wei Liu 2015-09-07 16:57 ` Wei Liu 2015-09-08 11:07 ` Julien Grall 2015-09-08 11:07 ` [Xen-devel] " Julien Grall 2015-09-08 11:07 ` Julien Grall 2015-09-08 11:09 ` Wei Liu 2015-09-08 11:09 ` [Xen-devel] " Wei Liu 2015-09-08 11:09 ` Wei Liu 2015-09-07 15:33 ` [PATCH v4 19/20] xen/privcmd: Add support for Linux " Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` [PATCH v4 20/20] arm/xen: Add support for " Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-07 15:33 ` Julien Grall 2015-09-11 19:39 ` [PATCH v4 00/20] xen/arm64: Add support for 64KB page in Linux Julien Grall 2015-09-11 19:39 ` [Xen-devel] " Julien Grall 2015-09-11 19:39 ` Julien Grall 2015-09-14 8:56 ` Roger Pau Monné 2015-09-14 8:56 ` Roger Pau Monné 2015-09-14 10:40 ` Julien Grall 2015-09-14 10:40 ` Julien Grall 2015-09-14 11:04 ` Roger Pau Monné 2015-09-14 11:04 ` Roger Pau Monné 2015-09-14 11:04 ` Roger Pau Monné 2015-09-14 11:21 ` Julien Grall 2015-09-14 11:21 ` Julien Grall 2015-09-14 11:21 ` Julien Grall 2015-09-14 12:08 ` Roger Pau Monné 2015-09-14 12:08 ` Roger Pau Monné 2015-09-14 12:08 ` Roger Pau Monné 2015-09-14 12:47 ` Julien Grall 2015-09-14 12:47 ` Julien Grall 2015-09-14 14:29 ` Roger Pau Monné 2015-09-14 14:29 ` Roger Pau Monné 2015-09-14 14:46 ` Julien Grall 2015-09-14 14:46 ` Julien Grall 2015-09-14 14:46 ` Julien Grall 2015-09-14 14:54 ` Stefano Stabellini 2015-09-14 14:54 ` Stefano Stabellini 2015-09-14 14:54 ` Stefano Stabellini 2015-09-14 15:23 ` Roger Pau Monné 2015-09-14 15:23 ` Roger Pau Monné 2015-09-22 10:59 ` Ian Campbell 2015-09-22 10:59 ` Ian Campbell 2015-10-06 9:28 ` Roger Pau Monné 2015-10-06 9:28 ` Roger Pau Monné 2015-10-06 9:28 ` Roger Pau Monné 2015-10-06 10:17 ` Ian Campbell 2015-10-06 10:17 ` Ian Campbell 2015-10-06 10:17 ` Ian Campbell 2015-10-06 13:55 ` Stefano Stabellini 2015-10-06 13:55 ` Stefano Stabellini 2015-10-06 13:55 ` Stefano Stabellini 2015-09-22 10:59 ` Ian Campbell 2015-09-14 15:23 ` Roger Pau Monné 2015-09-14 14:29 ` Roger Pau Monné 2015-09-14 12:47 ` Julien Grall 2015-09-18 14:10 ` Julien Grall 2015-09-18 14:10 ` Julien Grall 2015-09-18 14:10 ` Julien Grall 2015-09-14 11:32 ` Arnd Bergmann 2015-09-14 11:32 ` Arnd Bergmann 2015-09-15 13:14 ` [Xen-devel] " David Vrabel 2015-09-15 13:14 ` David Vrabel 2015-09-15 13:24 ` Arnd Bergmann 2015-09-15 13:24 ` [Xen-devel] " Arnd Bergmann 2015-09-15 13:24 ` Arnd Bergmann 2015-09-15 13:14 ` David Vrabel 2015-09-14 11:32 ` Arnd Bergmann 2015-09-14 10:40 ` Julien Grall 2015-09-14 8:56 ` Roger Pau Monné 2015-09-29 16:27 ` David Vrabel 2015-09-29 16:27 ` [Xen-devel] " David Vrabel 2015-09-29 16:27 ` David Vrabel 2015-09-29 16:33 ` Julien Grall 2015-09-29 16:33 ` Julien Grall 2015-09-29 16:36 ` David Vrabel 2015-09-29 16:36 ` [Xen-devel] " David Vrabel 2015-09-29 16:36 ` David Vrabel 2015-09-29 16:33 ` Julien Grall
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=1441640038-23615-4-git-send-email-julien.grall@citrix.com \ --to=julien.grall@citrix.com \ --cc=boris.ostrovsky@oracle.com \ --cc=david.vrabel@citrix.com \ --cc=ian.campbell@citrix.com \ --cc=konrad.wilk@oracle.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=stefano.stabellini@eu.citrix.com \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.