From: Greg Kroah-Hartman Date: Tue, 2 Sep 2014 21:56:50 +0000 (-0700) Subject: 3.16-stable patches X-Git-Tag: v3.10.54~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=46bcee9ae2f2a77e01c2b58408a9b5cbe10f545d;p=thirdparty%2Fkernel%2Fstable-queue.git 3.16-stable patches added patches: acpi-pci-fix-sysfs-acpi_index-and-label-errors.patch drm-radeon-add-additional-si-pci-ids.patch drm-radeon-add-new-bonaire-pci-ids.patch drm-radeon-add-new-kv-pci-id.patch hpsa-fix-bad-enomem-return-value-in-hpsa_big_passthru_ioctl.patch hpsa-fix-non-x86-builds.patch pci-configure-aspm-when-enabling-device.patch pci-keep-original-resource-if-we-fail-to-expand-it.patch pci-pciehp-clear-data-link-layer-state-changed-during-init.patch powerpc-eeh-wrong-place-to-call-pci_get_slot.patch powerpc-pci-reorder-pci-bus-bridge-unregistration-during-phb-removal.patch powerpc-powernv-update-dev-dma_mask-in-pci_set_dma_mask-path.patch x86-don-t-exclude-low-bios-area-when-allocating-address-space-for-non-pci-cards.patch x86-efi-enforce-config_relocatable-for-efi-boot-stub.patch x86-ia64-move-efi_fb-vga_default_device-initialization-to-pci_vga_fixup.patch x86-mce-add-raw_lock-conversion-again.patch x86-mm-fix-pte_special-versus-pte_numa.patch x86-xen-resume-timer-irqs-early.patch x86-xen-use-vmap-to-map-grant-table-pages-in-pvh-guests.patch x86_64-vsyscall-fix-warn_bad_vsyscall-log-output.patch xen-events-fifo-ensure-all-bitops-are-properly-aligned-even-on-x86.patch --- diff --git a/queue-3.16/acpi-pci-fix-sysfs-acpi_index-and-label-errors.patch b/queue-3.16/acpi-pci-fix-sysfs-acpi_index-and-label-errors.patch new file mode 100644 index 00000000000..3fcfb4e2e41 --- /dev/null +++ b/queue-3.16/acpi-pci-fix-sysfs-acpi_index-and-label-errors.patch @@ -0,0 +1,79 @@ +From dcfa9be83866e28fcb8b7e22b4eeb4ba63bd3174 Mon Sep 17 00:00:00 2001 +From: Simone Gotti +Date: Wed, 18 Jun 2014 16:55:30 +0200 +Subject: ACPI / PCI: Fix sysfs acpi_index and label errors + +From: Simone Gotti + +commit dcfa9be83866e28fcb8b7e22b4eeb4ba63bd3174 upstream. + +Fix errors in handling "device label" _DSM return values. + +If _DSM returns a Unicode string, the ACPI type is ACPI_TYPE_BUFFER, not +ACPI_TYPE_STRING. Fix dsm_label_utf16s_to_utf8s() to convert UTF-16 from +acpi_object->buffer instead of acpi_object->string. + +Prior to v3.14, we accepted Unicode labels (ACPI_TYPE_BUFFER return +values). But after 1d0fcef73283, we accepted only ASCII (ACPI_TYPE_STRING) +(and we incorrectly tried to convert those ASCII labels from UTF-16 to +UTF-8). + +Rejecting Unicode labels made us return -EPERM when reading sysfs +"acpi_index" or "label" files, which in turn caused on-board network +interfaces on a Dell PowerEdge E420 to be renamed (by udev net_id internal) +from eno1/eno2 to enp2s0f0/enp2s0f1. + +Fix this by accepting either ACPI_TYPE_STRING (and treating it as ASCII) or +ACPI_TYPE_BUFFER (and converting from UTF-16 to UTF-8). + +[bhelgaas: changelog] +Fixes: 1d0fcef73283 ("ACPI / PCI: replace open-coded _DSM code with helper functions") +Signed-off-by: Simone Gotti +Signed-off-by: Bjorn Helgaas +Reviewed-by: Jiang Liu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/pci-label.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +--- a/drivers/pci/pci-label.c ++++ b/drivers/pci/pci-label.c +@@ -161,8 +161,8 @@ enum acpi_attr_enum { + static void dsm_label_utf16s_to_utf8s(union acpi_object *obj, char *buf) + { + int len; +- len = utf16s_to_utf8s((const wchar_t *)obj->string.pointer, +- obj->string.length, ++ len = utf16s_to_utf8s((const wchar_t *)obj->buffer.pointer, ++ obj->buffer.length, + UTF16_LITTLE_ENDIAN, + buf, PAGE_SIZE); + buf[len] = '\n'; +@@ -187,16 +187,22 @@ static int dsm_get_label(struct device * + tmp = obj->package.elements; + if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 && + tmp[0].type == ACPI_TYPE_INTEGER && +- tmp[1].type == ACPI_TYPE_STRING) { ++ (tmp[1].type == ACPI_TYPE_STRING || ++ tmp[1].type == ACPI_TYPE_BUFFER)) { + /* + * The second string element is optional even when + * this _DSM is implemented; when not implemented, + * this entry must return a null string. + */ +- if (attr == ACPI_ATTR_INDEX_SHOW) ++ if (attr == ACPI_ATTR_INDEX_SHOW) { + scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value); +- else if (attr == ACPI_ATTR_LABEL_SHOW) +- dsm_label_utf16s_to_utf8s(tmp + 1, buf); ++ } else if (attr == ACPI_ATTR_LABEL_SHOW) { ++ if (tmp[1].type == ACPI_TYPE_STRING) ++ scnprintf(buf, PAGE_SIZE, "%s\n", ++ tmp[1].string.pointer); ++ else if (tmp[1].type == ACPI_TYPE_BUFFER) ++ dsm_label_utf16s_to_utf8s(tmp + 1, buf); ++ } + len = strlen(buf) > 0 ? strlen(buf) : -1; + } + diff --git a/queue-3.16/drm-radeon-add-additional-si-pci-ids.patch b/queue-3.16/drm-radeon-add-additional-si-pci-ids.patch new file mode 100644 index 00000000000..2379a54b32a --- /dev/null +++ b/queue-3.16/drm-radeon-add-additional-si-pci-ids.patch @@ -0,0 +1,38 @@ +From 37dbeab788a8f23fd946c0be083e5484d6f929a1 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Thu, 21 Aug 2014 10:55:07 -0400 +Subject: drm/radeon: add additional SI pci ids + +From: Alex Deucher + +commit 37dbeab788a8f23fd946c0be083e5484d6f929a1 upstream. + +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + include/drm/drm_pciids.h | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/include/drm/drm_pciids.h ++++ b/include/drm/drm_pciids.h +@@ -165,8 +165,11 @@ + {0x1002, 0x6601, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6602, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6603, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ ++ {0x1002, 0x6604, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ ++ {0x1002, 0x6605, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6606, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6607, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ ++ {0x1002, 0x6608, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ +@@ -300,6 +303,7 @@ + {0x1002, 0x6829, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x682A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x682B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ ++ {0x1002, 0x682C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x682D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x682F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6830, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VERDE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ diff --git a/queue-3.16/drm-radeon-add-new-bonaire-pci-ids.patch b/queue-3.16/drm-radeon-add-new-bonaire-pci-ids.patch new file mode 100644 index 00000000000..9d4831ef81c --- /dev/null +++ b/queue-3.16/drm-radeon-add-new-bonaire-pci-ids.patch @@ -0,0 +1,27 @@ +From 5fc540edc8ea1297c76685f74bc82a2107fe6731 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Thu, 21 Aug 2014 10:48:11 -0400 +Subject: drm/radeon: add new bonaire pci ids + +From: Alex Deucher + +commit 5fc540edc8ea1297c76685f74bc82a2107fe6731 upstream. + +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + include/drm/drm_pciids.h | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/include/drm/drm_pciids.h ++++ b/include/drm/drm_pciids.h +@@ -176,6 +176,8 @@ + {0x1002, 0x6631, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6640, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6641, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ ++ {0x1002, 0x6646, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ ++ {0x1002, 0x6647, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6649, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6650, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ + {0x1002, 0x6651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BONAIRE|RADEON_NEW_MEMMAP}, \ diff --git a/queue-3.16/drm-radeon-add-new-kv-pci-id.patch b/queue-3.16/drm-radeon-add-new-kv-pci-id.patch new file mode 100644 index 00000000000..7fa22c1a908 --- /dev/null +++ b/queue-3.16/drm-radeon-add-new-kv-pci-id.patch @@ -0,0 +1,40 @@ +From 6dc14baf4ced769017c7a7045019c7a19f373865 Mon Sep 17 00:00:00 2001 +From: Alex Deucher +Date: Thu, 21 Aug 2014 10:41:42 -0400 +Subject: drm/radeon: add new KV pci id + +From: Alex Deucher + +commit 6dc14baf4ced769017c7a7045019c7a19f373865 upstream. + +bug: +https://bugs.freedesktop.org/show_bug.cgi?id=82912 + +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/radeon/cik.c | 1 + + include/drm/drm_pciids.h | 1 + + 2 files changed, 2 insertions(+) + +--- a/drivers/gpu/drm/radeon/cik.c ++++ b/drivers/gpu/drm/radeon/cik.c +@@ -3320,6 +3320,7 @@ static void cik_gpu_init(struct radeon_d + (rdev->pdev->device == 0x130B) || + (rdev->pdev->device == 0x130E) || + (rdev->pdev->device == 0x1315) || ++ (rdev->pdev->device == 0x1318) || + (rdev->pdev->device == 0x131B)) { + rdev->config.cik.max_cu_per_sh = 4; + rdev->config.cik.max_backends_per_se = 1; +--- a/include/drm/drm_pciids.h ++++ b/include/drm/drm_pciids.h +@@ -17,6 +17,7 @@ + {0x1002, 0x1315, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ + {0x1002, 0x1316, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ + {0x1002, 0x1317, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ ++ {0x1002, 0x1318, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ + {0x1002, 0x131B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ + {0x1002, 0x131C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ + {0x1002, 0x131D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_KAVERI|RADEON_NEW_MEMMAP|RADEON_IS_IGP}, \ diff --git a/queue-3.16/hpsa-fix-bad-enomem-return-value-in-hpsa_big_passthru_ioctl.patch b/queue-3.16/hpsa-fix-bad-enomem-return-value-in-hpsa_big_passthru_ioctl.patch new file mode 100644 index 00000000000..96859295557 --- /dev/null +++ b/queue-3.16/hpsa-fix-bad-enomem-return-value-in-hpsa_big_passthru_ioctl.patch @@ -0,0 +1,34 @@ +From 0758f4f732b08b6ef07f2e5f735655cf69fea477 Mon Sep 17 00:00:00 2001 +From: "Stephen M. Cameron" +Date: Thu, 3 Jul 2014 10:18:03 -0500 +Subject: hpsa: fix bad -ENOMEM return value in hpsa_big_passthru_ioctl + +From: "Stephen M. Cameron" + +commit 0758f4f732b08b6ef07f2e5f735655cf69fea477 upstream. + +When copy_from_user fails, return -EFAULT, not -ENOMEM + +Signed-off-by: Stephen M. Cameron +Reported-by: Robert Elliott +Reviewed-by: Joe Handzik +Reviewed-by: Scott Teel +Reviewed by: Mike MIller +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/hpsa.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/hpsa.c ++++ b/drivers/scsi/hpsa.c +@@ -5092,7 +5092,7 @@ static int hpsa_big_passthru_ioctl(struc + } + if (ioc->Request.Type.Direction & XFER_WRITE) { + if (copy_from_user(buff[sg_used], data_ptr, sz)) { +- status = -ENOMEM; ++ status = -EFAULT; + goto cleanup1; + } + } else diff --git a/queue-3.16/hpsa-fix-non-x86-builds.patch b/queue-3.16/hpsa-fix-non-x86-builds.patch new file mode 100644 index 00000000000..8cf12bf55f4 --- /dev/null +++ b/queue-3.16/hpsa-fix-non-x86-builds.patch @@ -0,0 +1,48 @@ +From 0b9e7b741f2bf8103b15bb14d5b4a6f5ee91c59a Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Thu, 26 Jun 2014 15:44:52 +0200 +Subject: hpsa: fix non-x86 builds + +From: Arnd Bergmann + +commit 0b9e7b741f2bf8103b15bb14d5b4a6f5ee91c59a upstream. + +commit 28e134464734 "[SCSI] hpsa: enable unit attention reporting" +turns on unit attention notifications, but got the change wrong for +all architectures other than x86, which now store an uninitialized +value into the device register. + +Gcc helpfully warns about this: + +../drivers/scsi/hpsa.c: In function 'hpsa_set_driver_support_bits': +../drivers/scsi/hpsa.c:6373:17: warning: 'driver_support' is used uninitialized in this function [-Wuninitialized] + driver_support |= ENABLE_UNIT_ATTN; + ^ + +This moves the #ifdef so only the prefetch-enable is conditional +on x86, not also reading the initial register contents. + +Signed-off-by: Arnd Bergmann +Fixes: 28e134464734 "[SCSI] hpsa: enable unit attention reporting" +Acked-by: Stephen M. Cameron +Signed-off-by: Christoph Hellwig +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/hpsa.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/scsi/hpsa.c ++++ b/drivers/scsi/hpsa.c +@@ -6365,9 +6365,9 @@ static inline void hpsa_set_driver_suppo + { + u32 driver_support; + +-#ifdef CONFIG_X86 +- /* Need to enable prefetch in the SCSI core for 6400 in x86 */ + driver_support = readl(&(h->cfgtable->driver_support)); ++ /* Need to enable prefetch in the SCSI core for 6400 in x86 */ ++#ifdef CONFIG_X86 + driver_support |= ENABLE_SCSI_PREFETCH; + #endif + driver_support |= ENABLE_UNIT_ATTN; diff --git a/queue-3.16/pci-configure-aspm-when-enabling-device.patch b/queue-3.16/pci-configure-aspm-when-enabling-device.patch new file mode 100644 index 00000000000..8dccd8ebf6d --- /dev/null +++ b/queue-3.16/pci-configure-aspm-when-enabling-device.patch @@ -0,0 +1,78 @@ +From 1f6ae47ecff7f23da73417e068018b311f3b5583 Mon Sep 17 00:00:00 2001 +From: Vidya Sagar +Date: Wed, 16 Jul 2014 15:33:42 +0530 +Subject: PCI: Configure ASPM when enabling device + +From: Vidya Sagar + +commit 1f6ae47ecff7f23da73417e068018b311f3b5583 upstream. + +We can't do ASPM configuration at enumeration-time because enabling it +makes some defective hardware unresponsive, even if ASPM is disabled later +(see 41cd766b0659 ("PCI: Don't enable aspm before drivers have had a chance +to veto it"). Therefore, we have to do it after a driver claims the +device. + +We previously configured ASPM in pci_set_power_state(), but that's not a +very good place because it's not really related to setting the PCI device +power state, and doing it there means: + + - We incorrectly skipped ASPM config when setting a device that's + already in D0 to D0. + + - We unnecessarily configured ASPM when setting a device to a low-power + state (the ASPM feature only applies when the device is in D0). + + - We unnecessarily configured ASPM when called from a .resume() method + (ASPM configuration needs to be restored during resume, but + pci_restore_pcie_state() should already do this). + +Move ASPM configuration from pci_set_power_state() to +do_pci_enable_device() so we do it when a driver enables a device. + +[bhelgaas: changelog] +Link: https://bugzilla.kernel.org/show_bug.cgi?id=79621 +Fixes: db288c9c5f9d ("PCI / PM: restore the original behavior of pci_set_power_state()") +Suggested-by: Bjorn Helgaas +Signed-off-by: Vidya Sagar +Signed-off-by: Bjorn Helgaas +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/pci.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/pci/pci.c ++++ b/drivers/pci/pci.c +@@ -839,12 +839,6 @@ int pci_set_power_state(struct pci_dev * + + if (!__pci_complete_power_transition(dev, state)) + error = 0; +- /* +- * When aspm_policy is "powersave" this call ensures +- * that ASPM is configured. +- */ +- if (!error && dev->bus->self) +- pcie_aspm_powersave_config_link(dev->bus->self); + + return error; + } +@@ -1195,12 +1189,18 @@ int __weak pcibios_enable_device(struct + static int do_pci_enable_device(struct pci_dev *dev, int bars) + { + int err; ++ struct pci_dev *bridge; + u16 cmd; + u8 pin; + + err = pci_set_power_state(dev, PCI_D0); + if (err < 0 && err != -EIO) + return err; ++ ++ bridge = pci_upstream_bridge(dev); ++ if (bridge) ++ pcie_aspm_powersave_config_link(bridge); ++ + err = pcibios_enable_device(dev, bars); + if (err < 0) + return err; diff --git a/queue-3.16/pci-keep-original-resource-if-we-fail-to-expand-it.patch b/queue-3.16/pci-keep-original-resource-if-we-fail-to-expand-it.patch new file mode 100644 index 00000000000..8b5b828b368 --- /dev/null +++ b/queue-3.16/pci-keep-original-resource-if-we-fail-to-expand-it.patch @@ -0,0 +1,60 @@ +From c33377082dd9ede1e998f7ce416077e4b1c2276c Mon Sep 17 00:00:00 2001 +From: Guo Chao +Date: Thu, 3 Jul 2014 18:30:29 -0600 +Subject: PCI: Keep original resource if we fail to expand it + +From: Guo Chao + +commit c33377082dd9ede1e998f7ce416077e4b1c2276c upstream. + +If we have space assigned to a resource, we try to expand the resource +(e.g., to accommodate SR-IOV resources), and the expansion attempt fails, +we should keep the original assignment. + +After bd064f0a231a ("PCI: Mark resources as IORESOURCE_UNSET if we can't +assign them"), we left the resource marked IORESOURCE_UNSET when the +expansion failed, even if it had originally been set. That caused errors +like this: + + pci 0003:00:00.0: can't enable device: BAR 15 [mem size 0x0c000000 64bit pref] not assigned + pci 0003:00:00.0: Error enabling bridge (-22), continuing + +Fix this by restoring the original flags when reassignment fails. + +[bhelgaas: reworked to simplify, changelog] +Fixes: bd064f0a231a ("PCI: Mark resources as IORESOURCE_UNSET if we can't assign them") +Signed-off-by: Guo Chao +Signed-off-by: Bjorn Helgaas +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/setup-res.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/pci/setup-res.c ++++ b/drivers/pci/setup-res.c +@@ -320,9 +320,11 @@ int pci_reassign_resource(struct pci_dev + resource_size_t min_align) + { + struct resource *res = dev->resource + resno; ++ unsigned long flags; + resource_size_t new_size; + int ret; + ++ flags = res->flags; + res->flags |= IORESOURCE_UNSET; + if (!res->parent) { + dev_info(&dev->dev, "BAR %d: can't reassign an unassigned resource %pR\n", +@@ -339,7 +341,12 @@ int pci_reassign_resource(struct pci_dev + dev_info(&dev->dev, "BAR %d: reassigned %pR\n", resno, res); + if (resno < PCI_BRIDGE_RESOURCES) + pci_update_resource(dev, resno); ++ } else { ++ res->flags = flags; ++ dev_info(&dev->dev, "BAR %d: %pR (failed to expand by %#llx)\n", ++ resno, res, (unsigned long long) addsize); + } ++ + return ret; + } + diff --git a/queue-3.16/pci-pciehp-clear-data-link-layer-state-changed-during-init.patch b/queue-3.16/pci-pciehp-clear-data-link-layer-state-changed-during-init.patch new file mode 100644 index 00000000000..b5f7dca59b6 --- /dev/null +++ b/queue-3.16/pci-pciehp-clear-data-link-layer-state-changed-during-init.patch @@ -0,0 +1,54 @@ +From 0d25d35c987d7b0b63368d9c1ae35a917e1a7bab Mon Sep 17 00:00:00 2001 +From: Myron Stowe +Date: Tue, 17 Jun 2014 13:27:34 -0600 +Subject: PCI: pciehp: Clear Data Link Layer State Changed during init + +From: Myron Stowe + +commit 0d25d35c987d7b0b63368d9c1ae35a917e1a7bab upstream. + +During PCIe hot-plug initialization - pciehp_probe() - data structures +related to slot capabilities are set up. As part of this set up, ISRs are +put in place to handle slot events and all event bits are cleared out. + +This patch adds the Data Link Layer State Changed (PCI_EXP_SLTSTA_DLLSC) +Slot Status bit to the event bits that are cleared out during +initialization. + +If the BIOS doesn't clear DLLSC before handoff to the OS, pciehp notices +that it's set and interprets it as a new Link Up event, which results in +spurious messages: + + pciehp 0000:82:04.0:pcie24: slot(4): Link Up event + pciehp 0000:82:04.0:pcie24: Device 0000:83:00.0 already exists at 0000:83:00, cannot hot-add + pciehp 0000:82:04.0:pcie24: Cannot add device at 0000:83:00 + +Prior to e48f1b67f668 ("PCI: pciehp: Use link change notifications for +hot-plug and removal"), pciehp ignored DLLSC. + +Reference: + PCI-SIG. PCI Express Base Specification Revision 4.0 Version 0.3 + (PCI-SIG, 2014): 7.8.11. Slot Status Register (Offset 1Ah). + +[bhelgaas: add e48f1b67f668 ref and stable tag] +Fixes: e48f1b67f668 ("PCI: pciehp: Use link change notifications for hot-plug and removal") +Link: https://bugzilla.kernel.org/show_bug.cgi?id=79611 +Signed-off-by: Myron Stowe +Signed-off-by: Bjorn Helgaas +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/pci/hotplug/pciehp_hpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/pci/hotplug/pciehp_hpc.c ++++ b/drivers/pci/hotplug/pciehp_hpc.c +@@ -794,7 +794,7 @@ struct controller *pcie_init(struct pcie + pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, + PCI_EXP_SLTSTA_ABP | PCI_EXP_SLTSTA_PFD | + PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_PDC | +- PCI_EXP_SLTSTA_CC); ++ PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC); + + /* Disable software notification */ + pcie_disable_notification(ctrl); diff --git a/queue-3.16/powerpc-eeh-wrong-place-to-call-pci_get_slot.patch b/queue-3.16/powerpc-eeh-wrong-place-to-call-pci_get_slot.patch new file mode 100644 index 00000000000..419adf7c650 --- /dev/null +++ b/queue-3.16/powerpc-eeh-wrong-place-to-call-pci_get_slot.patch @@ -0,0 +1,113 @@ +From 9e5c6e5a3be0b2e17ff61b9b74adef4a2c9e6934 Mon Sep 17 00:00:00 2001 +From: Mike Qiu +Date: Tue, 15 Jul 2014 01:42:22 -0400 +Subject: powerpc/eeh: Wrong place to call pci_get_slot() + +From: Mike Qiu + +commit 9e5c6e5a3be0b2e17ff61b9b74adef4a2c9e6934 upstream. + +pci_get_slot() is called with hold of PCI bus semaphore and it's not +safe to be called in interrupt context. However, we possibly checks +EEH error and calls the function in interrupt context. To avoid using +pci_get_slot(), we turn into device tree for fetching location code. +Otherwise, we might run into WARN_ON() as following messages indicate: + + WARNING: at drivers/pci/search.c:223 + CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.16.0-rc3+ #72 + task: c000000001367af0 ti: c000000001444000 task.ti: c000000001444000 + NIP: c000000000497b70 LR: c000000000037530 CTR: 000000003003d114 + REGS: c000000001446fa0 TRAP: 0700 Not tainted (3.16.0-rc3+) + MSR: 9000000000029032 CR: 48002422 XER: 20000000 + CFAR: c00000000003752c SOFTE: 0 + : + NIP [c000000000497b70] .pci_get_slot+0x40/0x110 + LR [c000000000037530] .eeh_pe_loc_get+0x150/0x190 + Call Trace: + .of_get_property+0x30/0x60 (unreliable) + .eeh_pe_loc_get+0x150/0x190 + .eeh_dev_check_failure+0x1b4/0x550 + .eeh_check_failure+0x90/0xf0 + .lpfc_sli_check_eratt+0x504/0x7c0 [lpfc] + .lpfc_poll_eratt+0x64/0x100 [lpfc] + .call_timer_fn+0x64/0x190 + .run_timer_softirq+0x2cc/0x3e0 + +Signed-off-by: Mike Qiu +Acked-by: Gavin Shan +Signed-off-by: Benjamin Herrenschmidt +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/kernel/eeh_pe.c | 46 ++++++++++++------------------------------- + 1 file changed, 13 insertions(+), 33 deletions(-) + +--- a/arch/powerpc/kernel/eeh_pe.c ++++ b/arch/powerpc/kernel/eeh_pe.c +@@ -802,53 +802,33 @@ void eeh_pe_restore_bars(struct eeh_pe * + */ + const char *eeh_pe_loc_get(struct eeh_pe *pe) + { +- struct pci_controller *hose; + struct pci_bus *bus = eeh_pe_bus_get(pe); +- struct pci_dev *pdev; +- struct device_node *dn; +- const char *loc; ++ struct device_node *dn = pci_bus_to_OF_node(bus); ++ const char *loc = NULL; + +- if (!bus) +- return "N/A"; ++ if (!dn) ++ goto out; + + /* PHB PE or root PE ? */ + if (pci_is_root_bus(bus)) { +- hose = pci_bus_to_host(bus); +- loc = of_get_property(hose->dn, +- "ibm,loc-code", NULL); +- if (loc) +- return loc; +- loc = of_get_property(hose->dn, +- "ibm,io-base-loc-code", NULL); ++ loc = of_get_property(dn, "ibm,loc-code", NULL); ++ if (!loc) ++ loc = of_get_property(dn, "ibm,io-base-loc-code", NULL); + if (loc) +- return loc; ++ goto out; + +- pdev = pci_get_slot(bus, 0x0); +- } else { +- pdev = bus->self; +- } +- +- if (!pdev) { +- loc = "N/A"; +- goto out; +- } +- +- dn = pci_device_to_OF_node(pdev); +- if (!dn) { +- loc = "N/A"; +- goto out; ++ /* Check the root port */ ++ dn = dn->child; ++ if (!dn) ++ goto out; + } + + loc = of_get_property(dn, "ibm,loc-code", NULL); + if (!loc) + loc = of_get_property(dn, "ibm,slot-location-code", NULL); +- if (!loc) +- loc = "N/A"; + + out: +- if (pci_is_root_bus(bus) && pdev) +- pci_dev_put(pdev); +- return loc; ++ return loc ? loc : "N/A"; + } + + /** diff --git a/queue-3.16/powerpc-pci-reorder-pci-bus-bridge-unregistration-during-phb-removal.patch b/queue-3.16/powerpc-pci-reorder-pci-bus-bridge-unregistration-during-phb-removal.patch new file mode 100644 index 00000000000..68985db2846 --- /dev/null +++ b/queue-3.16/powerpc-pci-reorder-pci-bus-bridge-unregistration-during-phb-removal.patch @@ -0,0 +1,42 @@ +From 7340056567e32b2c9d3554eb146e1977c93da116 Mon Sep 17 00:00:00 2001 +From: Tyrel Datwyler +Date: Tue, 29 Jul 2014 13:48:13 -0400 +Subject: powerpc/pci: Reorder pci bus/bridge unregistration during PHB removal + +From: Tyrel Datwyler + +commit 7340056567e32b2c9d3554eb146e1977c93da116 upstream. + +Commit bcdde7e made __sysfs_remove_dir() recursive and introduced a BUG_ON +during PHB removal while attempting to delete the power managment attribute +group of the bus. This is a result of tearing the bridge and bus devices down +out of order in remove_phb_dynamic. Since, the the bus resides below the bridge +in the sysfs device tree it should be torn down first. + +This patch simply moves the device_unregister call for the PHB bridge device +after the device_unregister call for the PHB bus. + +Fixes: bcdde7e221a8 ("sysfs: make __sysfs_remove_dir() recursive") +Signed-off-by: Tyrel Datwyler +Signed-off-by: Benjamin Herrenschmidt +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/platforms/pseries/pci_dlpar.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/powerpc/platforms/pseries/pci_dlpar.c ++++ b/arch/powerpc/platforms/pseries/pci_dlpar.c +@@ -118,10 +118,10 @@ int remove_phb_dynamic(struct pci_contro + } + } + +- /* Unregister the bridge device from sysfs and remove the PCI bus */ +- device_unregister(b->bridge); ++ /* Remove the PCI bus and unregister the bridge device from sysfs */ + phb->bus = NULL; + pci_remove_bus(b); ++ device_unregister(b->bridge); + + /* Now release the IO resource */ + if (res->flags & IORESOURCE_IO) diff --git a/queue-3.16/powerpc-powernv-update-dev-dma_mask-in-pci_set_dma_mask-path.patch b/queue-3.16/powerpc-powernv-update-dev-dma_mask-in-pci_set_dma_mask-path.patch new file mode 100644 index 00000000000..a8ae91cb033 --- /dev/null +++ b/queue-3.16/powerpc-powernv-update-dev-dma_mask-in-pci_set_dma_mask-path.patch @@ -0,0 +1,33 @@ +From a32305bf90a2ae0e6a9a93370c7616565f75e15a Mon Sep 17 00:00:00 2001 +From: Brian W Hart +Date: Thu, 31 Jul 2014 14:24:37 -0500 +Subject: powerpc/powernv: Update dev->dma_mask in pci_set_dma_mask() path + +From: Brian W Hart + +commit a32305bf90a2ae0e6a9a93370c7616565f75e15a upstream. + +powerpc defines various machine-specific routines for handling +pci_set_dma_mask(). The routines for machine "PowerNV" may neglect +to set dev->dma_mask. This could confuse anyone (e.g. drivers) that +consult dev->dma_mask to find the current mask. Set the dma_mask in +the PowerNV leaf routine. + +Signed-off-by: Brian W. Hart +Signed-off-by: Benjamin Herrenschmidt +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/platforms/powernv/pci-ioda.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/powerpc/platforms/powernv/pci-ioda.c ++++ b/arch/powerpc/platforms/powernv/pci-ioda.c +@@ -491,6 +491,7 @@ static int pnv_pci_ioda_dma_set_mask(str + set_dma_ops(&pdev->dev, &dma_iommu_ops); + set_iommu_table_base(&pdev->dev, &pe->tce32_table); + } ++ *pdev->dev.dma_mask = dma_mask; + return 0; + } + diff --git a/queue-3.16/series b/queue-3.16/series index 38b20c32f8b..625ca172502 100644 --- a/queue-3.16/series +++ b/queue-3.16/series @@ -61,3 +61,24 @@ kvm-nvmx-fix-acknowledge-interrupt-on-exit-when-apicv-is-in-use.patch revert-kvm-x86-increase-the-number-of-fixed-mtrr-regs-to-10.patch kvm-iommu-fix-the-third-parameter-of-kvm_iommu_put_pages-cve-2014-3601.patch ext4-fix-bug_on-in-mb_free_blocks.patch +drm-radeon-add-new-kv-pci-id.patch +drm-radeon-add-new-bonaire-pci-ids.patch +drm-radeon-add-additional-si-pci-ids.patch +pci-configure-aspm-when-enabling-device.patch +pci-keep-original-resource-if-we-fail-to-expand-it.patch +pci-pciehp-clear-data-link-layer-state-changed-during-init.patch +acpi-pci-fix-sysfs-acpi_index-and-label-errors.patch +x86-ia64-move-efi_fb-vga_default_device-initialization-to-pci_vga_fixup.patch +x86-don-t-exclude-low-bios-area-when-allocating-address-space-for-non-pci-cards.patch +powerpc-eeh-wrong-place-to-call-pci_get_slot.patch +powerpc-pci-reorder-pci-bus-bridge-unregistration-during-phb-removal.patch +powerpc-powernv-update-dev-dma_mask-in-pci_set_dma_mask-path.patch +x86_64-vsyscall-fix-warn_bad_vsyscall-log-output.patch +hpsa-fix-non-x86-builds.patch +x86-mce-add-raw_lock-conversion-again.patch +xen-events-fifo-ensure-all-bitops-are-properly-aligned-even-on-x86.patch +x86-efi-enforce-config_relocatable-for-efi-boot-stub.patch +x86-xen-use-vmap-to-map-grant-table-pages-in-pvh-guests.patch +x86-xen-resume-timer-irqs-early.patch +x86-mm-fix-pte_special-versus-pte_numa.patch +hpsa-fix-bad-enomem-return-value-in-hpsa_big_passthru_ioctl.patch diff --git a/queue-3.16/x86-don-t-exclude-low-bios-area-when-allocating-address-space-for-non-pci-cards.patch b/queue-3.16/x86-don-t-exclude-low-bios-area-when-allocating-address-space-for-non-pci-cards.patch new file mode 100644 index 00000000000..e39f056405b --- /dev/null +++ b/queue-3.16/x86-don-t-exclude-low-bios-area-when-allocating-address-space-for-non-pci-cards.patch @@ -0,0 +1,90 @@ +From cbace46a9710a480cae51e4611697df5de41713e Mon Sep 17 00:00:00 2001 +From: Christoph Schulz +Date: Wed, 16 Jul 2014 10:00:57 +0200 +Subject: x86: don't exclude low BIOS area when allocating address space for non-PCI cards + +From: Christoph Schulz + +commit cbace46a9710a480cae51e4611697df5de41713e upstream. + +Commit 30919b0bf356 ("x86: avoid low BIOS area when allocating address +space") moved the test for resource allocations that fall within the first +1MB of address space from the PCI-specific path to a generic path, such +that all resource allocations will avoid this area. However, this breaks +ISA cards which need to allocate a memory region within the first 1MB. An +example is the i82365 PCMCIA controller and derivatives like the Ricoh +RF5C296/396 which map part of the PCMCIA socket memory address space into +the first 1MB of system memory address space. They do not work anymore as +no usable memory region exists due to this change: + + Intel ISA PCIC probe: Ricoh RF5C296/396 ISA-to-PCMCIA at port 0x3e0 ofs 0x00, 2 sockets + host opts [0]: none + host opts [1]: none + ISA irqs (scanned) = 3,4,5,9,10 status change on irq 10 + pcmcia_socket pcmcia_socket1: pccard: PCMCIA card inserted into slot 1 + pcmcia_socket pcmcia_socket0: cs: IO port probe 0xc00-0xcff: excluding 0xcf8-0xcff + pcmcia_socket pcmcia_socket0: cs: IO port probe 0xa00-0xaff: clean. + pcmcia_socket pcmcia_socket0: cs: IO port probe 0x100-0x3ff: excluding 0x170-0x177 0x1f0-0x1f7 0x2f8-0x2ff 0x370-0x37f 0x3c0-0x3e7 0x3f0-0x3ff + pcmcia_socket pcmcia_socket0: cs: memory probe 0x0a0000-0x0affff: excluding 0xa0000-0xaffff + pcmcia_socket pcmcia_socket0: cs: memory probe 0x0b0000-0x0bffff: excluding 0xb0000-0xbffff + pcmcia_socket pcmcia_socket0: cs: memory probe 0x0c0000-0x0cffff: excluding 0xc0000-0xcbfff + pcmcia_socket pcmcia_socket0: cs: memory probe 0x0d0000-0x0dffff: clean. + pcmcia_socket pcmcia_socket0: cs: memory probe 0x0e0000-0x0effff: clean. + pcmcia_socket pcmcia_socket0: cs: memory probe 0x60000000-0x60ffffff: clean. + pcmcia_socket pcmcia_socket0: cs: memory probe 0xa0000000-0xa0ffffff: clean. + pcmcia_socket pcmcia_socket1: cs: IO port probe 0xc00-0xcff: excluding 0xcf8-0xcff + pcmcia_socket pcmcia_socket1: cs: IO port probe 0xa00-0xaff: clean. + pcmcia_socket pcmcia_socket1: cs: IO port probe 0x100-0x3ff: excluding 0x170-0x177 0x1f0-0x1f7 0x2f8-0x2ff 0x370-0x37f 0x3c0-0x3e7 0x3f0-0x3ff + pcmcia_socket pcmcia_socket1: cs: memory probe 0x0a0000-0x0affff: excluding 0xa0000-0xaffff + pcmcia_socket pcmcia_socket1: cs: memory probe 0x0b0000-0x0bffff: excluding 0xb0000-0xbffff + pcmcia_socket pcmcia_socket1: cs: memory probe 0x0c0000-0x0cffff: excluding 0xc0000-0xcbfff + pcmcia_socket pcmcia_socket1: cs: memory probe 0x0d0000-0x0dffff: clean. + pcmcia_socket pcmcia_socket1: cs: memory probe 0x0e0000-0x0effff: clean. + pcmcia_socket pcmcia_socket1: cs: memory probe 0x60000000-0x60ffffff: clean. + pcmcia_socket pcmcia_socket1: cs: memory probe 0xa0000000-0xa0ffffff: clean. + pcmcia_socket pcmcia_socket1: cs: memory probe 0x0cc000-0x0effff: excluding 0xe0000-0xeffff + pcmcia_socket pcmcia_socket1: cs: unable to map card memory! + +If filtering out the first 1MB is reverted, everything works as expected. + +Tested-by: Robert Resch +Signed-off-by: Christoph Schulz +Signed-off-by: Bjorn Helgaas +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/resource.c | 8 +++++--- + arch/x86/pci/i386.c | 4 ++++ + 2 files changed, 9 insertions(+), 3 deletions(-) + +--- a/arch/x86/kernel/resource.c ++++ b/arch/x86/kernel/resource.c +@@ -37,10 +37,12 @@ static void remove_e820_regions(struct r + + void arch_remove_reservations(struct resource *avail) + { +- /* Trim out BIOS areas (low 1MB and high 2MB) and E820 regions */ ++ /* ++ * Trim out BIOS area (high 2MB) and E820 regions. We do not remove ++ * the low 1MB unconditionally, as this area is needed for some ISA ++ * cards requiring a memory range, e.g. the i82365 PCMCIA controller. ++ */ + if (avail->flags & IORESOURCE_MEM) { +- if (avail->start < BIOS_END) +- avail->start = BIOS_END; + resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END); + + remove_e820_regions(avail); +--- a/arch/x86/pci/i386.c ++++ b/arch/x86/pci/i386.c +@@ -162,6 +162,10 @@ pcibios_align_resource(void *data, const + return start; + if (start & 0x300) + start = (start + 0x3ff) & ~0x3ff; ++ } else if (res->flags & IORESOURCE_MEM) { ++ /* The low 1MB range is reserved for ISA cards */ ++ if (start < BIOS_END) ++ start = BIOS_END; + } + return start; + } diff --git a/queue-3.16/x86-efi-enforce-config_relocatable-for-efi-boot-stub.patch b/queue-3.16/x86-efi-enforce-config_relocatable-for-efi-boot-stub.patch new file mode 100644 index 00000000000..6af4b9ad678 --- /dev/null +++ b/queue-3.16/x86-efi-enforce-config_relocatable-for-efi-boot-stub.patch @@ -0,0 +1,49 @@ +From 7b2a583afb4ab894f78bc0f8bd136e96b6499a7e Mon Sep 17 00:00:00 2001 +From: Matt Fleming +Date: Fri, 11 Jul 2014 08:45:25 +0100 +Subject: x86/efi: Enforce CONFIG_RELOCATABLE for EFI boot stub +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Matt Fleming + +commit 7b2a583afb4ab894f78bc0f8bd136e96b6499a7e upstream. + +Without CONFIG_RELOCATABLE the early boot code will decompress the +kernel to LOAD_PHYSICAL_ADDR. While this may have been fine in the BIOS +days, that isn't going to fly with UEFI since parts of the firmware +code/data may be located at LOAD_PHYSICAL_ADDR. + +Straying outside of the bounds of the regions we've explicitly requested +from the firmware will cause all sorts of trouble. Bruno reports that +his machine resets while trying to decompress the kernel image. + +We already go to great pains to ensure the kernel is loaded into a +suitably aligned buffer, it's just that the address isn't necessarily +LOAD_PHYSICAL_ADDR, because we can't guarantee that address isn't in-use +by the firmware. + +Explicitly enforce CONFIG_RELOCATABLE for the EFI boot stub, so that we +can load the kernel at any address with the correct alignment. + +Reported-by: Bruno Prémont +Tested-by: Bruno Prémont +Cc: H. Peter Anvin +Signed-off-by: Matt Fleming +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -1537,6 +1537,7 @@ config EFI + config EFI_STUB + bool "EFI stub support" + depends on EFI ++ select RELOCATABLE + ---help--- + This kernel feature allows a bzImage to be loaded directly + by EFI firmware without the use of a bootloader. diff --git a/queue-3.16/x86-ia64-move-efi_fb-vga_default_device-initialization-to-pci_vga_fixup.patch b/queue-3.16/x86-ia64-move-efi_fb-vga_default_device-initialization-to-pci_vga_fixup.patch new file mode 100644 index 00000000000..7dfcd79d071 --- /dev/null +++ b/queue-3.16/x86-ia64-move-efi_fb-vga_default_device-initialization-to-pci_vga_fixup.patch @@ -0,0 +1,195 @@ +From 20cde694027e7477cc532833e38ab9fcaa83fb64 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bruno=20Pr=C3=A9mont?= +Date: Wed, 25 Jun 2014 00:55:01 +0200 +Subject: x86, ia64: Move EFI_FB vga_default_device() initialization to pci_vga_fixup() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: =?UTF-8?q?Bruno=20Pr=C3=A9mont?= + +commit 20cde694027e7477cc532833e38ab9fcaa83fb64 upstream. + +Commit b4aa0163056b ("efifb: Implement vga_default_device() (v2)") added +efifb vga_default_device() so EFI systems that do not load shadow VBIOS or +setup VGA get proper value for boot_vga PCI sysfs attribute on the +corresponding PCI device. + +Xorg doesn't detect devices when boot_vga=0, e.g., on some EFI systems such +as MacBookAir2,1. Xorg detects the GPU and finds the DRI device but then +bails out with "no devices detected". + +Note: When vga_default_device() is set boot_vga PCI sysfs attribute +reflects its state. When unset this attribute is 1 whenever +IORESOURCE_ROM_SHADOW flag is set. + +With introduction of sysfb/simplefb/simpledrm efifb is getting obsolete +while having native drivers for the GPU also makes selecting sysfb/efifb +optional. + +Remove the efifb implementation of vga_default_device() and initialize +vgaarb's vga_default_device() with the PCI GPU that matches boot +screen_info in pci_fixup_video(). + +[bhelgaas: remove unused "dev" in efifb_setup()] +Fixes: b4aa0163056b ("efifb: Implement vga_default_device() (v2)") +Tested-by: Anibal Francisco Martinez Cortina +Signed-off-by: Bruno Prémont +Signed-off-by: Bjorn Helgaas +Acked-by: Matthew Garrett +Signed-off-by: Greg Kroah-Hartman + +--- + arch/ia64/pci/fixup.c | 22 ++++++++++++++++++++++ + arch/x86/include/asm/vga.h | 6 ------ + arch/x86/pci/fixup.c | 21 +++++++++++++++++++++ + drivers/video/fbdev/efifb.c | 39 --------------------------------------- + 4 files changed, 43 insertions(+), 45 deletions(-) + +--- a/arch/ia64/pci/fixup.c ++++ b/arch/ia64/pci/fixup.c +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + + #include + +@@ -37,6 +38,27 @@ static void pci_fixup_video(struct pci_d + return; + /* Maybe, this machine supports legacy memory map. */ + ++ if (!vga_default_device()) { ++ resource_size_t start, end; ++ int i; ++ ++ /* Does firmware framebuffer belong to us? */ ++ for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { ++ if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM)) ++ continue; ++ ++ start = pci_resource_start(pdev, i); ++ end = pci_resource_end(pdev, i); ++ ++ if (!start || !end) ++ continue; ++ ++ if (screen_info.lfb_base >= start && ++ (screen_info.lfb_base + screen_info.lfb_size) < end) ++ vga_set_default_device(pdev); ++ } ++ } ++ + /* Is VGA routed to us? */ + bus = pdev->bus; + while (bus) { +--- a/arch/x86/include/asm/vga.h ++++ b/arch/x86/include/asm/vga.h +@@ -17,10 +17,4 @@ + #define vga_readb(x) (*(x)) + #define vga_writeb(x, y) (*(y) = (x)) + +-#ifdef CONFIG_FB_EFI +-#define __ARCH_HAS_VGA_DEFAULT_DEVICE +-extern struct pci_dev *vga_default_device(void); +-extern void vga_set_default_device(struct pci_dev *pdev); +-#endif +- + #endif /* _ASM_X86_VGA_H */ +--- a/arch/x86/pci/fixup.c ++++ b/arch/x86/pci/fixup.c +@@ -326,6 +326,27 @@ static void pci_fixup_video(struct pci_d + struct pci_bus *bus; + u16 config; + ++ if (!vga_default_device()) { ++ resource_size_t start, end; ++ int i; ++ ++ /* Does firmware framebuffer belong to us? */ ++ for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { ++ if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM)) ++ continue; ++ ++ start = pci_resource_start(pdev, i); ++ end = pci_resource_end(pdev, i); ++ ++ if (!start || !end) ++ continue; ++ ++ if (screen_info.lfb_base >= start && ++ (screen_info.lfb_base + screen_info.lfb_size) < end) ++ vga_set_default_device(pdev); ++ } ++ } ++ + /* Is VGA routed to us? */ + bus = pdev->bus; + while (bus) { +--- a/drivers/video/fbdev/efifb.c ++++ b/drivers/video/fbdev/efifb.c +@@ -19,8 +19,6 @@ + + static bool request_mem_succeeded = false; + +-static struct pci_dev *default_vga; +- + static struct fb_var_screeninfo efifb_defined = { + .activate = FB_ACTIVATE_NOW, + .height = -1, +@@ -84,23 +82,10 @@ static struct fb_ops efifb_ops = { + .fb_imageblit = cfb_imageblit, + }; + +-struct pci_dev *vga_default_device(void) +-{ +- return default_vga; +-} +- +-EXPORT_SYMBOL_GPL(vga_default_device); +- +-void vga_set_default_device(struct pci_dev *pdev) +-{ +- default_vga = pdev; +-} +- + static int efifb_setup(char *options) + { + char *this_opt; + int i; +- struct pci_dev *dev = NULL; + + if (options && *options) { + while ((this_opt = strsep(&options, ",")) != NULL) { +@@ -126,30 +111,6 @@ static int efifb_setup(char *options) + } + } + +- for_each_pci_dev(dev) { +- int i; +- +- if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) +- continue; +- +- for (i=0; i < DEVICE_COUNT_RESOURCE; i++) { +- resource_size_t start, end; +- +- if (!(pci_resource_flags(dev, i) & IORESOURCE_MEM)) +- continue; +- +- start = pci_resource_start(dev, i); +- end = pci_resource_end(dev, i); +- +- if (!start || !end) +- continue; +- +- if (screen_info.lfb_base >= start && +- (screen_info.lfb_base + screen_info.lfb_size) < end) +- default_vga = dev; +- } +- } +- + return 0; + } + diff --git a/queue-3.16/x86-mce-add-raw_lock-conversion-again.patch b/queue-3.16/x86-mce-add-raw_lock-conversion-again.patch new file mode 100644 index 00000000000..31f84bb8d72 --- /dev/null +++ b/queue-3.16/x86-mce-add-raw_lock-conversion-again.patch @@ -0,0 +1,111 @@ +From ed5c41d30ef2ce578fd6b6e2f7ec23f2a58b1eba Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Tue, 5 Aug 2014 22:57:19 +0200 +Subject: x86: MCE: Add raw_lock conversion again + +From: Thomas Gleixner + +commit ed5c41d30ef2ce578fd6b6e2f7ec23f2a58b1eba upstream. + +Commit ea431643d6c3 ("x86/mce: Fix CMCI preemption bugs") breaks RT by +the completely unrelated conversion of the cmci_discover_lock to a +regular (non raw) spinlock. This lock was annotated in commit +59d958d2c7de ("locking, x86: mce: Annotate cmci_discover_lock as raw") +with a proper explanation why. + +The argument for converting the lock back to a regular spinlock was: + + - it does percpu ops without disabling preemption. Preemption is not + disabled due to the mistaken use of a raw spinlock. + +Which is complete nonsense. The raw_spinlock is disabling preemption in +the same way as a regular spinlock. In mainline spinlock maps to +raw_spinlock, in RT spinlock becomes a "sleeping" lock. + +raw_spinlock has on RT exactly the same semantics as in mainline. And +because this lock is taken in non preemptible context it must be raw on +RT. + +Undo the locking brainfart. + +Reported-by: Clark Williams +Reported-by: Steven Rostedt +Signed-off-by: Thomas Gleixner +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/cpu/mcheck/mce_intel.c | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c ++++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c +@@ -42,7 +42,7 @@ static DEFINE_PER_CPU(mce_banks_t, mce_b + * cmci_discover_lock protects against parallel discovery attempts + * which could race against each other. + */ +-static DEFINE_SPINLOCK(cmci_discover_lock); ++static DEFINE_RAW_SPINLOCK(cmci_discover_lock); + + #define CMCI_THRESHOLD 1 + #define CMCI_POLL_INTERVAL (30 * HZ) +@@ -144,14 +144,14 @@ static void cmci_storm_disable_banks(voi + int bank; + u64 val; + +- spin_lock_irqsave(&cmci_discover_lock, flags); ++ raw_spin_lock_irqsave(&cmci_discover_lock, flags); + owned = __get_cpu_var(mce_banks_owned); + for_each_set_bit(bank, owned, MAX_NR_BANKS) { + rdmsrl(MSR_IA32_MCx_CTL2(bank), val); + val &= ~MCI_CTL2_CMCI_EN; + wrmsrl(MSR_IA32_MCx_CTL2(bank), val); + } +- spin_unlock_irqrestore(&cmci_discover_lock, flags); ++ raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); + } + + static bool cmci_storm_detect(void) +@@ -211,7 +211,7 @@ static void cmci_discover(int banks) + int i; + int bios_wrong_thresh = 0; + +- spin_lock_irqsave(&cmci_discover_lock, flags); ++ raw_spin_lock_irqsave(&cmci_discover_lock, flags); + for (i = 0; i < banks; i++) { + u64 val; + int bios_zero_thresh = 0; +@@ -266,7 +266,7 @@ static void cmci_discover(int banks) + WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks))); + } + } +- spin_unlock_irqrestore(&cmci_discover_lock, flags); ++ raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); + if (mca_cfg.bios_cmci_threshold && bios_wrong_thresh) { + pr_info_once( + "bios_cmci_threshold: Some banks do not have valid thresholds set\n"); +@@ -316,10 +316,10 @@ void cmci_clear(void) + + if (!cmci_supported(&banks)) + return; +- spin_lock_irqsave(&cmci_discover_lock, flags); ++ raw_spin_lock_irqsave(&cmci_discover_lock, flags); + for (i = 0; i < banks; i++) + __cmci_disable_bank(i); +- spin_unlock_irqrestore(&cmci_discover_lock, flags); ++ raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); + } + + static void cmci_rediscover_work_func(void *arg) +@@ -360,9 +360,9 @@ void cmci_disable_bank(int bank) + if (!cmci_supported(&banks)) + return; + +- spin_lock_irqsave(&cmci_discover_lock, flags); ++ raw_spin_lock_irqsave(&cmci_discover_lock, flags); + __cmci_disable_bank(bank); +- spin_unlock_irqrestore(&cmci_discover_lock, flags); ++ raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); + } + + static void intel_init_cmci(void) diff --git a/queue-3.16/x86-mm-fix-pte_special-versus-pte_numa.patch b/queue-3.16/x86-mm-fix-pte_special-versus-pte_numa.patch new file mode 100644 index 00000000000..ac2bdc0ccd6 --- /dev/null +++ b/queue-3.16/x86-mm-fix-pte_special-versus-pte_numa.patch @@ -0,0 +1,106 @@ +From b38af4721f59d0b564468f623b3e52a638195015 Mon Sep 17 00:00:00 2001 +From: Hugh Dickins +Date: Fri, 29 Aug 2014 15:18:44 -0700 +Subject: x86,mm: fix pte_special versus pte_numa + +From: Hugh Dickins + +commit b38af4721f59d0b564468f623b3e52a638195015 upstream. + +Sasha Levin has shown oopses on ffffea0003480048 and ffffea0003480008 at +mm/memory.c:1132, running Trinity on different 3.16-rc-next kernels: +where zap_pte_range() checks page->mapping to see if PageAnon(page). + +Those addresses fit struct pages for pfns d2001 and d2000, and in each +dump a register or a stack slot showed d2001730 or d2000730: pte flags +0x730 are PCD ACCESSED PROTNONE SPECIAL IOMAP; and Sasha's e820 map has +a hole between cfffffff and 100000000, which would need special access. + +Commit c46a7c817e66 ("x86: define _PAGE_NUMA by reusing software bits on +the PMD and PTE levels") has broken vm_normal_page(): a PROTNONE SPECIAL +pte no longer passes the pte_special() test, so zap_pte_range() goes on +to try to access a non-existent struct page. + +Fix this by refining pte_special() (SPECIAL with PRESENT or PROTNONE) to +complement pte_numa() (SPECIAL with neither PRESENT nor PROTNONE). A +hint that this was a problem was that c46a7c817e66 added pte_numa() test +to vm_normal_page(), and moved its is_zero_pfn() test from slow to fast +path: This was papering over a pte_special() snag when the zero page was +encountered during zap. This patch reverts vm_normal_page() to how it +was before, relying on pte_special(). + +It still appears that this patch may be incomplete: aren't there other +places which need to be handling PROTNONE along with PRESENT? For +example, pte_mknuma() clears _PAGE_PRESENT and sets _PAGE_NUMA, but on a +PROT_NONE area, that would make it pte_special(). This is side-stepped +by the fact that NUMA hinting faults skipped PROT_NONE VMAs and there +are no grounds where a NUMA hinting fault on a PROT_NONE VMA would be +interesting. + +Fixes: c46a7c817e66 ("x86: define _PAGE_NUMA by reusing software bits on the PMD and PTE levels") +Reported-by: Sasha Levin +Tested-by: Sasha Levin +Signed-off-by: Hugh Dickins +Signed-off-by: Mel Gorman +Cc: "Kirill A. Shutemov" +Cc: Peter Zijlstra +Cc: Rik van Riel +Cc: Johannes Weiner +Cc: Cyrill Gorcunov +Cc: Matthew Wilcox +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/include/asm/pgtable.h | 9 +++++++-- + mm/memory.c | 7 +++---- + 2 files changed, 10 insertions(+), 6 deletions(-) + +--- a/arch/x86/include/asm/pgtable.h ++++ b/arch/x86/include/asm/pgtable.h +@@ -131,8 +131,13 @@ static inline int pte_exec(pte_t pte) + + static inline int pte_special(pte_t pte) + { +- return (pte_flags(pte) & (_PAGE_PRESENT|_PAGE_SPECIAL)) == +- (_PAGE_PRESENT|_PAGE_SPECIAL); ++ /* ++ * See CONFIG_NUMA_BALANCING pte_numa in include/asm-generic/pgtable.h. ++ * On x86 we have _PAGE_BIT_NUMA == _PAGE_BIT_GLOBAL+1 == ++ * __PAGE_BIT_SOFTW1 == _PAGE_BIT_SPECIAL. ++ */ ++ return (pte_flags(pte) & _PAGE_SPECIAL) && ++ (pte_flags(pte) & (_PAGE_PRESENT|_PAGE_PROTNONE)); + } + + static inline unsigned long pte_pfn(pte_t pte) +--- a/mm/memory.c ++++ b/mm/memory.c +@@ -751,7 +751,7 @@ struct page *vm_normal_page(struct vm_ar + unsigned long pfn = pte_pfn(pte); + + if (HAVE_PTE_SPECIAL) { +- if (likely(!pte_special(pte) || pte_numa(pte))) ++ if (likely(!pte_special(pte))) + goto check_pfn; + if (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)) + return NULL; +@@ -777,15 +777,14 @@ struct page *vm_normal_page(struct vm_ar + } + } + ++ if (is_zero_pfn(pfn)) ++ return NULL; + check_pfn: + if (unlikely(pfn > highest_memmap_pfn)) { + print_bad_pte(vma, addr, pte, NULL); + return NULL; + } + +- if (is_zero_pfn(pfn)) +- return NULL; +- + /* + * NOTE! We still have PageReserved() pages in the page tables. + * eg. VDSO mappings can cause them to exist. diff --git a/queue-3.16/x86-xen-resume-timer-irqs-early.patch b/queue-3.16/x86-xen-resume-timer-irqs-early.patch new file mode 100644 index 00000000000..87e545aab31 --- /dev/null +++ b/queue-3.16/x86-xen-resume-timer-irqs-early.patch @@ -0,0 +1,43 @@ +From 8d5999df35314607c38fbd6bdd709e25c3a4eeab Mon Sep 17 00:00:00 2001 +From: David Vrabel +Date: Thu, 7 Aug 2014 17:06:06 +0100 +Subject: x86/xen: resume timer irqs early + +From: David Vrabel + +commit 8d5999df35314607c38fbd6bdd709e25c3a4eeab upstream. + +If the timer irqs are resumed during device resume it is possible in +certain circumstances for the resume to hang early on, before device +interrupts are resumed. For an Ubuntu 14.04 PVHVM guest this would +occur in ~0.5% of resume attempts. + +It is not entirely clear what is occuring the point of the hang but I +think a task necessary for the resume calls schedule_timeout(), +waiting for a timer interrupt (which never arrives). This failure may +require specific tasks to be running on the other VCPUs to trigger +(processes are not frozen during a suspend/resume if PREEMPT is +disabled). + +Add IRQF_EARLY_RESUME to the timer interrupts so they are resumed in +syscore_resume(). + +Signed-off-by: David Vrabel +Reviewed-by: Boris Ostrovsky +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/xen/time.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/xen/time.c ++++ b/arch/x86/xen/time.c +@@ -444,7 +444,7 @@ void xen_setup_timer(int cpu) + + irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt, + IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER| +- IRQF_FORCE_RESUME, ++ IRQF_FORCE_RESUME|IRQF_EARLY_RESUME, + name, NULL); + (void)xen_set_irq_priority(irq, XEN_IRQ_PRIORITY_MAX); + diff --git a/queue-3.16/x86-xen-use-vmap-to-map-grant-table-pages-in-pvh-guests.patch b/queue-3.16/x86-xen-use-vmap-to-map-grant-table-pages-in-pvh-guests.patch new file mode 100644 index 00000000000..d113dfda6f8 --- /dev/null +++ b/queue-3.16/x86-xen-use-vmap-to-map-grant-table-pages-in-pvh-guests.patch @@ -0,0 +1,63 @@ +From 7d951f3ccb0308c95bf76d5eef9886dea35a7013 Mon Sep 17 00:00:00 2001 +From: David Vrabel +Date: Tue, 5 Aug 2014 11:49:19 +0100 +Subject: x86/xen: use vmap() to map grant table pages in PVH guests + +From: David Vrabel + +commit 7d951f3ccb0308c95bf76d5eef9886dea35a7013 upstream. + +Commit b7dd0e350e0b (x86/xen: safely map and unmap grant frames when +in atomic context) causes PVH guests to crash in +arch_gnttab_map_shared() when they attempted to map the pages for the +grant table. + +This use of a PV-specific function during the PVH grant table setup is +non-obvious and not needed. The standard vmap() function does the +right thing. + +Signed-off-by: David Vrabel +Reported-by: Mukesh Rathor +Tested-by: Mukesh Rathor +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/xen/grant-table.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/arch/x86/xen/grant-table.c ++++ b/arch/x86/xen/grant-table.c +@@ -168,6 +168,7 @@ static int __init xlated_setup_gnttab_pa + { + struct page **pages; + xen_pfn_t *pfns; ++ void *vaddr; + int rc; + unsigned int i; + unsigned long nr_grant_frames = gnttab_max_grant_frames(); +@@ -193,21 +194,20 @@ static int __init xlated_setup_gnttab_pa + for (i = 0; i < nr_grant_frames; i++) + pfns[i] = page_to_pfn(pages[i]); + +- rc = arch_gnttab_map_shared(pfns, nr_grant_frames, nr_grant_frames, +- &xen_auto_xlat_grant_frames.vaddr); +- +- if (rc) { ++ vaddr = vmap(pages, nr_grant_frames, 0, PAGE_KERNEL); ++ if (!vaddr) { + pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__, + nr_grant_frames, rc); + free_xenballooned_pages(nr_grant_frames, pages); + kfree(pages); + kfree(pfns); +- return rc; ++ return -ENOMEM; + } + kfree(pages); + + xen_auto_xlat_grant_frames.pfn = pfns; + xen_auto_xlat_grant_frames.count = nr_grant_frames; ++ xen_auto_xlat_grant_frames.vaddr = vaddr; + + return 0; + } diff --git a/queue-3.16/x86_64-vsyscall-fix-warn_bad_vsyscall-log-output.patch b/queue-3.16/x86_64-vsyscall-fix-warn_bad_vsyscall-log-output.patch new file mode 100644 index 00000000000..9672e773b48 --- /dev/null +++ b/queue-3.16/x86_64-vsyscall-fix-warn_bad_vsyscall-log-output.patch @@ -0,0 +1,50 @@ +From 53b884ac3745353de220d92ef792515c3ae692f0 Mon Sep 17 00:00:00 2001 +From: Andy Lutomirski +Date: Fri, 25 Jul 2014 16:30:27 -0700 +Subject: x86_64/vsyscall: Fix warn_bad_vsyscall log output + +From: Andy Lutomirski + +commit 53b884ac3745353de220d92ef792515c3ae692f0 upstream. + +This commit in Linux 3.6: + + commit c767a54ba0657e52e6edaa97cbe0b0a8bf1c1655 + Author: Joe Perches + Date: Mon May 21 19:50:07 2012 -0700 + + x86/debug: Add KERN_ to bare printks, convert printks to pr_ + +caused warn_bad_vsyscall to output garbage in the middle of the +line. Revert the bad part of it. + +The printk in question isn't actually bare; the level is "%s". + +The bug this fixes is purely cosmetic; backports are optional. + +Signed-off-by: Andy Lutomirski +Link: http://lkml.kernel.org/r/03eac1f24110bbe496ecc12a4df467e0d88466d4.1406330947.git.luto@amacapital.net +Signed-off-by: H. Peter Anvin +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kernel/vsyscall_64.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/x86/kernel/vsyscall_64.c ++++ b/arch/x86/kernel/vsyscall_64.c +@@ -81,10 +81,10 @@ static void warn_bad_vsyscall(const char + if (!show_unhandled_signals) + return; + +- pr_notice_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n", +- level, current->comm, task_pid_nr(current), +- message, regs->ip, regs->cs, +- regs->sp, regs->ax, regs->si, regs->di); ++ printk_ratelimited("%s%s[%d] %s ip:%lx cs:%lx sp:%lx ax:%lx si:%lx di:%lx\n", ++ level, current->comm, task_pid_nr(current), ++ message, regs->ip, regs->cs, ++ regs->sp, regs->ax, regs->si, regs->di); + } + + static int addr_to_vsyscall_nr(unsigned long addr) diff --git a/queue-3.16/xen-events-fifo-ensure-all-bitops-are-properly-aligned-even-on-x86.patch b/queue-3.16/xen-events-fifo-ensure-all-bitops-are-properly-aligned-even-on-x86.patch new file mode 100644 index 00000000000..47fa1693ffa --- /dev/null +++ b/queue-3.16/xen-events-fifo-ensure-all-bitops-are-properly-aligned-even-on-x86.patch @@ -0,0 +1,49 @@ +From dcecb8fd93a65787130a74e61fdf29932c8d85eb Mon Sep 17 00:00:00 2001 +From: David Vrabel +Date: Thu, 31 Jul 2014 16:22:25 +0100 +Subject: xen/events/fifo: ensure all bitops are properly aligned even on x86 + +From: David Vrabel + +commit dcecb8fd93a65787130a74e61fdf29932c8d85eb upstream. + +When using the FIFO-based ABI on x86_64, if the last port is at the +end of an event array page then sync_test_bit() on this port's event +word will read beyond the end of the page and in certain circumstances +this may fault. + +The fault requires the following page in the kernel's direct mapping +to be not present, which would mean: + +a) the array page is the last page of RAM; or + +b) the following page is ballooned out /and/ it has been used for a + foreign mapping by a kernel driver (such as netback or blkback) + /and/ the grant has been unmapped. + +Use the infrastructure added for arm64 to ensure that all bitops +operating on event words are unsigned long aligned. + +Signed-off-by: David Vrabel +Reviewed-by: Boris Ostrovsky +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/xen/events/events_fifo.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/drivers/xen/events/events_fifo.c ++++ b/drivers/xen/events/events_fifo.c +@@ -67,10 +67,9 @@ static event_word_t *event_array[MAX_EVE + static unsigned event_array_pages __read_mostly; + + /* +- * sync_set_bit() and friends must be unsigned long aligned on non-x86 +- * platforms. ++ * sync_set_bit() and friends must be unsigned long aligned. + */ +-#if !defined(CONFIG_X86) && BITS_PER_LONG > 32 ++#if BITS_PER_LONG > 32 + + #define BM(w) (unsigned long *)((unsigned long)w & ~0x7UL) + #define EVTCHN_FIFO_BIT(b, w) \