aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-02-14 18:20:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-02-14 18:20:11 -0500
commit694ce18ec3485f5b0a4f3820073f5e2b0b4e0870 (patch)
treee979926df34b41e17024107ee4731739608d8b51 /drivers
parent13d261932bbfff7f45f288c5c8cce43177cccd3b (diff)
parenta43a5ccdfa5bd5b2f00aa9b2321df268c2e5d6e2 (diff)
Merge tag 'stable/for-linus-fixes-3.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
Two fixes for VCPU offlining; One to fix the string format exposed by the xen-pci[front|back] to conform to the one used in majority of PCI drivers; Two fixes to make the code more resilient to invalid configurations. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> * tag 'stable/for-linus-fixes-3.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xenbus_dev: add missing error check to watch handling xen/pci[front|back]: Use %d instead of %1x for displaying PCI devfn. xen pvhvm: do not remap pirqs onto evtchns if !xen_have_vector_callback xen/smp: Fix CPU online/offline bug triggering a BUG: scheduling while atomic. xen/bootup: During bootup suppress XENBUS: Unable to read cpu state
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/xen-pcifront.c10
-rw-r--r--drivers/xen/cpu_hotplug.c3
-rw-r--r--drivers/xen/xen-pciback/pci_stub.c8
-rw-r--r--drivers/xen/xen-pciback/xenbus.c5
-rw-r--r--drivers/xen/xenbus/xenbus_dev_frontend.c4
5 files changed, 18 insertions, 12 deletions
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 7cf3d2fcf56a..1620088a0e7e 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -189,7 +189,7 @@ static int pcifront_bus_read(struct pci_bus *bus, unsigned int devfn,
189 189
190 if (verbose_request) 190 if (verbose_request)
191 dev_info(&pdev->xdev->dev, 191 dev_info(&pdev->xdev->dev,
192 "read dev=%04x:%02x:%02x.%01x - offset %x size %d\n", 192 "read dev=%04x:%02x:%02x.%d - offset %x size %d\n",
193 pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), 193 pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),
194 PCI_FUNC(devfn), where, size); 194 PCI_FUNC(devfn), where, size);
195 195
@@ -228,7 +228,7 @@ static int pcifront_bus_write(struct pci_bus *bus, unsigned int devfn,
228 228
229 if (verbose_request) 229 if (verbose_request)
230 dev_info(&pdev->xdev->dev, 230 dev_info(&pdev->xdev->dev,
231 "write dev=%04x:%02x:%02x.%01x - " 231 "write dev=%04x:%02x:%02x.%d - "
232 "offset %x size %d val %x\n", 232 "offset %x size %d val %x\n",
233 pci_domain_nr(bus), bus->number, 233 pci_domain_nr(bus), bus->number,
234 PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, val); 234 PCI_SLOT(devfn), PCI_FUNC(devfn), where, size, val);
@@ -432,7 +432,7 @@ static int __devinit pcifront_scan_bus(struct pcifront_device *pdev,
432 d = pci_scan_single_device(b, devfn); 432 d = pci_scan_single_device(b, devfn);
433 if (d) 433 if (d)
434 dev_info(&pdev->xdev->dev, "New device on " 434 dev_info(&pdev->xdev->dev, "New device on "
435 "%04x:%02x:%02x.%02x found.\n", domain, bus, 435 "%04x:%02x:%02x.%d found.\n", domain, bus,
436 PCI_SLOT(devfn), PCI_FUNC(devfn)); 436 PCI_SLOT(devfn), PCI_FUNC(devfn));
437 } 437 }
438 438
@@ -1041,7 +1041,7 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
1041 pci_dev = pci_get_slot(pci_bus, PCI_DEVFN(slot, func)); 1041 pci_dev = pci_get_slot(pci_bus, PCI_DEVFN(slot, func));
1042 if (!pci_dev) { 1042 if (!pci_dev) {
1043 dev_dbg(&pdev->xdev->dev, 1043 dev_dbg(&pdev->xdev->dev,
1044 "Cannot get PCI device %04x:%02x:%02x.%02x\n", 1044 "Cannot get PCI device %04x:%02x:%02x.%d\n",
1045 domain, bus, slot, func); 1045 domain, bus, slot, func);
1046 continue; 1046 continue;
1047 } 1047 }
@@ -1049,7 +1049,7 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
1049 pci_dev_put(pci_dev); 1049 pci_dev_put(pci_dev);
1050 1050
1051 dev_dbg(&pdev->xdev->dev, 1051 dev_dbg(&pdev->xdev->dev,
1052 "PCI device %04x:%02x:%02x.%02x removed.\n", 1052 "PCI device %04x:%02x:%02x.%d removed.\n",
1053 domain, bus, slot, func); 1053 domain, bus, slot, func);
1054 } 1054 }
1055 1055
diff --git a/drivers/xen/cpu_hotplug.c b/drivers/xen/cpu_hotplug.c
index 14e2d995e958..4dcfced107f5 100644
--- a/drivers/xen/cpu_hotplug.c
+++ b/drivers/xen/cpu_hotplug.c
@@ -30,7 +30,8 @@ static int vcpu_online(unsigned int cpu)
30 sprintf(dir, "cpu/%u", cpu); 30 sprintf(dir, "cpu/%u", cpu);
31 err = xenbus_scanf(XBT_NIL, dir, "availability", "%s", state); 31 err = xenbus_scanf(XBT_NIL, dir, "availability", "%s", state);
32 if (err != 1) { 32 if (err != 1) {
33 printk(KERN_ERR "XENBUS: Unable to read cpu state\n"); 33 if (!xen_initial_domain())
34 printk(KERN_ERR "XENBUS: Unable to read cpu state\n");
34 return err; 35 return err;
35 } 36 }
36 37
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index 7944a17f5cbf..19834d1c7c36 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -884,7 +884,7 @@ static inline int str_to_quirk(const char *buf, int *domain, int *bus, int
884 int err; 884 int err;
885 885
886 err = 886 err =
887 sscanf(buf, " %04x:%02x:%02x.%1x-%08x:%1x:%08x", domain, bus, slot, 887 sscanf(buf, " %04x:%02x:%02x.%d-%08x:%1x:%08x", domain, bus, slot,
888 func, reg, size, mask); 888 func, reg, size, mask);
889 if (err == 7) 889 if (err == 7)
890 return 0; 890 return 0;
@@ -904,7 +904,7 @@ static int pcistub_device_id_add(int domain, int bus, int slot, int func)
904 pci_dev_id->bus = bus; 904 pci_dev_id->bus = bus;
905 pci_dev_id->devfn = PCI_DEVFN(slot, func); 905 pci_dev_id->devfn = PCI_DEVFN(slot, func);
906 906
907 pr_debug(DRV_NAME ": wants to seize %04x:%02x:%02x.%01x\n", 907 pr_debug(DRV_NAME ": wants to seize %04x:%02x:%02x.%d\n",
908 domain, bus, slot, func); 908 domain, bus, slot, func);
909 909
910 spin_lock_irqsave(&device_ids_lock, flags); 910 spin_lock_irqsave(&device_ids_lock, flags);
@@ -934,7 +934,7 @@ static int pcistub_device_id_remove(int domain, int bus, int slot, int func)
934 934
935 err = 0; 935 err = 0;
936 936
937 pr_debug(DRV_NAME ": removed %04x:%02x:%02x.%01x from " 937 pr_debug(DRV_NAME ": removed %04x:%02x:%02x.%d from "
938 "seize list\n", domain, bus, slot, func); 938 "seize list\n", domain, bus, slot, func);
939 } 939 }
940 } 940 }
@@ -1029,7 +1029,7 @@ static ssize_t pcistub_slot_show(struct device_driver *drv, char *buf)
1029 break; 1029 break;
1030 1030
1031 count += scnprintf(buf + count, PAGE_SIZE - count, 1031 count += scnprintf(buf + count, PAGE_SIZE - count,
1032 "%04x:%02x:%02x.%01x\n", 1032 "%04x:%02x:%02x.%d\n",
1033 pci_dev_id->domain, pci_dev_id->bus, 1033 pci_dev_id->domain, pci_dev_id->bus,
1034 PCI_SLOT(pci_dev_id->devfn), 1034 PCI_SLOT(pci_dev_id->devfn),
1035 PCI_FUNC(pci_dev_id->devfn)); 1035 PCI_FUNC(pci_dev_id->devfn));
diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index d5dcf8d5d3d9..64b11f99eacc 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -206,6 +206,7 @@ static int xen_pcibk_publish_pci_dev(struct xen_pcibk_device *pdev,
206 goto out; 206 goto out;
207 } 207 }
208 208
209 /* Note: The PV protocol uses %02x, don't change it */
209 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, str, 210 err = xenbus_printf(XBT_NIL, pdev->xdev->nodename, str,
210 "%04x:%02x:%02x.%02x", domain, bus, 211 "%04x:%02x:%02x.%02x", domain, bus,
211 PCI_SLOT(devfn), PCI_FUNC(devfn)); 212 PCI_SLOT(devfn), PCI_FUNC(devfn));
@@ -229,7 +230,7 @@ static int xen_pcibk_export_device(struct xen_pcibk_device *pdev,
229 err = -EINVAL; 230 err = -EINVAL;
230 xenbus_dev_fatal(pdev->xdev, err, 231 xenbus_dev_fatal(pdev->xdev, err,
231 "Couldn't locate PCI device " 232 "Couldn't locate PCI device "
232 "(%04x:%02x:%02x.%01x)! " 233 "(%04x:%02x:%02x.%d)! "
233 "perhaps already in-use?", 234 "perhaps already in-use?",
234 domain, bus, slot, func); 235 domain, bus, slot, func);
235 goto out; 236 goto out;
@@ -274,7 +275,7 @@ static int xen_pcibk_remove_device(struct xen_pcibk_device *pdev,
274 if (!dev) { 275 if (!dev) {
275 err = -EINVAL; 276 err = -EINVAL;
276 dev_dbg(&pdev->xdev->dev, "Couldn't locate PCI device " 277 dev_dbg(&pdev->xdev->dev, "Couldn't locate PCI device "
277 "(%04x:%02x:%02x.%01x)! not owned by this domain\n", 278 "(%04x:%02x:%02x.%d)! not owned by this domain\n",
278 domain, bus, slot, func); 279 domain, bus, slot, func);
279 goto out; 280 goto out;
280 } 281 }
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c
index 527dc2a3b89f..89f76252a16f 100644
--- a/drivers/xen/xenbus/xenbus_dev_frontend.c
+++ b/drivers/xen/xenbus/xenbus_dev_frontend.c
@@ -369,6 +369,10 @@ static int xenbus_write_watch(unsigned msg_type, struct xenbus_file_priv *u)
369 goto out; 369 goto out;
370 } 370 }
371 token++; 371 token++;
372 if (memchr(token, 0, u->u.msg.len - (token - path)) == NULL) {
373 rc = -EILSEQ;
374 goto out;
375 }
372 376
373 if (msg_type == XS_WATCH) { 377 if (msg_type == XS_WATCH) {
374 watch = alloc_watch_adapter(path, token); 378 watch = alloc_watch_adapter(path, token);