Commit d75e2f90 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag '3.9-rc3-smp-6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/sstabellini/xen

Pull ARM Xen SMP updates from Stefano Stabellini:
 "This contains a bunch of Xen/ARM specific changes, including some
  fixes, SMP support for Xen on ARM, and moving the xenvm machine from
  mach-vexpress to mach-virt.

  The non-Xen files that are touched are arch/arm/Kconfig, to select
  ARM_PSCI on XEN, and arch/arm/boot/dts/Makefile, to build the xenvm
  DTB if CONFIG_ARCH_VIRT.

  Highlights:

   - Move xenvm to mach-virt.

   - Implement SMP support in Xen on ARM.

   - Add support for machine reboot and power off via Xen hypercalls"

* tag '3.9-rc3-smp-6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/sstabellini/xen:
  xen/arm: remove duplicated include from enlighten.c
  xen/arm: use sched_op hypercalls for machine reboot and power off
  xenvm: add a simple PSCI node and a second cpu
  xen/arm: XEN selects ARM_PSCI
  xen: move the xenvm machine to mach-virt
  xen/arm: SMP support
  xen/arm: implement HYPERVISOR_vcpu_op
  xen/arm: actually pass a non-NULL percpu pointer to request_percpu_irq
parents de9c9f86 9bc25a1d
...@@ -1794,6 +1794,7 @@ config XEN ...@@ -1794,6 +1794,7 @@ config XEN
depends on ARM && AEABI && OF depends on ARM && AEABI && OF
depends on CPU_V7 && !CPU_V6 depends on CPU_V7 && !CPU_V6
depends on !GENERIC_ATOMIC64 depends on !GENERIC_ATOMIC64
select ARM_PSCI
help help
Say Y if you want to run Linux in a Virtual Machine on Xen on ARM. Say Y if you want to run Linux in a Virtual Machine on Xen on ARM.
......
...@@ -200,8 +200,8 @@ dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \ ...@@ -200,8 +200,8 @@ dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \
dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \
vexpress-v2p-ca9.dtb \ vexpress-v2p-ca9.dtb \
vexpress-v2p-ca15-tc1.dtb \ vexpress-v2p-ca15-tc1.dtb \
vexpress-v2p-ca15_a7.dtb \ vexpress-v2p-ca15_a7.dtb
xenvm-4.2.dtb dtb-$(CONFIG_ARCH_VIRT) += xenvm-4.2.dtb
dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
wm8505-ref.dtb \ wm8505-ref.dtb \
wm8650-mid.dtb \ wm8650-mid.dtb \
......
...@@ -29,6 +29,19 @@ cpu@0 { ...@@ -29,6 +29,19 @@ cpu@0 {
compatible = "arm,cortex-a15"; compatible = "arm,cortex-a15";
reg = <0>; reg = <0>;
}; };
cpu@1 {
device_type = "cpu";
compatible = "arm,cortex-a15";
reg = <1>;
};
};
psci {
compatible = "arm,psci";
method = "hvc";
cpu_off = <1>;
cpu_on = <2>;
}; };
memory@80000000 { memory@80000000 {
......
...@@ -46,6 +46,7 @@ int HYPERVISOR_event_channel_op(int cmd, void *arg); ...@@ -46,6 +46,7 @@ int HYPERVISOR_event_channel_op(int cmd, void *arg);
unsigned long HYPERVISOR_hvm_op(int op, void *arg); unsigned long HYPERVISOR_hvm_op(int op, void *arg);
int HYPERVISOR_memory_op(unsigned int cmd, void *arg); int HYPERVISOR_memory_op(unsigned int cmd, void *arg);
int HYPERVISOR_physdev_op(int cmd, void *arg); int HYPERVISOR_physdev_op(int cmd, void *arg);
int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args);
static inline void static inline void
MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va, MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
......
...@@ -450,7 +450,6 @@ static void __init v2m_dt_init(void) ...@@ -450,7 +450,6 @@ static void __init v2m_dt_init(void)
static const char * const v2m_dt_match[] __initconst = { static const char * const v2m_dt_match[] __initconst = {
"arm,vexpress", "arm,vexpress",
"xen,xenvm",
NULL, NULL,
}; };
......
...@@ -32,6 +32,7 @@ static void __init virt_init(void) ...@@ -32,6 +32,7 @@ static void __init virt_init(void)
static const char *virt_dt_match[] = { static const char *virt_dt_match[] = {
"linux,dummy-virt", "linux,dummy-virt",
"xen,xenvm",
NULL NULL
}; };
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <xen/events.h> #include <xen/events.h>
#include <xen/grant_table.h> #include <xen/grant_table.h>
#include <xen/hvm.h> #include <xen/hvm.h>
#include <xen/interface/vcpu.h>
#include <xen/interface/xen.h> #include <xen/interface/xen.h>
#include <xen/interface/memory.h> #include <xen/interface/memory.h>
#include <xen/interface/hvm/params.h> #include <xen/interface/hvm/params.h>
...@@ -9,9 +10,11 @@ ...@@ -9,9 +10,11 @@
#include <xen/platform_pci.h> #include <xen/platform_pci.h>
#include <xen/xenbus.h> #include <xen/xenbus.h>
#include <xen/page.h> #include <xen/page.h>
#include <xen/interface/sched.h>
#include <xen/xen-ops.h> #include <xen/xen-ops.h>
#include <asm/xen/hypervisor.h> #include <asm/xen/hypervisor.h>
#include <asm/xen/hypercall.h> #include <asm/xen/hypercall.h>
#include <asm/system_misc.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irqreturn.h> #include <linux/irqreturn.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -32,6 +35,7 @@ struct shared_info xen_dummy_shared_info; ...@@ -32,6 +35,7 @@ struct shared_info xen_dummy_shared_info;
struct shared_info *HYPERVISOR_shared_info = (void *)&xen_dummy_shared_info; struct shared_info *HYPERVISOR_shared_info = (void *)&xen_dummy_shared_info;
DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu); DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
static struct vcpu_info __percpu *xen_vcpu_info;
/* These are unused until we support booting "pre-ballooned" */ /* These are unused until we support booting "pre-ballooned" */
unsigned long xen_released_pages; unsigned long xen_released_pages;
...@@ -148,6 +152,47 @@ int xen_unmap_domain_mfn_range(struct vm_area_struct *vma, ...@@ -148,6 +152,47 @@ int xen_unmap_domain_mfn_range(struct vm_area_struct *vma,
} }
EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range); EXPORT_SYMBOL_GPL(xen_unmap_domain_mfn_range);
static int __init xen_secondary_init(unsigned int cpu)
{
struct vcpu_register_vcpu_info info;
struct vcpu_info *vcpup;
int err;
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);
err = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_info, cpu, &info);
if (err) {
pr_debug("register_vcpu_info failed: err=%d\n", err);
} else {
/* This cpu is using the registered vcpu info, even if
later ones fail to. */
per_cpu(xen_vcpu, cpu) = vcpup;
}
return 0;
}
static void xen_restart(char str, const char *cmd)
{
struct sched_shutdown r = { .reason = SHUTDOWN_reboot };
int rc;
rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
if (rc)
BUG();
}
static void xen_power_off(void)
{
struct sched_shutdown r = { .reason = SHUTDOWN_poweroff };
int rc;
rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r);
if (rc)
BUG();
}
/* /*
* see Documentation/devicetree/bindings/arm/xen.txt for the * see Documentation/devicetree/bindings/arm/xen.txt for the
* documentation of the Xen Device Tree format. * documentation of the Xen Device Tree format.
...@@ -163,6 +208,7 @@ static int __init xen_guest_init(void) ...@@ -163,6 +208,7 @@ static int __init xen_guest_init(void)
const char *version = NULL; const char *version = NULL;
const char *xen_prefix = "xen,xen-"; const char *xen_prefix = "xen,xen-";
struct resource res; struct resource res;
int i;
node = of_find_compatible_node(NULL, NULL, "xen,xen"); node = of_find_compatible_node(NULL, NULL, "xen,xen");
if (!node) { if (!node) {
...@@ -209,18 +255,26 @@ static int __init xen_guest_init(void) ...@@ -209,18 +255,26 @@ static int __init xen_guest_init(void)
/* xen_vcpu is a pointer to the vcpu_info struct in the shared_info /* xen_vcpu is a pointer to the vcpu_info struct in the shared_info
* page, we use it in the event channel upcall and in some pvclock * page, we use it in the event channel upcall and in some pvclock
* related functions. We don't need the vcpu_info placement * related functions.
* optimizations because we don't use any pv_mmu or pv_irq op on
* HVM.
* The shared info contains exactly 1 CPU (the boot CPU). The guest * The shared info contains exactly 1 CPU (the boot CPU). The guest
* is required to use VCPUOP_register_vcpu_info to place vcpu info * is required to use VCPUOP_register_vcpu_info to place vcpu info
* for secondary CPUs as they are brought up. */ * for secondary CPUs as they are brought up.
per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; * For uniformity we use VCPUOP_register_vcpu_info even on cpu0.
*/
xen_vcpu_info = __alloc_percpu(sizeof(struct vcpu_info),
sizeof(struct vcpu_info));
if (xen_vcpu_info == NULL)
return -ENOMEM;
for_each_online_cpu(i)
xen_secondary_init(i);
gnttab_init(); gnttab_init();
if (!xen_initial_domain()) if (!xen_initial_domain())
xenbus_probe(NULL); xenbus_probe(NULL);
pm_power_off = xen_power_off;
arm_pm_restart = xen_restart;
return 0; return 0;
} }
core_initcall(xen_guest_init); core_initcall(xen_guest_init);
...@@ -231,6 +285,11 @@ static irqreturn_t xen_arm_callback(int irq, void *arg) ...@@ -231,6 +285,11 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static __init void xen_percpu_enable_events(void *unused)
{
enable_percpu_irq(xen_events_irq, 0);
}
static int __init xen_init_events(void) static int __init xen_init_events(void)
{ {
if (!xen_domain() || xen_events_irq < 0) if (!xen_domain() || xen_events_irq < 0)
...@@ -239,12 +298,12 @@ static int __init xen_init_events(void) ...@@ -239,12 +298,12 @@ static int __init xen_init_events(void)
xen_init_IRQ(); xen_init_IRQ();
if (request_percpu_irq(xen_events_irq, xen_arm_callback, if (request_percpu_irq(xen_events_irq, xen_arm_callback,
"events", xen_vcpu)) { "events", &xen_vcpu)) {
pr_err("Error requesting IRQ %d\n", xen_events_irq); pr_err("Error requesting IRQ %d\n", xen_events_irq);
return -EINVAL; return -EINVAL;
} }
enable_percpu_irq(xen_events_irq, 0); on_each_cpu(xen_percpu_enable_events, NULL, 0);
return 0; return 0;
} }
...@@ -259,4 +318,5 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_sched_op); ...@@ -259,4 +318,5 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_sched_op);
EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op); EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op);
EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op); EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op); EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op);
EXPORT_SYMBOL_GPL(privcmd_call); EXPORT_SYMBOL_GPL(privcmd_call);
...@@ -87,6 +87,7 @@ HYPERCALL2(event_channel_op); ...@@ -87,6 +87,7 @@ HYPERCALL2(event_channel_op);
HYPERCALL2(hvm_op); HYPERCALL2(hvm_op);
HYPERCALL2(memory_op); HYPERCALL2(memory_op);
HYPERCALL2(physdev_op); HYPERCALL2(physdev_op);
HYPERCALL3(vcpu_op);
ENTRY(privcmd_call) ENTRY(privcmd_call)
stmdb sp!, {r4} stmdb sp!, {r4}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment