2012-08-09 00:33:46 +08:00
|
|
|
#ifndef _ASM_ARM_XEN_PAGE_H
|
|
|
|
#define _ASM_ARM_XEN_PAGE_H
|
|
|
|
|
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/pgtable.h>
|
|
|
|
|
|
|
|
#include <linux/pfn.h>
|
|
|
|
#include <linux/types.h>
|
2013-10-10 21:40:44 +08:00
|
|
|
#include <linux/dma-mapping.h>
|
2012-08-09 00:33:46 +08:00
|
|
|
|
2013-10-18 00:22:27 +08:00
|
|
|
#include <xen/xen.h>
|
2012-08-09 00:33:46 +08:00
|
|
|
#include <xen/interface/grant_table.h>
|
|
|
|
|
2012-10-17 16:39:17 +08:00
|
|
|
#define phys_to_machine_mapping_valid(pfn) (1)
|
2012-08-09 00:33:46 +08:00
|
|
|
#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
|
|
|
|
|
|
|
|
#define pte_mfn pte_pfn
|
|
|
|
#define mfn_pte pfn_pte
|
|
|
|
|
|
|
|
/* Xen machine address */
|
|
|
|
typedef struct xmaddr {
|
|
|
|
phys_addr_t maddr;
|
|
|
|
} xmaddr_t;
|
|
|
|
|
|
|
|
/* Xen pseudo-physical address */
|
|
|
|
typedef struct xpaddr {
|
|
|
|
phys_addr_t paddr;
|
|
|
|
} xpaddr_t;
|
|
|
|
|
|
|
|
#define XMADDR(x) ((xmaddr_t) { .maddr = (x) })
|
|
|
|
#define XPADDR(x) ((xpaddr_t) { .paddr = (x) })
|
|
|
|
|
2012-10-17 16:39:17 +08:00
|
|
|
#define INVALID_P2M_ENTRY (~0UL)
|
|
|
|
|
2013-10-18 00:22:27 +08:00
|
|
|
unsigned long __pfn_to_mfn(unsigned long pfn);
|
|
|
|
extern struct rb_root phys_to_mach;
|
|
|
|
|
|
|
|
static inline unsigned long pfn_to_mfn(unsigned long pfn)
|
|
|
|
{
|
|
|
|
unsigned long mfn;
|
2013-11-09 04:36:09 +08:00
|
|
|
|
2013-10-18 00:22:27 +08:00
|
|
|
if (phys_to_mach.rb_node != NULL) {
|
|
|
|
mfn = __pfn_to_mfn(pfn);
|
|
|
|
if (mfn != INVALID_P2M_ENTRY)
|
|
|
|
return mfn;
|
|
|
|
}
|
|
|
|
|
2013-11-11 20:50:30 +08:00
|
|
|
return pfn;
|
2013-10-18 00:22:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned long mfn_to_pfn(unsigned long mfn)
|
|
|
|
{
|
2013-11-11 20:50:30 +08:00
|
|
|
return mfn;
|
2013-10-18 00:22:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#define mfn_to_local_pfn(mfn) mfn_to_pfn(mfn)
|
|
|
|
|
2012-08-09 00:33:46 +08:00
|
|
|
static inline xmaddr_t phys_to_machine(xpaddr_t phys)
|
|
|
|
{
|
|
|
|
unsigned offset = phys.paddr & ~PAGE_MASK;
|
|
|
|
return XMADDR(PFN_PHYS(pfn_to_mfn(PFN_DOWN(phys.paddr))) | offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline xpaddr_t machine_to_phys(xmaddr_t machine)
|
|
|
|
{
|
|
|
|
unsigned offset = machine.maddr & ~PAGE_MASK;
|
|
|
|
return XPADDR(PFN_PHYS(mfn_to_pfn(PFN_DOWN(machine.maddr))) | offset);
|
|
|
|
}
|
|
|
|
/* VIRT <-> MACHINE conversion */
|
|
|
|
#define virt_to_machine(v) (phys_to_machine(XPADDR(__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))
|
|
|
|
|
|
|
|
static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr)
|
|
|
|
{
|
|
|
|
/* TODO: assuming it is mapped in the kernel 1:1 */
|
|
|
|
return virt_to_machine(vaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: this shouldn't be here but it is because the frontend drivers
|
|
|
|
* are using it (its rolled in headers) even though we won't hit the code path.
|
|
|
|
* So for right now just punt with this.
|
|
|
|
*/
|
|
|
|
static inline pte_t *lookup_address(unsigned long address, unsigned int *level)
|
|
|
|
{
|
|
|
|
BUG();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-02-27 23:55:30 +08:00
|
|
|
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);
|
2012-08-09 00:33:46 +08:00
|
|
|
|
2014-02-27 23:55:30 +08:00
|
|
|
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);
|
2012-08-09 00:33:46 +08:00
|
|
|
|
2013-10-18 00:22:27 +08:00
|
|
|
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);
|
2012-10-17 16:39:17 +08:00
|
|
|
|
2012-08-09 00:33:46 +08:00
|
|
|
static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn)
|
|
|
|
{
|
2012-10-17 16:39:17 +08:00
|
|
|
return __set_phys_to_machine(pfn, mfn);
|
2012-08-09 00:33:46 +08:00
|
|
|
}
|
2013-02-19 21:59:19 +08:00
|
|
|
|
Features:
- FIFO event channels. Key advantages: support for over 100,000 events (2^17),
16 different event priorities, improved fairness in event latency through
the use of FIFOs.
- Xen PVH support. "It’s a fully PV kernel mode, running with paravirtualized
disk and network, paravirtualized interrupts and timers, no emulated devices
of any kind (and thus no qemu), no BIOS or legacy boot — but instead of
requiring PV MMU, it uses the HVM hardware extensions to virtualize the
pagetables, as well as system calls and other privileged operations."
(from "The Paravirtualization Spectrum, Part 2: From poles to a spectrum")
Bug-fixes:
- Fixes in balloon driver (refactor and make it work under ARM)
- Allow xenfb to be used in HVM guests.
- Allow xen_platform_pci=0 to work properly.
- Refactors in event channels.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAABAgAGBQJS4BmLAAoJEFjIrFwIi8fJ4SAH/iNGESowgMhfW64vRA8pBWq+
NRJpUjYjjwmbxpwoNl6NPwn15cIXFyc3sMtvvrDD3taRDyko2RFuT+NTjpO05xPh
d/cRpRXpXERHoiFgPf/WTp7ONBDhvPtHG0+BzJKwgqEIOUYXdbhD+gEjaVlFJScS
CAY68OLmk7XYMSZBNzPfKNbSCyhVgZF7wpaimK9lxZBKsFRCDIq6jIyrAsC8epIL
6V/V4l2S6lk/uUeGB6ULphYeINjI2kkpbSfCd1vyenLfWpVscc2o8uWEYFcZMAxy
V4HpsoseuqrfdDqgPfud3VgogdISvbkCvDfW85rzfDP4MWxei2mVHFtJ/gSBV+g=
=ToNG
-----END PGP SIGNATURE-----
Merge tag 'stable/for-linus-3.14-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull Xen updates from Konrad Rzeszutek Wilk:
"Two major features that Xen community is excited about:
The first is event channel scalability by David Vrabel - we switch
over from an two-level per-cpu bitmap of events (IRQs) - to an FIFO
queue with priorities. This lets us be able to handle more events,
have lower latency, and better scalability. Good stuff.
The other is PVH by Mukesh Rathor. In short, PV is a mode where the
kernel lets the hypervisor program page-tables, segments, etc. With
EPT/NPT capabilities in current processors, the overhead of doing this
in an HVM (Hardware Virtual Machine) container is much lower than the
hypervisor doing it for us.
In short we let a PV guest run without doing page-table, segment,
syscall, etc updates through the hypervisor - instead it is all done
within the guest container. It is a "hybrid" PV - hence the 'PVH'
name - a PV guest within an HVM container.
The major benefits are less code to deal with - for example we only
use one function from the the pv_mmu_ops (which has 39 function
calls); faster performance for syscall (no context switches into the
hypervisor); less traps on various operations; etc.
It is still being baked - the ABI is not yet set in stone. But it is
pretty awesome and we are excited about it.
Lastly, there are some changes to ARM code - you should get a simple
conflict which has been resolved in #linux-next.
In short, this pull has awesome features.
Features:
- FIFO event channels. Key advantages: support for over 100,000
events (2^17), 16 different event priorities, improved fairness in
event latency through the use of FIFOs.
- Xen PVH support. "It’s a fully PV kernel mode, running with
paravirtualized disk and network, paravirtualized interrupts and
timers, no emulated devices of any kind (and thus no qemu), no BIOS
or legacy boot — but instead of requiring PV MMU, it uses the HVM
hardware extensions to virtualize the pagetables, as well as system
calls and other privileged operations." (from "The
Paravirtualization Spectrum, Part 2: From poles to a spectrum")
Bug-fixes:
- Fixes in balloon driver (refactor and make it work under ARM)
- Allow xenfb to be used in HVM guests.
- Allow xen_platform_pci=0 to work properly.
- Refactors in event channels"
* tag 'stable/for-linus-3.14-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: (52 commits)
xen/pvh: Set X86_CR0_WP and others in CR0 (v2)
MAINTAINERS: add git repository for Xen
xen/pvh: Use 'depend' instead of 'select'.
xen: delete new instances of __cpuinit usage
xen/fb: allow xenfb initialization for hvm guests
xen/evtchn_fifo: fix error return code in evtchn_fifo_setup()
xen-platform: fix error return code in platform_pci_init()
xen/pvh: remove duplicated include from enlighten.c
xen/pvh: Fix compile issues with xen_pvh_domain()
xen: Use dev_is_pci() to check whether it is pci device
xen/grant-table: Force to use v1 of grants.
xen/pvh: Support ParaVirtualized Hardware extensions (v3).
xen/pvh: Piggyback on PVHVM XenBus.
xen/pvh: Piggyback on PVHVM for grant driver (v4)
xen/grant: Implement an grant frame array struct (v3).
xen/grant-table: Refactor gnttab_init
xen/grants: Remove gnttab_max_grant_frames dependency on gnttab_init.
xen/pvh: Piggyback on PVHVM for event channels (v2)
xen/pvh: Update E820 to work with PVH (v2)
xen/pvh: Secondary VCPU bringup (non-bootup CPUs)
...
2014-01-23 14:00:18 +08:00
|
|
|
#define xen_remap(cookie, size) ioremap_cache((cookie), (size))
|
2014-01-06 23:40:36 +08:00
|
|
|
#define xen_unmap(cookie) iounmap((cookie))
|
2013-02-19 21:59:19 +08:00
|
|
|
|
2014-11-21 19:07:39 +08:00
|
|
|
bool xen_arch_need_swiotlb(struct device *dev,
|
|
|
|
unsigned long pfn,
|
|
|
|
unsigned long mfn);
|
|
|
|
|
2012-08-09 00:33:46 +08:00
|
|
|
#endif /* _ASM_ARM_XEN_PAGE_H */
|