Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1236143
| From | Julien Grall <julien.grall@citrix.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v5 20/22] arm/xen: Add support for 64KB page granularity |
| Date | 2015-09-30 13:00 +0200 |
| Message-ID | <qenh7-2Ko-3@gated-at.bofh.it> (permalink) |
| References | <qen7r-2yO-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The hypercall interface is always using 4KB page granularity. This is
requiring to use xen page definition macro when we deal with hypercall.
Note that pfn_to_gfn is working with a Xen pfn (i.e 4KB). We may want to
rename pfn_gfn to make this explicit.
We also allocate a 64KB page for the shared page even though only the
first 4KB is used. I don't think this is really important for now as it
helps to have the pointer 4KB aligned (XENMEM_add_to_physmap is taking a
Xen PFN).
Signed-off-by: Julien Grall <julien.grall@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Stefano, I've dropped your reviewed-by given I've updated the doc and do
changes to avoid usage of XEN_PAGE_SHIFT
Changes in v4:
- Add Stefano's Reviewed-by
Changes in v3:
- s/MFN/GFN/ base on the new naming
- Use virt_to_gfn to avoid use XEN_PAGE_SHIFT
- Drop Stefano's reviewed-by
- Add some docs in arch/arm/asm/xen/page.h
Changes in v2
- Add Stefano's reviewed-by
---
arch/arm/include/asm/xen/page.h | 15 +++++++++++++--
arch/arm/xen/enlighten.c | 6 +++---
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
index 98c9fc3..e3d94cf 100644
--- a/arch/arm/include/asm/xen/page.h
+++ b/arch/arm/include/asm/xen/page.h
@@ -28,6 +28,17 @@ typedef struct xpaddr {
#define INVALID_P2M_ENTRY (~0UL)
+/*
+ * The pseudo-physical frame (pfn) used in all the helpers is always based
+ * on Xen page granularity (i.e 4KB).
+ *
+ * A Linux page may be split across multiple non-contiguous Xen page so we
+ * have to keep track with frame based on 4KB page granularity.
+ *
+ * PV drivers should never make a direct usage of those helpers (particularly
+ * pfn_to_gfn and gfn_to_pfn).
+ */
+
unsigned long __pfn_to_mfn(unsigned long pfn);
extern struct rb_root phys_to_mach;
@@ -64,8 +75,8 @@ static inline unsigned long bfn_to_pfn(unsigned long bfn)
#define bfn_to_local_pfn(bfn) bfn_to_pfn(bfn)
/* VIRT <-> GUEST conversion */
-#define virt_to_gfn(v) (pfn_to_gfn(virt_to_pfn(v)))
-#define gfn_to_virt(m) (__va(gfn_to_pfn(m) << PAGE_SHIFT))
+#define virt_to_gfn(v) (pfn_to_gfn(virt_to_phys(v) >> XEN_PAGE_SHIFT))
+#define gfn_to_virt(m) (__va(gfn_to_pfn(m) << XEN_PAGE_SHIFT))
/* Only used in PV code. But ARM guests are always HVM. */
static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr)
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index eeeab07..50b4769 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -89,8 +89,8 @@ static void xen_percpu_init(void)
pr_info("Xen: initializing cpu%d\n", cpu);
vcpup = per_cpu_ptr(xen_vcpu_info, cpu);
- info.mfn = __pa(vcpup) >> PAGE_SHIFT;
- info.offset = offset_in_page(vcpup);
+ info.mfn = virt_to_gfn(vcpup);
+ info.offset = xen_offset_in_page(vcpup);
err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, cpu, &info);
BUG_ON(err);
@@ -213,7 +213,7 @@ static int __init xen_guest_init(void)
xatp.domid = DOMID_SELF;
xatp.idx = 0;
xatp.space = XENMAPSPACE_shared_info;
- xatp.gpfn = __pa(shared_info_page) >> PAGE_SHIFT;
+ xatp.gpfn = virt_to_gfn(shared_info_page);
if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
BUG();
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5 00/22] xen/arm64: Add support for 64KB page in Linux Julien Grall <julien.grall@citrix.com> - 2015-09-30 12:50 +0200
[PATCH v5 02/22] arm/xen: Drop pte_mfn and mfn_pte Julien Grall <julien.grall@citrix.com> - 2015-09-30 12:50 +0200
[PATCH v5 07/22] block/xen-blkfront: Store a page rather a pfn in the grant structure Julien Grall <julien.grall@citrix.com> - 2015-09-30 12:50 +0200
[PATCH v5 09/22] xen/biomerge: Don't allow biovec's to be merged when Linux is not using 4KB pages Julien Grall <julien.grall@citrix.com> - 2015-09-30 12:50 +0200
[PATCH v5 20/22] arm/xen: Add support for 64KB page granularity Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 10/22] xen/xenbus: Use Xen page definition Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 16/22] block/xen-blkback: Make it running on 64KB page granularity Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 11/22] tty/hvc: xen: Use xen page definition Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 22/22] xen/swiotlb: Add support for 64KB page granularity Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 19/22] xen/privcmd: Add support for Linux 64KB page granularity Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 17/22] net/xen-netfront: Make it running on 64KB page granularity Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 14/22] xen/grant-table: Make it running on 64KB granularity Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 12/22] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
Re: [PATCH v5 12/22] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux David Vrabel <david.vrabel@citrix.com> - 2015-10-02 16:10 +0200
Re: [PATCH v5 12/22] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux Julien Grall <julien.grall@citrix.com> - 2015-10-02 16:40 +0200
Re: [PATCH v5 12/22] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux Julien Grall <julien.grall@citrix.com> - 2015-10-02 17:00 +0200
Re: [PATCH v5 12/22] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2015-10-02 17:20 +0200
Re: [Xen-devel] [PATCH v5 12/22] xen/balloon: Don't rely on the page granularity is the same for Xen and Linux David Vrabel <david.vrabel@citrix.com> - 2015-10-02 17:20 +0200
[PATCH v5 15/22] block/xen-blkfront: Make it running on 64KB page granularity Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 13/22] xen/events: fifo: Make it running on 64KB granularity Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 21/22] xen/swiotlb: Pass addresses rather than frame numbers to xen_arch_need_swiotlb Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
[PATCH v5 18/22] net/xen-netback: Make it running on 64KB page granularity Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:00 +0200
Re: [PATCH v5 00/22] xen/arm64: Add support for 64KB page in Linux Mark Rutland <mark.rutland@arm.com> - 2015-09-30 13:40 +0200
Re: [PATCH v5 00/22] xen/arm64: Add support for 64KB page in Linux Julien Grall <julien.grall@citrix.com> - 2015-09-30 13:50 +0200
Re: [PATCH v5 00/22] xen/arm64: Add support for 64KB page in Linux Mark Rutland <mark.rutland@arm.com> - 2015-09-30 15:10 +0200
Re: [Xen-devel] [PATCH v5 00/22] xen/arm64: Add support for 64KB page in Linux David Vrabel <david.vrabel@citrix.com> - 2015-10-01 17:20 +0200
csiph-web