forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'stable/for-linus-3.7-arm-tag' of git://git.kernel.org/pub/…
…scm/linux/kernel/git/konrad/xen Pull ADM Xen support from Konrad Rzeszutek Wilk: Features: * Allow a Linux guest to boot as initial domain and as normal guests on Xen on ARM (specifically ARMv7 with virtualized extensions). PV console, block and network frontend/backends are working. Bug-fixes: * Fix compile linux-next fallout. * Fix PVHVM bootup crashing. The Xen-unstable hypervisor (so will be 4.3 in a ~6 months), supports ARMv7 platforms. The goal in implementing this architecture is to exploit the hardware as much as possible. That means use as little as possible of PV operations (so no PV MMU) - and use existing PV drivers for I/Os (network, block, console, etc). This is similar to how PVHVM guests operate in X86 platform nowadays - except that on ARM there is no need for QEMU. The end result is that we share a lot of the generic Xen drivers and infrastructure. Details on how to compile/boot/etc are available at this Wiki: http://wiki.xen.org/wiki/Xen_ARMv7_with_Virtualization_Extensions and this blog has links to a technical discussion/presentations on the overall architecture: http://blog.xen.org/index.php/2012/09/21/xensummit-sessions-new-pvh-virtualisation-mode-for-arm-cortex-a15arm-servers-and-x86/ * tag 'stable/for-linus-3.7-arm-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: (21 commits) xen/xen_initial_domain: check that xen_start_info is initialized xen: mark xen_init_IRQ __init xen/Makefile: fix dom-y build arm: introduce a DTS for Xen unprivileged virtual machines MAINTAINERS: add myself as Xen ARM maintainer xen/arm: compile netback xen/arm: compile blkfront and blkback xen/arm: implement alloc/free_xenballooned_pages with alloc_pages/kfree xen/arm: receive Xen events on ARM xen/arm: initialize grant_table on ARM xen/arm: get privilege status xen/arm: introduce CONFIG_XEN on ARM xen: do not compile manage, balloon, pci, acpi, pcpu and cpu_hotplug on ARM xen/arm: Introduce xen_ulong_t for unsigned long xen/arm: Xen detection and shared_info page mapping docs: Xen ARM DT bindings xen/arm: empty implementation of grant_table arch specific functions xen/arm: sync_bitops xen/arm: page.h definitions xen/arm: hypercalls ...
- Loading branch information
Showing
35 changed files
with
783 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
* Xen hypervisor device tree bindings | ||
|
||
Xen ARM virtual platforms shall have a top-level "hypervisor" node with | ||
the following properties: | ||
|
||
- compatible: | ||
compatible = "xen,xen-<version>", "xen,xen"; | ||
where <version> is the version of the Xen ABI of the platform. | ||
|
||
- reg: specifies the base physical address and size of a region in | ||
memory where the grant table should be mapped to, using an | ||
HYPERVISOR_memory_op hypercall. The memory region is large enough to map | ||
the whole grant table (it is larger or equal to gnttab_max_grant_frames()). | ||
|
||
- interrupts: the interrupt used by Xen to inject event notifications. | ||
A GIC node is also required. | ||
|
||
|
||
Example (assuming #address-cells = <2> and #size-cells = <2>): | ||
|
||
hypervisor { | ||
compatible = "xen,xen-4.3", "xen,xen"; | ||
reg = <0 0xb0000000 0 0x20000>; | ||
interrupts = <1 15 0xf08>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7803,6 +7803,13 @@ F: drivers/xen/ | |
F: arch/x86/include/asm/xen/ | ||
F: include/xen/ | ||
|
||
XEN HYPERVISOR ARM | ||
M: Stefano Stabellini <[email protected]> | ||
L: [email protected] (moderated for non-subscribers) | ||
S: Supported | ||
F: arch/arm/xen/ | ||
F: arch/arm/include/asm/xen/ | ||
|
||
XEN NETWORK BACKEND DRIVER | ||
M: Ian Campbell <[email protected]> | ||
L: [email protected] (moderated for non-subscribers) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Xen Virtual Machine for unprivileged guests | ||
* | ||
* Based on ARM Ltd. Versatile Express CoreTile Express (single CPU) | ||
* Cortex-A15 MPCore (V2P-CA15) | ||
* | ||
*/ | ||
|
||
/dts-v1/; | ||
|
||
/ { | ||
model = "XENVM-4.2"; | ||
compatible = "xen,xenvm-4.2", "xen,xenvm"; | ||
interrupt-parent = <&gic>; | ||
#address-cells = <2>; | ||
#size-cells = <2>; | ||
|
||
chosen { | ||
/* this field is going to be adjusted by the hypervisor */ | ||
bootargs = "console=hvc0 root=/dev/xvda"; | ||
}; | ||
|
||
cpus { | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
cpu@0 { | ||
device_type = "cpu"; | ||
compatible = "arm,cortex-a15"; | ||
reg = <0>; | ||
}; | ||
}; | ||
|
||
memory@80000000 { | ||
device_type = "memory"; | ||
/* this field is going to be adjusted by the hypervisor */ | ||
reg = <0 0x80000000 0 0x08000000>; | ||
}; | ||
|
||
gic: interrupt-controller@2c001000 { | ||
compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; | ||
#interrupt-cells = <3>; | ||
#address-cells = <0>; | ||
interrupt-controller; | ||
reg = <0 0x2c001000 0 0x1000>, | ||
<0 0x2c002000 0 0x100>; | ||
}; | ||
|
||
timer { | ||
compatible = "arm,armv7-timer"; | ||
interrupts = <1 13 0xf08>, | ||
<1 14 0xf08>, | ||
<1 11 0xf08>, | ||
<1 10 0xf08>; | ||
}; | ||
|
||
hypervisor { | ||
compatible = "xen,xen-4.2", "xen,xen"; | ||
/* this field is going to be adjusted by the hypervisor */ | ||
reg = <0 0xb0000000 0 0x20000>; | ||
/* this field is going to be adjusted by the hypervisor */ | ||
interrupts = <1 15 0xf08>; | ||
}; | ||
|
||
motherboard { | ||
arm,v2m-memory-map = "rs1"; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef _ASM_ARM_HYPERVISOR_H | ||
#define _ASM_ARM_HYPERVISOR_H | ||
|
||
#include <asm/xen/hypervisor.h> | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef __ASM_SYNC_BITOPS_H__ | ||
#define __ASM_SYNC_BITOPS_H__ | ||
|
||
#include <asm/bitops.h> | ||
#include <asm/system.h> | ||
|
||
/* sync_bitops functions are equivalent to the SMP implementation of the | ||
* original functions, independently from CONFIG_SMP being defined. | ||
* | ||
* We need them because _set_bit etc are not SMP safe if !CONFIG_SMP. But | ||
* under Xen you might be communicating with a completely external entity | ||
* who might be on another CPU (e.g. two uniprocessor guests communicating | ||
* via event channels and grant tables). So we need a variant of the bit | ||
* ops which are SMP safe even on a UP kernel. | ||
*/ | ||
|
||
#define sync_set_bit(nr, p) _set_bit(nr, p) | ||
#define sync_clear_bit(nr, p) _clear_bit(nr, p) | ||
#define sync_change_bit(nr, p) _change_bit(nr, p) | ||
#define sync_test_and_set_bit(nr, p) _test_and_set_bit(nr, p) | ||
#define sync_test_and_clear_bit(nr, p) _test_and_clear_bit(nr, p) | ||
#define sync_test_and_change_bit(nr, p) _test_and_change_bit(nr, p) | ||
#define sync_test_bit(nr, addr) test_bit(nr, addr) | ||
#define sync_cmpxchg cmpxchg | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#ifndef _ASM_ARM_XEN_EVENTS_H | ||
#define _ASM_ARM_XEN_EVENTS_H | ||
|
||
#include <asm/ptrace.h> | ||
|
||
enum ipi_vector { | ||
XEN_PLACEHOLDER_VECTOR, | ||
|
||
/* Xen IPIs go here */ | ||
XEN_NR_IPIS, | ||
}; | ||
|
||
static inline int xen_irqs_disabled(struct pt_regs *regs) | ||
{ | ||
return raw_irqs_disabled_flags(regs->ARM_cpsr); | ||
} | ||
|
||
#endif /* _ASM_ARM_XEN_EVENTS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/****************************************************************************** | ||
* hypercall.h | ||
* | ||
* Linux-specific hypervisor handling. | ||
* | ||
* Stefano Stabellini <[email protected]>, Citrix, 2012 | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License version 2 | ||
* as published by the Free Software Foundation; or, when distributed | ||
* separately from the Linux kernel or incorporated into other | ||
* software packages, subject to the following license: | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this source file (the "Software"), to deal in the Software without | ||
* restriction, including without limitation the rights to use, copy, modify, | ||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
* and to permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
* IN THE SOFTWARE. | ||
*/ | ||
|
||
#ifndef _ASM_ARM_XEN_HYPERCALL_H | ||
#define _ASM_ARM_XEN_HYPERCALL_H | ||
|
||
#include <xen/interface/xen.h> | ||
|
||
long privcmd_call(unsigned call, unsigned long a1, | ||
unsigned long a2, unsigned long a3, | ||
unsigned long a4, unsigned long a5); | ||
int HYPERVISOR_xen_version(int cmd, void *arg); | ||
int HYPERVISOR_console_io(int cmd, int count, char *str); | ||
int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count); | ||
int HYPERVISOR_sched_op(int cmd, void *arg); | ||
int HYPERVISOR_event_channel_op(int cmd, void *arg); | ||
unsigned long HYPERVISOR_hvm_op(int op, void *arg); | ||
int HYPERVISOR_memory_op(unsigned int cmd, void *arg); | ||
int HYPERVISOR_physdev_op(int cmd, void *arg); | ||
|
||
static inline void | ||
MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va, | ||
unsigned int new_val, unsigned long flags) | ||
{ | ||
BUG(); | ||
} | ||
|
||
static inline void | ||
MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req, | ||
int count, int *success_count, domid_t domid) | ||
{ | ||
BUG(); | ||
} | ||
|
||
static inline int | ||
HYPERVISOR_multicall(void *call_list, int nr_calls) | ||
{ | ||
BUG(); | ||
} | ||
#endif /* _ASM_ARM_XEN_HYPERCALL_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef _ASM_ARM_XEN_HYPERVISOR_H | ||
#define _ASM_ARM_XEN_HYPERVISOR_H | ||
|
||
extern struct shared_info *HYPERVISOR_shared_info; | ||
extern struct start_info *xen_start_info; | ||
|
||
/* Lazy mode for batching updates / context switch */ | ||
enum paravirt_lazy_mode { | ||
PARAVIRT_LAZY_NONE, | ||
PARAVIRT_LAZY_MMU, | ||
PARAVIRT_LAZY_CPU, | ||
}; | ||
|
||
static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void) | ||
{ | ||
return PARAVIRT_LAZY_NONE; | ||
} | ||
|
||
#endif /* _ASM_ARM_XEN_HYPERVISOR_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/****************************************************************************** | ||
* Guest OS interface to ARM Xen. | ||
* | ||
* Stefano Stabellini <[email protected]>, Citrix, 2012 | ||
*/ | ||
|
||
#ifndef _ASM_ARM_XEN_INTERFACE_H | ||
#define _ASM_ARM_XEN_INTERFACE_H | ||
|
||
#include <linux/types.h> | ||
|
||
#define uint64_aligned_t uint64_t __attribute__((aligned(8))) | ||
|
||
#define __DEFINE_GUEST_HANDLE(name, type) \ | ||
typedef struct { union { type *p; uint64_aligned_t q; }; } \ | ||
__guest_handle_ ## name | ||
|
||
#define DEFINE_GUEST_HANDLE_STRUCT(name) \ | ||
__DEFINE_GUEST_HANDLE(name, struct name) | ||
#define DEFINE_GUEST_HANDLE(name) __DEFINE_GUEST_HANDLE(name, name) | ||
#define GUEST_HANDLE(name) __guest_handle_ ## name | ||
|
||
#define set_xen_guest_handle(hnd, val) \ | ||
do { \ | ||
if (sizeof(hnd) == 8) \ | ||
*(uint64_t *)&(hnd) = 0; \ | ||
(hnd).p = val; \ | ||
} while (0) | ||
|
||
#ifndef __ASSEMBLY__ | ||
/* Explicitly size integers that represent pfns in the interface with | ||
* Xen so that we can have one ABI that works for 32 and 64 bit guests. */ | ||
typedef uint64_t xen_pfn_t; | ||
typedef uint64_t xen_ulong_t; | ||
/* Guest handles for primitive C types. */ | ||
__DEFINE_GUEST_HANDLE(uchar, unsigned char); | ||
__DEFINE_GUEST_HANDLE(uint, unsigned int); | ||
__DEFINE_GUEST_HANDLE(ulong, unsigned long); | ||
DEFINE_GUEST_HANDLE(char); | ||
DEFINE_GUEST_HANDLE(int); | ||
DEFINE_GUEST_HANDLE(long); | ||
DEFINE_GUEST_HANDLE(void); | ||
DEFINE_GUEST_HANDLE(uint64_t); | ||
DEFINE_GUEST_HANDLE(uint32_t); | ||
DEFINE_GUEST_HANDLE(xen_pfn_t); | ||
|
||
/* Maximum number of virtual CPUs in multi-processor guests. */ | ||
#define MAX_VIRT_CPUS 1 | ||
|
||
struct arch_vcpu_info { }; | ||
struct arch_shared_info { }; | ||
|
||
/* TODO: Move pvclock definitions some place arch independent */ | ||
struct pvclock_vcpu_time_info { | ||
u32 version; | ||
u32 pad0; | ||
u64 tsc_timestamp; | ||
u64 system_time; | ||
u32 tsc_to_system_mul; | ||
s8 tsc_shift; | ||
u8 flags; | ||
u8 pad[2]; | ||
} __attribute__((__packed__)); /* 32 bytes */ | ||
|
||
/* It is OK to have a 12 bytes struct with no padding because it is packed */ | ||
struct pvclock_wall_clock { | ||
u32 version; | ||
u32 sec; | ||
u32 nsec; | ||
} __attribute__((__packed__)); | ||
#endif | ||
|
||
#endif /* _ASM_ARM_XEN_INTERFACE_H */ |
Oops, something went wrong.