From ab0ecd9c5914a54f5c81494d84e9ec4afe735788 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 24 Jan 2013 09:18:44 -0800 Subject: [PATCH] 3.4-stable patches added patches: drivers-firmware-dmi_scan.c-check-dmi-version-when-get.patch drivers-firmware-dmi_scan.c-fetch-dmi-version-from-smbios-if-it-exists.patch scsi-sd-reshuffle-init_sd-to-avoid-crash.patch usb-dwc3-gadget-fix-ep-maxburst-for-ep0.patch usb-musb-cppi_dma-drop-__init-annotation.patch usb-uhci-fix-irq-race-during-initialization.patch --- ...mi_scan.c-check-dmi-version-when-get.patch | 76 +++++++++ ...dmi-version-from-smbios-if-it-exists.patch | 149 ++++++++++++++++++ ...-sd-reshuffle-init_sd-to-avoid-crash.patch | 66 ++++++++ queue-3.4/series | 6 + ...-dwc3-gadget-fix-ep-maxburst-for-ep0.patch | 30 ++++ ...musb-cppi_dma-drop-__init-annotation.patch | 54 +++++++ ...i-fix-irq-race-during-initialization.patch | 79 ++++++++++ 7 files changed, 460 insertions(+) create mode 100644 queue-3.4/drivers-firmware-dmi_scan.c-check-dmi-version-when-get.patch create mode 100644 queue-3.4/drivers-firmware-dmi_scan.c-fetch-dmi-version-from-smbios-if-it-exists.patch create mode 100644 queue-3.4/scsi-sd-reshuffle-init_sd-to-avoid-crash.patch create mode 100644 queue-3.4/usb-dwc3-gadget-fix-ep-maxburst-for-ep0.patch create mode 100644 queue-3.4/usb-musb-cppi_dma-drop-__init-annotation.patch create mode 100644 queue-3.4/usb-uhci-fix-irq-race-during-initialization.patch diff --git a/queue-3.4/drivers-firmware-dmi_scan.c-check-dmi-version-when-get.patch b/queue-3.4/drivers-firmware-dmi_scan.c-check-dmi-version-when-get.patch new file mode 100644 index 00000000000..237fe9c0972 --- /dev/null +++ b/queue-3.4/drivers-firmware-dmi_scan.c-check-dmi-version-when-get.patch @@ -0,0 +1,76 @@ +From f1d8e614d74b09531b9a85e812485340f3df7b1c Mon Sep 17 00:00:00 2001 +From: Zhenzhong Duan +Date: Thu, 20 Dec 2012 15:05:13 -0800 +Subject: drivers/firmware/dmi_scan.c: check dmi version when get + system uuid + +From: Zhenzhong Duan + +commit f1d8e614d74b09531b9a85e812485340f3df7b1c upstream. + +As of version 2.6 of the SMBIOS specification, the first 3 fields of the +UUID are supposed to be little-endian encoded. + +Also a minor fix to match variable meaning and mute checkpatch.pl + +[akpm@linux-foundation.org: tweak code comment] +Signed-off-by: Zhenzhong Duan +Cc: Feng Jin +Cc: Jean Delvare +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Abdallah Chatila +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/firmware/dmi_scan.c | 18 +++++++++++++++--- + 1 file changed, 15 insertions(+), 3 deletions(-) + +--- a/drivers/firmware/dmi_scan.c ++++ b/drivers/firmware/dmi_scan.c +@@ -16,6 +16,7 @@ + */ + static char dmi_empty_string[] = " "; + ++static u16 __initdata dmi_ver; + /* + * Catch too early calls to dmi_check_system(): + */ +@@ -161,8 +162,10 @@ static void __init dmi_save_uuid(const s + return; + + for (i = 0; i < 16 && (is_ff || is_00); i++) { +- if(d[i] != 0x00) is_ff = 0; +- if(d[i] != 0xFF) is_00 = 0; ++ if (d[i] != 0x00) ++ is_00 = 0; ++ if (d[i] != 0xFF) ++ is_ff = 0; + } + + if (is_ff || is_00) +@@ -172,7 +175,15 @@ static void __init dmi_save_uuid(const s + if (!s) + return; + +- sprintf(s, "%pUB", d); ++ /* ++ * As of version 2.6 of the SMBIOS specification, the first 3 fields of ++ * the UUID are supposed to be little-endian encoded. The specification ++ * says that this is the defacto standard. ++ */ ++ if (dmi_ver >= 0x0206) ++ sprintf(s, "%pUL", d); ++ else ++ sprintf(s, "%pUB", d); + + dmi_ident[slot] = s; + } +@@ -414,6 +425,7 @@ static int __init dmi_present(const char + * DMI version 0.0 means that the real version is taken from + * the SMBIOS version, which we don't know at this point. + */ ++ dmi_ver = (buf[14] & 0xf0) << 4 | (buf[14] & 0x0f); + if (buf[14] != 0) + printk(KERN_INFO "DMI %d.%d present.\n", + buf[14] >> 4, buf[14] & 0xF); diff --git a/queue-3.4/drivers-firmware-dmi_scan.c-fetch-dmi-version-from-smbios-if-it-exists.patch b/queue-3.4/drivers-firmware-dmi_scan.c-fetch-dmi-version-from-smbios-if-it-exists.patch new file mode 100644 index 00000000000..70b3d8e5cbe --- /dev/null +++ b/queue-3.4/drivers-firmware-dmi_scan.c-fetch-dmi-version-from-smbios-if-it-exists.patch @@ -0,0 +1,149 @@ +From 9f9c9cbb60576a1518d0bf93fb8e499cffccf377 Mon Sep 17 00:00:00 2001 +From: Zhenzhong Duan +Date: Thu, 20 Dec 2012 15:05:14 -0800 +Subject: drivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists + +From: Zhenzhong Duan + +commit 9f9c9cbb60576a1518d0bf93fb8e499cffccf377 upstream. + +The right dmi version is in SMBIOS if it's zero in DMI region + +This issue was originally found from an oracle bug. +One customer noticed system UUID doesn't match between dmidecode & uek2. + + - HP ProLiant BL460c G6 : + # cat /sys/devices/virtual/dmi/id/product_uuid + 00000000-0000-4C48-3031-4D5030333531 + # dmidecode | grep -i uuid + UUID: 00000000-0000-484C-3031-4D5030333531 + +From SMBIOS 2.6 on, spec use little-endian encoding for UUID other than +network byte order. + +So we need to get dmi version to distinguish. If version is 0.0, the +real version is taken from the SMBIOS version. This is part of original +kernel comment in code. + +[akpm@linux-foundation.org: checkpatch fixes] +Signed-off-by: Zhenzhong Duan +Cc: Feng Jin +Cc: Jean Delvare +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Abdallah Chatila +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/firmware/dmi_scan.c | 62 +++++++++++++++++++++++++++++++++----------- + 1 file changed, 47 insertions(+), 15 deletions(-) + +--- a/drivers/firmware/dmi_scan.c ++++ b/drivers/firmware/dmi_scan.c +@@ -119,12 +119,12 @@ static int __init dmi_walk_early(void (* + return 0; + } + +-static int __init dmi_checksum(const u8 *buf) ++static int __init dmi_checksum(const u8 *buf, u8 len) + { + u8 sum = 0; + int a; + +- for (a = 0; a < 15; a++) ++ for (a = 0; a < len; a++) + sum += buf[a]; + + return sum == 0; +@@ -415,30 +415,57 @@ static int __init dmi_present(const char + u8 buf[15]; + + memcpy_fromio(buf, p, 15); +- if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { ++ if (dmi_checksum(buf, 15)) { + dmi_num = (buf[13] << 8) | buf[12]; + dmi_len = (buf[7] << 8) | buf[6]; + dmi_base = (buf[11] << 24) | (buf[10] << 16) | + (buf[9] << 8) | buf[8]; + +- /* +- * DMI version 0.0 means that the real version is taken from +- * the SMBIOS version, which we don't know at this point. +- */ +- dmi_ver = (buf[14] & 0xf0) << 4 | (buf[14] & 0x0f); +- if (buf[14] != 0) +- printk(KERN_INFO "DMI %d.%d present.\n", +- buf[14] >> 4, buf[14] & 0xF); +- else +- printk(KERN_INFO "DMI present.\n"); + if (dmi_walk_early(dmi_decode) == 0) { ++ if (dmi_ver) ++ pr_info("SMBIOS %d.%d present.\n", ++ dmi_ver >> 8, dmi_ver & 0xFF); ++ else { ++ dmi_ver = (buf[14] & 0xF0) << 4 | ++ (buf[14] & 0x0F); ++ pr_info("Legacy DMI %d.%d present.\n", ++ dmi_ver >> 8, dmi_ver & 0xFF); ++ } + dmi_dump_ids(); + return 0; + } + } ++ dmi_ver = 0; + return 1; + } + ++static int __init smbios_present(const char __iomem *p) ++{ ++ u8 buf[32]; ++ int offset = 0; ++ ++ memcpy_fromio(buf, p, 32); ++ if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) { ++ dmi_ver = (buf[6] << 8) + buf[7]; ++ ++ /* Some BIOS report weird SMBIOS version, fix that up */ ++ switch (dmi_ver) { ++ case 0x021F: ++ case 0x0221: ++ pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", ++ dmi_ver & 0xFF, 3); ++ dmi_ver = 0x0203; ++ break; ++ case 0x0233: ++ pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", 51, 6); ++ dmi_ver = 0x0206; ++ break; ++ } ++ offset = 16; ++ } ++ return dmi_present(buf + offset); ++} ++ + void __init dmi_scan_machine(void) + { + char __iomem *p, *q; +@@ -456,7 +483,7 @@ void __init dmi_scan_machine(void) + if (p == NULL) + goto error; + +- rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ ++ rc = smbios_present(p); + dmi_iounmap(p, 32); + if (!rc) { + dmi_available = 1; +@@ -474,7 +501,12 @@ void __init dmi_scan_machine(void) + goto error; + + for (q = p; q < p + 0x10000; q += 16) { +- rc = dmi_present(q); ++ if (memcmp(q, "_SM_", 4) == 0 && q - p <= 0xFFE0) ++ rc = smbios_present(q); ++ else if (memcmp(q, "_DMI_", 5) == 0) ++ rc = dmi_present(q); ++ else ++ continue; + if (!rc) { + dmi_available = 1; + dmi_iounmap(p, 0x10000); diff --git a/queue-3.4/scsi-sd-reshuffle-init_sd-to-avoid-crash.patch b/queue-3.4/scsi-sd-reshuffle-init_sd-to-avoid-crash.patch new file mode 100644 index 00000000000..b6df93ba818 --- /dev/null +++ b/queue-3.4/scsi-sd-reshuffle-init_sd-to-avoid-crash.patch @@ -0,0 +1,66 @@ +From afd5e34b2bb34881d3a789e62486814a49b47faa Mon Sep 17 00:00:00 2001 +From: "Joel D. Diaz" +Date: Wed, 10 Oct 2012 10:36:11 +0200 +Subject: SCSI: sd: Reshuffle init_sd to avoid crash + +From: "Joel D. Diaz" + +commit afd5e34b2bb34881d3a789e62486814a49b47faa upstream. + +scsi_register_driver will register a prep_fn() function, which +in turn migh need to use the sd_cdp_pool for DIF. +Which hasn't been initialised at this point, leading to +a crash. So reshuffle the init_sd() and exit_sd() paths +to have the driver registered last. + +Signed-off-by: Joel D. Diaz +Signed-off-by: Hannes Reinecke +Signed-off-by: James Bottomley +Cc: CAI Qian +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/sd.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +--- a/drivers/scsi/sd.c ++++ b/drivers/scsi/sd.c +@@ -2919,10 +2919,6 @@ static int __init init_sd(void) + if (err) + goto err_out; + +- err = scsi_register_driver(&sd_template.gendrv); +- if (err) +- goto err_out_class; +- + sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE, + 0, 0, NULL); + if (!sd_cdb_cache) { +@@ -2936,8 +2932,15 @@ static int __init init_sd(void) + goto err_out_cache; + } + ++ err = scsi_register_driver(&sd_template.gendrv); ++ if (err) ++ goto err_out_driver; ++ + return 0; + ++err_out_driver: ++ mempool_destroy(sd_cdb_pool); ++ + err_out_cache: + kmem_cache_destroy(sd_cdb_cache); + +@@ -2960,10 +2963,10 @@ static void __exit exit_sd(void) + + SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n")); + ++ scsi_unregister_driver(&sd_template.gendrv); + mempool_destroy(sd_cdb_pool); + kmem_cache_destroy(sd_cdb_cache); + +- scsi_unregister_driver(&sd_template.gendrv); + class_unregister(&sd_disk_class); + + for (i = 0; i < SD_MAJORS; i++) diff --git a/queue-3.4/series b/queue-3.4/series index cd51d36b3a0..6178da66884 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -9,3 +9,9 @@ pci-aer-pci_get_domain_bus_and_slot-call-missing-required-pci_dev_put.patch pci-allow-pcie_aspm-force-even-when-fadt-indicates-it-is-unsupported.patch pci-pciehp-use-per-slot-workqueues-to-avoid-deadlock.patch pci-shpchp-handle-push-button-event-asynchronously.patch +usb-uhci-fix-irq-race-during-initialization.patch +usb-dwc3-gadget-fix-ep-maxburst-for-ep0.patch +usb-musb-cppi_dma-drop-__init-annotation.patch +scsi-sd-reshuffle-init_sd-to-avoid-crash.patch +drivers-firmware-dmi_scan.c-check-dmi-version-when-get.patch +drivers-firmware-dmi_scan.c-fetch-dmi-version-from-smbios-if-it-exists.patch diff --git a/queue-3.4/usb-dwc3-gadget-fix-ep-maxburst-for-ep0.patch b/queue-3.4/usb-dwc3-gadget-fix-ep-maxburst-for-ep0.patch new file mode 100644 index 00000000000..690cf6ff19c --- /dev/null +++ b/queue-3.4/usb-dwc3-gadget-fix-ep-maxburst-for-ep0.patch @@ -0,0 +1,30 @@ +From 6048e4c69d80600baba35856651056860d5d8f5a Mon Sep 17 00:00:00 2001 +From: Pratyush Anand +Date: Fri, 18 Jan 2013 16:53:56 +0530 +Subject: usb: dwc3: gadget: fix ep->maxburst for ep0 + +From: Pratyush Anand + +commit 6048e4c69d80600baba35856651056860d5d8f5a upstream. + +dwc3_gadget_set_ep_config expects maxburst as incremented by 1. So, by +default initialize ep->maxburst to 1 for ep0. + +Signed-off-by: Pratyush Anand +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/dwc3/gadget.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -1453,6 +1453,7 @@ static int __devinit dwc3_gadget_init_en + + if (epnum == 0 || epnum == 1) { + dep->endpoint.maxpacket = 512; ++ dep->endpoint.maxburst = 1; + dep->endpoint.ops = &dwc3_gadget_ep0_ops; + if (!epnum) + dwc->gadget.ep0 = &dep->endpoint; diff --git a/queue-3.4/usb-musb-cppi_dma-drop-__init-annotation.patch b/queue-3.4/usb-musb-cppi_dma-drop-__init-annotation.patch new file mode 100644 index 00000000000..29475cd5192 --- /dev/null +++ b/queue-3.4/usb-musb-cppi_dma-drop-__init-annotation.patch @@ -0,0 +1,54 @@ +From 091a62c9b3d899d99dbf4e3dbebc8dfa3edbccdd Mon Sep 17 00:00:00 2001 +From: Sergei Shtylyov +Date: Fri, 14 Dec 2012 21:30:27 +0300 +Subject: usb: musb: cppi_dma: drop '__init' annotation + +From: Sergei Shtylyov + +commit 091a62c9b3d899d99dbf4e3dbebc8dfa3edbccdd upstream. + +This patch fixes the following: + +WARNING: vmlinux.o(.text+0x1e709c): Section mismatch in reference from the funct +ion dma_controller_create() to the function .init.text:cppi_controller_start() +The function dma_controller_create() references +the function __init cppi_controller_start(). +This is often because dma_controller_create lacks a __init +annotation or the annotation of cppi_controller_start is wrong. + +This warning is there due to the deficiency in the commit 07a67bbb (usb: musb: +Make dma_controller_create __devinit). + +Since the start() method is only called from musb_init_controller() which is +not annotated, drop '__init' annotation from cppi_controller_start() and also +cppi_pool_init() since it gets called from that function, to avoid another +section mismatch warning... + +Signed-off-by: Sergei Shtylyov +Signed-off-by: Felipe Balbi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/musb/cppi_dma.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/usb/musb/cppi_dma.c ++++ b/drivers/usb/musb/cppi_dma.c +@@ -104,7 +104,7 @@ static void cppi_reset_tx(struct cppi_tx + musb_writel(&tx->tx_complete, 0, ptr); + } + +-static void __init cppi_pool_init(struct cppi *cppi, struct cppi_channel *c) ++static void cppi_pool_init(struct cppi *cppi, struct cppi_channel *c) + { + int j; + +@@ -149,7 +149,7 @@ static void cppi_pool_free(struct cppi_c + c->last_processed = NULL; + } + +-static int __init cppi_controller_start(struct dma_controller *c) ++static int cppi_controller_start(struct dma_controller *c) + { + struct cppi *controller; + void __iomem *tibase; diff --git a/queue-3.4/usb-uhci-fix-irq-race-during-initialization.patch b/queue-3.4/usb-uhci-fix-irq-race-during-initialization.patch new file mode 100644 index 00000000000..c393618d417 --- /dev/null +++ b/queue-3.4/usb-uhci-fix-irq-race-during-initialization.patch @@ -0,0 +1,79 @@ +From 0f815a0a700bc10547449bde6c106051a035a1b9 Mon Sep 17 00:00:00 2001 +From: Alan Stern +Date: Tue, 22 Jan 2013 11:37:35 -0500 +Subject: USB: UHCI: fix IRQ race during initialization + +From: Alan Stern + +commit 0f815a0a700bc10547449bde6c106051a035a1b9 upstream. + +This patch (as1644) fixes a race that occurs during startup in +uhci-hcd. If the IRQ line is shared with other devices, it's possible +for the handler routine to be called before the data structures are +fully initialized. + +The problem is fixed by adding a check to the IRQ handler routine. If +the initialization hasn't finished yet, the routine will return +immediately. + +Signed-off-by: Alan Stern +Reported-by: Don Zickus +Tested-by: "Huang, Adrian (ISS Linux TW)" +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/uhci-hcd.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +--- a/drivers/usb/host/uhci-hcd.c ++++ b/drivers/usb/host/uhci-hcd.c +@@ -447,6 +447,10 @@ static irqreturn_t uhci_irq(struct usb_h + return IRQ_NONE; + uhci_writew(uhci, status, USBSTS); /* Clear it */ + ++ spin_lock(&uhci->lock); ++ if (unlikely(!uhci->is_initialized)) /* not yet configured */ ++ goto done; ++ + if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) { + if (status & USBSTS_HSE) + dev_err(uhci_dev(uhci), "host system error, " +@@ -455,7 +459,6 @@ static irqreturn_t uhci_irq(struct usb_h + dev_err(uhci_dev(uhci), "host controller process " + "error, something bad happened!\n"); + if (status & USBSTS_HCH) { +- spin_lock(&uhci->lock); + if (uhci->rh_state >= UHCI_RH_RUNNING) { + dev_err(uhci_dev(uhci), + "host controller halted, " +@@ -473,15 +476,15 @@ static irqreturn_t uhci_irq(struct usb_h + * pending unlinks */ + mod_timer(&hcd->rh_timer, jiffies); + } +- spin_unlock(&uhci->lock); + } + } + +- if (status & USBSTS_RD) ++ if (status & USBSTS_RD) { ++ spin_unlock(&uhci->lock); + usb_hcd_poll_rh_status(hcd); +- else { +- spin_lock(&uhci->lock); ++ } else { + uhci_scan_schedule(uhci); ++ done: + spin_unlock(&uhci->lock); + } + +@@ -662,9 +665,9 @@ static int uhci_start(struct usb_hcd *hc + */ + mb(); + ++ spin_lock_irq(&uhci->lock); + configure_hc(uhci); + uhci->is_initialized = 1; +- spin_lock_irq(&uhci->lock); + start_rh(uhci); + spin_unlock_irq(&uhci->lock); + return 0; -- 2.47.3