]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 May 2015 17:00:48 +0000 (19:00 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 May 2015 17:00:48 +0000 (19:00 +0200)
added patches:
acpi-scan-annotate-physical_node_lock-in-acpi_scan_is_offline.patch
acpica-store-gpe-register-enable-masks-upfront.patch
acpica-tables-don-t-release-acpi_mtx_tables-in-acpi_tb_install_standard_table.patch
acpica-utilities-split-io-address-types-from-data-type-models.patch
arm64-adjust-efi-libstub-object-include-logic.patch
arm64-apply-alternatives-for-smp-kernels.patch
arm64-errata-add-workaround-for-cortex-a53-erratum-845719.patch
arm64-fix-midr-range-for-cortex-a57-erratum-832075.patch
arm64-head.s-ensure-visibility-of-page-tables.patch
asoc-cs4271-increase-delay-time-after-reset.patch
asoc-davinci-evm-drop-un-necessary-remove-function.patch
asoc-pcm512x-add-analogue-prefix-to-analogue-volume-controls.patch
asoc-pcm512x-fix-divide-by-zero-issue.patch
asoc-wm8741-fix-rates-constraints-values.patch
bluetooth-ath3k-add-support-atheros-ar5b195-combo-mini-pcie-card.patch
clk-qcom-fix-i2c-frequency-table.patch
clk-qcom-fix-ipq806x-lcc-frequency-tables.patch
clk-qcom-fix-rcg-m-n-counter-configuration.patch
clk-qcom-properly-change-rates-for-ahbix-clock.patch
clk-samsung-exynos4-disable-armclk-down-feature-on-exynos4210-soc.patch
clk-tegra-register-the-proper-number-of-resets.patch
clk-tegra-use-the-proper-parent-for-plld_dsi.patch
dm-crypt-fix-deadlock-when-async-crypto-algorithm-returns-ebusy.patch
gpio-mvebu-fix-mask-unmask-managment-per-irq-chip-type.patch
iscsi-target-convert-iscsi_thread_set-usage-to-kthread.h.patch
iser-target-fix-possible-deadlock-in-rdma_cm-connection-error.patch
iser-target-fix-session-hang-in-case-of-an-rdma-read-dif-error.patch
perf-symbols-define-stt_gnu_ifunc-for-glibc-2.9-and-older.patch
perf-tools-fix-perf-read-vdsox32-not-building-and-lib64-install-dir.patch
perf-tools-work-around-lack-of-sched_getcpu-in-glibc-2.6.patch
powerpc-cell-fix-cell-iommu-after-it_page_shift-changes.patch
powerpc-cell-fix-crash-in-iic_setup_cpu-after-per_cpu-changes.patch
powerpc-fix-missing-l2-cache-size-in-sys-devices-system-cpu.patch
powerpc-jump_label-include-linux-jump_label.h-to-get-have_jump_label-define.patch
powerpc-perf-cap-64bit-userspace-backtraces-to-perf_max_stack_depth.patch
powerpc-powernv-don-t-map-m64-segments-using-m32dt.patch
scsi-storvsc-fix-a-bug-in-copy_from_bounce_buffer.patch
sd-fix-missing-ato-tag-check.patch
sd-unregister-integrity-profile.patch
serial-8250-check-uart_scr-is-writable.patch
serial-8250_dw-add-support-for-amd-soc-carrizo.patch
serial-imx-fix-clearing-of-receiver-overrun-flag.patch
target-file-fix-bug-when-config_debug_sg-y-and-dif-protection-enabled.patch
target-file-fix-sg-table-for-prot_buf-initialization.patch
target-file-fix-unmap-with-dif-protection-support.patch
target-fix-compare_and_write-with-sg_to_mem_noalloc-handling.patch
tools-lib-traceevent-kbuffer-remove-extra-update-to-data-pointer-in-padding.patch
tools-power-turbostat-use-curdir-instead-of-pwd-and-add-support-for-o-option-in-makefile.patch
tpm-fix-sanitized-code-paths-in-tpm_chip_register.patch
ubi-account-for-bitflips-in-both-the-vid-header-and-data.patch
ubi-fix-check-for-too-many-bytes.patch
ubi-fix-out-of-bounds-write.patch
ubi-initialize-leb-number-variable.patch
xtensa-iss-fix-locking-in-tap-network-adapter.patch
xtensa-provide-__nr_sync_file_range2-instead-of-__nr_sync_file_range.patch
xtensa-xtfpga-fix-hardware-lockup-caused-by-lcd-driver.patch

57 files changed:
queue-4.0/acpi-scan-annotate-physical_node_lock-in-acpi_scan_is_offline.patch [new file with mode: 0644]
queue-4.0/acpica-store-gpe-register-enable-masks-upfront.patch [new file with mode: 0644]
queue-4.0/acpica-tables-don-t-release-acpi_mtx_tables-in-acpi_tb_install_standard_table.patch [new file with mode: 0644]
queue-4.0/acpica-utilities-split-io-address-types-from-data-type-models.patch [new file with mode: 0644]
queue-4.0/arm64-adjust-efi-libstub-object-include-logic.patch [new file with mode: 0644]
queue-4.0/arm64-apply-alternatives-for-smp-kernels.patch [new file with mode: 0644]
queue-4.0/arm64-errata-add-workaround-for-cortex-a53-erratum-845719.patch [new file with mode: 0644]
queue-4.0/arm64-fix-midr-range-for-cortex-a57-erratum-832075.patch [new file with mode: 0644]
queue-4.0/arm64-head.s-ensure-visibility-of-page-tables.patch [new file with mode: 0644]
queue-4.0/asoc-cs4271-increase-delay-time-after-reset.patch [new file with mode: 0644]
queue-4.0/asoc-davinci-evm-drop-un-necessary-remove-function.patch [new file with mode: 0644]
queue-4.0/asoc-pcm512x-add-analogue-prefix-to-analogue-volume-controls.patch [new file with mode: 0644]
queue-4.0/asoc-pcm512x-fix-divide-by-zero-issue.patch [new file with mode: 0644]
queue-4.0/asoc-wm8741-fix-rates-constraints-values.patch [new file with mode: 0644]
queue-4.0/bluetooth-ath3k-add-support-atheros-ar5b195-combo-mini-pcie-card.patch [new file with mode: 0644]
queue-4.0/clk-qcom-fix-i2c-frequency-table.patch [new file with mode: 0644]
queue-4.0/clk-qcom-fix-ipq806x-lcc-frequency-tables.patch [new file with mode: 0644]
queue-4.0/clk-qcom-fix-rcg-m-n-counter-configuration.patch [new file with mode: 0644]
queue-4.0/clk-qcom-properly-change-rates-for-ahbix-clock.patch [new file with mode: 0644]
queue-4.0/clk-samsung-exynos4-disable-armclk-down-feature-on-exynos4210-soc.patch [new file with mode: 0644]
queue-4.0/clk-tegra-register-the-proper-number-of-resets.patch [new file with mode: 0644]
queue-4.0/clk-tegra-use-the-proper-parent-for-plld_dsi.patch [new file with mode: 0644]
queue-4.0/dm-crypt-fix-deadlock-when-async-crypto-algorithm-returns-ebusy.patch [new file with mode: 0644]
queue-4.0/gpio-mvebu-fix-mask-unmask-managment-per-irq-chip-type.patch [new file with mode: 0644]
queue-4.0/iscsi-target-convert-iscsi_thread_set-usage-to-kthread.h.patch [new file with mode: 0644]
queue-4.0/iser-target-fix-possible-deadlock-in-rdma_cm-connection-error.patch [new file with mode: 0644]
queue-4.0/iser-target-fix-session-hang-in-case-of-an-rdma-read-dif-error.patch [new file with mode: 0644]
queue-4.0/perf-symbols-define-stt_gnu_ifunc-for-glibc-2.9-and-older.patch [new file with mode: 0644]
queue-4.0/perf-tools-fix-perf-read-vdsox32-not-building-and-lib64-install-dir.patch [new file with mode: 0644]
queue-4.0/perf-tools-work-around-lack-of-sched_getcpu-in-glibc-2.6.patch [new file with mode: 0644]
queue-4.0/powerpc-cell-fix-cell-iommu-after-it_page_shift-changes.patch [new file with mode: 0644]
queue-4.0/powerpc-cell-fix-crash-in-iic_setup_cpu-after-per_cpu-changes.patch [new file with mode: 0644]
queue-4.0/powerpc-fix-missing-l2-cache-size-in-sys-devices-system-cpu.patch [new file with mode: 0644]
queue-4.0/powerpc-jump_label-include-linux-jump_label.h-to-get-have_jump_label-define.patch [new file with mode: 0644]
queue-4.0/powerpc-perf-cap-64bit-userspace-backtraces-to-perf_max_stack_depth.patch [new file with mode: 0644]
queue-4.0/powerpc-powernv-don-t-map-m64-segments-using-m32dt.patch [new file with mode: 0644]
queue-4.0/scsi-storvsc-fix-a-bug-in-copy_from_bounce_buffer.patch [new file with mode: 0644]
queue-4.0/sd-fix-missing-ato-tag-check.patch [new file with mode: 0644]
queue-4.0/sd-unregister-integrity-profile.patch [new file with mode: 0644]
queue-4.0/serial-8250-check-uart_scr-is-writable.patch [new file with mode: 0644]
queue-4.0/serial-8250_dw-add-support-for-amd-soc-carrizo.patch [new file with mode: 0644]
queue-4.0/serial-imx-fix-clearing-of-receiver-overrun-flag.patch [new file with mode: 0644]
queue-4.0/series
queue-4.0/target-file-fix-bug-when-config_debug_sg-y-and-dif-protection-enabled.patch [new file with mode: 0644]
queue-4.0/target-file-fix-sg-table-for-prot_buf-initialization.patch [new file with mode: 0644]
queue-4.0/target-file-fix-unmap-with-dif-protection-support.patch [new file with mode: 0644]
queue-4.0/target-fix-compare_and_write-with-sg_to_mem_noalloc-handling.patch [new file with mode: 0644]
queue-4.0/tools-lib-traceevent-kbuffer-remove-extra-update-to-data-pointer-in-padding.patch [new file with mode: 0644]
queue-4.0/tools-power-turbostat-use-curdir-instead-of-pwd-and-add-support-for-o-option-in-makefile.patch [new file with mode: 0644]
queue-4.0/tpm-fix-sanitized-code-paths-in-tpm_chip_register.patch [new file with mode: 0644]
queue-4.0/ubi-account-for-bitflips-in-both-the-vid-header-and-data.patch [new file with mode: 0644]
queue-4.0/ubi-fix-check-for-too-many-bytes.patch [new file with mode: 0644]
queue-4.0/ubi-fix-out-of-bounds-write.patch [new file with mode: 0644]
queue-4.0/ubi-initialize-leb-number-variable.patch [new file with mode: 0644]
queue-4.0/xtensa-iss-fix-locking-in-tap-network-adapter.patch [new file with mode: 0644]
queue-4.0/xtensa-provide-__nr_sync_file_range2-instead-of-__nr_sync_file_range.patch [new file with mode: 0644]
queue-4.0/xtensa-xtfpga-fix-hardware-lockup-caused-by-lcd-driver.patch [new file with mode: 0644]

diff --git a/queue-4.0/acpi-scan-annotate-physical_node_lock-in-acpi_scan_is_offline.patch b/queue-4.0/acpi-scan-annotate-physical_node_lock-in-acpi_scan_is_offline.patch
new file mode 100644 (file)
index 0000000..a88e7e9
--- /dev/null
@@ -0,0 +1,39 @@
+From 4c533c801d1c9b5c38458a0e7516e0cf50643782 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Sat, 18 Apr 2015 01:25:46 +0200
+Subject: ACPI / scan: Annotate physical_node_lock in acpi_scan_is_offline()
+
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+
+commit 4c533c801d1c9b5c38458a0e7516e0cf50643782 upstream.
+
+acpi_scan_is_offline() may be called under the physical_node_lock
+lock of the given device object's parent, so prevent lockdep from
+complaining about that by annotating that instance with
+SINGLE_DEPTH_NESTING.
+
+Fixes: caa73ea158de (ACPI / hotplug / driver core: Handle containers in a special way)
+Reported-and-tested-by: Xie XiuQi <xiexiuqi@huawei.com>
+Reviewed-by: Toshi Kani <toshi.kani@hp.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/scan.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/drivers/acpi/scan.c
++++ b/drivers/acpi/scan.c
+@@ -298,7 +298,11 @@ bool acpi_scan_is_offline(struct acpi_de
+       struct acpi_device_physical_node *pn;
+       bool offline = true;
+-      mutex_lock(&adev->physical_node_lock);
++      /*
++       * acpi_container_offline() calls this for all of the container's
++       * children under the container's physical_node_lock lock.
++       */
++      mutex_lock_nested(&adev->physical_node_lock, SINGLE_DEPTH_NESTING);
+       list_for_each_entry(pn, &adev->physical_node_list, node)
+               if (device_supports_offline(pn->dev) && !pn->dev->offline) {
diff --git a/queue-4.0/acpica-store-gpe-register-enable-masks-upfront.patch b/queue-4.0/acpica-store-gpe-register-enable-masks-upfront.patch
new file mode 100644 (file)
index 0000000..eec1a91
--- /dev/null
@@ -0,0 +1,121 @@
+From 0ee0d34985ceffe4036319e1e46df8bff591b9e3 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Wed, 15 Apr 2015 04:00:27 +0200
+Subject: ACPICA: Store GPE register enable masks upfront
+
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+
+commit 0ee0d34985ceffe4036319e1e46df8bff591b9e3 upstream.
+
+It is reported that ACPI interrupts do not work any more on
+Dell Latitude D600 after commit c50f13c672df (ACPICA: Save
+current masks of enabled GPEs after enable register writes).
+The problem turns out to be related to the fact that the
+enable_mask and enable_for_run GPE bit masks are not in
+sync (in the absence of any system suspend/resume events)
+for at least one GPE register on that machine.
+
+Address this problem by writing the enable_for_run mask into
+enable_mask as soon as enable_for_run is updated instead of
+doing that only after the subsequent register write has
+succeeded.  For consistency, update acpi_hw_gpe_enable_write()
+to store the bit mask to be written into the GPE register
+in enable_mask unconditionally before the write.
+
+Since the ACPI_GPE_SAVE_MASK flag is not necessary any more after
+that, drop it along with the symbols depending on it.
+
+Reported-and-tested-by: Jim Bos <jim876@xs4all.nl>
+Fixes: c50f13c672df (ACPICA: Save current masks of enabled GPEs after enable register writes)
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/acpica/evgpe.c |    5 +++--
+ drivers/acpi/acpica/hwgpe.c |   11 ++++-------
+ include/acpi/actypes.h      |    4 ----
+ 3 files changed, 7 insertions(+), 13 deletions(-)
+
+--- a/drivers/acpi/acpica/evgpe.c
++++ b/drivers/acpi/acpica/evgpe.c
+@@ -92,6 +92,7 @@ acpi_ev_update_gpe_enable_mask(struct ac
+               ACPI_SET_BIT(gpe_register_info->enable_for_run,
+                            (u8)register_bit);
+       }
++      gpe_register_info->enable_mask = gpe_register_info->enable_for_run;
+       return_ACPI_STATUS(AE_OK);
+ }
+@@ -123,7 +124,7 @@ acpi_status acpi_ev_enable_gpe(struct ac
+       /* Enable the requested GPE */
+-      status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE_SAVE);
++      status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
+       return_ACPI_STATUS(status);
+ }
+@@ -202,7 +203,7 @@ acpi_ev_remove_gpe_reference(struct acpi
+               if (ACPI_SUCCESS(status)) {
+                       status =
+                           acpi_hw_low_set_gpe(gpe_event_info,
+-                                              ACPI_GPE_DISABLE_SAVE);
++                                              ACPI_GPE_DISABLE);
+               }
+               if (ACPI_FAILURE(status)) {
+--- a/drivers/acpi/acpica/hwgpe.c
++++ b/drivers/acpi/acpica/hwgpe.c
+@@ -89,6 +89,8 @@ u32 acpi_hw_get_gpe_register_bit(struct
+  * RETURN:    Status
+  *
+  * DESCRIPTION: Enable or disable a single GPE in the parent enable register.
++ *              The enable_mask field of the involved GPE register must be
++ *              updated by the caller if necessary.
+  *
+  ******************************************************************************/
+@@ -119,7 +121,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_even
+       /* Set or clear just the bit that corresponds to this GPE */
+       register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info);
+-      switch (action & ~ACPI_GPE_SAVE_MASK) {
++      switch (action) {
+       case ACPI_GPE_CONDITIONAL_ENABLE:
+               /* Only enable if the corresponding enable_mask bit is set */
+@@ -149,9 +151,6 @@ acpi_hw_low_set_gpe(struct acpi_gpe_even
+       /* Write the updated enable mask */
+       status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address);
+-      if (ACPI_SUCCESS(status) && (action & ACPI_GPE_SAVE_MASK)) {
+-              gpe_register_info->enable_mask = (u8)enable_mask;
+-      }
+       return (status);
+ }
+@@ -286,10 +285,8 @@ acpi_hw_gpe_enable_write(u8 enable_mask,
+ {
+       acpi_status status;
++      gpe_register_info->enable_mask = enable_mask;
+       status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address);
+-      if (ACPI_SUCCESS(status)) {
+-              gpe_register_info->enable_mask = enable_mask;
+-      }
+       return (status);
+ }
+--- a/include/acpi/actypes.h
++++ b/include/acpi/actypes.h
+@@ -756,10 +756,6 @@ typedef u32 acpi_event_status;
+ #define ACPI_GPE_ENABLE                 0
+ #define ACPI_GPE_DISABLE                1
+ #define ACPI_GPE_CONDITIONAL_ENABLE     2
+-#define ACPI_GPE_SAVE_MASK              4
+-
+-#define ACPI_GPE_ENABLE_SAVE            (ACPI_GPE_ENABLE | ACPI_GPE_SAVE_MASK)
+-#define ACPI_GPE_DISABLE_SAVE           (ACPI_GPE_DISABLE | ACPI_GPE_SAVE_MASK)
+ /*
+  * GPE info flags - Per GPE
diff --git a/queue-4.0/acpica-tables-don-t-release-acpi_mtx_tables-in-acpi_tb_install_standard_table.patch b/queue-4.0/acpica-tables-don-t-release-acpi_mtx_tables-in-acpi_tb_install_standard_table.patch
new file mode 100644 (file)
index 0000000..ba122e2
--- /dev/null
@@ -0,0 +1,42 @@
+From 77ddc2fe08329e375505bc36a3df3233fe57317b Mon Sep 17 00:00:00 2001
+From: Octavian Purdila <octavian.purdila@intel.com>
+Date: Mon, 13 Apr 2015 11:49:05 +0800
+Subject: ACPICA: Tables: Don't release ACPI_MTX_TABLES in acpi_tb_install_standard_table().
+
+From: Octavian Purdila <octavian.purdila@intel.com>
+
+commit 77ddc2fe08329e375505bc36a3df3233fe57317b upstream.
+
+ACPICA commit c70434d4da13e65b6163c79a5aa16b40193631c7
+
+ACPI_MTX_TABLES is acquired and released by the callers of
+acpi_tb_install_standard_table() so releasing it in the function itself is
+causing the following error in Linux kernel if the table is reloaded:
+
+ACPI Error: Mutex [0x2] is not acquired, cannot release (20141107/utmutex-321)
+Call Trace:
+  [<ffffffff81b0bd48>] dump_stack+0x4f/0x7b
+  [<ffffffff81546bf5>] acpi_ut_release_mutex+0x47/0x67
+  [<ffffffff81544357>] acpi_load_table+0x73/0xcb
+
+Link: https://github.com/acpica/acpica/commit/c70434d4
+Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
+Signed-off-by: Lv Zheng <lv.zheng@intel.com>
+Signed-off-by: Bob Moore <robert.moore@intel.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/acpica/tbinstal.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/acpi/acpica/tbinstal.c
++++ b/drivers/acpi/acpica/tbinstal.c
+@@ -346,7 +346,6 @@ acpi_tb_install_standard_table(acpi_phys
+                                */
+                               acpi_tb_uninstall_table(&new_table_desc);
+                               *table_index = i;
+-                              (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
+                               return_ACPI_STATUS(AE_OK);
+                       }
+               }
diff --git a/queue-4.0/acpica-utilities-split-io-address-types-from-data-type-models.patch b/queue-4.0/acpica-utilities-split-io-address-types-from-data-type-models.patch
new file mode 100644 (file)
index 0000000..ec17708
--- /dev/null
@@ -0,0 +1,110 @@
+From 2b8760100e1de69b6ff004c986328a82947db4ad Mon Sep 17 00:00:00 2001
+From: Lv Zheng <lv.zheng@intel.com>
+Date: Mon, 13 Apr 2015 11:48:58 +0800
+Subject: ACPICA: Utilities: split IO address types from data type models.
+
+From: Lv Zheng <lv.zheng@intel.com>
+
+commit 2b8760100e1de69b6ff004c986328a82947db4ad upstream.
+
+ACPICA commit aacf863cfffd46338e268b7415f7435cae93b451
+
+It is reported that on a physically 64-bit addressed machine, 32-bit kernel
+can trigger crashes in accessing the memory regions that are beyond the
+32-bit boundary. The region field's start address should still be 32-bit
+compliant, but after a calculation (adding some offsets), it may exceed the
+32-bit boundary. This case is rare and buggy, but there are real BIOSes
+leaked with such issues (see References below).
+
+This patch fixes this gap by always defining IO addresses as 64-bit, and
+allows OSPMs to optimize it for a real 32-bit machine to reduce the size of
+the internal objects.
+
+Internal acpi_physical_address usages in the structures that can be fixed
+by this change include:
+ 1. struct acpi_object_region:
+    acpi_physical_address              address;
+ 2. struct acpi_address_range:
+    acpi_physical_address              start_address;
+    acpi_physical_address              end_address;
+ 3. struct acpi_mem_space_context;
+    acpi_physical_address              address;
+ 4. struct acpi_table_desc
+    acpi_physical_address              address;
+See known issues 1 for other usages.
+
+Note that acpi_io_address which is used for ACPI_PROCESSOR may also suffer
+from same problem, so this patch changes it accordingly.
+
+For iasl, it will enforce acpi_physical_address as 32-bit to generate
+32-bit OSPM compatible tables on 32-bit platforms, we need to define
+ACPI_32BIT_PHYSICAL_ADDRESS for it in acenv.h.
+
+Known issues:
+ 1. Cleanup of mapped virtual address
+   In struct acpi_mem_space_context, acpi_physical_address is used as a virtual
+   address:
+    acpi_physical_address                   mapped_physical_address;
+   It is better to introduce acpi_virtual_address or use acpi_size instead.
+   This patch doesn't make such a change. Because this should be done along
+   with a change to acpi_os_map_memory()/acpi_os_unmap_memory().
+   There should be no functional problem to leave this unchanged except
+   that only this structure is enlarged unexpectedly.
+
+Link: https://github.com/acpica/acpica/commit/aacf863c
+Reference: https://bugzilla.kernel.org/show_bug.cgi?id=87971
+Reference: https://bugzilla.kernel.org/show_bug.cgi?id=79501
+Reported-and-tested-by: Paul Menzel <paulepanter@users.sourceforge.net>
+Reported-and-tested-by: Sial Nije <sialnije@gmail.com>
+Signed-off-by: Lv Zheng <lv.zheng@intel.com>
+Signed-off-by: Bob Moore <robert.moore@intel.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/acpi/actypes.h        |   20 ++++++++++++++++++++
+ include/acpi/platform/acenv.h |    1 +
+ 2 files changed, 21 insertions(+)
+
+--- a/include/acpi/actypes.h
++++ b/include/acpi/actypes.h
+@@ -199,9 +199,29 @@ typedef int s32;
+ typedef s32 acpi_native_int;
+ typedef u32 acpi_size;
++
++#ifdef ACPI_32BIT_PHYSICAL_ADDRESS
++
++/*
++ * OSPMs can define this to shrink the size of the structures for 32-bit
++ * none PAE environment. ASL compiler may always define this to generate
++ * 32-bit OSPM compliant tables.
++ */
+ typedef u32 acpi_io_address;
+ typedef u32 acpi_physical_address;
++#else                         /* ACPI_32BIT_PHYSICAL_ADDRESS */
++
++/*
++ * It is reported that, after some calculations, the physical addresses can
++ * wrap over the 32-bit boundary on 32-bit PAE environment.
++ * https://bugzilla.kernel.org/show_bug.cgi?id=87971
++ */
++typedef u64 acpi_io_address;
++typedef u64 acpi_physical_address;
++
++#endif                                /* ACPI_32BIT_PHYSICAL_ADDRESS */
++
+ #define ACPI_MAX_PTR                    ACPI_UINT32_MAX
+ #define ACPI_SIZE_MAX                   ACPI_UINT32_MAX
+--- a/include/acpi/platform/acenv.h
++++ b/include/acpi/platform/acenv.h
+@@ -76,6 +76,7 @@
+ #define ACPI_LARGE_NAMESPACE_NODE
+ #define ACPI_DATA_TABLE_DISASSEMBLY
+ #define ACPI_SINGLE_THREADED
++#define ACPI_32BIT_PHYSICAL_ADDRESS
+ #endif
+ /* acpi_exec configuration. Multithreaded with full AML debugger */
diff --git a/queue-4.0/arm64-adjust-efi-libstub-object-include-logic.patch b/queue-4.0/arm64-adjust-efi-libstub-object-include-logic.patch
new file mode 100644 (file)
index 0000000..032099e
--- /dev/null
@@ -0,0 +1,52 @@
+From ad08fd494bf00c03ae372e0bbd9cefa37bf608d6 Mon Sep 17 00:00:00 2001
+From: Steve Capper <steve.capper@linaro.org>
+Date: Mon, 16 Mar 2015 09:30:39 +0000
+Subject: arm64: Adjust EFI libstub object include logic
+
+From: Steve Capper <steve.capper@linaro.org>
+
+commit ad08fd494bf00c03ae372e0bbd9cefa37bf608d6 upstream.
+
+Commit f4f75ad5 ("efi: efistub: Convert into static library")
+introduced a static library for EFI stub, libstub.
+
+The EFI libstub directory is referenced by the kernel build system via
+a obj subdirectory rule in:
+drivers/firmware/efi/Makefile
+
+Unfortunately, arm64 also references the EFI libstub via:
+libs-$(CONFIG_EFI_STUB) += drivers/firmware/efi/libstub/
+
+If we're unlucky, the kernel build system can enter libstub via two
+simultaneous threads resulting in build failures such as:
+
+fixdep: error opening depfile: drivers/firmware/efi/libstub/.efi-stub-helper.o.d: No such file or directory
+scripts/Makefile.build:257: recipe for target 'drivers/firmware/efi/libstub/efi-stub-helper.o' failed
+make[1]: *** [drivers/firmware/efi/libstub/efi-stub-helper.o] Error 2
+Makefile:939: recipe for target 'drivers/firmware/efi/libstub' failed
+make: *** [drivers/firmware/efi/libstub] Error 2
+make: *** Waiting for unfinished jobs....
+
+This patch adjusts the arm64 Makefile to reference the compiled library
+explicitly (as is currently done in x86), rather than the directory.
+
+Fixes: f4f75ad5 efi: efistub: Convert into static library
+Signed-off-by: Steve Capper <steve.capper@linaro.org>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/Makefile |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/Makefile
++++ b/arch/arm64/Makefile
+@@ -48,7 +48,7 @@ core-$(CONFIG_KVM) += arch/arm64/kvm/
+ core-$(CONFIG_XEN) += arch/arm64/xen/
+ core-$(CONFIG_CRYPTO) += arch/arm64/crypto/
+ libs-y                := arch/arm64/lib/ $(libs-y)
+-libs-$(CONFIG_EFI_STUB) += drivers/firmware/efi/libstub/
++core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
+ # Default target when executing plain make
+ KBUILD_IMAGE  := Image.gz
diff --git a/queue-4.0/arm64-apply-alternatives-for-smp-kernels.patch b/queue-4.0/arm64-apply-alternatives-for-smp-kernels.patch
new file mode 100644 (file)
index 0000000..9b5f4c6
--- /dev/null
@@ -0,0 +1,90 @@
+From 137650aad96c9594683445e41afa8ac5a2097520 Mon Sep 17 00:00:00 2001
+From: Mark Rutland <mark.rutland@arm.com>
+Date: Fri, 13 Mar 2015 16:14:34 +0000
+Subject: arm64: apply alternatives for !SMP kernels
+
+From: Mark Rutland <mark.rutland@arm.com>
+
+commit 137650aad96c9594683445e41afa8ac5a2097520 upstream.
+
+Currently we only perform alternative patching for kernels built with
+CONFIG_SMP, as we call apply_alternatives_all() in smp.c, which is only
+built for CONFIG_SMP. Thus !SMP kernels may not have necessary
+alternatives patched in.
+
+This patch ensures that we call apply_alternatives_all() once all CPUs
+are booted, even for !SMP kernels, by having the smp_init_cpus() stub
+call this for !SMP kernels via up_late_init. A new wrapper,
+do_post_cpus_up_work, is added so we can hook other calls here later
+(e.g. boot mode logging).
+
+Cc: Andre Przywara <andre.przywara@arm.com>
+Cc: Catalin Marinas <catalin.marinas@arm.com>
+Fixes: e039ee4ee3fcf174 ("arm64: add alternative runtime patching")
+Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Signed-off-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/Kconfig                |    4 ++++
+ arch/arm64/include/asm/smp_plat.h |    2 ++
+ arch/arm64/kernel/setup.c         |   12 ++++++++++++
+ arch/arm64/kernel/smp.c           |    2 +-
+ 4 files changed, 19 insertions(+), 1 deletion(-)
+
+--- a/arch/arm64/Kconfig
++++ b/arch/arm64/Kconfig
+@@ -470,6 +470,10 @@ config HOTPLUG_CPU
+ source kernel/Kconfig.preempt
++config UP_LATE_INIT
++       def_bool y
++       depends on !SMP
++
+ config HZ
+       int
+       default 100
+--- a/arch/arm64/include/asm/smp_plat.h
++++ b/arch/arm64/include/asm/smp_plat.h
+@@ -40,4 +40,6 @@ static inline u32 mpidr_hash_size(void)
+ extern u64 __cpu_logical_map[NR_CPUS];
+ #define cpu_logical_map(cpu)    __cpu_logical_map[cpu]
++void __init do_post_cpus_up_work(void);
++
+ #endif /* __ASM_SMP_PLAT_H */
+--- a/arch/arm64/kernel/setup.c
++++ b/arch/arm64/kernel/setup.c
+@@ -207,6 +207,18 @@ static void __init smp_build_mpidr_hash(
+ }
+ #endif
++void __init do_post_cpus_up_work(void)
++{
++      apply_alternatives_all();
++}
++
++#ifdef CONFIG_UP_LATE_INIT
++void __init up_late_init(void)
++{
++      do_post_cpus_up_work();
++}
++#endif /* CONFIG_UP_LATE_INIT */
++
+ static void __init setup_processor(void)
+ {
+       struct cpu_info *cpu_info;
+--- a/arch/arm64/kernel/smp.c
++++ b/arch/arm64/kernel/smp.c
+@@ -309,7 +309,7 @@ void cpu_die(void)
+ void __init smp_cpus_done(unsigned int max_cpus)
+ {
+       pr_info("SMP: Total of %d processors activated.\n", num_online_cpus());
+-      apply_alternatives_all();
++      do_post_cpus_up_work();
+ }
+ void __init smp_prepare_boot_cpu(void)
diff --git a/queue-4.0/arm64-errata-add-workaround-for-cortex-a53-erratum-845719.patch b/queue-4.0/arm64-errata-add-workaround-for-cortex-a53-erratum-845719.patch
new file mode 100644 (file)
index 0000000..dab0c1c
--- /dev/null
@@ -0,0 +1,130 @@
+From 905e8c5dcaa147163672b06fe9dcb5abaacbc711 Mon Sep 17 00:00:00 2001
+From: Will Deacon <will.deacon@arm.com>
+Date: Mon, 23 Mar 2015 19:07:02 +0000
+Subject: arm64: errata: add workaround for cortex-a53 erratum #845719
+
+From: Will Deacon <will.deacon@arm.com>
+
+commit 905e8c5dcaa147163672b06fe9dcb5abaacbc711 upstream.
+
+When running a compat (AArch32) userspace on Cortex-A53, a load at EL0
+from a virtual address that matches the bottom 32 bits of the virtual
+address used by a recent load at (AArch64) EL1 might return incorrect
+data.
+
+This patch works around the issue by writing to the contextidr_el1
+register on the exception return path when returning to a 32-bit task.
+This workaround is patched in at runtime based on the MIDR value of the
+processor.
+
+Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
+Tested-by: Mark Rutland <mark.rutland@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Kevin Hilman <khilman@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/Kconfig                  |   21 +++++++++++++++++++++
+ arch/arm64/include/asm/cpufeature.h |    3 ++-
+ arch/arm64/kernel/cpu_errata.c      |    8 ++++++++
+ arch/arm64/kernel/entry.S           |   20 ++++++++++++++++++++
+ 4 files changed, 51 insertions(+), 1 deletion(-)
+
+--- a/arch/arm64/Kconfig
++++ b/arch/arm64/Kconfig
+@@ -361,6 +361,27 @@ config ARM64_ERRATUM_832075
+         If unsure, say Y.
++config ARM64_ERRATUM_845719
++      bool "Cortex-A53: 845719: a load might read incorrect data"
++      depends on COMPAT
++      default y
++      help
++        This option adds an alternative code sequence to work around ARM
++        erratum 845719 on Cortex-A53 parts up to r0p4.
++
++        When running a compat (AArch32) userspace on an affected Cortex-A53
++        part, a load at EL0 from a virtual address that matches the bottom 32
++        bits of the virtual address used by a recent load at (AArch64) EL1
++        might return incorrect data.
++
++        The workaround is to write the contextidr_el1 register on exception
++        return to a 32-bit task.
++        Please note that this does not necessarily enable the workaround,
++        as it depends on the alternative framework, which will only patch
++        the kernel if an affected CPU is detected.
++
++        If unsure, say Y.
++
+ endmenu
+--- a/arch/arm64/include/asm/cpufeature.h
++++ b/arch/arm64/include/asm/cpufeature.h
+@@ -23,8 +23,9 @@
+ #define ARM64_WORKAROUND_CLEAN_CACHE          0
+ #define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE  1
++#define ARM64_WORKAROUND_845719                       2
+-#define ARM64_NCAPS                           2
++#define ARM64_NCAPS                           3
+ #ifndef __ASSEMBLY__
+--- a/arch/arm64/kernel/cpu_errata.c
++++ b/arch/arm64/kernel/cpu_errata.c
+@@ -92,6 +92,14 @@ struct arm64_cpu_capabilities arm64_erra
+                          (1 << MIDR_VARIANT_SHIFT) | 2),
+       },
+ #endif
++#ifdef CONFIG_ARM64_ERRATUM_845719
++      {
++      /* Cortex-A53 r0p[01234] */
++              .desc = "ARM erratum 845719",
++              .capability = ARM64_WORKAROUND_845719,
++              MIDR_RANGE(MIDR_CORTEX_A53, 0x00, 0x04),
++      },
++#endif
+       {
+       }
+ };
+--- a/arch/arm64/kernel/entry.S
++++ b/arch/arm64/kernel/entry.S
+@@ -21,8 +21,10 @@
+ #include <linux/init.h>
+ #include <linux/linkage.h>
++#include <asm/alternative-asm.h>
+ #include <asm/assembler.h>
+ #include <asm/asm-offsets.h>
++#include <asm/cpufeature.h>
+ #include <asm/errno.h>
+ #include <asm/esr.h>
+ #include <asm/thread_info.h>
+@@ -120,6 +122,24 @@
+       ct_user_enter
+       ldr     x23, [sp, #S_SP]                // load return stack pointer
+       msr     sp_el0, x23
++
++#ifdef CONFIG_ARM64_ERRATUM_845719
++      alternative_insn                                                \
++      "nop",                                                          \
++      "tbz x22, #4, 1f",                                              \
++      ARM64_WORKAROUND_845719
++#ifdef CONFIG_PID_IN_CONTEXTIDR
++      alternative_insn                                                \
++      "nop; nop",                                                     \
++      "mrs x29, contextidr_el1; msr contextidr_el1, x29; 1:",         \
++      ARM64_WORKAROUND_845719
++#else
++      alternative_insn                                                \
++      "nop",                                                          \
++      "msr contextidr_el1, xzr; 1:",                                  \
++      ARM64_WORKAROUND_845719
++#endif
++#endif
+       .endif
+       msr     elr_el1, x21                    // set up the return data
+       msr     spsr_el1, x22
diff --git a/queue-4.0/arm64-fix-midr-range-for-cortex-a57-erratum-832075.patch b/queue-4.0/arm64-fix-midr-range-for-cortex-a57-erratum-832075.patch
new file mode 100644 (file)
index 0000000..8f21228
--- /dev/null
@@ -0,0 +1,39 @@
+From 6d1966dfd6e0ad2f8aa4b664ae1a62e33abe1998 Mon Sep 17 00:00:00 2001
+From: Bo Yan <byan@nvidia.com>
+Date: Tue, 31 Mar 2015 21:30:48 +0100
+Subject: arm64: fix midr range for Cortex-A57 erratum 832075
+
+From: Bo Yan <byan@nvidia.com>
+
+commit 6d1966dfd6e0ad2f8aa4b664ae1a62e33abe1998 upstream.
+
+Register MIDR_EL1 is masked to get variant and revision fields, then
+compared against midr_range_min and midr_range_max when checking
+whether CPU is affected by any particular erratum. However, variant
+and revision fields in MIDR_EL1 are separated by 16 bits, so the min
+and max of midr range should be constructed accordingly, otherwise
+the patch will not be applied when variant field is non-0.
+
+Acked-by: Andre Przywara <andre.przywara@arm.com>
+Reviewed-by: Paul Walmsley <paul@pwsan.com>
+Signed-off-by: Bo Yan <byan@nvidia.com>
+[will: use MIDR_VARIANT_SHIFT to construct upper bound]
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kernel/cpu_errata.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/arch/arm64/kernel/cpu_errata.c
++++ b/arch/arm64/kernel/cpu_errata.c
+@@ -88,7 +88,8 @@ struct arm64_cpu_capabilities arm64_erra
+       /* Cortex-A57 r0p0 - r1p2 */
+               .desc = "ARM erratum 832075",
+               .capability = ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE,
+-              MIDR_RANGE(MIDR_CORTEX_A57, 0x00, 0x12),
++              MIDR_RANGE(MIDR_CORTEX_A57, 0x00,
++                         (1 << MIDR_VARIANT_SHIFT) | 2),
+       },
+ #endif
+       {
diff --git a/queue-4.0/arm64-head.s-ensure-visibility-of-page-tables.patch b/queue-4.0/arm64-head.s-ensure-visibility-of-page-tables.patch
new file mode 100644 (file)
index 0000000..76229be
--- /dev/null
@@ -0,0 +1,46 @@
+From 91d57155dc5ab4b311624b7ee570339b6af19ad5 Mon Sep 17 00:00:00 2001
+From: Mark Rutland <mark.rutland@arm.com>
+Date: Tue, 24 Mar 2015 13:50:27 +0000
+Subject: arm64: head.S: ensure visibility of page tables
+
+From: Mark Rutland <mark.rutland@arm.com>
+
+commit 91d57155dc5ab4b311624b7ee570339b6af19ad5 upstream.
+
+After writing the page tables, we use __inval_cache_range to invalidate
+any stale cache entries. Strongly Ordered memory accesses are not
+ordered w.r.t. cache maintenance instructions, and hence explicit memory
+barriers are required to provide this ordering. However,
+__inval_cache_range was written to be used on Normal Cacheable memory
+once the MMU and caches are on, and does not have any barriers prior to
+the DC instructions.
+
+This patch adds a DMB between the page tables being written and the
+corresponding cachelines being invalidated, ensuring that the
+invalidation makes the new data visible to subsequent cacheable
+accesses. A barrier is not required before the prior invalidate as we do
+not access the page table memory area prior to this, and earlier
+barriers in preserve_boot_args and set_cpu_boot_mode_flag ensures
+ordering w.r.t. any stores performed prior to entering Linux.
+
+Signed-off-by: Mark Rutland <mark.rutland@arm.com>
+Cc: Catalin Marinas <catalin.marinas@arm.com>
+Cc: Will Deacon <will.deacon@arm.com>
+Fixes: c218bca74eeafa2f ("arm64: Relax the kernel cache requirements for boot")
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kernel/head.S |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/arm64/kernel/head.S
++++ b/arch/arm64/kernel/head.S
+@@ -426,6 +426,7 @@ __create_page_tables:
+        */
+       mov     x0, x25
+       add     x1, x26, #SWAPPER_DIR_SIZE
++      dmb     sy
+       bl      __inval_cache_range
+       mov     lr, x27
diff --git a/queue-4.0/asoc-cs4271-increase-delay-time-after-reset.patch b/queue-4.0/asoc-cs4271-increase-delay-time-after-reset.patch
new file mode 100644 (file)
index 0000000..36eb7c3
--- /dev/null
@@ -0,0 +1,37 @@
+From 74ff960222d90999508b4ba0d3449f796695b6d5 Mon Sep 17 00:00:00 2001
+From: Pascal Huerst <pascal.huerst@gmail.com>
+Date: Thu, 2 Apr 2015 10:17:40 +0200
+Subject: ASoC: cs4271: Increase delay time after reset
+
+From: Pascal Huerst <pascal.huerst@gmail.com>
+
+commit 74ff960222d90999508b4ba0d3449f796695b6d5 upstream.
+
+The delay time after a reset in the codec probe callback was too short,
+and did not work on certain hw because the codec needs more time to
+power on. This increases the delay time from 1us to 1ms.
+
+Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com>
+Acked-by: Brian Austin <brian.austin@cirrus.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/cs4271.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/sound/soc/codecs/cs4271.c
++++ b/sound/soc/codecs/cs4271.c
+@@ -561,10 +561,10 @@ static int cs4271_codec_probe(struct snd
+       if (gpio_is_valid(cs4271->gpio_nreset)) {
+               /* Reset codec */
+               gpio_direction_output(cs4271->gpio_nreset, 0);
+-              udelay(1);
++              mdelay(1);
+               gpio_set_value(cs4271->gpio_nreset, 1);
+               /* Give the codec time to wake up */
+-              udelay(1);
++              mdelay(1);
+       }
+       ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2,
diff --git a/queue-4.0/asoc-davinci-evm-drop-un-necessary-remove-function.patch b/queue-4.0/asoc-davinci-evm-drop-un-necessary-remove-function.patch
new file mode 100644 (file)
index 0000000..08f4b74
--- /dev/null
@@ -0,0 +1,45 @@
+From a57069e33fbc6625f39e1b09c88ea44629a35206 Mon Sep 17 00:00:00 2001
+From: Manish Badarkhe <manishvb@ti.com>
+Date: Thu, 26 Mar 2015 15:38:25 +0200
+Subject: ASoC: davinci-evm: drop un-necessary remove function
+
+From: Manish Badarkhe <manishvb@ti.com>
+
+commit a57069e33fbc6625f39e1b09c88ea44629a35206 upstream.
+
+As davinci card gets registered using 'devm_' api
+there is no need to unregister the card in 'remove'
+function.
+Hence drop the 'remove' function.
+
+Fixes: ee2f615d6e59c (ASoC: davinci-evm: Add device tree binding)
+Signed-off-by: Manish Badarkhe <manishvb@ti.com>
+Signed-off-by: Jyri Sarha <jsarha@ti.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/davinci/davinci-evm.c |   10 ----------
+ 1 file changed, 10 deletions(-)
+
+--- a/sound/soc/davinci/davinci-evm.c
++++ b/sound/soc/davinci/davinci-evm.c
+@@ -425,18 +425,8 @@ static int davinci_evm_probe(struct plat
+       return ret;
+ }
+-static int davinci_evm_remove(struct platform_device *pdev)
+-{
+-      struct snd_soc_card *card = platform_get_drvdata(pdev);
+-
+-      snd_soc_unregister_card(card);
+-
+-      return 0;
+-}
+-
+ static struct platform_driver davinci_evm_driver = {
+       .probe          = davinci_evm_probe,
+-      .remove         = davinci_evm_remove,
+       .driver         = {
+               .name   = "davinci_evm",
+               .pm     = &snd_soc_pm_ops,
diff --git a/queue-4.0/asoc-pcm512x-add-analogue-prefix-to-analogue-volume-controls.patch b/queue-4.0/asoc-pcm512x-add-analogue-prefix-to-analogue-volume-controls.patch
new file mode 100644 (file)
index 0000000..7cb3e52
--- /dev/null
@@ -0,0 +1,34 @@
+From 4d9b13c7cc803fbde59d7e998f7de2b9a2101c7e Mon Sep 17 00:00:00 2001
+From: Howard Mitchell <hm@hmbedded.co.uk>
+Date: Thu, 19 Mar 2015 12:08:30 +0000
+Subject: ASoC: pcm512x: Add 'Analogue' prefix to analogue volume controls
+
+From: Howard Mitchell <hm@hmbedded.co.uk>
+
+commit 4d9b13c7cc803fbde59d7e998f7de2b9a2101c7e upstream.
+
+This is to ensure that 'alsactl restore' does not apply default
+initialisation as the chip reset defaults are preferred.
+
+Signed-off-by: Howard Mitchell <hm@hmbedded.co.uk>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/pcm512x.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/sound/soc/codecs/pcm512x.c
++++ b/sound/soc/codecs/pcm512x.c
+@@ -304,9 +304,9 @@ static const struct soc_enum pcm512x_ved
+ static const struct snd_kcontrol_new pcm512x_controls[] = {
+ SOC_DOUBLE_R_TLV("Digital Playback Volume", PCM512x_DIGITAL_VOLUME_2,
+                PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv),
+-SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL,
++SOC_DOUBLE_TLV("Analogue Playback Volume", PCM512x_ANALOG_GAIN_CTRL,
+              PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv),
+-SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST,
++SOC_DOUBLE_TLV("Analogue Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST,
+              PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv),
+ SOC_DOUBLE("Digital Playback Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT,
+          PCM512x_RQMR_SHIFT, 1, 1),
diff --git a/queue-4.0/asoc-pcm512x-fix-divide-by-zero-issue.patch b/queue-4.0/asoc-pcm512x-fix-divide-by-zero-issue.patch
new file mode 100644 (file)
index 0000000..ea88e30
--- /dev/null
@@ -0,0 +1,35 @@
+From f073faa73626f41db7050a69edd5074c53ce6d6c Mon Sep 17 00:00:00 2001
+From: Howard Mitchell <hm@hmbedded.co.uk>
+Date: Fri, 20 Mar 2015 21:13:45 +0000
+Subject: ASoC: pcm512x: Fix divide by zero issue
+
+From: Howard Mitchell <hm@hmbedded.co.uk>
+
+commit f073faa73626f41db7050a69edd5074c53ce6d6c upstream.
+
+If den=1 and pllin_rate>20MHz then den and num are adjusted to 0
+causing a divide by zero error a few lines further on. Therefore
+this patch correctly scales num and den such that
+pllin_rate/den < 20MHz as required in the device data sheet.
+
+Signed-off-by: Howard Mitchell <hm@hmbedded.co.uk>
+Signed-off-by: Mark Brown <broonie@sirena.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/pcm512x.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/sound/soc/codecs/pcm512x.c
++++ b/sound/soc/codecs/pcm512x.c
+@@ -576,8 +576,8 @@ static int pcm512x_find_pll_coeff(struct
+       /* pllin_rate / P (or here, den) cannot be greater than 20 MHz */
+       if (pllin_rate / den > 20000000 && num < 8) {
+-              num *= 20000000 / (pllin_rate / den);
+-              den *= 20000000 / (pllin_rate / den);
++              num *= DIV_ROUND_UP(pllin_rate / den, 20000000);
++              den *= DIV_ROUND_UP(pllin_rate / den, 20000000);
+       }
+       dev_dbg(dev, "num / den = %lu / %lu\n", num, den);
diff --git a/queue-4.0/asoc-wm8741-fix-rates-constraints-values.patch b/queue-4.0/asoc-wm8741-fix-rates-constraints-values.patch
new file mode 100644 (file)
index 0000000..6845586
--- /dev/null
@@ -0,0 +1,63 @@
+From 8787041d9bb832b9449b1eb878cedcebce42c61a Mon Sep 17 00:00:00 2001
+From: Sergej Sawazki <ce3a@gmx.de>
+Date: Tue, 24 Mar 2015 21:13:22 +0100
+Subject: ASoC: wm8741: Fix rates constraints values
+
+From: Sergej Sawazki <ce3a@gmx.de>
+
+commit 8787041d9bb832b9449b1eb878cedcebce42c61a upstream.
+
+The WM8741 DAC supports the following typical audio sampling rates:
+  44.1kHz, 88.2kHz, 176.4kHz (eg: with a master clock of 22.5792MHz)
+  32kHz, 48kHz, 96kHz, 192kHz (eg: with a master clock of 24.576MHz)
+
+For the rates lists, we should use 82000 instead of 88235, 176400
+instead of 1764000 and 192000 instead of 19200 (seems to be a typo).
+
+Signed-off-by: Sergej Sawazki <ce3a@gmx.de>
+Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/wm8741.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/sound/soc/codecs/wm8741.c
++++ b/sound/soc/codecs/wm8741.c
+@@ -123,7 +123,7 @@ static struct {
+ };
+ static const unsigned int rates_11289[] = {
+-      44100, 88235,
++      44100, 88200,
+ };
+ static const struct snd_pcm_hw_constraint_list constraints_11289 = {
+@@ -150,7 +150,7 @@ static const struct snd_pcm_hw_constrain
+ };
+ static const unsigned int rates_16934[] = {
+-      44100, 88235,
++      44100, 88200,
+ };
+ static const struct snd_pcm_hw_constraint_list constraints_16934 = {
+@@ -168,7 +168,7 @@ static const struct snd_pcm_hw_constrain
+ };
+ static const unsigned int rates_22579[] = {
+-      44100, 88235, 1764000
++      44100, 88200, 176400
+ };
+ static const struct snd_pcm_hw_constraint_list constraints_22579 = {
+@@ -186,7 +186,7 @@ static const struct snd_pcm_hw_constrain
+ };
+ static const unsigned int rates_36864[] = {
+-      48000, 96000, 19200
++      48000, 96000, 192000
+ };
+ static const struct snd_pcm_hw_constraint_list constraints_36864 = {
diff --git a/queue-4.0/bluetooth-ath3k-add-support-atheros-ar5b195-combo-mini-pcie-card.patch b/queue-4.0/bluetooth-ath3k-add-support-atheros-ar5b195-combo-mini-pcie-card.patch
new file mode 100644 (file)
index 0000000..e088ef1
--- /dev/null
@@ -0,0 +1,69 @@
+From 2eeff0b4317a02f0e281df891d990194f0737aae Mon Sep 17 00:00:00 2001
+From: Alexander Ploumistos <alex.ploumistos@gmail.com>
+Date: Fri, 13 Feb 2015 21:05:11 +0200
+Subject: Bluetooth: ath3k: Add support Atheros AR5B195 combo Mini PCIe card
+
+From: Alexander Ploumistos <alex.ploumistos@gmail.com>
+
+commit 2eeff0b4317a02f0e281df891d990194f0737aae upstream.
+
+Add 04f2:aff1 to ath3k.c supported devices list and btusb.c blacklist, so
+that the device can load the ath3k firmware and re-enumerate itself as an
+AR3011 device.
+
+T:  Bus=05 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
+D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
+P:  Vendor=04f2 ProdID=aff1 Rev= 0.01
+C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
+I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
+E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
+E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
+E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
+I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
+E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
+E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
+I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
+E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
+E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
+I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
+E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
+E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
+I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
+E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
+E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
+I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
+E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
+E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
+I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
+E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
+E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
+
+Signed-off-by: Alexander Ploumistos <alexpl@fedoraproject.org>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/bluetooth/ath3k.c |    1 +
+ drivers/bluetooth/btusb.c |    1 +
+ 2 files changed, 2 insertions(+)
+
+--- a/drivers/bluetooth/ath3k.c
++++ b/drivers/bluetooth/ath3k.c
+@@ -65,6 +65,7 @@ static const struct usb_device_id ath3k_
+       /* Atheros AR3011 with sflash firmware*/
+       { USB_DEVICE(0x0489, 0xE027) },
+       { USB_DEVICE(0x0489, 0xE03D) },
++      { USB_DEVICE(0x04F2, 0xAFF1) },
+       { USB_DEVICE(0x0930, 0x0215) },
+       { USB_DEVICE(0x0CF3, 0x3002) },
+       { USB_DEVICE(0x0CF3, 0xE019) },
+--- a/drivers/bluetooth/btusb.c
++++ b/drivers/bluetooth/btusb.c
+@@ -159,6 +159,7 @@ static const struct usb_device_id blackl
+       /* Atheros 3011 with sflash firmware */
+       { USB_DEVICE(0x0489, 0xe027), .driver_info = BTUSB_IGNORE },
+       { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE },
++      { USB_DEVICE(0x04f2, 0xaff1), .driver_info = BTUSB_IGNORE },
+       { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
+       { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE },
+       { USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE },
diff --git a/queue-4.0/clk-qcom-fix-i2c-frequency-table.patch b/queue-4.0/clk-qcom-fix-i2c-frequency-table.patch
new file mode 100644 (file)
index 0000000..d005831
--- /dev/null
@@ -0,0 +1,36 @@
+From 0bf0ff82c34da02ee5795101b328225a2d519594 Mon Sep 17 00:00:00 2001
+From: Stephen Boyd <sboyd@codeaurora.org>
+Date: Mon, 23 Feb 2015 13:30:28 -0800
+Subject: clk: qcom: Fix i2c frequency table
+
+From: Stephen Boyd <sboyd@codeaurora.org>
+
+commit 0bf0ff82c34da02ee5795101b328225a2d519594 upstream.
+
+PXO is 25MHz, not 27MHz. Fix the table.
+
+Fixes: 24d8fba44af3 "clk: qcom: Add support for IPQ8064's global
+clock controller (GCC)"
+
+Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+Reviewed-by: Andy Gross <agross@codeaurora.org>
+Tested-by: Andy Gross <agross@codeaurora.org>
+Signed-off-by: Michael Turquette <mturquette@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/qcom/gcc-ipq806x.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/clk/qcom/gcc-ipq806x.c
++++ b/drivers/clk/qcom/gcc-ipq806x.c
+@@ -525,8 +525,8 @@ static struct freq_tbl clk_tbl_gsbi_qup[
+       { 10800000, P_PXO,  1, 2,  5 },
+       { 15060000, P_PLL8, 1, 2, 51 },
+       { 24000000, P_PLL8, 4, 1,  4 },
++      { 25000000, P_PXO,  1, 0,  0 },
+       { 25600000, P_PLL8, 1, 1, 15 },
+-      { 27000000, P_PXO,  1, 0,  0 },
+       { 48000000, P_PLL8, 4, 1,  2 },
+       { 51200000, P_PLL8, 1, 2, 15 },
+       { }
diff --git a/queue-4.0/clk-qcom-fix-ipq806x-lcc-frequency-tables.patch b/queue-4.0/clk-qcom-fix-ipq806x-lcc-frequency-tables.patch
new file mode 100644 (file)
index 0000000..8f810c2
--- /dev/null
@@ -0,0 +1,56 @@
+From b3261d768bcdd4b368179ed85becf38c95461848 Mon Sep 17 00:00:00 2001
+From: Stephen Boyd <sboyd@codeaurora.org>
+Date: Thu, 26 Feb 2015 19:34:35 -0800
+Subject: clk: qcom: Fix ipq806x LCC frequency tables
+
+From: Stephen Boyd <sboyd@codeaurora.org>
+
+commit b3261d768bcdd4b368179ed85becf38c95461848 upstream.
+
+These frequency tables list the wrong rates. Either they don't
+have the correct frequency at all, or they're specified in kHz
+instead of Hz. Fix it.
+
+Fixes: c99e515a92e9 "clk: qcom: Add IPQ806X LPASS clock controller (LCC) driver"
+Tested-by: Kenneth Westfield <kwestfie@codeaurora.org>
+Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/qcom/lcc-ipq806x.c |   18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+--- a/drivers/clk/qcom/lcc-ipq806x.c
++++ b/drivers/clk/qcom/lcc-ipq806x.c
+@@ -294,14 +294,14 @@ static struct clk_regmap_mux pcm_clk = {
+ };
+ static struct freq_tbl clk_tbl_aif_osr[] = {
+-      {  22050, P_PLL4, 1, 147, 20480 },
+-      {  32000, P_PLL4, 1,   1,    96 },
+-      {  44100, P_PLL4, 1, 147, 10240 },
+-      {  48000, P_PLL4, 1,   1,    64 },
+-      {  88200, P_PLL4, 1, 147,  5120 },
+-      {  96000, P_PLL4, 1,   1,    32 },
+-      { 176400, P_PLL4, 1, 147,  2560 },
+-      { 192000, P_PLL4, 1,   1,    16 },
++      {  2822400, P_PLL4, 1, 147, 20480 },
++      {  4096000, P_PLL4, 1,   1,    96 },
++      {  5644800, P_PLL4, 1, 147, 10240 },
++      {  6144000, P_PLL4, 1,   1,    64 },
++      { 11289600, P_PLL4, 1, 147,  5120 },
++      { 12288000, P_PLL4, 1,   1,    32 },
++      { 22579200, P_PLL4, 1, 147,  2560 },
++      { 24576000, P_PLL4, 1,   1,    16 },
+       { },
+ };
+@@ -360,7 +360,7 @@ static struct clk_branch spdif_clk = {
+ };
+ static struct freq_tbl clk_tbl_ahbix[] = {
+-      { 131072, P_PLL4, 1, 1, 3 },
++      { 131072000, P_PLL4, 1, 1, 3 },
+       { },
+ };
diff --git a/queue-4.0/clk-qcom-fix-rcg-m-n-counter-configuration.patch b/queue-4.0/clk-qcom-fix-rcg-m-n-counter-configuration.patch
new file mode 100644 (file)
index 0000000..f703180
--- /dev/null
@@ -0,0 +1,44 @@
+From 0b21503dbbfa669dbd847b33578d4041513cddb2 Mon Sep 17 00:00:00 2001
+From: Archit Taneja <architt@codeaurora.org>
+Date: Wed, 4 Mar 2015 15:19:35 +0530
+Subject: clk: qcom: fix RCG M/N counter configuration
+
+From: Archit Taneja <architt@codeaurora.org>
+
+commit 0b21503dbbfa669dbd847b33578d4041513cddb2 upstream.
+
+Currently, a RCG's M/N counter (used for fraction division) is
+set to either 'bypass' (counter disabled) or 'dual edge' (counter
+enabled) based on whether the corresponding rcg struct has a mnd
+field specified and a non-zero N.
+
+In the case where M and N are the same value, the M/N counter is
+still enabled by code even though no division takes place.
+Leaving the RCG in such a state can result in improper behavior.
+This was observed with the DSI pixel clock RCG when M and N were
+both set to 1.
+
+Add an additional check (M != N) to enable the M/N counter only
+when it's needed for fraction division.
+
+Signed-off-by: Archit Taneja <architt@codeaurora.org>
+Fixes: bcd61c0f535a (clk: qcom: Add support for root clock
+generators (RCGs))
+Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/qcom/clk-rcg2.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/clk/qcom/clk-rcg2.c
++++ b/drivers/clk/qcom/clk-rcg2.c
+@@ -243,7 +243,7 @@ static int clk_rcg2_configure(struct clk
+       mask |= CFG_SRC_SEL_MASK | CFG_MODE_MASK;
+       cfg = f->pre_div << CFG_SRC_DIV_SHIFT;
+       cfg |= rcg->parent_map[f->src] << CFG_SRC_SEL_SHIFT;
+-      if (rcg->mnd_width && f->n)
++      if (rcg->mnd_width && f->n && (f->m != f->n))
+               cfg |= CFG_MODE_DUAL_EDGE;
+       ret = regmap_update_bits(rcg->clkr.regmap,
+                       rcg->cmd_rcgr + CFG_REG, mask, cfg);
diff --git a/queue-4.0/clk-qcom-properly-change-rates-for-ahbix-clock.patch b/queue-4.0/clk-qcom-properly-change-rates-for-ahbix-clock.patch
new file mode 100644 (file)
index 0000000..9cd7143
--- /dev/null
@@ -0,0 +1,132 @@
+From 9d3745d44a7faa7d24db7facb1949a1378162f3e Mon Sep 17 00:00:00 2001
+From: Stephen Boyd <sboyd@codeaurora.org>
+Date: Fri, 6 Mar 2015 15:41:53 -0800
+Subject: clk: qcom: Properly change rates for ahbix clock
+
+From: Stephen Boyd <sboyd@codeaurora.org>
+
+commit 9d3745d44a7faa7d24db7facb1949a1378162f3e upstream.
+
+The ahbix clock can never be turned off in practice. To change the
+rates we need to switch the mux off the M/N counter to an always on
+source (XO), reprogram the M/N counter to get the rate we want and
+finally switch back to the M/N counter. Add a new ops structure
+for this type of clock so that we can set the rate properly.
+
+Fixes: c99e515a92e9 "clk: qcom: Add IPQ806X LPASS clock controller (LCC) driver"
+Tested-by: Kenneth Westfield <kwestfie@codeaurora.org>
+Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/qcom/clk-rcg.c     |   62 +++++++++++++++++++++++++++++++++++++++++
+ drivers/clk/qcom/clk-rcg.h     |    1 
+ drivers/clk/qcom/lcc-ipq806x.c |    5 +--
+ 3 files changed, 65 insertions(+), 3 deletions(-)
+
+--- a/drivers/clk/qcom/clk-rcg.c
++++ b/drivers/clk/qcom/clk-rcg.c
+@@ -495,6 +495,57 @@ static int clk_rcg_bypass_set_rate(struc
+       return __clk_rcg_set_rate(rcg, rcg->freq_tbl);
+ }
++/*
++ * This type of clock has a glitch-free mux that switches between the output of
++ * the M/N counter and an always on clock source (XO). When clk_set_rate() is
++ * called we need to make sure that we don't switch to the M/N counter if it
++ * isn't clocking because the mux will get stuck and the clock will stop
++ * outputting a clock. This can happen if the framework isn't aware that this
++ * clock is on and so clk_set_rate() doesn't turn on the new parent. To fix
++ * this we switch the mux in the enable/disable ops and reprogram the M/N
++ * counter in the set_rate op. We also make sure to switch away from the M/N
++ * counter in set_rate if software thinks the clock is off.
++ */
++static int clk_rcg_lcc_set_rate(struct clk_hw *hw, unsigned long rate,
++                              unsigned long parent_rate)
++{
++      struct clk_rcg *rcg = to_clk_rcg(hw);
++      const struct freq_tbl *f;
++      int ret;
++      u32 gfm = BIT(10);
++
++      f = qcom_find_freq(rcg->freq_tbl, rate);
++      if (!f)
++              return -EINVAL;
++
++      /* Switch to XO to avoid glitches */
++      regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, 0);
++      ret = __clk_rcg_set_rate(rcg, f);
++      /* Switch back to M/N if it's clocking */
++      if (__clk_is_enabled(hw->clk))
++              regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, gfm);
++
++      return ret;
++}
++
++static int clk_rcg_lcc_enable(struct clk_hw *hw)
++{
++      struct clk_rcg *rcg = to_clk_rcg(hw);
++      u32 gfm = BIT(10);
++
++      /* Use M/N */
++      return regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, gfm);
++}
++
++static void clk_rcg_lcc_disable(struct clk_hw *hw)
++{
++      struct clk_rcg *rcg = to_clk_rcg(hw);
++      u32 gfm = BIT(10);
++
++      /* Use XO */
++      regmap_update_bits(rcg->clkr.regmap, rcg->ns_reg, gfm, 0);
++}
++
+ static int __clk_dyn_rcg_set_rate(struct clk_hw *hw, unsigned long rate)
+ {
+       struct clk_dyn_rcg *rcg = to_clk_dyn_rcg(hw);
+@@ -543,6 +594,17 @@ const struct clk_ops clk_rcg_bypass_ops
+ };
+ EXPORT_SYMBOL_GPL(clk_rcg_bypass_ops);
++const struct clk_ops clk_rcg_lcc_ops = {
++      .enable = clk_rcg_lcc_enable,
++      .disable = clk_rcg_lcc_disable,
++      .get_parent = clk_rcg_get_parent,
++      .set_parent = clk_rcg_set_parent,
++      .recalc_rate = clk_rcg_recalc_rate,
++      .determine_rate = clk_rcg_determine_rate,
++      .set_rate = clk_rcg_lcc_set_rate,
++};
++EXPORT_SYMBOL_GPL(clk_rcg_lcc_ops);
++
+ const struct clk_ops clk_dyn_rcg_ops = {
+       .enable = clk_enable_regmap,
+       .is_enabled = clk_is_enabled_regmap,
+--- a/drivers/clk/qcom/clk-rcg.h
++++ b/drivers/clk/qcom/clk-rcg.h
+@@ -96,6 +96,7 @@ struct clk_rcg {
+ extern const struct clk_ops clk_rcg_ops;
+ extern const struct clk_ops clk_rcg_bypass_ops;
++extern const struct clk_ops clk_rcg_lcc_ops;
+ #define to_clk_rcg(_hw) container_of(to_clk_regmap(_hw), struct clk_rcg, clkr)
+--- a/drivers/clk/qcom/lcc-ipq806x.c
++++ b/drivers/clk/qcom/lcc-ipq806x.c
+@@ -386,13 +386,12 @@ static struct clk_rcg ahbix_clk = {
+       .freq_tbl = clk_tbl_ahbix,
+       .clkr = {
+               .enable_reg = 0x38,
+-              .enable_mask = BIT(10), /* toggle the gfmux to select mn/pxo */
++              .enable_mask = BIT(11),
+               .hw.init = &(struct clk_init_data){
+                       .name = "ahbix",
+                       .parent_names = lcc_pxo_pll4,
+                       .num_parents = 2,
+-                      .ops = &clk_rcg_ops,
+-                      .flags = CLK_SET_RATE_GATE,
++                      .ops = &clk_rcg_lcc_ops,
+               },
+       },
+ };
diff --git a/queue-4.0/clk-samsung-exynos4-disable-armclk-down-feature-on-exynos4210-soc.patch b/queue-4.0/clk-samsung-exynos4-disable-armclk-down-feature-on-exynos4210-soc.patch
new file mode 100644 (file)
index 0000000..480ae7e
--- /dev/null
@@ -0,0 +1,69 @@
+From 3a9e9cb65be84d6c64fbe9c69a73c15d59f29454 Mon Sep 17 00:00:00 2001
+From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
+Date: Fri, 27 Mar 2015 17:27:10 +0100
+Subject: clk: samsung: exynos4: Disable ARMCLK down feature on Exynos4210 SoC
+
+From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
+
+commit 3a9e9cb65be84d6c64fbe9c69a73c15d59f29454 upstream.
+
+Commit 42773b28e71d ("clk: samsung: exynos4: Enable ARMCLK
+down feature") enabled ARMCLK down feature on all Exynos4
+SoCs.  Unfortunately on Exynos4210 SoC ARMCLK down feature
+causes a lockup when ondemand cpufreq governor is used.
+Fix it by limiting ARMCLK down feature to Exynos4x12 SoCs.
+
+This patch was tested on:
+- Exynos4210 SoC based Trats board
+- Exynos4210 SoC based Origen board
+- Exynos4412 SoC based Trats2 board
+- Exynos4412 SoC based Odroid-U3 board
+
+Cc: Daniel Drake <drake@endlessm.com>
+Cc: Tomasz Figa <t.figa@samsung.com>
+Cc: Kukjin Kim <kgene@kernel.org>
+Fixes: 42773b28e71d ("clk: samsung: exynos4: Enable ARMCLK down feature")
+Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
+Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
+Signed-off-by: Michael Turquette <mturquette@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/samsung/clk-exynos4.c |   11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+--- a/drivers/clk/samsung/clk-exynos4.c
++++ b/drivers/clk/samsung/clk-exynos4.c
+@@ -1354,7 +1354,7 @@ static struct samsung_pll_clock exynos4x
+                       VPLL_LOCK, VPLL_CON0, NULL),
+ };
+-static void __init exynos4_core_down_clock(enum exynos4_soc soc)
++static void __init exynos4x12_core_down_clock(void)
+ {
+       unsigned int tmp;
+@@ -1373,11 +1373,9 @@ static void __init exynos4_core_down_clo
+       __raw_writel(tmp, reg_base + PWR_CTRL1);
+       /*
+-       * Disable the clock up feature on Exynos4x12, in case it was
+-       * enabled by bootloader.
++       * Disable the clock up feature in case it was enabled by bootloader.
+        */
+-      if (exynos4_soc == EXYNOS4X12)
+-              __raw_writel(0x0, reg_base + E4X12_PWR_CTRL2);
++      __raw_writel(0x0, reg_base + E4X12_PWR_CTRL2);
+ }
+ /* register exynos4 clocks */
+@@ -1474,7 +1472,8 @@ static void __init exynos4_clk_init(stru
+       samsung_clk_register_alias(ctx, exynos4_aliases,
+                       ARRAY_SIZE(exynos4_aliases));
+-      exynos4_core_down_clock(soc);
++      if (soc == EXYNOS4X12)
++              exynos4x12_core_down_clock();
+       exynos4_clk_sleep_init();
+       samsung_clk_of_add_provider(np, ctx);
diff --git a/queue-4.0/clk-tegra-register-the-proper-number-of-resets.patch b/queue-4.0/clk-tegra-register-the-proper-number-of-resets.patch
new file mode 100644 (file)
index 0000000..6871dfe
--- /dev/null
@@ -0,0 +1,39 @@
+From 5e43e259171e1eee8bc074d9c44be434e685087b Mon Sep 17 00:00:00 2001
+From: Thierry Reding <treding@nvidia.com>
+Date: Mon, 23 Mar 2015 10:57:46 +0100
+Subject: clk: tegra: Register the proper number of resets
+
+From: Thierry Reding <treding@nvidia.com>
+
+commit 5e43e259171e1eee8bc074d9c44be434e685087b upstream.
+
+The number of resets controls is 32 times the number of peripheral
+register banks rather than 32 times the number of clocks. This reduces
+(drastically) the number of reset controls registered from 10080 (315
+clocks * 32) to 224 (6 peripheral register banks * 32).
+
+This also fixes a potential crash because trying to use any of the
+excess reset controls (224-10079) would have caused accesses beyond
+the array bounds of the peripheral register banks definition array.
+
+Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
+Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
+Fixes: 6d5b988e7dc5 ("clk: tegra: implement a reset driver")
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/tegra/clk.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/clk/tegra/clk.c
++++ b/drivers/clk/tegra/clk.c
+@@ -272,7 +272,7 @@ void __init tegra_add_of_provider(struct
+       of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+       rst_ctlr.of_node = np;
+-      rst_ctlr.nr_resets = clk_num * 32;
++      rst_ctlr.nr_resets = periph_banks * 32;
+       reset_controller_register(&rst_ctlr);
+ }
diff --git a/queue-4.0/clk-tegra-use-the-proper-parent-for-plld_dsi.patch b/queue-4.0/clk-tegra-use-the-proper-parent-for-plld_dsi.patch
new file mode 100644 (file)
index 0000000..2fd6558
--- /dev/null
@@ -0,0 +1,60 @@
+From c1d676cec572544616273d5853cb7cc38fbaa62b Mon Sep 17 00:00:00 2001
+From: Thierry Reding <treding@nvidia.com>
+Date: Thu, 26 Mar 2015 17:53:01 +0100
+Subject: clk: tegra: Use the proper parent for plld_dsi
+
+From: Thierry Reding <treding@nvidia.com>
+
+commit c1d676cec572544616273d5853cb7cc38fbaa62b upstream.
+
+The current parent, plld_out0, does not exist. The proper name is
+pll_d_out0. While at it, rename the plld_dsi clock to pll_d_dsi_out to
+be more consistent with other clock names.
+
+Fixes: b270491eb9a0 ("clk: tegra: Define PLLD_DSI and remove dsia(b)_mux")
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/clk/tegra/clk-tegra124.c                |   14 ++++++++------
+ include/dt-bindings/clock/tegra124-car-common.h |    2 +-
+ 2 files changed, 9 insertions(+), 7 deletions(-)
+
+--- a/drivers/clk/tegra/clk-tegra124.c
++++ b/drivers/clk/tegra/clk-tegra124.c
+@@ -1110,16 +1110,18 @@ static __init void tegra124_periph_clk_i
+                                       1, 2);
+       clks[TEGRA124_CLK_XUSB_SS_DIV2] = clk;
+-      clk = clk_register_gate(NULL, "plld_dsi", "plld_out0", 0,
++      clk = clk_register_gate(NULL, "pll_d_dsi_out", "pll_d_out0", 0,
+                               clk_base + PLLD_MISC, 30, 0, &pll_d_lock);
+-      clks[TEGRA124_CLK_PLLD_DSI] = clk;
++      clks[TEGRA124_CLK_PLL_D_DSI_OUT] = clk;
+-      clk = tegra_clk_register_periph_gate("dsia", "plld_dsi", 0, clk_base,
+-                                           0, 48, periph_clk_enb_refcnt);
++      clk = tegra_clk_register_periph_gate("dsia", "pll_d_dsi_out", 0,
++                                           clk_base, 0, 48,
++                                           periph_clk_enb_refcnt);
+       clks[TEGRA124_CLK_DSIA] = clk;
+-      clk = tegra_clk_register_periph_gate("dsib", "plld_dsi", 0, clk_base,
+-                                           0, 82, periph_clk_enb_refcnt);
++      clk = tegra_clk_register_periph_gate("dsib", "pll_d_dsi_out", 0,
++                                           clk_base, 0, 82,
++                                           periph_clk_enb_refcnt);
+       clks[TEGRA124_CLK_DSIB] = clk;
+       /* emc mux */
+--- a/include/dt-bindings/clock/tegra124-car-common.h
++++ b/include/dt-bindings/clock/tegra124-car-common.h
+@@ -297,7 +297,7 @@
+ #define TEGRA124_CLK_PLL_C4 270
+ #define TEGRA124_CLK_PLL_DP 271
+ #define TEGRA124_CLK_PLL_E_MUX 272
+-#define TEGRA124_CLK_PLLD_DSI 273
++#define TEGRA124_CLK_PLL_D_DSI_OUT 273
+ /* 274 */
+ /* 275 */
+ /* 276 */
diff --git a/queue-4.0/dm-crypt-fix-deadlock-when-async-crypto-algorithm-returns-ebusy.patch b/queue-4.0/dm-crypt-fix-deadlock-when-async-crypto-algorithm-returns-ebusy.patch
new file mode 100644 (file)
index 0000000..551c9d5
--- /dev/null
@@ -0,0 +1,79 @@
+From 0618764cb25f6fa9fb31152995de42a8a0496475 Mon Sep 17 00:00:00 2001
+From: Ben Collins <ben.c@servergy.com>
+Date: Fri, 3 Apr 2015 16:09:46 +0000
+Subject: dm crypt: fix deadlock when async crypto algorithm returns -EBUSY
+
+From: Ben Collins <ben.c@servergy.com>
+
+commit 0618764cb25f6fa9fb31152995de42a8a0496475 upstream.
+
+I suspect this doesn't show up for most anyone because software
+algorithms typically don't have a sense of being too busy.  However,
+when working with the Freescale CAAM driver it will return -EBUSY on
+occasion under heavy -- which resulted in dm-crypt deadlock.
+
+After checking the logic in some other drivers, the scheme for
+crypt_convert() and it's callback, kcryptd_async_done(), were not
+correctly laid out to properly handle -EBUSY or -EINPROGRESS.
+
+Fix this by using the completion for both -EBUSY and -EINPROGRESS.  Now
+crypt_convert()'s use of completion is comparable to
+af_alg_wait_for_completion().  Similarly, kcryptd_async_done() follows
+the pattern used in af_alg_complete().
+
+Before this fix dm-crypt would lockup within 1-2 minutes running with
+the CAAM driver.  Fix was regression tested against software algorithms
+on PPC32 and x86_64, and things seem perfectly happy there as well.
+
+Signed-off-by: Ben Collins <ben.c@servergy.com>
+Signed-off-by: Mike Snitzer <snitzer@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/md/dm-crypt.c |   12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/md/dm-crypt.c
++++ b/drivers/md/dm-crypt.c
+@@ -925,11 +925,10 @@ static int crypt_convert(struct crypt_co
+               switch (r) {
+               /* async */
++              case -EINPROGRESS:
+               case -EBUSY:
+                       wait_for_completion(&ctx->restart);
+                       reinit_completion(&ctx->restart);
+-                      /* fall through*/
+-              case -EINPROGRESS:
+                       ctx->req = NULL;
+                       ctx->cc_sector++;
+                       continue;
+@@ -1346,10 +1345,8 @@ static void kcryptd_async_done(struct cr
+       struct dm_crypt_io *io = container_of(ctx, struct dm_crypt_io, ctx);
+       struct crypt_config *cc = io->cc;
+-      if (error == -EINPROGRESS) {
+-              complete(&ctx->restart);
++      if (error == -EINPROGRESS)
+               return;
+-      }
+       if (!error && cc->iv_gen_ops && cc->iv_gen_ops->post)
+               error = cc->iv_gen_ops->post(cc, iv_of_dmreq(cc, dmreq), dmreq);
+@@ -1360,12 +1357,15 @@ static void kcryptd_async_done(struct cr
+       crypt_free_req(cc, req_of_dmreq(cc, dmreq), io->base_bio);
+       if (!atomic_dec_and_test(&ctx->cc_pending))
+-              return;
++              goto done;
+       if (bio_data_dir(io->base_bio) == READ)
+               kcryptd_crypt_read_done(io);
+       else
+               kcryptd_crypt_write_io_submit(io, 1);
++done:
++      if (!completion_done(&ctx->restart))
++              complete(&ctx->restart);
+ }
+ static void kcryptd_crypt(struct work_struct *work)
diff --git a/queue-4.0/gpio-mvebu-fix-mask-unmask-managment-per-irq-chip-type.patch b/queue-4.0/gpio-mvebu-fix-mask-unmask-managment-per-irq-chip-type.patch
new file mode 100644 (file)
index 0000000..81d68bf
--- /dev/null
@@ -0,0 +1,108 @@
+From 61819549f572edd7fce53f228c0d8420cdc85f71 Mon Sep 17 00:00:00 2001
+From: Gregory CLEMENT <gregory.clement@free-electrons.com>
+Date: Thu, 2 Apr 2015 17:11:11 +0200
+Subject: gpio: mvebu: Fix mask/unmask managment per irq chip type
+
+From: Gregory CLEMENT <gregory.clement@free-electrons.com>
+
+commit 61819549f572edd7fce53f228c0d8420cdc85f71 upstream.
+
+Level IRQ handlers and edge IRQ handler are managed by tow different
+sets of registers. But currently the driver uses the same mask for the
+both registers. It lead to issues with the following scenario:
+
+First, an IRQ is requested on a GPIO to be triggered on front. After,
+this an other IRQ is requested for a GPIO of the same bank but
+triggered on level. Then the first one will be also setup to be
+triggered on level. It leads to an interrupt storm.
+
+The different kind of handler are already associated with two
+different irq chip type. With this patch the driver uses a private
+mask for each one which solves this issue.
+
+It has been tested on an Armada XP based board and on an Armada 375
+board. For the both boards, with this patch is applied, there is no
+such interrupt storm when running the previous scenario.
+
+This bug was already fixed but in a different way in the legacy
+version of this driver by Evgeniy Dushistov:
+9ece8839b1277fb9128ff6833411614ab6c88d68 "ARM: orion: Fix for certain
+sequence of request_irq can cause irq storm". The fact the new version
+of the gpio drive could be affected had been discussed there:
+http://thread.gmane.org/gmane.linux.ports.arm.kernel/344670/focus=364012
+
+Reported-by: Evgeniy A. Dushistov <dushistov@mail.ru>
+Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-mvebu.c |   24 ++++++++++++++++--------
+ 1 file changed, 16 insertions(+), 8 deletions(-)
+
+--- a/drivers/gpio/gpio-mvebu.c
++++ b/drivers/gpio/gpio-mvebu.c
+@@ -320,11 +320,13 @@ static void mvebu_gpio_edge_irq_mask(str
+ {
+       struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+       struct mvebu_gpio_chip *mvchip = gc->private;
++      struct irq_chip_type *ct = irq_data_get_chip_type(d);
+       u32 mask = 1 << (d->irq - gc->irq_base);
+       irq_gc_lock(gc);
+-      gc->mask_cache &= ~mask;
+-      writel_relaxed(gc->mask_cache, mvebu_gpioreg_edge_mask(mvchip));
++      ct->mask_cache_priv &= ~mask;
++
++      writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_edge_mask(mvchip));
+       irq_gc_unlock(gc);
+ }
+@@ -332,11 +334,13 @@ static void mvebu_gpio_edge_irq_unmask(s
+ {
+       struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+       struct mvebu_gpio_chip *mvchip = gc->private;
++      struct irq_chip_type *ct = irq_data_get_chip_type(d);
++
+       u32 mask = 1 << (d->irq - gc->irq_base);
+       irq_gc_lock(gc);
+-      gc->mask_cache |= mask;
+-      writel_relaxed(gc->mask_cache, mvebu_gpioreg_edge_mask(mvchip));
++      ct->mask_cache_priv |= mask;
++      writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_edge_mask(mvchip));
+       irq_gc_unlock(gc);
+ }
+@@ -344,11 +348,13 @@ static void mvebu_gpio_level_irq_mask(st
+ {
+       struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+       struct mvebu_gpio_chip *mvchip = gc->private;
++      struct irq_chip_type *ct = irq_data_get_chip_type(d);
++
+       u32 mask = 1 << (d->irq - gc->irq_base);
+       irq_gc_lock(gc);
+-      gc->mask_cache &= ~mask;
+-      writel_relaxed(gc->mask_cache, mvebu_gpioreg_level_mask(mvchip));
++      ct->mask_cache_priv &= ~mask;
++      writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_level_mask(mvchip));
+       irq_gc_unlock(gc);
+ }
+@@ -356,11 +362,13 @@ static void mvebu_gpio_level_irq_unmask(
+ {
+       struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+       struct mvebu_gpio_chip *mvchip = gc->private;
++      struct irq_chip_type *ct = irq_data_get_chip_type(d);
++
+       u32 mask = 1 << (d->irq - gc->irq_base);
+       irq_gc_lock(gc);
+-      gc->mask_cache |= mask;
+-      writel_relaxed(gc->mask_cache, mvebu_gpioreg_level_mask(mvchip));
++      ct->mask_cache_priv |= mask;
++      writel_relaxed(ct->mask_cache_priv, mvebu_gpioreg_level_mask(mvchip));
+       irq_gc_unlock(gc);
+ }
diff --git a/queue-4.0/iscsi-target-convert-iscsi_thread_set-usage-to-kthread.h.patch b/queue-4.0/iscsi-target-convert-iscsi_thread_set-usage-to-kthread.h.patch
new file mode 100644 (file)
index 0000000..319b931
--- /dev/null
@@ -0,0 +1,462 @@
+From 88dcd2dab5c23b1c9cfc396246d8f476c872f0ca Mon Sep 17 00:00:00 2001
+From: Nicholas Bellinger <nab@linux-iscsi.org>
+Date: Thu, 26 Feb 2015 22:19:15 -0800
+Subject: iscsi-target: Convert iscsi_thread_set usage to kthread.h
+
+From: Nicholas Bellinger <nab@linux-iscsi.org>
+
+commit 88dcd2dab5c23b1c9cfc396246d8f476c872f0ca upstream.
+
+This patch converts iscsi-target code to use modern kthread.h API
+callers for creating RX/TX threads for each new iscsi_conn descriptor,
+and releasing associated RX/TX threads during connection shutdown.
+
+This is done using iscsit_start_kthreads() -> kthread_run() to start
+new kthreads from within iscsi_post_login_handler(), and invoking
+kthread_stop() from existing iscsit_close_connection() code.
+
+Also, convert iscsit_logout_post_handler_closesession() code to use
+cmpxchg when determing when iscsit_cause_connection_reinstatement()
+needs to sleep waiting for completion.
+
+Reported-by: Sagi Grimberg <sagig@mellanox.com>
+Tested-by: Sagi Grimberg <sagig@mellanox.com>
+Cc: Slava Shwartsman <valyushash@gmail.com>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/target/iscsi/iscsi_target.c       |  104 ++++++++++++------------------
+ drivers/target/iscsi/iscsi_target_erl0.c  |   13 ++-
+ drivers/target/iscsi/iscsi_target_login.c |   59 +++++++++++++++--
+ include/target/iscsi/iscsi_target_core.h  |    7 ++
+ 4 files changed, 114 insertions(+), 69 deletions(-)
+
+--- a/drivers/target/iscsi/iscsi_target.c
++++ b/drivers/target/iscsi/iscsi_target.c
+@@ -537,7 +537,7 @@ static struct iscsit_transport iscsi_tar
+ static int __init iscsi_target_init_module(void)
+ {
+-      int ret = 0;
++      int ret = 0, size;
+       pr_debug("iSCSI-Target "ISCSIT_VERSION"\n");
+@@ -546,6 +546,7 @@ static int __init iscsi_target_init_modu
+               pr_err("Unable to allocate memory for iscsit_global\n");
+               return -1;
+       }
++      spin_lock_init(&iscsit_global->ts_bitmap_lock);
+       mutex_init(&auth_id_lock);
+       spin_lock_init(&sess_idr_lock);
+       idr_init(&tiqn_idr);
+@@ -555,15 +556,11 @@ static int __init iscsi_target_init_modu
+       if (ret < 0)
+               goto out;
+-      ret = iscsi_thread_set_init();
+-      if (ret < 0)
++      size = BITS_TO_LONGS(ISCSIT_BITMAP_BITS) * sizeof(long);
++      iscsit_global->ts_bitmap = vzalloc(size);
++      if (!iscsit_global->ts_bitmap) {
++              pr_err("Unable to allocate iscsit_global->ts_bitmap\n");
+               goto configfs_out;
+-
+-      if (iscsi_allocate_thread_sets(TARGET_THREAD_SET_COUNT) !=
+-                      TARGET_THREAD_SET_COUNT) {
+-              pr_err("iscsi_allocate_thread_sets() returned"
+-                      " unexpected value!\n");
+-              goto ts_out1;
+       }
+       lio_qr_cache = kmem_cache_create("lio_qr_cache",
+@@ -572,7 +569,7 @@ static int __init iscsi_target_init_modu
+       if (!lio_qr_cache) {
+               pr_err("nable to kmem_cache_create() for"
+                               " lio_qr_cache\n");
+-              goto ts_out2;
++              goto bitmap_out;
+       }
+       lio_dr_cache = kmem_cache_create("lio_dr_cache",
+@@ -617,10 +614,8 @@ dr_out:
+       kmem_cache_destroy(lio_dr_cache);
+ qr_out:
+       kmem_cache_destroy(lio_qr_cache);
+-ts_out2:
+-      iscsi_deallocate_thread_sets();
+-ts_out1:
+-      iscsi_thread_set_free();
++bitmap_out:
++      vfree(iscsit_global->ts_bitmap);
+ configfs_out:
+       iscsi_target_deregister_configfs();
+ out:
+@@ -630,8 +625,6 @@ out:
+ static void __exit iscsi_target_cleanup_module(void)
+ {
+-      iscsi_deallocate_thread_sets();
+-      iscsi_thread_set_free();
+       iscsit_release_discovery_tpg();
+       iscsit_unregister_transport(&iscsi_target_transport);
+       kmem_cache_destroy(lio_qr_cache);
+@@ -641,6 +634,7 @@ static void __exit iscsi_target_cleanup_
+       iscsi_target_deregister_configfs();
++      vfree(iscsit_global->ts_bitmap);
+       kfree(iscsit_global);
+ }
+@@ -3715,17 +3709,16 @@ static int iscsit_send_reject(
+ void iscsit_thread_get_cpumask(struct iscsi_conn *conn)
+ {
+-      struct iscsi_thread_set *ts = conn->thread_set;
+       int ord, cpu;
+       /*
+-       * thread_id is assigned from iscsit_global->ts_bitmap from
+-       * within iscsi_thread_set.c:iscsi_allocate_thread_sets()
++       * bitmap_id is assigned from iscsit_global->ts_bitmap from
++       * within iscsit_start_kthreads()
+        *
+-       * Here we use thread_id to determine which CPU that this
+-       * iSCSI connection's iscsi_thread_set will be scheduled to
++       * Here we use bitmap_id to determine which CPU that this
++       * iSCSI connection's RX/TX threads will be scheduled to
+        * execute upon.
+        */
+-      ord = ts->thread_id % cpumask_weight(cpu_online_mask);
++      ord = conn->bitmap_id % cpumask_weight(cpu_online_mask);
+       for_each_online_cpu(cpu) {
+               if (ord-- == 0) {
+                       cpumask_set_cpu(cpu, conn->conn_cpumask);
+@@ -3914,7 +3907,7 @@ check_rsp_state:
+       switch (state) {
+       case ISTATE_SEND_LOGOUTRSP:
+               if (!iscsit_logout_post_handler(cmd, conn))
+-                      goto restart;
++                      return -ECONNRESET;
+               /* fall through */
+       case ISTATE_SEND_STATUS:
+       case ISTATE_SEND_ASYNCMSG:
+@@ -3942,8 +3935,6 @@ check_rsp_state:
+ err:
+       return -1;
+-restart:
+-      return -EAGAIN;
+ }
+ static int iscsit_handle_response_queue(struct iscsi_conn *conn)
+@@ -3970,21 +3961,13 @@ static int iscsit_handle_response_queue(
+ int iscsi_target_tx_thread(void *arg)
+ {
+       int ret = 0;
+-      struct iscsi_conn *conn;
+-      struct iscsi_thread_set *ts = arg;
++      struct iscsi_conn *conn = arg;
+       /*
+        * Allow ourselves to be interrupted by SIGINT so that a
+        * connection recovery / failure event can be triggered externally.
+        */
+       allow_signal(SIGINT);
+-restart:
+-      conn = iscsi_tx_thread_pre_handler(ts);
+-      if (!conn)
+-              goto out;
+-
+-      ret = 0;
+-
+       while (!kthread_should_stop()) {
+               /*
+                * Ensure that both TX and RX per connection kthreads
+@@ -3993,11 +3976,9 @@ restart:
+               iscsit_thread_check_cpumask(conn, current, 1);
+               wait_event_interruptible(conn->queues_wq,
+-                                       !iscsit_conn_all_queues_empty(conn) ||
+-                                       ts->status == ISCSI_THREAD_SET_RESET);
++                                       !iscsit_conn_all_queues_empty(conn));
+-              if ((ts->status == ISCSI_THREAD_SET_RESET) ||
+-                   signal_pending(current))
++              if (signal_pending(current))
+                       goto transport_err;
+ get_immediate:
+@@ -4008,15 +3989,14 @@ get_immediate:
+               ret = iscsit_handle_response_queue(conn);
+               if (ret == 1)
+                       goto get_immediate;
+-              else if (ret == -EAGAIN)
+-                      goto restart;
++              else if (ret == -ECONNRESET)
++                      goto out;
+               else if (ret < 0)
+                       goto transport_err;
+       }
+ transport_err:
+       iscsit_take_action_for_connection_exit(conn);
+-      goto restart;
+ out:
+       return 0;
+ }
+@@ -4111,8 +4091,7 @@ int iscsi_target_rx_thread(void *arg)
+       int ret;
+       u8 buffer[ISCSI_HDR_LEN], opcode;
+       u32 checksum = 0, digest = 0;
+-      struct iscsi_conn *conn = NULL;
+-      struct iscsi_thread_set *ts = arg;
++      struct iscsi_conn *conn = arg;
+       struct kvec iov;
+       /*
+        * Allow ourselves to be interrupted by SIGINT so that a
+@@ -4120,11 +4099,6 @@ int iscsi_target_rx_thread(void *arg)
+        */
+       allow_signal(SIGINT);
+-restart:
+-      conn = iscsi_rx_thread_pre_handler(ts);
+-      if (!conn)
+-              goto out;
+-
+       if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) {
+               struct completion comp;
+               int rc;
+@@ -4134,7 +4108,7 @@ restart:
+               if (rc < 0)
+                       goto transport_err;
+-              goto out;
++              goto transport_err;
+       }
+       while (!kthread_should_stop()) {
+@@ -4210,8 +4184,6 @@ transport_err:
+       if (!signal_pending(current))
+               atomic_set(&conn->transport_failed, 1);
+       iscsit_take_action_for_connection_exit(conn);
+-      goto restart;
+-out:
+       return 0;
+ }
+@@ -4273,7 +4245,24 @@ int iscsit_close_connection(
+       if (conn->conn_transport->transport_type == ISCSI_TCP)
+               complete(&conn->conn_logout_comp);
+-      iscsi_release_thread_set(conn);
++      if (!strcmp(current->comm, ISCSI_RX_THREAD_NAME)) {
++              if (conn->tx_thread &&
++                  cmpxchg(&conn->tx_thread_active, true, false)) {
++                      send_sig(SIGINT, conn->tx_thread, 1);
++                      kthread_stop(conn->tx_thread);
++              }
++      } else if (!strcmp(current->comm, ISCSI_TX_THREAD_NAME)) {
++              if (conn->rx_thread &&
++                  cmpxchg(&conn->rx_thread_active, true, false)) {
++                      send_sig(SIGINT, conn->rx_thread, 1);
++                      kthread_stop(conn->rx_thread);
++              }
++      }
++
++      spin_lock(&iscsit_global->ts_bitmap_lock);
++      bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
++                            get_order(1));
++      spin_unlock(&iscsit_global->ts_bitmap_lock);
+       iscsit_stop_timers_for_cmds(conn);
+       iscsit_stop_nopin_response_timer(conn);
+@@ -4551,15 +4540,13 @@ static void iscsit_logout_post_handler_c
+       struct iscsi_conn *conn)
+ {
+       struct iscsi_session *sess = conn->sess;
+-
+-      iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
+-      iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
++      int sleep = cmpxchg(&conn->tx_thread_active, true, false);
+       atomic_set(&conn->conn_logout_remove, 0);
+       complete(&conn->conn_logout_comp);
+       iscsit_dec_conn_usage_count(conn);
+-      iscsit_stop_session(sess, 1, 1);
++      iscsit_stop_session(sess, sleep, sleep);
+       iscsit_dec_session_usage_count(sess);
+       target_put_session(sess->se_sess);
+ }
+@@ -4567,13 +4554,12 @@ static void iscsit_logout_post_handler_c
+ static void iscsit_logout_post_handler_samecid(
+       struct iscsi_conn *conn)
+ {
+-      iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD);
+-      iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD);
++      int sleep = cmpxchg(&conn->tx_thread_active, true, false);
+       atomic_set(&conn->conn_logout_remove, 0);
+       complete(&conn->conn_logout_comp);
+-      iscsit_cause_connection_reinstatement(conn, 1);
++      iscsit_cause_connection_reinstatement(conn, sleep);
+       iscsit_dec_conn_usage_count(conn);
+ }
+--- a/drivers/target/iscsi/iscsi_target_erl0.c
++++ b/drivers/target/iscsi/iscsi_target_erl0.c
+@@ -860,7 +860,10 @@ void iscsit_connection_reinstatement_rcf
+       }
+       spin_unlock_bh(&conn->state_lock);
+-      iscsi_thread_set_force_reinstatement(conn);
++      if (conn->tx_thread && conn->tx_thread_active)
++              send_sig(SIGINT, conn->tx_thread, 1);
++      if (conn->rx_thread && conn->rx_thread_active)
++              send_sig(SIGINT, conn->rx_thread, 1);
+ sleep:
+       wait_for_completion(&conn->conn_wait_rcfr_comp);
+@@ -885,10 +888,10 @@ void iscsit_cause_connection_reinstateme
+               return;
+       }
+-      if (iscsi_thread_set_force_reinstatement(conn) < 0) {
+-              spin_unlock_bh(&conn->state_lock);
+-              return;
+-      }
++      if (conn->tx_thread && conn->tx_thread_active)
++              send_sig(SIGINT, conn->tx_thread, 1);
++      if (conn->rx_thread && conn->rx_thread_active)
++              send_sig(SIGINT, conn->rx_thread, 1);
+       atomic_set(&conn->connection_reinstatement, 1);
+       if (!sleep) {
+--- a/drivers/target/iscsi/iscsi_target_login.c
++++ b/drivers/target/iscsi/iscsi_target_login.c
+@@ -699,6 +699,51 @@ static void iscsi_post_login_start_timer
+               iscsit_start_nopin_timer(conn);
+ }
++int iscsit_start_kthreads(struct iscsi_conn *conn)
++{
++      int ret = 0;
++
++      spin_lock(&iscsit_global->ts_bitmap_lock);
++      conn->bitmap_id = bitmap_find_free_region(iscsit_global->ts_bitmap,
++                                      ISCSIT_BITMAP_BITS, get_order(1));
++      spin_unlock(&iscsit_global->ts_bitmap_lock);
++
++      if (conn->bitmap_id < 0) {
++              pr_err("bitmap_find_free_region() failed for"
++                     " iscsit_start_kthreads()\n");
++              return -ENOMEM;
++      }
++
++      conn->tx_thread = kthread_run(iscsi_target_tx_thread, conn,
++                                    "%s", ISCSI_TX_THREAD_NAME);
++      if (IS_ERR(conn->tx_thread)) {
++              pr_err("Unable to start iscsi_target_tx_thread\n");
++              ret = PTR_ERR(conn->tx_thread);
++              goto out_bitmap;
++      }
++      conn->tx_thread_active = true;
++
++      conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn,
++                                    "%s", ISCSI_RX_THREAD_NAME);
++      if (IS_ERR(conn->rx_thread)) {
++              pr_err("Unable to start iscsi_target_rx_thread\n");
++              ret = PTR_ERR(conn->rx_thread);
++              goto out_tx;
++      }
++      conn->rx_thread_active = true;
++
++      return 0;
++out_tx:
++      kthread_stop(conn->tx_thread);
++      conn->tx_thread_active = false;
++out_bitmap:
++      spin_lock(&iscsit_global->ts_bitmap_lock);
++      bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id,
++                            get_order(1));
++      spin_unlock(&iscsit_global->ts_bitmap_lock);
++      return ret;
++}
++
+ int iscsi_post_login_handler(
+       struct iscsi_np *np,
+       struct iscsi_conn *conn,
+@@ -709,7 +754,7 @@ int iscsi_post_login_handler(
+       struct se_session *se_sess = sess->se_sess;
+       struct iscsi_portal_group *tpg = sess->tpg;
+       struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
+-      struct iscsi_thread_set *ts;
++      int rc;
+       iscsit_inc_conn_usage_count(conn);
+@@ -724,7 +769,6 @@ int iscsi_post_login_handler(
+       /*
+        * SCSI Initiator -> SCSI Target Port Mapping
+        */
+-      ts = iscsi_get_thread_set();
+       if (!zero_tsih) {
+               iscsi_set_session_parameters(sess->sess_ops,
+                               conn->param_list, 0);
+@@ -751,9 +795,11 @@ int iscsi_post_login_handler(
+                       sess->sess_ops->InitiatorName);
+               spin_unlock_bh(&sess->conn_lock);
+-              iscsi_post_login_start_timers(conn);
++              rc = iscsit_start_kthreads(conn);
++              if (rc)
++                      return rc;
+-              iscsi_activate_thread_set(conn, ts);
++              iscsi_post_login_start_timers(conn);
+               /*
+                * Determine CPU mask to ensure connection's RX and TX kthreads
+                * are scheduled on the same CPU.
+@@ -810,8 +856,11 @@ int iscsi_post_login_handler(
+               " iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt);
+       spin_unlock_bh(&se_tpg->session_lock);
++      rc = iscsit_start_kthreads(conn);
++      if (rc)
++              return rc;
++
+       iscsi_post_login_start_timers(conn);
+-      iscsi_activate_thread_set(conn, ts);
+       /*
+        * Determine CPU mask to ensure connection's RX and TX kthreads
+        * are scheduled on the same CPU.
+--- a/include/target/iscsi/iscsi_target_core.h
++++ b/include/target/iscsi/iscsi_target_core.h
+@@ -602,6 +602,11 @@ struct iscsi_conn {
+       struct iscsi_session    *sess;
+       /* Pointer to thread_set in use for this conn's threads */
+       struct iscsi_thread_set *thread_set;
++      int                     bitmap_id;
++      int                     rx_thread_active;
++      struct task_struct      *rx_thread;
++      int                     tx_thread_active;
++      struct task_struct      *tx_thread;
+       /* list_head for session connection list */
+       struct list_head        conn_list;
+ } ____cacheline_aligned;
+@@ -871,10 +876,12 @@ struct iscsit_global {
+       /* Unique identifier used for the authentication daemon */
+       u32                     auth_id;
+       u32                     inactive_ts;
++#define ISCSIT_BITMAP_BITS    262144
+       /* Thread Set bitmap count */
+       int                     ts_bitmap_count;
+       /* Thread Set bitmap pointer */
+       unsigned long           *ts_bitmap;
++      spinlock_t              ts_bitmap_lock;
+       /* Used for iSCSI discovery session authentication */
+       struct iscsi_node_acl   discovery_acl;
+       struct iscsi_portal_group       *discovery_tpg;
diff --git a/queue-4.0/iser-target-fix-possible-deadlock-in-rdma_cm-connection-error.patch b/queue-4.0/iser-target-fix-possible-deadlock-in-rdma_cm-connection-error.patch
new file mode 100644 (file)
index 0000000..3bae158
--- /dev/null
@@ -0,0 +1,79 @@
+From 4a579da2586bd3b79b025947ea24ede2bbfede62 Mon Sep 17 00:00:00 2001
+From: Sagi Grimberg <sagig@mellanox.com>
+Date: Sun, 29 Mar 2015 15:52:04 +0300
+Subject: iser-target: Fix possible deadlock in RDMA_CM connection error
+
+From: Sagi Grimberg <sagig@mellanox.com>
+
+commit 4a579da2586bd3b79b025947ea24ede2bbfede62 upstream.
+
+Before we reach to connection established we may get an
+error event. In this case the core won't teardown this
+connection (never established it), so we take care of freeing
+it ourselves.
+
+Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/ulp/isert/ib_isert.c |   14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+--- a/drivers/infiniband/ulp/isert/ib_isert.c
++++ b/drivers/infiniband/ulp/isert/ib_isert.c
+@@ -222,7 +222,7 @@ fail:
+ static void
+ isert_free_rx_descriptors(struct isert_conn *isert_conn)
+ {
+-      struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
++      struct ib_device *ib_dev = isert_conn->conn_device->ib_device;
+       struct iser_rx_desc *rx_desc;
+       int i;
+@@ -719,8 +719,8 @@ out:
+ static void
+ isert_connect_release(struct isert_conn *isert_conn)
+ {
+-      struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
+       struct isert_device *device = isert_conn->conn_device;
++      struct ib_device *ib_dev = device->ib_device;
+       isert_dbg("conn %p\n", isert_conn);
+@@ -728,7 +728,8 @@ isert_connect_release(struct isert_conn
+               isert_conn_free_fastreg_pool(isert_conn);
+       isert_free_rx_descriptors(isert_conn);
+-      rdma_destroy_id(isert_conn->conn_cm_id);
++      if (isert_conn->conn_cm_id)
++              rdma_destroy_id(isert_conn->conn_cm_id);
+       if (isert_conn->conn_qp) {
+               struct isert_comp *comp = isert_conn->conn_qp->recv_cq->cq_context;
+@@ -878,12 +879,15 @@ isert_disconnected_handler(struct rdma_c
+       return 0;
+ }
+-static void
++static int
+ isert_connect_error(struct rdma_cm_id *cma_id)
+ {
+       struct isert_conn *isert_conn = cma_id->qp->qp_context;
++      isert_conn->conn_cm_id = NULL;
+       isert_put_conn(isert_conn);
++
++      return -1;
+ }
+ static int
+@@ -912,7 +916,7 @@ isert_cma_handler(struct rdma_cm_id *cma
+       case RDMA_CM_EVENT_REJECTED:       /* FALLTHRU */
+       case RDMA_CM_EVENT_UNREACHABLE:    /* FALLTHRU */
+       case RDMA_CM_EVENT_CONNECT_ERROR:
+-              isert_connect_error(cma_id);
++              ret = isert_connect_error(cma_id);
+               break;
+       default:
+               isert_err("Unhandled RDMA CMA event: %d\n", event->event);
diff --git a/queue-4.0/iser-target-fix-session-hang-in-case-of-an-rdma-read-dif-error.patch b/queue-4.0/iser-target-fix-session-hang-in-case-of-an-rdma-read-dif-error.patch
new file mode 100644 (file)
index 0000000..9a27e1f
--- /dev/null
@@ -0,0 +1,40 @@
+From 364189f0ada5478e4faf8a552d6071a650d757cd Mon Sep 17 00:00:00 2001
+From: Sagi Grimberg <sagig@mellanox.com>
+Date: Sun, 29 Mar 2015 15:52:03 +0300
+Subject: iser-target: Fix session hang in case of an rdma read DIF error
+
+From: Sagi Grimberg <sagig@mellanox.com>
+
+commit 364189f0ada5478e4faf8a552d6071a650d757cd upstream.
+
+This hang was a result of a missing command put when
+a DIF error occurred during a rdma read (and we sent
+an CHECK_CONDITION error without passing it to the
+backend).
+
+Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/ulp/isert/ib_isert.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/infiniband/ulp/isert/ib_isert.c
++++ b/drivers/infiniband/ulp/isert/ib_isert.c
+@@ -1861,11 +1861,13 @@ isert_completion_rdma_read(struct iser_t
+       cmd->i_state = ISTATE_RECEIVED_LAST_DATAOUT;
+       spin_unlock_bh(&cmd->istate_lock);
+-      if (ret)
++      if (ret) {
++              target_put_sess_cmd(se_cmd->se_sess, se_cmd);
+               transport_send_check_condition_and_sense(se_cmd,
+                                                        se_cmd->pi_err, 0);
+-      else
++      } else {
+               target_execute_cmd(se_cmd);
++      }
+ }
+ static void
diff --git a/queue-4.0/perf-symbols-define-stt_gnu_ifunc-for-glibc-2.9-and-older.patch b/queue-4.0/perf-symbols-define-stt_gnu_ifunc-for-glibc-2.9-and-older.patch
new file mode 100644 (file)
index 0000000..8292370
--- /dev/null
@@ -0,0 +1,55 @@
+From 4e31050f482c02c822b150d71cf1ea5be7c9d6e4 Mon Sep 17 00:00:00 2001
+From: Vinson Lee <vlee@twitter.com>
+Date: Mon, 9 Feb 2015 16:29:37 -0800
+Subject: perf symbols: Define STT_GNU_IFUNC for glibc 2.9 and older.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Vinson Lee <vlee@twitter.com>
+
+commit 4e31050f482c02c822b150d71cf1ea5be7c9d6e4 upstream.
+
+The token STT_GNU_IFUNC is not available with glibc 2.9 and older.
+Define this token if it is not already defined.
+
+This patch fixes this build errors with older versions of glibc.
+
+  CC       util/symbol-elf.o
+util/symbol-elf.c: In function â€˜elf_sym__is_function’:
+util/symbol-elf.c:75: error: â€˜STT_GNU_IFUNC’ undeclared (first use in this function)
+util/symbol-elf.c:75: error: (Each undeclared identifier is reported only once
+util/symbol-elf.c:75: error: for each function it appears in.)
+make: *** [util/symbol-elf.o] Error 1
+
+Signed-off-by: Vinson Lee <vlee@twitter.com>
+Acked-by: Namhyung Kim <namhyung@kernel.org>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Anton Blanchard <anton@samba.org>
+Cc: Avi Kivity <avi@cloudius-systems.com>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Paul Mackerras <paulus@samba.org>
+Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
+Cc: Stephane Eranian <eranian@google.com>
+Cc: Waiman Long <Waiman.Long@hp.com>
+Link: http://lkml.kernel.org/r/1423528286-13630-1-git-send-email-vlee@twopensource.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/util/symbol-elf.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/tools/perf/util/symbol-elf.c
++++ b/tools/perf/util/symbol-elf.c
+@@ -74,6 +74,10 @@ static inline uint8_t elf_sym__type(cons
+       return GELF_ST_TYPE(sym->st_info);
+ }
++#ifndef STT_GNU_IFUNC
++#define STT_GNU_IFUNC 10
++#endif
++
+ static inline int elf_sym__is_function(const GElf_Sym *sym)
+ {
+       return (elf_sym__type(sym) == STT_FUNC ||
diff --git a/queue-4.0/perf-tools-fix-perf-read-vdsox32-not-building-and-lib64-install-dir.patch b/queue-4.0/perf-tools-fix-perf-read-vdsox32-not-building-and-lib64-install-dir.patch
new file mode 100644 (file)
index 0000000..3425fd5
--- /dev/null
@@ -0,0 +1,62 @@
+From 76aea7731e7050c066943a1d7456ec6510702601 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Tue, 17 Mar 2015 15:27:48 -0700
+Subject: perf tools: Fix perf-read-vdsox32 not building and lib64 install dir
+
+From: "H.J. Lu" <hjl.tools@gmail.com>
+
+commit 76aea7731e7050c066943a1d7456ec6510702601 upstream.
+
+Commit:
+
+  c6e5e9fbc3ea ("perf tools: Fix building error in x86_64 when dwarf unwind is on")
+
+removed the definition of IS_X86_64 but not all places using it, with
+the consequence that perf-read-vdsox32 would not be built anymore, and
+the default lib install directory was 'lib' instead of 'lib64'.
+
+Also needs to go to v3.19.
+
+Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Acked-by: Jiri Olsa <jolsa@kernel.org>
+Link: http://lkml.kernel.org/r/CAMe9rOqpGVq3D88w+D15ef7sv6G6k57ZeTvxBm46=WFgzo9p1w@mail.gmail.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/config/Makefile |    4 ++--
+ tools/perf/tests/make      |    2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+--- a/tools/perf/config/Makefile
++++ b/tools/perf/config/Makefile
+@@ -651,7 +651,7 @@ ifeq (${IS_64_BIT}, 1)
+       NO_PERF_READ_VDSO32 := 1
+     endif
+   endif
+-  ifneq (${IS_X86_64}, 1)
++  ifneq ($(ARCH), x86)
+     NO_PERF_READ_VDSOX32 := 1
+   endif
+   ifndef NO_PERF_READ_VDSOX32
+@@ -699,7 +699,7 @@ sysconfdir = $(prefix)/etc
+ ETC_PERFCONFIG = etc/perfconfig
+ endif
+ ifndef lib
+-ifeq ($(IS_X86_64),1)
++ifeq ($(ARCH)$(IS_64_BIT), x861)
+ lib = lib64
+ else
+ lib = lib
+--- a/tools/perf/tests/make
++++ b/tools/perf/tests/make
+@@ -5,7 +5,7 @@ include config/Makefile.arch
+ # FIXME looks like x86 is the only arch running tests ;-)
+ # we need some IS_(32/64) flag to make this generic
+-ifeq ($(IS_X86_64),1)
++ifeq ($(ARCH)$(IS_64_BIT), x861)
+ lib = lib64
+ else
+ lib = lib
diff --git a/queue-4.0/perf-tools-work-around-lack-of-sched_getcpu-in-glibc-2.6.patch b/queue-4.0/perf-tools-work-around-lack-of-sched_getcpu-in-glibc-2.6.patch
new file mode 100644 (file)
index 0000000..f3cd690
--- /dev/null
@@ -0,0 +1,67 @@
+From e1e455f4f4d35850c30235747620d0d078fe9f64 Mon Sep 17 00:00:00 2001
+From: Vinson Lee <vlee@twitter.com>
+Date: Mon, 23 Mar 2015 12:09:16 -0700
+Subject: perf tools: Work around lack of sched_getcpu in glibc < 2.6.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Vinson Lee <vlee@twitter.com>
+
+commit e1e455f4f4d35850c30235747620d0d078fe9f64 upstream.
+
+This patch fixes this build error with glibc < 2.6.
+
+  CC       util/cloexec.o
+cc1: warnings being treated as errors
+util/cloexec.c: In function â€˜perf_flag_probe’:
+util/cloexec.c:24: error: implicit declaration of function
+‘sched_getcpu’
+util/cloexec.c:24: error: nested extern declaration of â€˜sched_getcpu’
+make: *** [util/cloexec.o] Error 1
+
+Signed-off-by: Vinson Lee <vlee@twitter.com>
+Acked-by: Jiri Olsa <jolsa@kernel.org>
+Acked-by: Namhyung Kim <namhyung@kernel.org>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
+Cc: Paul Mackerras <paulus@samba.org>
+Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
+Cc: Yann Droneaud <ydroneaud@opteya.com>
+Link: http://lkml.kernel.org/r/1427137761-16119-1-git-send-email-vlee@twopensource.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/perf/util/cloexec.c |    6 ++++++
+ tools/perf/util/cloexec.h |    6 ++++++
+ 2 files changed, 12 insertions(+)
+
+--- a/tools/perf/util/cloexec.c
++++ b/tools/perf/util/cloexec.c
+@@ -7,6 +7,12 @@
+ static unsigned long flag = PERF_FLAG_FD_CLOEXEC;
++int __weak sched_getcpu(void)
++{
++      errno = ENOSYS;
++      return -1;
++}
++
+ static int perf_flag_probe(void)
+ {
+       /* use 'safest' configuration as used in perf_evsel__fallback() */
+--- a/tools/perf/util/cloexec.h
++++ b/tools/perf/util/cloexec.h
+@@ -3,4 +3,10 @@
+ unsigned long perf_event_open_cloexec_flag(void);
++#ifdef __GLIBC_PREREQ
++#if !__GLIBC_PREREQ(2, 6)
++extern int sched_getcpu(void) __THROW;
++#endif
++#endif
++
+ #endif /* __PERF_CLOEXEC_H */
diff --git a/queue-4.0/powerpc-cell-fix-cell-iommu-after-it_page_shift-changes.patch b/queue-4.0/powerpc-cell-fix-cell-iommu-after-it_page_shift-changes.patch
new file mode 100644 (file)
index 0000000..01e42d0
--- /dev/null
@@ -0,0 +1,35 @@
+From 7261b956b276aa97fbf60d00f1d7717d2ea6ee78 Mon Sep 17 00:00:00 2001
+From: Michael Ellerman <mpe@ellerman.id.au>
+Date: Fri, 3 Apr 2015 14:11:54 +1100
+Subject: powerpc/cell: Fix cell iommu after it_page_shift changes
+
+From: Michael Ellerman <mpe@ellerman.id.au>
+
+commit 7261b956b276aa97fbf60d00f1d7717d2ea6ee78 upstream.
+
+The patch to add it_page_shift incorrectly changed the increment of
+uaddr to use it_page_shift, rather then (1 << it_page_shift).
+
+This broke booting on at least some Cell blades, as the iommu was
+basically non-functional.
+
+Fixes: 3a553170d35d ("powerpc/iommu: Add it_page_shift field to determine iommu page size")
+Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/platforms/cell/iommu.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/powerpc/platforms/cell/iommu.c
++++ b/arch/powerpc/platforms/cell/iommu.c
+@@ -197,7 +197,7 @@ static int tce_build_cell(struct iommu_t
+       io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
+-      for (i = 0; i < npages; i++, uaddr += tbl->it_page_shift)
++      for (i = 0; i < npages; i++, uaddr += (1 << tbl->it_page_shift))
+               io_pte[i] = base_pte | (__pa(uaddr) & CBE_IOPTE_RPN_Mask);
+       mb();
diff --git a/queue-4.0/powerpc-cell-fix-crash-in-iic_setup_cpu-after-per_cpu-changes.patch b/queue-4.0/powerpc-cell-fix-crash-in-iic_setup_cpu-after-per_cpu-changes.patch
new file mode 100644 (file)
index 0000000..b890da6
--- /dev/null
@@ -0,0 +1,36 @@
+From b0dd00addc5035f87ec9c5820dacc1ebc7fcb3e6 Mon Sep 17 00:00:00 2001
+From: Michael Ellerman <mpe@ellerman.id.au>
+Date: Fri, 3 Apr 2015 14:11:53 +1100
+Subject: powerpc/cell: Fix crash in iic_setup_cpu() after per_cpu changes
+
+From: Michael Ellerman <mpe@ellerman.id.au>
+
+commit b0dd00addc5035f87ec9c5820dacc1ebc7fcb3e6 upstream.
+
+The conversion from __get_cpu_var() to this_cpu_ptr() in iic_setup_cpu()
+is wrong. It causes an oops at boot.
+
+We need the per-cpu address of struct cpu_iic, not cpu_iic.regs->prio.
+
+Sparse noticed this, because we pass a non-iomem pointer to out_be64(),
+but we obviously don't check the sparse results often enough.
+
+Fixes: 69111bac42f5 ("powerpc: Replace __get_cpu_var uses")
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/platforms/cell/interrupt.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/powerpc/platforms/cell/interrupt.c
++++ b/arch/powerpc/platforms/cell/interrupt.c
+@@ -163,7 +163,7 @@ static unsigned int iic_get_irq(void)
+ void iic_setup_cpu(void)
+ {
+-      out_be64(this_cpu_ptr(&cpu_iic.regs->prio), 0xff);
++      out_be64(&this_cpu_ptr(&cpu_iic)->regs->prio, 0xff);
+ }
+ u8 iic_get_target_id(int cpu)
diff --git a/queue-4.0/powerpc-fix-missing-l2-cache-size-in-sys-devices-system-cpu.patch b/queue-4.0/powerpc-fix-missing-l2-cache-size-in-sys-devices-system-cpu.patch
new file mode 100644 (file)
index 0000000..325862d
--- /dev/null
@@ -0,0 +1,104 @@
+From f7e9e358362557c3aa2c1ec47490f29fe880a09e Mon Sep 17 00:00:00 2001
+From: Dave Olson <olson@cumulusnetworks.com>
+Date: Thu, 2 Apr 2015 21:28:45 -0700
+Subject: powerpc: Fix missing L2 cache size in /sys/devices/system/cpu
+
+From: Dave Olson <olson@cumulusnetworks.com>
+
+commit f7e9e358362557c3aa2c1ec47490f29fe880a09e upstream.
+
+This problem appears to have been introduced in 2.6.29 by commit
+93197a36a9c1 "Rewrite sysfs processor cache info code".
+
+This caused lscpu to error out on at least e500v2 devices, eg:
+
+  error: cannot open /sys/devices/system/cpu/cpu0/cache/index2/size: No such file or directory
+
+Some embedded powerpc systems use cache-size in DTS for the unified L2
+cache size, not d-cache-size, so we need to allow for both DTS names.
+Added a new CACHE_TYPE_UNIFIED_D cache_type_info structure to handle
+this.
+
+Fixes: 93197a36a9c1 ("powerpc: Rewrite sysfs processor cache info code")
+Signed-off-by: Dave Olson <olson@cumulusnetworks.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/kernel/cacheinfo.c |   44 ++++++++++++++++++++++++++++++----------
+ 1 file changed, 34 insertions(+), 10 deletions(-)
+
+--- a/arch/powerpc/kernel/cacheinfo.c
++++ b/arch/powerpc/kernel/cacheinfo.c
+@@ -61,12 +61,22 @@ struct cache_type_info {
+ };
+ /* These are used to index the cache_type_info array. */
+-#define CACHE_TYPE_UNIFIED     0
+-#define CACHE_TYPE_INSTRUCTION 1
+-#define CACHE_TYPE_DATA        2
++#define CACHE_TYPE_UNIFIED     0 /* cache-size, cache-block-size, etc. */
++#define CACHE_TYPE_UNIFIED_D   1 /* d-cache-size, d-cache-block-size, etc */
++#define CACHE_TYPE_INSTRUCTION 2
++#define CACHE_TYPE_DATA        3
+ static const struct cache_type_info cache_type_info[] = {
+       {
++              /* Embedded systems that use cache-size, cache-block-size,
++               * etc. for the Unified (typically L2) cache. */
++              .name            = "Unified",
++              .size_prop       = "cache-size",
++              .line_size_props = { "cache-line-size",
++                                   "cache-block-size", },
++              .nr_sets_prop    = "cache-sets",
++      },
++      {
+               /* PowerPC Processor binding says the [di]-cache-*
+                * must be equal on unified caches, so just use
+                * d-cache properties. */
+@@ -293,7 +303,8 @@ static struct cache *cache_find_first_si
+ {
+       struct cache *iter;
+-      if (cache->type == CACHE_TYPE_UNIFIED)
++      if (cache->type == CACHE_TYPE_UNIFIED ||
++          cache->type == CACHE_TYPE_UNIFIED_D)
+               return cache;
+       list_for_each_entry(iter, &cache_list, list)
+@@ -324,16 +335,29 @@ static bool cache_node_is_unified(const
+       return of_get_property(np, "cache-unified", NULL);
+ }
+-static struct cache *cache_do_one_devnode_unified(struct device_node *node,
+-                                                int level)
++/*
++ * Unified caches can have two different sets of tags.  Most embedded
++ * use cache-size, etc. for the unified cache size, but open firmware systems
++ * use d-cache-size, etc.   Check on initialization for which type we have, and
++ * return the appropriate structure type.  Assume it's embedded if it isn't
++ * open firmware.  If it's yet a 3rd type, then there will be missing entries
++ * in /sys/devices/system/cpu/cpu0/cache/index2/, and this code will need
++ * to be extended further.
++ */
++static int cache_is_unified_d(const struct device_node *np)
+ {
+-      struct cache *cache;
++      return of_get_property(np,
++              cache_type_info[CACHE_TYPE_UNIFIED_D].size_prop, NULL) ?
++              CACHE_TYPE_UNIFIED_D : CACHE_TYPE_UNIFIED;
++}
++/*
++ */
++static struct cache *cache_do_one_devnode_unified(struct device_node *node, int level)
++{
+       pr_debug("creating L%d ucache for %s\n", level, node->full_name);
+-      cache = new_cache(CACHE_TYPE_UNIFIED, level, node);
+-
+-      return cache;
++      return new_cache(cache_is_unified_d(node), level, node);
+ }
+ static struct cache *cache_do_one_devnode_split(struct device_node *node,
diff --git a/queue-4.0/powerpc-jump_label-include-linux-jump_label.h-to-get-have_jump_label-define.patch b/queue-4.0/powerpc-jump_label-include-linux-jump_label.h-to-get-have_jump_label-define.patch
new file mode 100644 (file)
index 0000000..2d0ff20
--- /dev/null
@@ -0,0 +1,92 @@
+From 58995a9a5b292458f94a2356b8c878230fa56fe0 Mon Sep 17 00:00:00 2001
+From: Anton Blanchard <anton@samba.org>
+Date: Thu, 9 Apr 2015 13:51:32 +1000
+Subject: powerpc, jump_label: Include linux/jump_label.h to get HAVE_JUMP_LABEL define
+
+From: Anton Blanchard <anton@samba.org>
+
+commit 58995a9a5b292458f94a2356b8c878230fa56fe0 upstream.
+
+Commit 1bc9e47aa8e4 ("powerpc/jump_label: Use HAVE_JUMP_LABEL")
+converted uses of CONFIG_JUMP_LABEL to HAVE_JUMP_LABEL in
+some assembly files.
+
+HAVE_JUMP_LABEL is defined in linux/jump_label.h, so we need to
+include this or we always get the non jump label fallback code.
+
+Signed-off-by: Anton Blanchard <anton@samba.org>
+Acked-by: Michael Ellerman <mpe@ellerman.id.au>
+Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: benh@kernel.crashing.org
+Cc: catalin.marinas@arm.com
+Cc: davem@davemloft.net
+Cc: heiko.carstens@de.ibm.com
+Cc: jbaron@akamai.com
+Cc: linux@arm.linux.org.uk
+Cc: linuxppc-dev@lists.ozlabs.org
+Cc: liuj97@gmail.com
+Cc: mgorman@suse.de
+Cc: mmarek@suse.cz
+Cc: paulus@samba.org
+Cc: ralf@linux-mips.org
+Cc: rostedt@goodmis.org
+Cc: schwidefsky@de.ibm.com
+Cc: will.deacon@arm.com
+Fixes: 1bc9e47aa8e4 ("powerpc/jump_label: Use HAVE_JUMP_LABEL")
+Link: http://lkml.kernel.org/r/1428551492-21977-3-git-send-email-anton@samba.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/platforms/powernv/opal-wrappers.S |    2 +-
+ arch/powerpc/platforms/pseries/hvCall.S        |    2 +-
+ arch/powerpc/platforms/pseries/lpar.c          |    2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
++++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
+@@ -9,11 +9,11 @@
+  * 2 of the License, or (at your option) any later version.
+  */
++#include <linux/jump_label.h>
+ #include <asm/ppc_asm.h>
+ #include <asm/hvcall.h>
+ #include <asm/asm-offsets.h>
+ #include <asm/opal.h>
+-#include <asm/jump_label.h>
+       .section        ".text"
+--- a/arch/powerpc/platforms/pseries/hvCall.S
++++ b/arch/powerpc/platforms/pseries/hvCall.S
+@@ -7,12 +7,12 @@
+  * as published by the Free Software Foundation; either version
+  * 2 of the License, or (at your option) any later version.
+  */
++#include <linux/jump_label.h>
+ #include <asm/hvcall.h>
+ #include <asm/processor.h>
+ #include <asm/ppc_asm.h>
+ #include <asm/asm-offsets.h>
+ #include <asm/ptrace.h>
+-#include <asm/jump_label.h>
+       .section        ".text"
+       
+--- a/arch/powerpc/platforms/pseries/lpar.c
++++ b/arch/powerpc/platforms/pseries/lpar.c
+@@ -26,7 +26,7 @@
+ #include <linux/dma-mapping.h>
+ #include <linux/console.h>
+ #include <linux/export.h>
+-#include <linux/static_key.h>
++#include <linux/jump_label.h>
+ #include <asm/processor.h>
+ #include <asm/mmu.h>
+ #include <asm/page.h>
diff --git a/queue-4.0/powerpc-perf-cap-64bit-userspace-backtraces-to-perf_max_stack_depth.patch b/queue-4.0/powerpc-perf-cap-64bit-userspace-backtraces-to-perf_max_stack_depth.patch
new file mode 100644 (file)
index 0000000..5868e4d
--- /dev/null
@@ -0,0 +1,31 @@
+From 9a5cbce421a283e6aea3c4007f141735bf9da8c3 Mon Sep 17 00:00:00 2001
+From: Anton Blanchard <anton@samba.org>
+Date: Tue, 14 Apr 2015 07:51:03 +1000
+Subject: powerpc/perf: Cap 64bit userspace backtraces to PERF_MAX_STACK_DEPTH
+
+From: Anton Blanchard <anton@samba.org>
+
+commit 9a5cbce421a283e6aea3c4007f141735bf9da8c3 upstream.
+
+We cap 32bit userspace backtraces to PERF_MAX_STACK_DEPTH
+(currently 127), but we forgot to do the same for 64bit backtraces.
+
+Signed-off-by: Anton Blanchard <anton@samba.org>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/perf/callchain.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/powerpc/perf/callchain.c
++++ b/arch/powerpc/perf/callchain.c
+@@ -243,7 +243,7 @@ static void perf_callchain_user_64(struc
+       sp = regs->gpr[1];
+       perf_callchain_store(entry, next_ip);
+-      for (;;) {
++      while (entry->nr < PERF_MAX_STACK_DEPTH) {
+               fp = (unsigned long __user *) sp;
+               if (!valid_user_sp(sp, 1) || read_user_stack_64(fp, &next_sp))
+                       return;
diff --git a/queue-4.0/powerpc-powernv-don-t-map-m64-segments-using-m32dt.patch b/queue-4.0/powerpc-powernv-don-t-map-m64-segments-using-m32dt.patch
new file mode 100644 (file)
index 0000000..d4d7ce5
--- /dev/null
@@ -0,0 +1,36 @@
+From 027fa02f84e851e21daffdf8900d6117071890f8 Mon Sep 17 00:00:00 2001
+From: Gavin Shan <gwshan@linux.vnet.ibm.com>
+Date: Fri, 27 Mar 2015 11:29:00 +1100
+Subject: powerpc/powernv: Don't map M64 segments using M32DT
+
+From: Gavin Shan <gwshan@linux.vnet.ibm.com>
+
+commit 027fa02f84e851e21daffdf8900d6117071890f8 upstream.
+
+If M64 has been supported, the prefetchable 64-bits memory resources
+shouldn't be mapped to the corresponding PE# via M32DT. Unfortunately,
+we're doing that in pnv_ioda_setup_pe_seg() wrongly. The issue was
+introduced by commit 262af55 ("powerpc/powernv: Enable M64 aperatus
+for PHB3"). The patch fixes the issue by simply skipping M64 resources
+when updating to M32DT.
+
+Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/platforms/powernv/pci-ioda.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/arch/powerpc/platforms/powernv/pci-ioda.c
++++ b/arch/powerpc/platforms/powernv/pci-ioda.c
+@@ -1777,7 +1777,8 @@ static void pnv_ioda_setup_pe_seg(struct
+                               region.start += phb->ioda.io_segsize;
+                               index++;
+                       }
+-              } else if (res->flags & IORESOURCE_MEM) {
++              } else if ((res->flags & IORESOURCE_MEM) &&
++                         !pnv_pci_is_mem_pref_64(res->flags)) {
+                       region.start = res->start -
+                                      hose->mem_offset[0] -
+                                      phb->ioda.m32_pci_base;
diff --git a/queue-4.0/scsi-storvsc-fix-a-bug-in-copy_from_bounce_buffer.patch b/queue-4.0/scsi-storvsc-fix-a-bug-in-copy_from_bounce_buffer.patch
new file mode 100644 (file)
index 0000000..fafcf2d
--- /dev/null
@@ -0,0 +1,53 @@
+From 8de580742fee8bc34d116f57a20b22b9a5f08403 Mon Sep 17 00:00:00 2001
+From: "K. Y. Srinivasan" <kys@microsoft.com>
+Date: Fri, 27 Mar 2015 00:27:18 -0700
+Subject: scsi: storvsc: Fix a bug in copy_from_bounce_buffer()
+
+From: "K. Y. Srinivasan" <kys@microsoft.com>
+
+commit 8de580742fee8bc34d116f57a20b22b9a5f08403 upstream.
+
+We may exit this function without properly freeing up the maapings
+we may have acquired. Fix the bug.
+
+Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
+Reviewed-by: Long Li <longli@microsoft.com>
+Signed-off-by: James Bottomley <JBottomley@Odin.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/storvsc_drv.c |   15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+--- a/drivers/scsi/storvsc_drv.c
++++ b/drivers/scsi/storvsc_drv.c
+@@ -746,21 +746,22 @@ static unsigned int copy_to_bounce_buffe
+                       if (bounce_sgl[j].length == PAGE_SIZE) {
+                               /* full..move to next entry */
+                               sg_kunmap_atomic(bounce_addr);
++                              bounce_addr = 0;
+                               j++;
++                      }
+-                              /* if we need to use another bounce buffer */
+-                              if (srclen || i != orig_sgl_count - 1)
+-                                      bounce_addr = sg_kmap_atomic(bounce_sgl,j);
++                      /* if we need to use another bounce buffer */
++                      if (srclen && bounce_addr == 0)
++                              bounce_addr = sg_kmap_atomic(bounce_sgl, j);
+-                      } else if (srclen == 0 && i == orig_sgl_count - 1) {
+-                              /* unmap the last bounce that is < PAGE_SIZE */
+-                              sg_kunmap_atomic(bounce_addr);
+-                      }
+               }
+               sg_kunmap_atomic(src_addr - orig_sgl[i].offset);
+       }
++      if (bounce_addr)
++              sg_kunmap_atomic(bounce_addr);
++
+       local_irq_restore(flags);
+       return total_copied;
diff --git a/queue-4.0/sd-fix-missing-ato-tag-check.patch b/queue-4.0/sd-fix-missing-ato-tag-check.patch
new file mode 100644 (file)
index 0000000..b6eda18
--- /dev/null
@@ -0,0 +1,33 @@
+From e557990e358934fb168d30371c9c0f63e314c6b8 Mon Sep 17 00:00:00 2001
+From: "Martin K. Petersen" <martin.petersen@oracle.com>
+Date: Tue, 14 Apr 2015 17:11:03 -0400
+Subject: sd: Fix missing ATO tag check
+
+From: "Martin K. Petersen" <martin.petersen@oracle.com>
+
+commit e557990e358934fb168d30371c9c0f63e314c6b8 upstream.
+
+3aec2f41a8bae introduced a merge error where we would end up check for
+sdkp instead of sdkp->ATO. Fix this so we register app tag capability
+correctly.
+
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
+Signed-off-by: James Bottomley <JBottomley@Odin.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/sd_dif.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/scsi/sd_dif.c
++++ b/drivers/scsi/sd_dif.c
+@@ -77,7 +77,7 @@ void sd_dif_config_host(struct scsi_disk
+               disk->integrity->flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
+-              if (!sdkp)
++              if (!sdkp->ATO)
+                       return;
+               if (type == SD_DIF_TYPE3_PROTECTION)
diff --git a/queue-4.0/sd-unregister-integrity-profile.patch b/queue-4.0/sd-unregister-integrity-profile.patch
new file mode 100644 (file)
index 0000000..bbe7dd2
--- /dev/null
@@ -0,0 +1,32 @@
+From e727c42bd55794765c460b7ac2b6cc969f2a9698 Mon Sep 17 00:00:00 2001
+From: "Martin K. Petersen" <martin.petersen@oracle.com>
+Date: Tue, 14 Apr 2015 16:56:23 -0400
+Subject: sd: Unregister integrity profile
+
+From: "Martin K. Petersen" <martin.petersen@oracle.com>
+
+commit e727c42bd55794765c460b7ac2b6cc969f2a9698 upstream.
+
+The new integrity code did not correctly unregister the profile for SD
+disks. Call blk_integrity_unregister() when we release a disk.
+
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Reported-by: Sagi Grimberg <sagig@dev.mellanox.co.il>
+Tested-by: Sagi Grimberg <sagig@mellanox.com>
+Signed-off-by: James Bottomley <JBottomley@Odin.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/scsi/sd.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/scsi/sd.c
++++ b/drivers/scsi/sd.c
+@@ -3100,6 +3100,7 @@ static void scsi_disk_release(struct dev
+       ida_remove(&sd_index_ida, sdkp->index);
+       spin_unlock(&sd_index_lock);
++      blk_integrity_unregister(disk);
+       disk->private_data = NULL;
+       put_disk(disk);
+       put_device(&sdkp->device->sdev_gendev);
diff --git a/queue-4.0/serial-8250-check-uart_scr-is-writable.patch b/queue-4.0/serial-8250-check-uart_scr-is-writable.patch
new file mode 100644 (file)
index 0000000..37320f4
--- /dev/null
@@ -0,0 +1,35 @@
+From f01a0bd8921b9d6668d41fae3198970e6318f532 Mon Sep 17 00:00:00 2001
+From: Peter Hurley <peter@hurleysoftware.com>
+Date: Mon, 9 Mar 2015 14:05:01 -0400
+Subject: serial: 8250: Check UART_SCR is writable
+
+From: Peter Hurley <peter@hurleysoftware.com>
+
+commit f01a0bd8921b9d6668d41fae3198970e6318f532 upstream.
+
+Au1x00/RT2800+ doesn't implement the 8250 scratch register (and
+this may be true of other h/w currently supported by the 8250 driver);
+read back the canary value written to the scratch register to enable
+the console h/w restart after resume from system suspend.
+
+Fixes: 4516d50aabedb ("serial: 8250: Use canary to restart console ...")
+Reported-by: Mason <slash.tmp@free.fr>
+Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/serial/8250/8250_core.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/serial/8250/8250_core.c
++++ b/drivers/tty/serial/8250/8250_core.c
+@@ -3444,7 +3444,8 @@ void serial8250_suspend_port(int line)
+           port->type != PORT_8250) {
+               unsigned char canary = 0xa5;
+               serial_out(up, UART_SCR, canary);
+-              up->canary = canary;
++              if (serial_in(up, UART_SCR) == canary)
++                      up->canary = canary;
+       }
+       uart_suspend_port(&serial8250_reg, port);
diff --git a/queue-4.0/serial-8250_dw-add-support-for-amd-soc-carrizo.patch b/queue-4.0/serial-8250_dw-add-support-for-amd-soc-carrizo.patch
new file mode 100644 (file)
index 0000000..c274d1f
--- /dev/null
@@ -0,0 +1,28 @@
+From 5ef86b74209db33c133b5f18738dd8f3189b63a1 Mon Sep 17 00:00:00 2001
+From: Ken Xue <Ken.Xue@amd.com>
+Date: Mon, 9 Mar 2015 17:10:13 +0800
+Subject: serial: 8250_dw: add support for AMD SOC Carrizo
+
+From: Ken Xue <Ken.Xue@amd.com>
+
+commit 5ef86b74209db33c133b5f18738dd8f3189b63a1 upstream.
+
+Add ACPI identifier for UART on AMD SOC Carrizo.
+
+Signed-off-by: Ken Xue <Ken.Xue@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/serial/8250/8250_dw.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/tty/serial/8250/8250_dw.c
++++ b/drivers/tty/serial/8250/8250_dw.c
+@@ -629,6 +629,7 @@ static const struct acpi_device_id dw825
+       { "80860F0A", 0 },
+       { "8086228A", 0 },
+       { "APMC0D08", 0},
++      { "AMD0020", 0 },
+       { },
+ };
+ MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match);
diff --git a/queue-4.0/serial-imx-fix-clearing-of-receiver-overrun-flag.patch b/queue-4.0/serial-imx-fix-clearing-of-receiver-overrun-flag.patch
new file mode 100644 (file)
index 0000000..ec5f6e4
--- /dev/null
@@ -0,0 +1,58 @@
+From 91555ce9012557b2d621d7b0b6ec694218a2a9bc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+Date: Tue, 24 Feb 2015 11:17:05 +0100
+Subject: serial: imx: Fix clearing of receiver overrun flag
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+
+commit 91555ce9012557b2d621d7b0b6ec694218a2a9bc upstream.
+
+The writeable bits in the USR2 register are all "write 1 to
+clear" so only write the bits that actually should be cleared.
+
+Fixes: f1f836e4209e ("serial: imx: Add Rx Fifo overrun error message")
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/serial/imx.c |    8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+--- a/drivers/tty/serial/imx.c
++++ b/drivers/tty/serial/imx.c
+@@ -818,7 +818,7 @@ static irqreturn_t imx_int(int irq, void
+       if (sts2 & USR2_ORE) {
+               dev_err(sport->port.dev, "Rx FIFO overrun\n");
+               sport->port.icount.overrun++;
+-              writel(sts2 | USR2_ORE, sport->port.membase + USR2);
++              writel(USR2_ORE, sport->port.membase + USR2);
+       }
+       return IRQ_HANDLED;
+@@ -1181,10 +1181,12 @@ static int imx_startup(struct uart_port
+               imx_uart_dma_init(sport);
+       spin_lock_irqsave(&sport->port.lock, flags);
++
+       /*
+        * Finally, clear and enable interrupts
+        */
+       writel(USR1_RTSD, sport->port.membase + USR1);
++      writel(USR2_ORE, sport->port.membase + USR2);
+       if (sport->dma_is_inited && !sport->dma_is_enabled)
+               imx_enable_dma(sport);
+@@ -1199,10 +1201,6 @@ static int imx_startup(struct uart_port
+       writel(temp, sport->port.membase + UCR1);
+-      /* Clear any pending ORE flag before enabling interrupt */
+-      temp = readl(sport->port.membase + USR2);
+-      writel(temp | USR2_ORE, sport->port.membase + USR2);
+-
+       temp = readl(sport->port.membase + UCR4);
+       temp |= UCR4_OREN;
+       writel(temp, sport->port.membase + UCR4);
index 6aa2c32a5022e0df0bcbaf4f31ecfc44e7da8182..15cce50660fa65b23910dbd3334b16cedc0ca2f6 100644 (file)
@@ -116,3 +116,59 @@ mnt-factor-umount_mnt-from-umount_tree.patch
 mnt-honor-mnt_locked-when-detaching-mounts.patch
 mnt-fix-the-error-check-in-__detach_mounts.patch
 mnt-update-detach_mounts-to-leave-mounts-connected.patch
+tpm-fix-sanitized-code-paths-in-tpm_chip_register.patch
+perf-symbols-define-stt_gnu_ifunc-for-glibc-2.9-and-older.patch
+perf-tools-fix-perf-read-vdsox32-not-building-and-lib64-install-dir.patch
+perf-tools-work-around-lack-of-sched_getcpu-in-glibc-2.6.patch
+powerpc-perf-cap-64bit-userspace-backtraces-to-perf_max_stack_depth.patch
+tools-lib-traceevent-kbuffer-remove-extra-update-to-data-pointer-in-padding.patch
+tools-power-turbostat-use-curdir-instead-of-pwd-and-add-support-for-o-option-in-makefile.patch
+ubi-account-for-bitflips-in-both-the-vid-header-and-data.patch
+ubi-fix-out-of-bounds-write.patch
+ubi-initialize-leb-number-variable.patch
+ubi-fix-check-for-too-many-bytes.patch
+scsi-storvsc-fix-a-bug-in-copy_from_bounce_buffer.patch
+iscsi-target-convert-iscsi_thread_set-usage-to-kthread.h.patch
+target-fix-compare_and_write-with-sg_to_mem_noalloc-handling.patch
+target-file-fix-bug-when-config_debug_sg-y-and-dif-protection-enabled.patch
+target-file-fix-unmap-with-dif-protection-support.patch
+target-file-fix-sg-table-for-prot_buf-initialization.patch
+iser-target-fix-session-hang-in-case-of-an-rdma-read-dif-error.patch
+iser-target-fix-possible-deadlock-in-rdma_cm-connection-error.patch
+bluetooth-ath3k-add-support-atheros-ar5b195-combo-mini-pcie-card.patch
+arm64-fix-midr-range-for-cortex-a57-erratum-832075.patch
+arm64-head.s-ensure-visibility-of-page-tables.patch
+arm64-adjust-efi-libstub-object-include-logic.patch
+arm64-apply-alternatives-for-smp-kernels.patch
+arm64-errata-add-workaround-for-cortex-a53-erratum-845719.patch
+powerpc-powernv-don-t-map-m64-segments-using-m32dt.patch
+powerpc-jump_label-include-linux-jump_label.h-to-get-have_jump_label-define.patch
+powerpc-fix-missing-l2-cache-size-in-sys-devices-system-cpu.patch
+powerpc-cell-fix-crash-in-iic_setup_cpu-after-per_cpu-changes.patch
+powerpc-cell-fix-cell-iommu-after-it_page_shift-changes.patch
+asoc-cs4271-increase-delay-time-after-reset.patch
+asoc-wm8741-fix-rates-constraints-values.patch
+asoc-davinci-evm-drop-un-necessary-remove-function.patch
+asoc-pcm512x-add-analogue-prefix-to-analogue-volume-controls.patch
+asoc-pcm512x-fix-divide-by-zero-issue.patch
+acpica-utilities-split-io-address-types-from-data-type-models.patch
+acpica-tables-don-t-release-acpi_mtx_tables-in-acpi_tb_install_standard_table.patch
+acpica-store-gpe-register-enable-masks-upfront.patch
+acpi-scan-annotate-physical_node_lock-in-acpi_scan_is_offline.patch
+xtensa-xtfpga-fix-hardware-lockup-caused-by-lcd-driver.patch
+xtensa-provide-__nr_sync_file_range2-instead-of-__nr_sync_file_range.patch
+xtensa-iss-fix-locking-in-tap-network-adapter.patch
+gpio-mvebu-fix-mask-unmask-managment-per-irq-chip-type.patch
+clk-samsung-exynos4-disable-armclk-down-feature-on-exynos4210-soc.patch
+clk-tegra-register-the-proper-number-of-resets.patch
+clk-tegra-use-the-proper-parent-for-plld_dsi.patch
+clk-qcom-fix-i2c-frequency-table.patch
+clk-qcom-properly-change-rates-for-ahbix-clock.patch
+clk-qcom-fix-rcg-m-n-counter-configuration.patch
+clk-qcom-fix-ipq806x-lcc-frequency-tables.patch
+dm-crypt-fix-deadlock-when-async-crypto-algorithm-returns-ebusy.patch
+serial-8250_dw-add-support-for-amd-soc-carrizo.patch
+serial-imx-fix-clearing-of-receiver-overrun-flag.patch
+serial-8250-check-uart_scr-is-writable.patch
+sd-unregister-integrity-profile.patch
+sd-fix-missing-ato-tag-check.patch
diff --git a/queue-4.0/target-file-fix-bug-when-config_debug_sg-y-and-dif-protection-enabled.patch b/queue-4.0/target-file-fix-bug-when-config_debug_sg-y-and-dif-protection-enabled.patch
new file mode 100644 (file)
index 0000000..510e615
--- /dev/null
@@ -0,0 +1,100 @@
+From 38da0f49e8aa1649af397d53f88e163d0e60c058 Mon Sep 17 00:00:00 2001
+From: Akinobu Mita <akinobu.mita@gmail.com>
+Date: Mon, 13 Apr 2015 23:21:56 +0900
+Subject: target/file: Fix BUG() when CONFIG_DEBUG_SG=y and DIF protection enabled
+
+From: Akinobu Mita <akinobu.mita@gmail.com>
+
+commit 38da0f49e8aa1649af397d53f88e163d0e60c058 upstream.
+
+When CONFIG_DEBUG_SG=y and DIF protection support enabled, kernel
+BUG()s are triggered due to the following two issues:
+
+1) prot_sg is not initialized by sg_init_table().
+
+When CONFIG_DEBUG_SG=y, scatterlist helpers check sg entry has a
+correct magic value.
+
+2) vmalloc'ed buffer is passed to sg_set_buf().
+
+sg_set_buf() uses virt_to_page() to convert virtual address to struct
+page, but it doesn't work with vmalloc address.  vmalloc_to_page()
+should be used instead.  As prot_buf isn't usually too large, so
+fix it by allocating prot_buf by kmalloc instead of vmalloc.
+
+Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
+Cc: Sagi Grimberg <sagig@mellanox.com>
+Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
+Cc: Christoph Hellwig <hch@lst.de>
+Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/target/target_core_file.c |   15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+--- a/drivers/target/target_core_file.c
++++ b/drivers/target/target_core_file.c
+@@ -274,7 +274,7 @@ static int fd_do_prot_rw(struct se_cmd *
+                    se_dev->prot_length;
+       if (!is_write) {
+-              fd_prot->prot_buf = vzalloc(prot_size);
++              fd_prot->prot_buf = kzalloc(prot_size, GFP_KERNEL);
+               if (!fd_prot->prot_buf) {
+                       pr_err("Unable to allocate fd_prot->prot_buf\n");
+                       return -ENOMEM;
+@@ -286,9 +286,10 @@ static int fd_do_prot_rw(struct se_cmd *
+                                          fd_prot->prot_sg_nents, GFP_KERNEL);
+               if (!fd_prot->prot_sg) {
+                       pr_err("Unable to allocate fd_prot->prot_sg\n");
+-                      vfree(fd_prot->prot_buf);
++                      kfree(fd_prot->prot_buf);
+                       return -ENOMEM;
+               }
++              sg_init_table(fd_prot->prot_sg, fd_prot->prot_sg_nents);
+               size = prot_size;
+               for_each_sg(fd_prot->prot_sg, sg, fd_prot->prot_sg_nents, i) {
+@@ -318,7 +319,7 @@ static int fd_do_prot_rw(struct se_cmd *
+       if (is_write || ret < 0) {
+               kfree(fd_prot->prot_sg);
+-              vfree(fd_prot->prot_buf);
++              kfree(fd_prot->prot_buf);
+       }
+       return ret;
+@@ -658,11 +659,11 @@ fd_execute_rw(struct se_cmd *cmd, struct
+                                                0, fd_prot.prot_sg, 0);
+                       if (rc) {
+                               kfree(fd_prot.prot_sg);
+-                              vfree(fd_prot.prot_buf);
++                              kfree(fd_prot.prot_buf);
+                               return rc;
+                       }
+                       kfree(fd_prot.prot_sg);
+-                      vfree(fd_prot.prot_buf);
++                      kfree(fd_prot.prot_buf);
+               }
+       } else {
+               memset(&fd_prot, 0, sizeof(struct fd_prot));
+@@ -678,7 +679,7 @@ fd_execute_rw(struct se_cmd *cmd, struct
+                                                 0, fd_prot.prot_sg, 0);
+                       if (rc) {
+                               kfree(fd_prot.prot_sg);
+-                              vfree(fd_prot.prot_buf);
++                              kfree(fd_prot.prot_buf);
+                               return rc;
+                       }
+               }
+@@ -714,7 +715,7 @@ fd_execute_rw(struct se_cmd *cmd, struct
+       if (ret < 0) {
+               kfree(fd_prot.prot_sg);
+-              vfree(fd_prot.prot_buf);
++              kfree(fd_prot.prot_buf);
+               return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
+       }
diff --git a/queue-4.0/target-file-fix-sg-table-for-prot_buf-initialization.patch b/queue-4.0/target-file-fix-sg-table-for-prot_buf-initialization.patch
new file mode 100644 (file)
index 0000000..521de93
--- /dev/null
@@ -0,0 +1,80 @@
+From c836777830428372074d5129ac513e1472c99791 Mon Sep 17 00:00:00 2001
+From: Akinobu Mita <akinobu.mita@gmail.com>
+Date: Mon, 13 Apr 2015 23:21:57 +0900
+Subject: target/file: Fix SG table for prot_buf initialization
+
+From: Akinobu Mita <akinobu.mita@gmail.com>
+
+commit c836777830428372074d5129ac513e1472c99791 upstream.
+
+In fd_do_prot_rw(), it allocates prot_buf which is used to copy from
+se_cmd->t_prot_sg by sbc_dif_copy_prot().  The SG table for prot_buf
+is also initialized by allocating 'se_cmd->t_prot_nents' entries of
+scatterlist and setting the data length of each entry to PAGE_SIZE
+at most.
+
+However if se_cmd->t_prot_sg contains a clustered entry (i.e.
+sg->length > PAGE_SIZE), the SG table for prot_buf can't be
+initialized correctly and sbc_dif_copy_prot() can't copy to prot_buf.
+(This actually happened with TCM loopback fabric module)
+
+As prot_buf is allocated by kzalloc() and it's physically contiguous,
+we only need a single scatterlist entry.
+
+Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
+Cc: Sagi Grimberg <sagig@mellanox.com>
+Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
+Cc: Christoph Hellwig <hch@lst.de>
+Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/target/target_core_file.c |   21 ++++++---------------
+ 1 file changed, 6 insertions(+), 15 deletions(-)
+
+--- a/drivers/target/target_core_file.c
++++ b/drivers/target/target_core_file.c
+@@ -264,11 +264,10 @@ static int fd_do_prot_rw(struct se_cmd *
+       struct se_device *se_dev = cmd->se_dev;
+       struct fd_dev *dev = FD_DEV(se_dev);
+       struct file *prot_fd = dev->fd_prot_file;
+-      struct scatterlist *sg;
+       loff_t pos = (cmd->t_task_lba * se_dev->prot_length);
+       unsigned char *buf;
+-      u32 prot_size, len, size;
+-      int rc, ret = 1, i;
++      u32 prot_size;
++      int rc, ret = 1;
+       prot_size = (cmd->data_length / se_dev->dev_attrib.block_size) *
+                    se_dev->prot_length;
+@@ -281,24 +280,16 @@ static int fd_do_prot_rw(struct se_cmd *
+               }
+               buf = fd_prot->prot_buf;
+-              fd_prot->prot_sg_nents = cmd->t_prot_nents;
+-              fd_prot->prot_sg = kzalloc(sizeof(struct scatterlist) *
+-                                         fd_prot->prot_sg_nents, GFP_KERNEL);
++              fd_prot->prot_sg_nents = 1;
++              fd_prot->prot_sg = kzalloc(sizeof(struct scatterlist),
++                                         GFP_KERNEL);
+               if (!fd_prot->prot_sg) {
+                       pr_err("Unable to allocate fd_prot->prot_sg\n");
+                       kfree(fd_prot->prot_buf);
+                       return -ENOMEM;
+               }
+               sg_init_table(fd_prot->prot_sg, fd_prot->prot_sg_nents);
+-              size = prot_size;
+-
+-              for_each_sg(fd_prot->prot_sg, sg, fd_prot->prot_sg_nents, i) {
+-
+-                      len = min_t(u32, PAGE_SIZE, size);
+-                      sg_set_buf(sg, buf, len);
+-                      size -= len;
+-                      buf += len;
+-              }
++              sg_set_buf(fd_prot->prot_sg, buf, prot_size);
+       }
+       if (is_write) {
diff --git a/queue-4.0/target-file-fix-unmap-with-dif-protection-support.patch b/queue-4.0/target-file-fix-unmap-with-dif-protection-support.patch
new file mode 100644 (file)
index 0000000..04f8234
--- /dev/null
@@ -0,0 +1,156 @@
+From 64d240b721b21e266ffde645ec965c3b6d1c551f Mon Sep 17 00:00:00 2001
+From: Akinobu Mita <akinobu.mita@gmail.com>
+Date: Mon, 13 Apr 2015 23:21:58 +0900
+Subject: target/file: Fix UNMAP with DIF protection support
+
+From: Akinobu Mita <akinobu.mita@gmail.com>
+
+commit 64d240b721b21e266ffde645ec965c3b6d1c551f upstream.
+
+When UNMAP command is issued with DIF protection support enabled,
+the protection info for the unmapped region is remain unchanged.
+So READ command for the region causes data integrity failure.
+
+This fixes it by invalidating protection info for the unmapped region
+by filling with 0xff pattern.  This change also adds helper function
+fd_do_prot_fill() in order to reduce code duplication with existing
+fd_format_prot().
+
+Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
+Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
+Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com>
+Cc: Christoph Hellwig <hch@lst.de>
+Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/target/target_core_file.c |   86 ++++++++++++++++++++++++++------------
+ 1 file changed, 61 insertions(+), 25 deletions(-)
+
+--- a/drivers/target/target_core_file.c
++++ b/drivers/target/target_core_file.c
+@@ -550,6 +550,56 @@ fd_execute_write_same(struct se_cmd *cmd
+       return 0;
+ }
++static int
++fd_do_prot_fill(struct se_device *se_dev, sector_t lba, sector_t nolb,
++              void *buf, size_t bufsize)
++{
++      struct fd_dev *fd_dev = FD_DEV(se_dev);
++      struct file *prot_fd = fd_dev->fd_prot_file;
++      sector_t prot_length, prot;
++      loff_t pos = lba * se_dev->prot_length;
++
++      if (!prot_fd) {
++              pr_err("Unable to locate fd_dev->fd_prot_file\n");
++              return -ENODEV;
++      }
++
++      prot_length = nolb * se_dev->prot_length;
++
++      for (prot = 0; prot < prot_length;) {
++              sector_t len = min_t(sector_t, bufsize, prot_length - prot);
++              ssize_t ret = kernel_write(prot_fd, buf, len, pos + prot);
++
++              if (ret != len) {
++                      pr_err("vfs_write to prot file failed: %zd\n", ret);
++                      return ret < 0 ? ret : -ENODEV;
++              }
++              prot += ret;
++      }
++
++      return 0;
++}
++
++static int
++fd_do_prot_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
++{
++      void *buf;
++      int rc;
++
++      buf = (void *)__get_free_page(GFP_KERNEL);
++      if (!buf) {
++              pr_err("Unable to allocate FILEIO prot buf\n");
++              return -ENOMEM;
++      }
++      memset(buf, 0xff, PAGE_SIZE);
++
++      rc = fd_do_prot_fill(cmd->se_dev, lba, nolb, buf, PAGE_SIZE);
++
++      free_page((unsigned long)buf);
++
++      return rc;
++}
++
+ static sense_reason_t
+ fd_do_unmap(struct se_cmd *cmd, void *priv, sector_t lba, sector_t nolb)
+ {
+@@ -557,6 +607,12 @@ fd_do_unmap(struct se_cmd *cmd, void *pr
+       struct inode *inode = file->f_mapping->host;
+       int ret;
++      if (cmd->se_dev->dev_attrib.pi_prot_type) {
++              ret = fd_do_prot_unmap(cmd, lba, nolb);
++              if (ret)
++                      return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
++      }
++
+       if (S_ISBLK(inode->i_mode)) {
+               /* The backend is block device, use discard */
+               struct block_device *bdev = inode->i_bdev;
+@@ -879,48 +935,28 @@ static int fd_init_prot(struct se_device
+ static int fd_format_prot(struct se_device *dev)
+ {
+-      struct fd_dev *fd_dev = FD_DEV(dev);
+-      struct file *prot_fd = fd_dev->fd_prot_file;
+-      sector_t prot_length, prot;
+       unsigned char *buf;
+-      loff_t pos = 0;
+       int unit_size = FDBD_FORMAT_UNIT_SIZE * dev->dev_attrib.block_size;
+-      int rc, ret = 0, size, len;
++      int ret;
+       if (!dev->dev_attrib.pi_prot_type) {
+               pr_err("Unable to format_prot while pi_prot_type == 0\n");
+               return -ENODEV;
+       }
+-      if (!prot_fd) {
+-              pr_err("Unable to locate fd_dev->fd_prot_file\n");
+-              return -ENODEV;
+-      }
+       buf = vzalloc(unit_size);
+       if (!buf) {
+               pr_err("Unable to allocate FILEIO prot buf\n");
+               return -ENOMEM;
+       }
+-      prot_length = (dev->transport->get_blocks(dev) + 1) * dev->prot_length;
+-      size = prot_length;
+       pr_debug("Using FILEIO prot_length: %llu\n",
+-               (unsigned long long)prot_length);
++               (unsigned long long)(dev->transport->get_blocks(dev) + 1) *
++                                      dev->prot_length);
+       memset(buf, 0xff, unit_size);
+-      for (prot = 0; prot < prot_length; prot += unit_size) {
+-              len = min(unit_size, size);
+-              rc = kernel_write(prot_fd, buf, len, pos);
+-              if (rc != len) {
+-                      pr_err("vfs_write to prot file failed: %d\n", rc);
+-                      ret = -ENODEV;
+-                      goto out;
+-              }
+-              pos += len;
+-              size -= len;
+-      }
+-
+-out:
++      ret = fd_do_prot_fill(dev, 0, dev->transport->get_blocks(dev) + 1,
++                            buf, unit_size);
+       vfree(buf);
+       return ret;
+ }
diff --git a/queue-4.0/target-fix-compare_and_write-with-sg_to_mem_noalloc-handling.patch b/queue-4.0/target-fix-compare_and_write-with-sg_to_mem_noalloc-handling.patch
new file mode 100644 (file)
index 0000000..bcc59af
--- /dev/null
@@ -0,0 +1,186 @@
+From c8e639852ad720499912acedfd6b072325fd2807 Mon Sep 17 00:00:00 2001
+From: Nicholas Bellinger <nab@linux-iscsi.org>
+Date: Tue, 7 Apr 2015 21:53:27 +0000
+Subject: target: Fix COMPARE_AND_WRITE with SG_TO_MEM_NOALLOC handling
+
+From: Nicholas Bellinger <nab@linux-iscsi.org>
+
+commit c8e639852ad720499912acedfd6b072325fd2807 upstream.
+
+This patch fixes a bug for COMPARE_AND_WRITE handling with
+fabrics using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC.
+
+It adds the missing allocation for cmd->t_bidi_data_sg within
+transport_generic_new_cmd() that is used by COMPARE_AND_WRITE
+for the initial READ payload, even if the fabric is already
+providing a pre-allocated buffer for cmd->t_data_sg.
+
+Also, fix zero-length COMPARE_AND_WRITE handling within the
+compare_and_write_callback() and target_complete_ok_work()
+to queue the response, skipping the initial READ.
+
+This fixes COMPARE_AND_WRITE emulation with loopback, vhost,
+and xen-backend fabric drivers using SG_TO_MEM_NOALLOC.
+
+Reported-by: Christoph Hellwig <hch@lst.de>
+Cc: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/target/target_core_sbc.c       |   15 ++++++++-----
+ drivers/target/target_core_transport.c |   37 +++++++++++++++++++++++++++++----
+ include/target/target_core_base.h      |    2 -
+ 3 files changed, 44 insertions(+), 10 deletions(-)
+
+--- a/drivers/target/target_core_sbc.c
++++ b/drivers/target/target_core_sbc.c
+@@ -312,7 +312,7 @@ sbc_setup_write_same(struct se_cmd *cmd,
+       return 0;
+ }
+-static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd)
++static sense_reason_t xdreadwrite_callback(struct se_cmd *cmd, bool success)
+ {
+       unsigned char *buf, *addr;
+       struct scatterlist *sg;
+@@ -376,7 +376,7 @@ sbc_execute_rw(struct se_cmd *cmd)
+                              cmd->data_direction);
+ }
+-static sense_reason_t compare_and_write_post(struct se_cmd *cmd)
++static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success)
+ {
+       struct se_device *dev = cmd->se_dev;
+@@ -399,7 +399,7 @@ static sense_reason_t compare_and_write_
+       return TCM_NO_SENSE;
+ }
+-static sense_reason_t compare_and_write_callback(struct se_cmd *cmd)
++static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool success)
+ {
+       struct se_device *dev = cmd->se_dev;
+       struct scatterlist *write_sg = NULL, *sg;
+@@ -414,11 +414,16 @@ static sense_reason_t compare_and_write_
+       /*
+        * Handle early failure in transport_generic_request_failure(),
+-       * which will not have taken ->caw_mutex yet..
++       * which will not have taken ->caw_sem yet..
+        */
+-      if (!cmd->t_data_sg || !cmd->t_bidi_data_sg)
++      if (!success && (!cmd->t_data_sg || !cmd->t_bidi_data_sg))
+               return TCM_NO_SENSE;
+       /*
++       * Handle special case for zero-length COMPARE_AND_WRITE
++       */
++      if (!cmd->data_length)
++              goto out;
++      /*
+        * Immediately exit + release dev->caw_sem if command has already
+        * been failed with a non-zero SCSI status.
+        */
+--- a/drivers/target/target_core_transport.c
++++ b/drivers/target/target_core_transport.c
+@@ -1615,11 +1615,11 @@ void transport_generic_request_failure(s
+       transport_complete_task_attr(cmd);
+       /*
+        * Handle special case for COMPARE_AND_WRITE failure, where the
+-       * callback is expected to drop the per device ->caw_mutex.
++       * callback is expected to drop the per device ->caw_sem.
+        */
+       if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
+            cmd->transport_complete_callback)
+-              cmd->transport_complete_callback(cmd);
++              cmd->transport_complete_callback(cmd, false);
+       switch (sense_reason) {
+       case TCM_NON_EXISTENT_LUN:
+@@ -1975,8 +1975,12 @@ static void target_complete_ok_work(stru
+       if (cmd->transport_complete_callback) {
+               sense_reason_t rc;
+-              rc = cmd->transport_complete_callback(cmd);
++              rc = cmd->transport_complete_callback(cmd, true);
+               if (!rc && !(cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE_POST)) {
++                      if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
++                          !cmd->data_length)
++                              goto queue_rsp;
++
+                       return;
+               } else if (rc) {
+                       ret = transport_send_check_condition_and_sense(cmd,
+@@ -1990,6 +1994,7 @@ static void target_complete_ok_work(stru
+               }
+       }
++queue_rsp:
+       switch (cmd->data_direction) {
+       case DMA_FROM_DEVICE:
+               spin_lock(&cmd->se_lun->lun_sep_lock);
+@@ -2094,6 +2099,16 @@ static inline void transport_reset_sgl_o
+ static inline void transport_free_pages(struct se_cmd *cmd)
+ {
+       if (cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) {
++              /*
++               * Release special case READ buffer payload required for
++               * SG_TO_MEM_NOALLOC to function with COMPARE_AND_WRITE
++               */
++              if (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) {
++                      transport_free_sgl(cmd->t_bidi_data_sg,
++                                         cmd->t_bidi_data_nents);
++                      cmd->t_bidi_data_sg = NULL;
++                      cmd->t_bidi_data_nents = 0;
++              }
+               transport_reset_sgl_orig(cmd);
+               return;
+       }
+@@ -2246,6 +2261,7 @@ sense_reason_t
+ transport_generic_new_cmd(struct se_cmd *cmd)
+ {
+       int ret = 0;
++      bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB);
+       /*
+        * Determine is the TCM fabric module has already allocated physical
+@@ -2254,7 +2270,6 @@ transport_generic_new_cmd(struct se_cmd
+        */
+       if (!(cmd->se_cmd_flags & SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC) &&
+           cmd->data_length) {
+-              bool zero_flag = !(cmd->se_cmd_flags & SCF_SCSI_DATA_CDB);
+               if ((cmd->se_cmd_flags & SCF_BIDI) ||
+                   (cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE)) {
+@@ -2285,6 +2300,20 @@ transport_generic_new_cmd(struct se_cmd
+                                      cmd->data_length, zero_flag);
+               if (ret < 0)
+                       return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
++      } else if ((cmd->se_cmd_flags & SCF_COMPARE_AND_WRITE) &&
++                  cmd->data_length) {
++              /*
++               * Special case for COMPARE_AND_WRITE with fabrics
++               * using SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC.
++               */
++              u32 caw_length = cmd->t_task_nolb *
++                               cmd->se_dev->dev_attrib.block_size;
++
++              ret = target_alloc_sgl(&cmd->t_bidi_data_sg,
++                                     &cmd->t_bidi_data_nents,
++                                     caw_length, zero_flag);
++              if (ret < 0)
++                      return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
+       }
+       /*
+        * If this command is not a write we can execute it right here,
+--- a/include/target/target_core_base.h
++++ b/include/target/target_core_base.h
+@@ -524,7 +524,7 @@ struct se_cmd {
+       sense_reason_t          (*execute_cmd)(struct se_cmd *);
+       sense_reason_t          (*execute_rw)(struct se_cmd *, struct scatterlist *,
+                                             u32, enum dma_data_direction);
+-      sense_reason_t (*transport_complete_callback)(struct se_cmd *);
++      sense_reason_t (*transport_complete_callback)(struct se_cmd *, bool);
+       unsigned char           *t_task_cdb;
+       unsigned char           __t_task_cdb[TCM_MAX_COMMAND_SIZE];
diff --git a/queue-4.0/tools-lib-traceevent-kbuffer-remove-extra-update-to-data-pointer-in-padding.patch b/queue-4.0/tools-lib-traceevent-kbuffer-remove-extra-update-to-data-pointer-in-padding.patch
new file mode 100644 (file)
index 0000000..49fcbe8
--- /dev/null
@@ -0,0 +1,39 @@
+From c5e691928bf166ac03430e957038b60adba3cf6c Mon Sep 17 00:00:00 2001
+From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
+Date: Tue, 24 Mar 2015 09:57:55 -0400
+Subject: tools lib traceevent kbuffer: Remove extra update to data pointer in PADDING
+
+From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
+
+commit c5e691928bf166ac03430e957038b60adba3cf6c upstream.
+
+When a event PADDING is hit (a deleted event that is still in the ring
+buffer), translate_data() sets the length of the padding and also updates
+the data pointer which is passed back to the caller.
+
+This is unneeded because the caller also updates the data pointer with
+the passed back length. translate_data() should not update the pointer,
+only set the length.
+
+Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Link: http://lkml.kernel.org/r/20150324135923.461431960@goodmis.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/lib/traceevent/kbuffer-parse.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/tools/lib/traceevent/kbuffer-parse.c
++++ b/tools/lib/traceevent/kbuffer-parse.c
+@@ -372,7 +372,6 @@ translate_data(struct kbuffer *kbuf, voi
+       switch (type_len) {
+       case KBUFFER_TYPE_PADDING:
+               *length = read_4(kbuf, data);
+-              data += *length;
+               break;
+       case KBUFFER_TYPE_TIME_EXTEND:
diff --git a/queue-4.0/tools-power-turbostat-use-curdir-instead-of-pwd-and-add-support-for-o-option-in-makefile.patch b/queue-4.0/tools-power-turbostat-use-curdir-instead-of-pwd-and-add-support-for-o-option-in-makefile.patch
new file mode 100644 (file)
index 0000000..544ba2a
--- /dev/null
@@ -0,0 +1,55 @@
+From f82263c6989c31ae9b94cecddffb29dcbec38710 Mon Sep 17 00:00:00 2001
+From: Thomas D <whissi@whissi.de>
+Date: Mon, 5 Jan 2015 21:37:23 +0100
+Subject: tools/power turbostat: Use $(CURDIR) instead of $(PWD) and add support for O= option in Makefile
+
+From: Thomas D <whissi@whissi.de>
+
+commit f82263c6989c31ae9b94cecddffb29dcbec38710 upstream.
+
+Since commit ee0778a30153
+("tools/power: turbostat: make Makefile a bit more capable")
+turbostat's Makefile is using
+
+  [...]
+  BUILD_OUTPUT    := $(PWD)
+  [...]
+
+which obviously causes trouble when building "turbostat" with
+
+  make -C /usr/src/linux/tools/power/x86/turbostat ARCH=x86 turbostat
+
+because GNU make does not update nor guarantee that $PWD is set.
+
+This patch changes the Makefile to use $CURDIR instead, which GNU make
+guarantees to set and update (i.e. when using "make -C ...") and also
+adds support for the O= option (see "make help" in your root of your
+kernel source tree for more details).
+
+Link: https://bugs.gentoo.org/show_bug.cgi?id=533918
+Fixes: ee0778a30153 ("tools/power: turbostat: make Makefile a bit more capable")
+Signed-off-by: Thomas D. <whissi@whissi.de>
+Cc: Mark Asselstine <mark.asselstine@windriver.com>
+Signed-off-by: Len Brown <len.brown@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ tools/power/x86/turbostat/Makefile |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/tools/power/x86/turbostat/Makefile
++++ b/tools/power/x86/turbostat/Makefile
+@@ -1,8 +1,12 @@
+ CC            = $(CROSS_COMPILE)gcc
+-BUILD_OUTPUT  := $(PWD)
++BUILD_OUTPUT  := $(CURDIR)
+ PREFIX                := /usr
+ DESTDIR               :=
++ifeq ("$(origin O)", "command line")
++      BUILD_OUTPUT := $(O)
++endif
++
+ turbostat : turbostat.c
+ CFLAGS +=     -Wall
+ CFLAGS +=     -DMSRHEADER='"../../../../arch/x86/include/uapi/asm/msr-index.h"'
diff --git a/queue-4.0/tpm-fix-sanitized-code-paths-in-tpm_chip_register.patch b/queue-4.0/tpm-fix-sanitized-code-paths-in-tpm_chip_register.patch
new file mode 100644 (file)
index 0000000..25abcb3
--- /dev/null
@@ -0,0 +1,136 @@
+From 34d47b6322087665be33ca3aa81775b143a4d7ac Mon Sep 17 00:00:00 2001
+From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+Date: Wed, 18 Mar 2015 08:17:14 +0200
+Subject: tpm: fix: sanitized code paths in tpm_chip_register()
+
+From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+
+commit 34d47b6322087665be33ca3aa81775b143a4d7ac upstream.
+
+I started to work with PPI interface so that it would be available
+under character device sysfs directory and realized that chip
+registeration was still too messy.
+
+In TPM 1.x in some rare scenarios (errors that almost never occur)
+wrong order in deinitialization steps was taken in teardown. I
+reproduced these scenarios by manually inserting error codes in the
+place of the corresponding function calls.
+
+The key problem is that the teardown is messy with two separate code
+paths (this was inherited when moving code from tpm-interface.c).
+
+Moved TPM 1.x specific register/unregister functionality to own helper
+functions and added single code path for teardown in tpm_chip_register().
+Now the code paths have been fixed and it should be easier to review
+later on this part of the code.
+
+Fixes: 7a1d7e6dd76a ("tpm: TPM 2.0 baseline support")
+Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
+Tested-by: Scot Doyle <lkml14@scotdoyle.com>
+Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
+Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/char/tpm/tpm-chip.c |   66 ++++++++++++++++++++++++++++----------------
+ 1 file changed, 42 insertions(+), 24 deletions(-)
+
+--- a/drivers/char/tpm/tpm-chip.c
++++ b/drivers/char/tpm/tpm-chip.c
+@@ -170,6 +170,41 @@ static void tpm_dev_del_device(struct tp
+       device_unregister(&chip->dev);
+ }
++static int tpm1_chip_register(struct tpm_chip *chip)
++{
++      int rc;
++
++      if (chip->flags & TPM_CHIP_FLAG_TPM2)
++              return 0;
++
++      rc = tpm_sysfs_add_device(chip);
++      if (rc)
++              return rc;
++
++      rc = tpm_add_ppi(chip);
++      if (rc) {
++              tpm_sysfs_del_device(chip);
++              return rc;
++      }
++
++      chip->bios_dir = tpm_bios_log_setup(chip->devname);
++
++      return 0;
++}
++
++static void tpm1_chip_unregister(struct tpm_chip *chip)
++{
++      if (chip->flags & TPM_CHIP_FLAG_TPM2)
++              return;
++
++      if (chip->bios_dir)
++              tpm_bios_log_teardown(chip->bios_dir);
++
++      tpm_remove_ppi(chip);
++
++      tpm_sysfs_del_device(chip);
++}
++
+ /*
+  * tpm_chip_register() - create a character device for the TPM chip
+  * @chip: TPM chip to use.
+@@ -185,22 +220,13 @@ int tpm_chip_register(struct tpm_chip *c
+ {
+       int rc;
+-      /* Populate sysfs for TPM1 devices. */
+-      if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
+-              rc = tpm_sysfs_add_device(chip);
+-              if (rc)
+-                      goto del_misc;
+-
+-              rc = tpm_add_ppi(chip);
+-              if (rc)
+-                      goto del_sysfs;
+-
+-              chip->bios_dir = tpm_bios_log_setup(chip->devname);
+-      }
++      rc = tpm1_chip_register(chip);
++      if (rc)
++              return rc;
+       rc = tpm_dev_add_device(chip);
+       if (rc)
+-              return rc;
++              goto out_err;
+       /* Make the chip available. */
+       spin_lock(&driver_lock);
+@@ -210,10 +236,8 @@ int tpm_chip_register(struct tpm_chip *c
+       chip->flags |= TPM_CHIP_FLAG_REGISTERED;
+       return 0;
+-del_sysfs:
+-      tpm_sysfs_del_device(chip);
+-del_misc:
+-      tpm_dev_del_device(chip);
++out_err:
++      tpm1_chip_unregister(chip);
+       return rc;
+ }
+ EXPORT_SYMBOL_GPL(tpm_chip_register);
+@@ -238,13 +262,7 @@ void tpm_chip_unregister(struct tpm_chip
+       spin_unlock(&driver_lock);
+       synchronize_rcu();
+-      if (!(chip->flags & TPM_CHIP_FLAG_TPM2)) {
+-              if (chip->bios_dir)
+-                      tpm_bios_log_teardown(chip->bios_dir);
+-              tpm_remove_ppi(chip);
+-              tpm_sysfs_del_device(chip);
+-      }
+-
++      tpm1_chip_unregister(chip);
+       tpm_dev_del_device(chip);
+ }
+ EXPORT_SYMBOL_GPL(tpm_chip_unregister);
diff --git a/queue-4.0/ubi-account-for-bitflips-in-both-the-vid-header-and-data.patch b/queue-4.0/ubi-account-for-bitflips-in-both-the-vid-header-and-data.patch
new file mode 100644 (file)
index 0000000..a0375e0
--- /dev/null
@@ -0,0 +1,34 @@
+From 8eef7d70f7c6772c3490f410ee2bceab3b543fa1 Mon Sep 17 00:00:00 2001
+From: Brian Norris <computersforpeace@gmail.com>
+Date: Sat, 28 Feb 2015 02:23:25 -0800
+Subject: UBI: account for bitflips in both the VID header and data
+
+From: Brian Norris <computersforpeace@gmail.com>
+
+commit 8eef7d70f7c6772c3490f410ee2bceab3b543fa1 upstream.
+
+We are completely discarding the earlier value of 'bitflips', which
+could reflect a bitflip found in ubi_io_read_vid_hdr(). Let's use the
+bitwise OR of header and data 'bitflip' statuses instead.
+
+Coverity CID #1226856
+
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/ubi/attach.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mtd/ubi/attach.c
++++ b/drivers/mtd/ubi/attach.c
+@@ -410,7 +410,7 @@ int ubi_compare_lebs(struct ubi_device *
+               second_is_newer = !second_is_newer;
+       } else {
+               dbg_bld("PEB %d CRC is OK", pnum);
+-              bitflips = !!err;
++              bitflips |= !!err;
+       }
+       mutex_unlock(&ubi->buf_mutex);
diff --git a/queue-4.0/ubi-fix-check-for-too-many-bytes.patch b/queue-4.0/ubi-fix-check-for-too-many-bytes.patch
new file mode 100644 (file)
index 0000000..7175f0a
--- /dev/null
@@ -0,0 +1,35 @@
+From 299d0c5b27346a77a0777c993372bf8777d4f2e5 Mon Sep 17 00:00:00 2001
+From: Brian Norris <computersforpeace@gmail.com>
+Date: Sat, 28 Feb 2015 02:23:28 -0800
+Subject: UBI: fix check for "too many bytes"
+
+From: Brian Norris <computersforpeace@gmail.com>
+
+commit 299d0c5b27346a77a0777c993372bf8777d4f2e5 upstream.
+
+The comparison from the previous line seems to have been erroneously
+(partially) copied-and-pasted onto the next. The second line should be
+checking req.bytes, not req.lnum.
+
+Coverity CID #139400
+
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+[rw: Fixed comparison]
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/ubi/cdev.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mtd/ubi/cdev.c
++++ b/drivers/mtd/ubi/cdev.c
+@@ -455,7 +455,7 @@ static long vol_cdev_ioctl(struct file *
+               /* Validate the request */
+               err = -EINVAL;
+               if (req.lnum < 0 || req.lnum >= vol->reserved_pebs ||
+-                  req.bytes < 0 || req.lnum >= vol->usable_leb_size)
++                  req.bytes < 0 || req.bytes > vol->usable_leb_size)
+                       break;
+               err = get_exclusive(desc);
diff --git a/queue-4.0/ubi-fix-out-of-bounds-write.patch b/queue-4.0/ubi-fix-out-of-bounds-write.patch
new file mode 100644 (file)
index 0000000..7f990ab
--- /dev/null
@@ -0,0 +1,34 @@
+From d74adbdb9abf0d2506a6c4afa534d894f28b763f Mon Sep 17 00:00:00 2001
+From: Brian Norris <computersforpeace@gmail.com>
+Date: Sat, 28 Feb 2015 02:23:26 -0800
+Subject: UBI: fix out of bounds write
+
+From: Brian Norris <computersforpeace@gmail.com>
+
+commit d74adbdb9abf0d2506a6c4afa534d894f28b763f upstream.
+
+If aeb->len >= vol->reserved_pebs, we should not be writing aeb into the
+PEB->LEB mapping.
+
+Caught by Coverity, CID #711212.
+
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/ubi/eba.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/ubi/eba.c
++++ b/drivers/mtd/ubi/eba.c
+@@ -1419,7 +1419,8 @@ int ubi_eba_init(struct ubi_device *ubi,
+                                * during re-size.
+                                */
+                               ubi_move_aeb_to_list(av, aeb, &ai->erase);
+-                      vol->eba_tbl[aeb->lnum] = aeb->pnum;
++                      else
++                              vol->eba_tbl[aeb->lnum] = aeb->pnum;
+               }
+       }
diff --git a/queue-4.0/ubi-initialize-leb-number-variable.patch b/queue-4.0/ubi-initialize-leb-number-variable.patch
new file mode 100644 (file)
index 0000000..eaefce1
--- /dev/null
@@ -0,0 +1,38 @@
+From f16db8071ce18819fbd705ddcc91c6f392fb61f8 Mon Sep 17 00:00:00 2001
+From: Brian Norris <computersforpeace@gmail.com>
+Date: Sat, 28 Feb 2015 02:23:27 -0800
+Subject: UBI: initialize LEB number variable
+
+From: Brian Norris <computersforpeace@gmail.com>
+
+commit f16db8071ce18819fbd705ddcc91c6f392fb61f8 upstream.
+
+In some of the 'out_not_moved' error paths, lnum may be used
+uninitialized. Don't ignore the warning; let's fix it.
+
+This uninitialized variable doesn't have much visible effect in the end,
+since we just schedule the PEB for erasure, and its LEB number doesn't
+really matter (it just gets printed in debug messages). But let's get it
+straight anyway.
+
+Coverity CID #113449
+
+Signed-off-by: Brian Norris <computersforpeace@gmail.com>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/ubi/wl.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mtd/ubi/wl.c
++++ b/drivers/mtd/ubi/wl.c
+@@ -1002,7 +1002,7 @@ static int wear_leveling_worker(struct u
+                               int shutdown)
+ {
+       int err, scrubbing = 0, torture = 0, protect = 0, erroneous = 0;
+-      int vol_id = -1, uninitialized_var(lnum);
++      int vol_id = -1, lnum = -1;
+ #ifdef CONFIG_MTD_UBI_FASTMAP
+       int anchor = wrk->anchor;
+ #endif
diff --git a/queue-4.0/xtensa-iss-fix-locking-in-tap-network-adapter.patch b/queue-4.0/xtensa-iss-fix-locking-in-tap-network-adapter.patch
new file mode 100644 (file)
index 0000000..624a6da
--- /dev/null
@@ -0,0 +1,136 @@
+From 24e94454c8cb6a13634f5a2f5a01da53a546a58d Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Fri, 3 Apr 2015 09:56:21 +0300
+Subject: xtensa: ISS: fix locking in TAP network adapter
+
+From: Max Filippov <jcmvbkbc@gmail.com>
+
+commit 24e94454c8cb6a13634f5a2f5a01da53a546a58d upstream.
+
+- don't lock lp->lock in the iss_net_timer for the call of iss_net_poll,
+  it will lock it itself;
+- invert order of lp->lock and opened_lock acquisition in the
+  iss_net_open to make it consistent with iss_net_poll;
+- replace spin_lock with spin_lock_bh when acquiring locks used in
+  iss_net_timer from non-atomic context;
+- replace spin_lock_irqsave with spin_lock_bh in the iss_net_start_xmit
+  as the driver doesn't use lp->lock in the hard IRQ context;
+- replace __SPIN_LOCK_UNLOCKED(lp.lock) with spin_lock_init, otherwise
+  lockdep is unhappy about using non-static key.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/xtensa/platforms/iss/network.c |   29 +++++++++++++++--------------
+ 1 file changed, 15 insertions(+), 14 deletions(-)
+
+--- a/arch/xtensa/platforms/iss/network.c
++++ b/arch/xtensa/platforms/iss/network.c
+@@ -349,8 +349,8 @@ static void iss_net_timer(unsigned long
+ {
+       struct iss_net_private *lp = (struct iss_net_private *)priv;
+-      spin_lock(&lp->lock);
+       iss_net_poll();
++      spin_lock(&lp->lock);
+       mod_timer(&lp->timer, jiffies + lp->timer_val);
+       spin_unlock(&lp->lock);
+ }
+@@ -361,7 +361,7 @@ static int iss_net_open(struct net_devic
+       struct iss_net_private *lp = netdev_priv(dev);
+       int err;
+-      spin_lock(&lp->lock);
++      spin_lock_bh(&lp->lock);
+       err = lp->tp.open(lp);
+       if (err < 0)
+@@ -376,9 +376,11 @@ static int iss_net_open(struct net_devic
+       while ((err = iss_net_rx(dev)) > 0)
+               ;
+-      spin_lock(&opened_lock);
++      spin_unlock_bh(&lp->lock);
++      spin_lock_bh(&opened_lock);
+       list_add(&lp->opened_list, &opened);
+-      spin_unlock(&opened_lock);
++      spin_unlock_bh(&opened_lock);
++      spin_lock_bh(&lp->lock);
+       init_timer(&lp->timer);
+       lp->timer_val = ISS_NET_TIMER_VALUE;
+@@ -387,7 +389,7 @@ static int iss_net_open(struct net_devic
+       mod_timer(&lp->timer, jiffies + lp->timer_val);
+ out:
+-      spin_unlock(&lp->lock);
++      spin_unlock_bh(&lp->lock);
+       return err;
+ }
+@@ -395,7 +397,7 @@ static int iss_net_close(struct net_devi
+ {
+       struct iss_net_private *lp = netdev_priv(dev);
+       netif_stop_queue(dev);
+-      spin_lock(&lp->lock);
++      spin_lock_bh(&lp->lock);
+       spin_lock(&opened_lock);
+       list_del(&opened);
+@@ -405,18 +407,17 @@ static int iss_net_close(struct net_devi
+       lp->tp.close(lp);
+-      spin_unlock(&lp->lock);
++      spin_unlock_bh(&lp->lock);
+       return 0;
+ }
+ static int iss_net_start_xmit(struct sk_buff *skb, struct net_device *dev)
+ {
+       struct iss_net_private *lp = netdev_priv(dev);
+-      unsigned long flags;
+       int len;
+       netif_stop_queue(dev);
+-      spin_lock_irqsave(&lp->lock, flags);
++      spin_lock_bh(&lp->lock);
+       len = lp->tp.write(lp, &skb);
+@@ -438,7 +439,7 @@ static int iss_net_start_xmit(struct sk_
+               pr_err("%s: %s failed(%d)\n", dev->name, __func__, len);
+       }
+-      spin_unlock_irqrestore(&lp->lock, flags);
++      spin_unlock_bh(&lp->lock);
+       dev_kfree_skb(skb);
+       return NETDEV_TX_OK;
+@@ -466,9 +467,9 @@ static int iss_net_set_mac(struct net_de
+       if (!is_valid_ether_addr(hwaddr->sa_data))
+               return -EADDRNOTAVAIL;
+-      spin_lock(&lp->lock);
++      spin_lock_bh(&lp->lock);
+       memcpy(dev->dev_addr, hwaddr->sa_data, ETH_ALEN);
+-      spin_unlock(&lp->lock);
++      spin_unlock_bh(&lp->lock);
+       return 0;
+ }
+@@ -520,11 +521,11 @@ static int iss_net_configure(int index,
+       *lp = (struct iss_net_private) {
+               .device_list            = LIST_HEAD_INIT(lp->device_list),
+               .opened_list            = LIST_HEAD_INIT(lp->opened_list),
+-              .lock                   = __SPIN_LOCK_UNLOCKED(lp.lock),
+               .dev                    = dev,
+               .index                  = index,
+-              };
++      };
++      spin_lock_init(&lp->lock);
+       /*
+        * If this name ends up conflicting with an existing registered
+        * netdevice, that is OK, register_netdev{,ice}() will notice this
diff --git a/queue-4.0/xtensa-provide-__nr_sync_file_range2-instead-of-__nr_sync_file_range.patch b/queue-4.0/xtensa-provide-__nr_sync_file_range2-instead-of-__nr_sync_file_range.patch
new file mode 100644 (file)
index 0000000..1eae324
--- /dev/null
@@ -0,0 +1,35 @@
+From 01e84c70fe40c8111f960987bcf7f931842e6d07 Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Fri, 27 Feb 2015 11:02:38 +0300
+Subject: xtensa: provide __NR_sync_file_range2 instead of __NR_sync_file_range
+
+From: Max Filippov <jcmvbkbc@gmail.com>
+
+commit 01e84c70fe40c8111f960987bcf7f931842e6d07 upstream.
+
+xtensa actually uses sync_file_range2 implementation, so it should
+define __NR_sync_file_range2 as other architectures that use that
+function. That fixes userspace interface (that apparently never worked)
+and avoids special-casing xtensa in libc implementations.
+See the thread ending at
+http://lists.busybox.net/pipermail/uclibc/2015-February/048833.html
+for more details.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/xtensa/include/uapi/asm/unistd.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/xtensa/include/uapi/asm/unistd.h
++++ b/arch/xtensa/include/uapi/asm/unistd.h
+@@ -715,7 +715,7 @@ __SYSCALL(323, sys_process_vm_writev, 6)
+ __SYSCALL(324, sys_name_to_handle_at, 5)
+ #define __NR_open_by_handle_at                        325
+ __SYSCALL(325, sys_open_by_handle_at, 3)
+-#define __NR_sync_file_range                  326
++#define __NR_sync_file_range2                 326
+ __SYSCALL(326, sys_sync_file_range2, 6)
+ #define __NR_perf_event_open                  327
+ __SYSCALL(327, sys_perf_event_open, 5)
diff --git a/queue-4.0/xtensa-xtfpga-fix-hardware-lockup-caused-by-lcd-driver.patch b/queue-4.0/xtensa-xtfpga-fix-hardware-lockup-caused-by-lcd-driver.patch
new file mode 100644 (file)
index 0000000..de25457
--- /dev/null
@@ -0,0 +1,227 @@
+From 4949009eb8d40a441dcddcd96e101e77d31cf1b2 Mon Sep 17 00:00:00 2001
+From: Max Filippov <jcmvbkbc@gmail.com>
+Date: Fri, 27 Feb 2015 06:28:00 +0300
+Subject: xtensa: xtfpga: fix hardware lockup caused by LCD driver
+
+From: Max Filippov <jcmvbkbc@gmail.com>
+
+commit 4949009eb8d40a441dcddcd96e101e77d31cf1b2 upstream.
+
+LCD driver is always built for the XTFPGA platform, but its base address
+is not configurable, and is wrong for ML605/KC705. Its initialization
+locks up KC705 board hardware.
+
+Make the whole driver optional, and its base address and bus width
+configurable. Implement 4-bit bus access method.
+
+Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/xtensa/Kconfig                                      |   30 ++++++++
+ arch/xtensa/platforms/xtfpga/Makefile                    |    3 
+ arch/xtensa/platforms/xtfpga/include/platform/hardware.h |    3 
+ arch/xtensa/platforms/xtfpga/include/platform/lcd.h      |   15 ++++
+ arch/xtensa/platforms/xtfpga/lcd.c                       |   55 +++++++++------
+ 5 files changed, 81 insertions(+), 25 deletions(-)
+
+--- a/arch/xtensa/Kconfig
++++ b/arch/xtensa/Kconfig
+@@ -428,6 +428,36 @@ config DEFAULT_MEM_SIZE
+         If unsure, leave the default value here.
++config XTFPGA_LCD
++      bool "Enable XTFPGA LCD driver"
++      depends on XTENSA_PLATFORM_XTFPGA
++      default n
++      help
++        There's a 2x16 LCD on most of XTFPGA boards, kernel may output
++        progress messages there during bootup/shutdown. It may be useful
++        during board bringup.
++
++        If unsure, say N.
++
++config XTFPGA_LCD_BASE_ADDR
++      hex "XTFPGA LCD base address"
++      depends on XTFPGA_LCD
++      default "0x0d0c0000"
++      help
++        Base address of the LCD controller inside KIO region.
++        Different boards from XTFPGA family have LCD controller at different
++        addresses. Please consult prototyping user guide for your board for
++        the correct address. Wrong address here may lead to hardware lockup.
++
++config XTFPGA_LCD_8BIT_ACCESS
++      bool "Use 8-bit access to XTFPGA LCD"
++      depends on XTFPGA_LCD
++      default n
++      help
++        LCD may be connected with 4- or 8-bit interface, 8-bit access may
++        only be used with 8-bit interface. Please consult prototyping user
++        guide for your board for the correct interface width.
++
+ endmenu
+ menu "Executable file formats"
+--- a/arch/xtensa/platforms/xtfpga/Makefile
++++ b/arch/xtensa/platforms/xtfpga/Makefile
+@@ -6,4 +6,5 @@
+ #
+ # Note 2! The CFLAGS definitions are in the main makefile...
+-obj-y                 = setup.o lcd.o
++obj-y                 += setup.o
++obj-$(CONFIG_XTFPGA_LCD) += lcd.o
+--- a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
++++ b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h
+@@ -40,9 +40,6 @@
+ /* UART */
+ #define DUART16552_PADDR      (XCHAL_KIO_PADDR + 0x0D050020)
+-/* LCD instruction and data addresses. */
+-#define LCD_INSTR_ADDR                ((char *)IOADDR(0x0D040000))
+-#define LCD_DATA_ADDR         ((char *)IOADDR(0x0D040004))
+ /* Misc. */
+ #define XTFPGA_FPGAREGS_VADDR IOADDR(0x0D020000)
+--- a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
++++ b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h
+@@ -11,10 +11,25 @@
+ #ifndef __XTENSA_XTAVNET_LCD_H
+ #define __XTENSA_XTAVNET_LCD_H
++#ifdef CONFIG_XTFPGA_LCD
+ /* Display string STR at position POS on the LCD. */
+ void lcd_disp_at_pos(char *str, unsigned char pos);
+ /* Shift the contents of the LCD display left or right. */
+ void lcd_shiftleft(void);
+ void lcd_shiftright(void);
++#else
++static inline void lcd_disp_at_pos(char *str, unsigned char pos)
++{
++}
++
++static inline void lcd_shiftleft(void)
++{
++}
++
++static inline void lcd_shiftright(void)
++{
++}
++#endif
++
+ #endif
+--- a/arch/xtensa/platforms/xtfpga/lcd.c
++++ b/arch/xtensa/platforms/xtfpga/lcd.c
+@@ -1,50 +1,63 @@
+ /*
+- * Driver for the LCD display on the Tensilica LX60 Board.
++ * Driver for the LCD display on the Tensilica XTFPGA board family.
++ * http://www.mytechcorp.com/cfdata/productFile/File1/MOC-16216B-B-A0A04.pdf
+  *
+  * This file is subject to the terms and conditions of the GNU General Public
+  * License.  See the file "COPYING" in the main directory of this archive
+  * for more details.
+  *
+  * Copyright (C) 2001, 2006 Tensilica Inc.
++ * Copyright (C) 2015 Cadence Design Systems Inc.
+  */
+-/*
+- *
+- * FIXME: this code is from the examples from the LX60 user guide.
+- *
+- * The lcd_pause function does busy waiting, which is probably not
+- * great. Maybe the code could be changed to use kernel timers, or
+- * change the hardware to not need to wait.
+- */
+-
++#include <linux/delay.h>
+ #include <linux/init.h>
+ #include <linux/io.h>
+ #include <platform/hardware.h>
+ #include <platform/lcd.h>
+-#include <linux/delay.h>
+-#define LCD_PAUSE_ITERATIONS  4000
++/* LCD instruction and data addresses. */
++#define LCD_INSTR_ADDR                ((char *)IOADDR(CONFIG_XTFPGA_LCD_BASE_ADDR))
++#define LCD_DATA_ADDR         (LCD_INSTR_ADDR + 4)
++
+ #define LCD_CLEAR             0x1
+ #define LCD_DISPLAY_ON                0xc
+ /* 8bit and 2 lines display */
+ #define LCD_DISPLAY_MODE8BIT  0x38
++#define LCD_DISPLAY_MODE4BIT  0x28
+ #define LCD_DISPLAY_POS               0x80
+ #define LCD_SHIFT_LEFT                0x18
+ #define LCD_SHIFT_RIGHT               0x1c
++static void lcd_put_byte(u8 *addr, u8 data)
++{
++#ifdef CONFIG_XTFPGA_LCD_8BIT_ACCESS
++      ACCESS_ONCE(*addr) = data;
++#else
++      ACCESS_ONCE(*addr) = data & 0xf0;
++      ACCESS_ONCE(*addr) = (data << 4) & 0xf0;
++#endif
++}
++
+ static int __init lcd_init(void)
+ {
+-      *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
++      ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
+       mdelay(5);
+-      *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
++      ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
+       udelay(200);
+-      *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT;
++      ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT;
++      udelay(50);
++#ifndef CONFIG_XTFPGA_LCD_8BIT_ACCESS
++      ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE4BIT;
++      udelay(50);
++      lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_MODE4BIT);
+       udelay(50);
+-      *LCD_INSTR_ADDR = LCD_DISPLAY_ON;
++#endif
++      lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_ON);
+       udelay(50);
+-      *LCD_INSTR_ADDR = LCD_CLEAR;
++      lcd_put_byte(LCD_INSTR_ADDR, LCD_CLEAR);
+       mdelay(10);
+       lcd_disp_at_pos("XTENSA LINUX", 0);
+       return 0;
+@@ -52,10 +65,10 @@ static int __init lcd_init(void)
+ void lcd_disp_at_pos(char *str, unsigned char pos)
+ {
+-      *LCD_INSTR_ADDR = LCD_DISPLAY_POS | pos;
++      lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_POS | pos);
+       udelay(100);
+       while (*str != 0) {
+-              *LCD_DATA_ADDR = *str;
++              lcd_put_byte(LCD_DATA_ADDR, *str);
+               udelay(200);
+               str++;
+       }
+@@ -63,13 +76,13 @@ void lcd_disp_at_pos(char *str, unsigned
+ void lcd_shiftleft(void)
+ {
+-      *LCD_INSTR_ADDR = LCD_SHIFT_LEFT;
++      lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_LEFT);
+       udelay(50);
+ }
+ void lcd_shiftright(void)
+ {
+-      *LCD_INSTR_ADDR = LCD_SHIFT_RIGHT;
++      lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_RIGHT);
+       udelay(50);
+ }