aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/xen-pciback
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 22:59:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-22 23:16:14 -0400
commitd4c6fa73fe984e504d52f3d6bba291fd76fe49f7 (patch)
tree47842ddebb2a48cc1513b36fba18835678e2b94e /drivers/xen/xen-pciback
parentaab008db8063364dc3c8ccf4981c21124866b395 (diff)
parent4bc25af79ec54b79266148f8c1b84bb1e7ff2621 (diff)
Merge tag 'stable/for-linus-3.4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
Pull xen updates from Konrad Rzeszutek Wilk: "which has three neat features: - PV multiconsole support, so that there can be hvc1, hvc2, etc; This can be used in HVM and in PV mode. - P-state and C-state power management driver that uploads said power management data to the hypervisor. It also inhibits cpufreq scaling drivers to load so that only the hypervisor can make power management decisions - fixing a weird perf bug. There is one thing in the Kconfig that you won't like: "default y if (X86_ACPI_CPUFREQ = y || X86_POWERNOW_K8 = y)" (note, that it all depends on CONFIG_XEN which depends on CONFIG_PARAVIRT which by default is off). I've a fix to convert that boolean expression into "default m" which I am going to post after the cpufreq git pull - as the two patches to make this work depend on a fix in Dave Jones's tree. - Function Level Reset (FLR) support in the Xen PCI backend. Fixes: - Kconfig dependencies for Xen PV keyboard and video - Compile warnings and constify fixes - Change over to use percpu_xxx instead of this_cpu_xxx" Fix up trivial conflicts in drivers/tty/hvc/hvc_xen.c due to changes to a removed commit. * tag 'stable/for-linus-3.4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xen kconfig: relax INPUT_XEN_KBDDEV_FRONTEND deps xen/acpi-processor: C and P-state driver that uploads said data to hypervisor. xen: constify all instances of "struct attribute_group" xen/xenbus: ignore console/0 hvc_xen: introduce HVC_XEN_FRONTEND hvc_xen: implement multiconsole support hvc_xen: support PV on HVM consoles xenbus: don't free other end details too early xen/enlighten: Expose MWAIT and MWAIT_LEAF if hypervisor OKs it. xen/setup/pm/acpi: Remove the call to boot_option_idle_override. xenbus: address compiler warnings xen: use this_cpu_xxx replace percpu_xxx funcs xen/pciback: Support pci_reset_function, aka FLR or D3 support. pci: Introduce __pci_reset_function_locked to be used when holding device_lock. xen: Utilize the restore_msi_irqs hook.
Diffstat (limited to 'drivers/xen/xen-pciback')
-rw-r--r--drivers/xen/xen-pciback/pci_stub.c41
-rw-r--r--drivers/xen/xen-pciback/pciback.h1
2 files changed, 39 insertions, 3 deletions
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index 19834d1c7c36..097e536e8672 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -85,19 +85,34 @@ static struct pcistub_device *pcistub_device_alloc(struct pci_dev *dev)
85static void pcistub_device_release(struct kref *kref) 85static void pcistub_device_release(struct kref *kref)
86{ 86{
87 struct pcistub_device *psdev; 87 struct pcistub_device *psdev;
88 struct xen_pcibk_dev_data *dev_data;
88 89
89 psdev = container_of(kref, struct pcistub_device, kref); 90 psdev = container_of(kref, struct pcistub_device, kref);
91 dev_data = pci_get_drvdata(psdev->dev);
90 92
91 dev_dbg(&psdev->dev->dev, "pcistub_device_release\n"); 93 dev_dbg(&psdev->dev->dev, "pcistub_device_release\n");
92 94
93 xen_unregister_device_domain_owner(psdev->dev); 95 xen_unregister_device_domain_owner(psdev->dev);
94 96
95 /* Clean-up the device */ 97 /* Call the reset function which does not take lock as this
98 * is called from "unbind" which takes a device_lock mutex.
99 */
100 __pci_reset_function_locked(psdev->dev);
101 if (pci_load_and_free_saved_state(psdev->dev,
102 &dev_data->pci_saved_state)) {
103 dev_dbg(&psdev->dev->dev, "Could not reload PCI state\n");
104 } else
105 pci_restore_state(psdev->dev);
106
107 /* Disable the device */
96 xen_pcibk_reset_device(psdev->dev); 108 xen_pcibk_reset_device(psdev->dev);
109
110 kfree(dev_data);
111 pci_set_drvdata(psdev->dev, NULL);
112
113 /* Clean-up the device */
97 xen_pcibk_config_free_dyn_fields(psdev->dev); 114 xen_pcibk_config_free_dyn_fields(psdev->dev);
98 xen_pcibk_config_free_dev(psdev->dev); 115 xen_pcibk_config_free_dev(psdev->dev);
99 kfree(pci_get_drvdata(psdev->dev));
100 pci_set_drvdata(psdev->dev, NULL);
101 116
102 psdev->dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED; 117 psdev->dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
103 pci_dev_put(psdev->dev); 118 pci_dev_put(psdev->dev);
@@ -231,7 +246,17 @@ void pcistub_put_pci_dev(struct pci_dev *dev)
231 /* Cleanup our device 246 /* Cleanup our device
232 * (so it's ready for the next domain) 247 * (so it's ready for the next domain)
233 */ 248 */
249
250 /* This is OK - we are running from workqueue context
251 * and want to inhibit the user from fiddling with 'reset'
252 */
253 pci_reset_function(dev);
254 pci_restore_state(psdev->dev);
255
256 /* This disables the device. */
234 xen_pcibk_reset_device(found_psdev->dev); 257 xen_pcibk_reset_device(found_psdev->dev);
258
259 /* And cleanup up our emulated fields. */
235 xen_pcibk_config_free_dyn_fields(found_psdev->dev); 260 xen_pcibk_config_free_dyn_fields(found_psdev->dev);
236 xen_pcibk_config_reset_dev(found_psdev->dev); 261 xen_pcibk_config_reset_dev(found_psdev->dev);
237 262
@@ -328,6 +353,16 @@ static int __devinit pcistub_init_device(struct pci_dev *dev)
328 if (err) 353 if (err)
329 goto config_release; 354 goto config_release;
330 355
356 dev_dbg(&dev->dev, "reseting (FLR, D3, etc) the device\n");
357 __pci_reset_function_locked(dev);
358
359 /* We need the device active to save the state. */
360 dev_dbg(&dev->dev, "save state of device\n");
361 pci_save_state(dev);
362 dev_data->pci_saved_state = pci_store_saved_state(dev);
363 if (!dev_data->pci_saved_state)
364 dev_err(&dev->dev, "Could not store PCI conf saved state!\n");
365
331 /* Now disable the device (this also ensures some private device 366 /* Now disable the device (this also ensures some private device
332 * data is setup before we export) 367 * data is setup before we export)
333 */ 368 */
diff --git a/drivers/xen/xen-pciback/pciback.h b/drivers/xen/xen-pciback/pciback.h
index e9b4011c5f9a..a7def010eba3 100644
--- a/drivers/xen/xen-pciback/pciback.h
+++ b/drivers/xen/xen-pciback/pciback.h
@@ -41,6 +41,7 @@ struct xen_pcibk_device {
41 41
42struct xen_pcibk_dev_data { 42struct xen_pcibk_dev_data {
43 struct list_head config_fields; 43 struct list_head config_fields;
44 struct pci_saved_state *pci_saved_state;
44 unsigned int permissive:1; 45 unsigned int permissive:1;
45 unsigned int warned_on_write:1; 46 unsigned int warned_on_write:1;
46 unsigned int enable_intx:1; 47 unsigned int enable_intx:1;