diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-24 19:02:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-24 19:02:08 -0400 |
commit | b5f4035adfffbcc6b478de5b8c44b618b3124aff (patch) | |
tree | e7a5f011d8aaf5c95edf933f98f25dfc8fa46837 /drivers/xen/xenbus | |
parent | ce004178be1bbaa292e9e6497939e2970300095a (diff) | |
parent | 68c2c39a76b094e9b2773e5846424ea674bf2c46 (diff) |
Merge tag 'stable/for-linus-3.5-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
Pull Xen updates from Konrad Rzeszutek Wilk:
"Features:
* Extend the APIC ops implementation and add IRQ_WORKER vector
support so that 'perf' can work properly.
* Fix self-ballooning code, and balloon logic when booting as initial
domain.
* Move array printing code to generic debugfs
* Support XenBus domains.
* Lazily free grants when a domain is dead/non-existent.
* In M2P code use batching calls
Bug-fixes:
* Fix NULL dereference in allocation failure path (hvc_xen)
* Fix unbinding of IRQ_WORKER vector during vCPU hot-unplug
* Fix HVM guest resume - we would leak an PIRQ value instead of
reusing the existing one."
Fix up add-add onflicts in arch/x86/xen/enlighten.c due to addition of
apic ipi interface next to the new apic_id functions.
* tag 'stable/for-linus-3.5-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
xen: do not map the same GSI twice in PVHVM guests.
hvc_xen: NULL dereference on allocation failure
xen: Add selfballoning memory reservation tunable.
xenbus: Add support for xenbus backend in stub domain
xen/smp: unbind irqworkX when unplugging vCPUs.
xen: enter/exit lazy_mmu_mode around m2p_override calls
xen/acpi/sleep: Enable ACPI sleep via the __acpi_os_prepare_sleep
xen: implement IRQ_WORK_VECTOR handler
xen: implement apic ipi interface
xen/setup: update VA mapping when releasing memory during setup
xen/setup: Combine the two hypercall functions - since they are quite similar.
xen/setup: Populate freed MFNs from non-RAM E820 entries and gaps to E820 RAM
xen/setup: Only print "Freeing XXX-YYY pfn range: Z pages freed" if Z > 0
xen/gnttab: add deferred freeing logic
debugfs: Add support to print u32 array in debugfs
xen/p2m: An early bootup variant of set_phys_to_machine
xen/p2m: Collapse early_alloc_p2m_middle redundant checks.
xen/p2m: Allow alloc_p2m_middle to call reserve_brk depending on argument
xen/p2m: Move code around to allow for better re-usage.
Diffstat (limited to 'drivers/xen/xenbus')
-rw-r--r-- | drivers/xen/xenbus/xenbus_comms.c | 6 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_comms.h | 1 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_dev_backend.c | 51 |
3 files changed, 58 insertions, 0 deletions
diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c index 2eff7a6aaa20..52fe7ad07666 100644 --- a/drivers/xen/xenbus/xenbus_comms.c +++ b/drivers/xen/xenbus/xenbus_comms.c | |||
@@ -234,3 +234,9 @@ int xb_init_comms(void) | |||
234 | 234 | ||
235 | return 0; | 235 | return 0; |
236 | } | 236 | } |
237 | |||
238 | void xb_deinit_comms(void) | ||
239 | { | ||
240 | unbind_from_irqhandler(xenbus_irq, &xb_waitq); | ||
241 | xenbus_irq = 0; | ||
242 | } | ||
diff --git a/drivers/xen/xenbus/xenbus_comms.h b/drivers/xen/xenbus/xenbus_comms.h index 6e42800fa499..c8abd3b8a6c4 100644 --- a/drivers/xen/xenbus/xenbus_comms.h +++ b/drivers/xen/xenbus/xenbus_comms.h | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | int xs_init(void); | 36 | int xs_init(void); |
37 | int xb_init_comms(void); | 37 | int xb_init_comms(void); |
38 | void xb_deinit_comms(void); | ||
38 | 39 | ||
39 | /* Low level routines. */ | 40 | /* Low level routines. */ |
40 | int xb_write(const void *data, unsigned len); | 41 | int xb_write(const void *data, unsigned len); |
diff --git a/drivers/xen/xenbus/xenbus_dev_backend.c b/drivers/xen/xenbus/xenbus_dev_backend.c index 3d3be78c1093..be738c43104b 100644 --- a/drivers/xen/xenbus/xenbus_dev_backend.c +++ b/drivers/xen/xenbus/xenbus_dev_backend.c | |||
@@ -8,7 +8,11 @@ | |||
8 | 8 | ||
9 | #include <xen/xen.h> | 9 | #include <xen/xen.h> |
10 | #include <xen/page.h> | 10 | #include <xen/page.h> |
11 | #include <xen/xenbus.h> | ||
11 | #include <xen/xenbus_dev.h> | 12 | #include <xen/xenbus_dev.h> |
13 | #include <xen/grant_table.h> | ||
14 | #include <xen/events.h> | ||
15 | #include <asm/xen/hypervisor.h> | ||
12 | 16 | ||
13 | #include "xenbus_comms.h" | 17 | #include "xenbus_comms.h" |
14 | 18 | ||
@@ -22,6 +26,50 @@ static int xenbus_backend_open(struct inode *inode, struct file *filp) | |||
22 | return nonseekable_open(inode, filp); | 26 | return nonseekable_open(inode, filp); |
23 | } | 27 | } |
24 | 28 | ||
29 | static long xenbus_alloc(domid_t domid) | ||
30 | { | ||
31 | struct evtchn_alloc_unbound arg; | ||
32 | int err = -EEXIST; | ||
33 | |||
34 | xs_suspend(); | ||
35 | |||
36 | /* If xenstored_ready is nonzero, that means we have already talked to | ||
37 | * xenstore and set up watches. These watches will be restored by | ||
38 | * xs_resume, but that requires communication over the port established | ||
39 | * below that is not visible to anyone until the ioctl returns. | ||
40 | * | ||
41 | * This can be resolved by splitting the ioctl into two parts | ||
42 | * (postponing the resume until xenstored is active) but this is | ||
43 | * unnecessarily complex for the intended use where xenstored is only | ||
44 | * started once - so return -EEXIST if it's already running. | ||
45 | */ | ||
46 | if (xenstored_ready) | ||
47 | goto out_err; | ||
48 | |||
49 | gnttab_grant_foreign_access_ref(GNTTAB_RESERVED_XENSTORE, domid, | ||
50 | virt_to_mfn(xen_store_interface), 0 /* writable */); | ||
51 | |||
52 | arg.dom = DOMID_SELF; | ||
53 | arg.remote_dom = domid; | ||
54 | |||
55 | err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &arg); | ||
56 | if (err) | ||
57 | goto out_err; | ||
58 | |||
59 | if (xen_store_evtchn > 0) | ||
60 | xb_deinit_comms(); | ||
61 | |||
62 | xen_store_evtchn = arg.port; | ||
63 | |||
64 | xs_resume(); | ||
65 | |||
66 | return arg.port; | ||
67 | |||
68 | out_err: | ||
69 | xs_suspend_cancel(); | ||
70 | return err; | ||
71 | } | ||
72 | |||
25 | static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, unsigned long data) | 73 | static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, unsigned long data) |
26 | { | 74 | { |
27 | if (!capable(CAP_SYS_ADMIN)) | 75 | if (!capable(CAP_SYS_ADMIN)) |
@@ -33,6 +81,9 @@ static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, unsigned l | |||
33 | return xen_store_evtchn; | 81 | return xen_store_evtchn; |
34 | return -ENODEV; | 82 | return -ENODEV; |
35 | 83 | ||
84 | case IOCTL_XENBUS_BACKEND_SETUP: | ||
85 | return xenbus_alloc(data); | ||
86 | |||
36 | default: | 87 | default: |
37 | return -ENOTTY; | 88 | return -ENOTTY; |
38 | } | 89 | } |