--- /dev/null
+From f1d8e614d74b09531b9a85e812485340f3df7b1c Mon Sep 17 00:00:00 2001
+From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
+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 <zhenzhong.duan@oracle.com>
+
+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 <zhenzhong.duan@oracle.com>
+Cc: Feng Jin <joe.jin@oracle.com>
+Cc: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Abdallah Chatila <abdallah.chatila@ericsson.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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);
--- /dev/null
+From 9f9c9cbb60576a1518d0bf93fb8e499cffccf377 Mon Sep 17 00:00:00 2001
+From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
+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 <zhenzhong.duan@oracle.com>
+
+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 <zhenzhong.duan@oracle.com>
+Cc: Feng Jin <joe.jin@oracle.com>
+Cc: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Abdallah Chatila <abdallah.chatila@ericsson.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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);
--- /dev/null
+From afd5e34b2bb34881d3a789e62486814a49b47faa Mon Sep 17 00:00:00 2001
+From: "Joel D. Diaz" <joeldiaz@us.ibm.com>
+Date: Wed, 10 Oct 2012 10:36:11 +0200
+Subject: SCSI: sd: Reshuffle init_sd to avoid crash
+
+From: "Joel D. Diaz" <joeldiaz@us.ibm.com>
+
+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 <joeldiaz@us.ibm.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: James Bottomley <JBottomley@Parallels.com>
+Cc: CAI Qian <caiqian@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/sd.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -2826,10 +2826,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) {
+@@ -2843,8 +2839,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);
+
+@@ -2867,10 +2870,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++)
drm-i915-invalidate-the-relocation-presumed_offsets-along-the-slow-path.patch
ftrace-be-first-to-run-code-modification-on-modules.patch
pci-allow-pcie_aspm-force-even-when-fadt-indicates-it-is-unsupported.patch
+usb-uhci-fix-irq-race-during-initialization.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
--- /dev/null
+From 091a62c9b3d899d99dbf4e3dbebc8dfa3edbccdd Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
+Date: Fri, 14 Dec 2012 21:30:27 +0300
+Subject: usb: musb: cppi_dma: drop '__init' annotation
+
+From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
+
+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 <sshtylyov@ru.mvista.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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;
--- /dev/null
+From 0f815a0a700bc10547449bde6c106051a035a1b9 Mon Sep 17 00:00:00 2001
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Tue, 22 Jan 2013 11:37:35 -0500
+Subject: USB: UHCI: fix IRQ race during initialization
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+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 <stern@rowland.harvard.edu>
+Reported-by: Don Zickus <dzickus@redhat.com>
+Tested-by: "Huang, Adrian (ISS Linux TW)" <adrian.huang@hp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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
+@@ -446,6 +446,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, "
+@@ -454,7 +458,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, "
+@@ -472,15 +475,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);
+ }
+
+@@ -658,9 +661,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;