diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-27 15:56:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-03-27 15:56:25 -0400 |
commit | 33b65f1e9ca51b2d1be4d66d2bbf6e874a022f0a (patch) | |
tree | d02f841be1024bcf38449119afa71a53df3560b5 /drivers/xen | |
parent | f8966048c128eff4f57f7c9e7f71360ebd10e1a9 (diff) | |
parent | c26377e62f4e6bfb4d99ef88526047209701a83f (diff) |
Merge tag 'stable/for-linus-3.9-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
Pull Xen bug-fixes from Konrad Rzeszutek Wilk:
"This is mostly just the last stragglers of the regression bugs that
this merge window had. There are also two bug-fixes: one that adds an
extra layer of security, and a regression fix for a change that was
added in v3.7 (the v1 was faulty, the v2 works).
- Regression fixes for C-and-P states not being parsed properly.
- Fix possible security issue with guests triggering DoS via
non-assigned MSI-Xs.
- Fix regression (introduced in v3.7) with raising an event (v2).
- Fix hastily introduced band-aid during c0 for the CR3 blowup."
* tag 'stable/for-linus-3.9-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
xen/events: avoid race with raising an event in unmask_evtchn()
xen/mmu: Move the setting of pvops.write_cr3 to later phase in bootup.
xen/acpi-stub: Disable it b/c the acpi_processor_add is no longer called.
xen-pciback: notify hypervisor about devices intended to be assigned to guests
xen/acpi-processor: Don't dereference struct acpi_processor on all CPUs.
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/Kconfig | 2 | ||||
-rw-r--r-- | drivers/xen/events.c | 20 | ||||
-rw-r--r-- | drivers/xen/fallback.c | 3 | ||||
-rw-r--r-- | drivers/xen/xen-acpi-processor.c | 3 | ||||
-rw-r--r-- | drivers/xen/xen-pciback/pci_stub.c | 59 |
5 files changed, 65 insertions, 22 deletions
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 5a32232cf7c1..67af155cf602 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -182,7 +182,7 @@ config XEN_PRIVCMD | |||
182 | 182 | ||
183 | config XEN_STUB | 183 | config XEN_STUB |
184 | bool "Xen stub drivers" | 184 | bool "Xen stub drivers" |
185 | depends on XEN && X86_64 | 185 | depends on XEN && X86_64 && BROKEN |
186 | default n | 186 | default n |
187 | help | 187 | help |
188 | Allow kernel to install stub drivers, to reserve space for Xen drivers, | 188 | Allow kernel to install stub drivers, to reserve space for Xen drivers, |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index d17aa41a9041..aa85881d17b2 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -403,11 +403,23 @@ static void unmask_evtchn(int port) | |||
403 | 403 | ||
404 | if (unlikely((cpu != cpu_from_evtchn(port)))) | 404 | if (unlikely((cpu != cpu_from_evtchn(port)))) |
405 | do_hypercall = 1; | 405 | do_hypercall = 1; |
406 | else | 406 | else { |
407 | /* | ||
408 | * Need to clear the mask before checking pending to | ||
409 | * avoid a race with an event becoming pending. | ||
410 | * | ||
411 | * EVTCHNOP_unmask will only trigger an upcall if the | ||
412 | * mask bit was set, so if a hypercall is needed | ||
413 | * remask the event. | ||
414 | */ | ||
415 | sync_clear_bit(port, BM(&s->evtchn_mask[0])); | ||
407 | evtchn_pending = sync_test_bit(port, BM(&s->evtchn_pending[0])); | 416 | evtchn_pending = sync_test_bit(port, BM(&s->evtchn_pending[0])); |
408 | 417 | ||
409 | if (unlikely(evtchn_pending && xen_hvm_domain())) | 418 | if (unlikely(evtchn_pending && xen_hvm_domain())) { |
410 | do_hypercall = 1; | 419 | sync_set_bit(port, BM(&s->evtchn_mask[0])); |
420 | do_hypercall = 1; | ||
421 | } | ||
422 | } | ||
411 | 423 | ||
412 | /* Slow path (hypercall) if this is a non-local port or if this is | 424 | /* Slow path (hypercall) if this is a non-local port or if this is |
413 | * an hvm domain and an event is pending (hvm domains don't have | 425 | * an hvm domain and an event is pending (hvm domains don't have |
@@ -418,8 +430,6 @@ static void unmask_evtchn(int port) | |||
418 | } else { | 430 | } else { |
419 | struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu); | 431 | struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu); |
420 | 432 | ||
421 | sync_clear_bit(port, BM(&s->evtchn_mask[0])); | ||
422 | |||
423 | /* | 433 | /* |
424 | * The following is basically the equivalent of | 434 | * The following is basically the equivalent of |
425 | * 'hw_resend_irq'. Just like a real IO-APIC we 'lose | 435 | * 'hw_resend_irq'. Just like a real IO-APIC we 'lose |
diff --git a/drivers/xen/fallback.c b/drivers/xen/fallback.c index 0ef7c4d40f86..b04fb64c5a91 100644 --- a/drivers/xen/fallback.c +++ b/drivers/xen/fallback.c | |||
@@ -44,7 +44,7 @@ int xen_event_channel_op_compat(int cmd, void *arg) | |||
44 | } | 44 | } |
45 | EXPORT_SYMBOL_GPL(xen_event_channel_op_compat); | 45 | EXPORT_SYMBOL_GPL(xen_event_channel_op_compat); |
46 | 46 | ||
47 | int HYPERVISOR_physdev_op_compat(int cmd, void *arg) | 47 | int xen_physdev_op_compat(int cmd, void *arg) |
48 | { | 48 | { |
49 | struct physdev_op op; | 49 | struct physdev_op op; |
50 | int rc; | 50 | int rc; |
@@ -78,3 +78,4 @@ int HYPERVISOR_physdev_op_compat(int cmd, void *arg) | |||
78 | 78 | ||
79 | return rc; | 79 | return rc; |
80 | } | 80 | } |
81 | EXPORT_SYMBOL_GPL(xen_physdev_op_compat); | ||
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index f3278a6603ca..90e34ac7e522 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c | |||
@@ -505,6 +505,9 @@ static int __init xen_acpi_processor_init(void) | |||
505 | 505 | ||
506 | pr = per_cpu(processors, i); | 506 | pr = per_cpu(processors, i); |
507 | perf = per_cpu_ptr(acpi_perf_data, i); | 507 | perf = per_cpu_ptr(acpi_perf_data, i); |
508 | if (!pr) | ||
509 | continue; | ||
510 | |||
508 | pr->performance = perf; | 511 | pr->performance = perf; |
509 | rc = acpi_processor_get_performance_info(pr); | 512 | rc = acpi_processor_get_performance_info(pr); |
510 | if (rc) | 513 | if (rc) |
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c index 9204126f1560..a2278ba7fb27 100644 --- a/drivers/xen/xen-pciback/pci_stub.c +++ b/drivers/xen/xen-pciback/pci_stub.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <xen/events.h> | 17 | #include <xen/events.h> |
18 | #include <asm/xen/pci.h> | 18 | #include <asm/xen/pci.h> |
19 | #include <asm/xen/hypervisor.h> | 19 | #include <asm/xen/hypervisor.h> |
20 | #include <xen/interface/physdev.h> | ||
20 | #include "pciback.h" | 21 | #include "pciback.h" |
21 | #include "conf_space.h" | 22 | #include "conf_space.h" |
22 | #include "conf_space_quirks.h" | 23 | #include "conf_space_quirks.h" |
@@ -85,37 +86,52 @@ static struct pcistub_device *pcistub_device_alloc(struct pci_dev *dev) | |||
85 | static void pcistub_device_release(struct kref *kref) | 86 | static void pcistub_device_release(struct kref *kref) |
86 | { | 87 | { |
87 | struct pcistub_device *psdev; | 88 | struct pcistub_device *psdev; |
89 | struct pci_dev *dev; | ||
88 | struct xen_pcibk_dev_data *dev_data; | 90 | struct xen_pcibk_dev_data *dev_data; |
89 | 91 | ||
90 | psdev = container_of(kref, struct pcistub_device, kref); | 92 | psdev = container_of(kref, struct pcistub_device, kref); |
91 | dev_data = pci_get_drvdata(psdev->dev); | 93 | dev = psdev->dev; |
94 | dev_data = pci_get_drvdata(dev); | ||
92 | 95 | ||
93 | dev_dbg(&psdev->dev->dev, "pcistub_device_release\n"); | 96 | dev_dbg(&dev->dev, "pcistub_device_release\n"); |
94 | 97 | ||
95 | xen_unregister_device_domain_owner(psdev->dev); | 98 | xen_unregister_device_domain_owner(dev); |
96 | 99 | ||
97 | /* Call the reset function which does not take lock as this | 100 | /* Call the reset function which does not take lock as this |
98 | * is called from "unbind" which takes a device_lock mutex. | 101 | * is called from "unbind" which takes a device_lock mutex. |
99 | */ | 102 | */ |
100 | __pci_reset_function_locked(psdev->dev); | 103 | __pci_reset_function_locked(dev); |
101 | if (pci_load_and_free_saved_state(psdev->dev, | 104 | if (pci_load_and_free_saved_state(dev, &dev_data->pci_saved_state)) |
102 | &dev_data->pci_saved_state)) { | 105 | dev_dbg(&dev->dev, "Could not reload PCI state\n"); |
103 | dev_dbg(&psdev->dev->dev, "Could not reload PCI state\n"); | 106 | else |
104 | } else | 107 | pci_restore_state(dev); |
105 | pci_restore_state(psdev->dev); | 108 | |
109 | if (pci_find_capability(dev, PCI_CAP_ID_MSIX)) { | ||
110 | struct physdev_pci_device ppdev = { | ||
111 | .seg = pci_domain_nr(dev->bus), | ||
112 | .bus = dev->bus->number, | ||
113 | .devfn = dev->devfn | ||
114 | }; | ||
115 | int err = HYPERVISOR_physdev_op(PHYSDEVOP_release_msix, | ||
116 | &ppdev); | ||
117 | |||
118 | if (err) | ||
119 | dev_warn(&dev->dev, "MSI-X release failed (%d)\n", | ||
120 | err); | ||
121 | } | ||
106 | 122 | ||
107 | /* Disable the device */ | 123 | /* Disable the device */ |
108 | xen_pcibk_reset_device(psdev->dev); | 124 | xen_pcibk_reset_device(dev); |
109 | 125 | ||
110 | kfree(dev_data); | 126 | kfree(dev_data); |
111 | pci_set_drvdata(psdev->dev, NULL); | 127 | pci_set_drvdata(dev, NULL); |
112 | 128 | ||
113 | /* Clean-up the device */ | 129 | /* Clean-up the device */ |
114 | xen_pcibk_config_free_dyn_fields(psdev->dev); | 130 | xen_pcibk_config_free_dyn_fields(dev); |
115 | xen_pcibk_config_free_dev(psdev->dev); | 131 | xen_pcibk_config_free_dev(dev); |
116 | 132 | ||
117 | psdev->dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED; | 133 | dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED; |
118 | pci_dev_put(psdev->dev); | 134 | pci_dev_put(dev); |
119 | 135 | ||
120 | kfree(psdev); | 136 | kfree(psdev); |
121 | } | 137 | } |
@@ -355,6 +371,19 @@ static int pcistub_init_device(struct pci_dev *dev) | |||
355 | if (err) | 371 | if (err) |
356 | goto config_release; | 372 | goto config_release; |
357 | 373 | ||
374 | if (pci_find_capability(dev, PCI_CAP_ID_MSIX)) { | ||
375 | struct physdev_pci_device ppdev = { | ||
376 | .seg = pci_domain_nr(dev->bus), | ||
377 | .bus = dev->bus->number, | ||
378 | .devfn = dev->devfn | ||
379 | }; | ||
380 | |||
381 | err = HYPERVISOR_physdev_op(PHYSDEVOP_prepare_msix, &ppdev); | ||
382 | if (err) | ||
383 | dev_err(&dev->dev, "MSI-X preparation failed (%d)\n", | ||
384 | err); | ||
385 | } | ||
386 | |||
358 | /* We need the device active to save the state. */ | 387 | /* We need the device active to save the state. */ |
359 | dev_dbg(&dev->dev, "save state of device\n"); | 388 | dev_dbg(&dev->dev, "save state of device\n"); |
360 | pci_save_state(dev); | 389 | pci_save_state(dev); |