]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Tue, 1 Oct 2019 17:13:38 +0000 (13:13 -0400)
committerSasha Levin <sashal@kernel.org>
Tue, 1 Oct 2019 17:13:38 +0000 (13:13 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
89 files changed:
queue-4.14/acpi-cppc-do-not-require-the-_psd-method.patch [new file with mode: 0644]
queue-4.14/acpi-custom_method-fix-memory-leaks.patch [new file with mode: 0644]
queue-4.14/acpi-pci-fix-acpi_pci_irq_enable-memory-leak.patch [new file with mode: 0644]
queue-4.14/acpi-processor-don-t-print-errors-for-processorids-0.patch [new file with mode: 0644]
queue-4.14/alsa-hda-drop-unsol-event-handler-for-intel-hdmi-cod.patch [new file with mode: 0644]
queue-4.14/alsa-hda-flush-interrupts-on-disabling.patch [new file with mode: 0644]
queue-4.14/alsa-hda-realtek-blacklist-pc-beep-for-lenovo-thinkc.patch [new file with mode: 0644]
queue-4.14/alsa-hda-show-the-fatal-corb-rirb-error-more-clearly.patch [new file with mode: 0644]
queue-4.14/alsa-i2c-ak4xxx-adda-fix-a-possible-null-pointer-der.patch [new file with mode: 0644]
queue-4.14/alsa-usb-audio-skip-bsynchaddress-endpoint-check-if-.patch [new file with mode: 0644]
queue-4.14/arm-dts-exynos-mark-ldo10-as-always-on-on-peach-pit-.patch [new file with mode: 0644]
queue-4.14/arm-dts-imx7d-cl-som-imx7-make-ethernet-work-again.patch [new file with mode: 0644]
queue-4.14/arm64-kpti-ensure-patched-kernel-text-is-fetched-fro.patch [new file with mode: 0644]
queue-4.14/asoc-dmaengine-make-the-pcm-name-equal-to-pcm-id-if-.patch [new file with mode: 0644]
queue-4.14/asoc-es8316-fix-headphone-mixer-volume-table.patch [new file with mode: 0644]
queue-4.14/asoc-rsnd-don-t-call-clk_get_rate-under-atomic-conte.patch [new file with mode: 0644]
queue-4.14/asoc-sgtl5000-fix-charge-pump-source-assignment.patch [new file with mode: 0644]
queue-4.14/base-soc-export-soc_device_register-unregister-apis.patch [new file with mode: 0644]
queue-4.14/btrfs-extent-tree-make-sure-we-only-allocate-extents.patch [new file with mode: 0644]
queue-4.14/dmaengine-bcm2835-print-error-in-case-setting-dma-ma.patch [new file with mode: 0644]
queue-4.14/dmaengine-iop-adma-use-correct-printk-format-strings.patch [new file with mode: 0644]
queue-4.14/dmaengine-ti-edma-do-not-reset-reserved-param-slots.patch [new file with mode: 0644]
queue-4.14/drm-amd-powerplay-smu7-enforce-minimal-vbitimeout-v2.patch [new file with mode: 0644]
queue-4.14/e1000e-add-workaround-for-possible-stalled-packet.patch [new file with mode: 0644]
queue-4.14/edac-altera-use-the-proper-type-for-the-irq-status-b.patch [new file with mode: 0644]
queue-4.14/edac-amd64-decode-syndrome-before-translating-addres.patch [new file with mode: 0644]
queue-4.14/edac-amd64-recognize-dram-device-type-ecc-capability.patch [new file with mode: 0644]
queue-4.14/edac-mc-fix-grain_bits-calculation.patch [new file with mode: 0644]
queue-4.14/edac-pnd2-fix-ioremap-size-in-dnv_rd_reg.patch [new file with mode: 0644]
queue-4.14/efi-cper-print-aer-info-of-pcie-fatal-error.patch [new file with mode: 0644]
queue-4.14/hwmon-acpi_power_meter-change-log-level-for-unsafe-s.patch [new file with mode: 0644]
queue-4.14/ia64-unwind-fix-double-free-for-mod-arch.init_unw_ta.patch [new file with mode: 0644]
queue-4.14/iommu-amd-silence-warnings-under-memory-pressure.patch [new file with mode: 0644]
queue-4.14/iommu-iova-avoid-false-sharing-on-fq_timer_on.patch [new file with mode: 0644]
queue-4.14/kprobes-prohibit-probing-on-bug-and-warn-address.patch [new file with mode: 0644]
queue-4.14/leds-leds-lp5562-allow-firmware-files-up-to-the-maxi.patch [new file with mode: 0644]
queue-4.14/libertas-add-missing-sentinel-at-end-of-if_usb.c-fw_.patch [new file with mode: 0644]
queue-4.14/libperf-fix-alignment-trap-with-xyarray-contents-in-.patch [new file with mode: 0644]
queue-4.14/libtraceevent-change-users-plugin-directory.patch [new file with mode: 0644]
queue-4.14/md-don-t-call-spare_active-in-md_reap_sync_thread-if.patch [new file with mode: 0644]
queue-4.14/md-don-t-set-in_sync-if-array-is-frozen.patch [new file with mode: 0644]
queue-4.14/md-raid1-end-bio-when-the-device-faulty.patch [new file with mode: 0644]
queue-4.14/md-raid1-fail-run-raid1-array-when-active-disk-less-.patch [new file with mode: 0644]
queue-4.14/media-cec-notifier-clear-cec_adap-in-cec_notifier_un.patch [new file with mode: 0644]
queue-4.14/media-cpia2_usb-fix-memory-leaks.patch [new file with mode: 0644]
queue-4.14/media-dib0700-fix-link-error-for-dibx000_i2c_set_spe.patch [new file with mode: 0644]
queue-4.14/media-dvb-core-fix-a-memory-leak-bug.patch [new file with mode: 0644]
queue-4.14/media-exynos4-is-fix-leaked-of_node-references.patch [new file with mode: 0644]
queue-4.14/media-fdp1-reduce-fcp-not-found-message-level-to-deb.patch [new file with mode: 0644]
queue-4.14/media-gspca-zero-usb_buf-on-error.patch [new file with mode: 0644]
queue-4.14/media-hdpvr-add-device-num-check-and-handling.patch [new file with mode: 0644]
queue-4.14/media-hdpvr-add-terminating-0-at-end-of-string.patch [new file with mode: 0644]
queue-4.14/media-i2c-ov5640-check-for-devm_gpiod_get_optional-e.patch [new file with mode: 0644]
queue-4.14/media-i2c-ov5645-fix-power-sequence.patch [new file with mode: 0644]
queue-4.14/media-iguanair-add-sanity-checks.patch [new file with mode: 0644]
queue-4.14/media-imx-mipi-csi-2-don-t-fail-if-initial-state-tim.patch [new file with mode: 0644]
queue-4.14/media-mtk-cir-lower-de-glitch-counter-for-rc-mm-prot.patch [new file with mode: 0644]
queue-4.14/media-mtk-mdp-fix-reference-count-on-old-device-tree.patch [new file with mode: 0644]
queue-4.14/media-omap3isp-don-t-set-streaming-state-on-random-s.patch [new file with mode: 0644]
queue-4.14/media-omap3isp-set-device-on-omap3isp-subdevs.patch [new file with mode: 0644]
queue-4.14/media-ov9650-add-a-sanity-check.patch [new file with mode: 0644]
queue-4.14/media-radio-si470x-kill-urb-on-error.patch [new file with mode: 0644]
queue-4.14/media-rc-imon-allow-imon-rc-protocol-for-ffdc-7e-dev.patch [new file with mode: 0644]
queue-4.14/media-saa7134-fix-terminology-around-saa7134_i2c_eep.patch [new file with mode: 0644]
queue-4.14/media-saa7146-add-cleanup-in-hexium_attach.patch [new file with mode: 0644]
queue-4.14/media-ttusb-dec-fix-info-leak-in-ttusb_dec_send_comm.patch [new file with mode: 0644]
queue-4.14/mmc-core-clarify-sdio_irq_pending-flag-for-mmc_cap2_.patch [new file with mode: 0644]
queue-4.14/mmc-sdhci-fix-incorrect-switch-to-hs-mode.patch [new file with mode: 0644]
queue-4.14/nbd-add-missing-config-put.patch [new file with mode: 0644]
queue-4.14/net-lpc-enet-fix-printk-format-strings.patch [new file with mode: 0644]
queue-4.14/nvmet-fix-data-units-read-and-written-counters-in-sm.patch [new file with mode: 0644]
queue-4.14/perf-ftrace-use-cap_sys_admin-instead-of-euid-0.patch [new file with mode: 0644]
queue-4.14/perf-record-support-aarch64-random-socket_id-assignm.patch [new file with mode: 0644]
queue-4.14/perf-test-vfs_getname-disable-.perfconfig-to-get-def.patch [new file with mode: 0644]
queue-4.14/perf-trace-beauty-ioctl-fix-off-by-one-error-in-cmd-.patch [new file with mode: 0644]
queue-4.14/pm-devfreq-exynos-bus-correct-clock-enable-sequence.patch [new file with mode: 0644]
queue-4.14/pm-devfreq-passive-fix-compiler-warning.patch [new file with mode: 0644]
queue-4.14/pm-devfreq-passive-use-non-devm-notifiers.patch [new file with mode: 0644]
queue-4.14/raid5-don-t-increment-read_errors-on-eilseq-return.patch [new file with mode: 0644]
queue-4.14/raid5-don-t-set-stripe_handle-to-stripe-which-is-in-.patch [new file with mode: 0644]
queue-4.14/ras-fix-prototype-warnings.patch [new file with mode: 0644]
queue-4.14/regulator-lm363x-fix-off-by-one-n_voltages-for-lm363.patch [new file with mode: 0644]
queue-4.14/s390-crypto-xts-aes-s390-fix-extra-run-time-crypto-s.patch [new file with mode: 0644]
queue-4.14/sched-core-fix-cpu-controller-for-rt_group_sched.patch [new file with mode: 0644]
queue-4.14/sched-fair-fix-imbalance-due-to-cpu-affinity.patch [new file with mode: 0644]
queue-4.14/sched-fair-use-rq_lock-unlock-in-online_fair_sched_g.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/x86-apic-soft-disable-apic-before-initializing-it.patch [new file with mode: 0644]
queue-4.14/x86-reboot-always-use-nmi-fallback-when-shutdown-via.patch [new file with mode: 0644]

diff --git a/queue-4.14/acpi-cppc-do-not-require-the-_psd-method.patch b/queue-4.14/acpi-cppc-do-not-require-the-_psd-method.patch
new file mode 100644 (file)
index 0000000..7f4e483
--- /dev/null
@@ -0,0 +1,55 @@
+From 9327eb06eb3c049360e0a26046baefd9b5d64b25 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 27 Aug 2019 18:21:20 -0600
+Subject: ACPI / CPPC: do not require the _PSD method
+
+From: Al Stone <ahs3@redhat.com>
+
+[ Upstream commit 4c4cdc4c63853fee48c02e25c8605fb65a6c9924 ]
+
+According to the ACPI 6.3 specification, the _PSD method is optional
+when using CPPC.  The underlying assumption is that each CPU can change
+frequency independently from all other CPUs; _PSD is provided to tell
+the OS that some processors can NOT do that.
+
+However, the acpi_get_psd() function returns ENODEV if there is no _PSD
+method present, or an ACPI error status if an error occurs when evaluating
+_PSD, if present.  This makes _PSD mandatory when using CPPC, in violation
+of the specification, and only on Linux.
+
+This has forced some firmware writers to provide a dummy _PSD, even though
+it is irrelevant, but only because Linux requires it; other OSPMs follow
+the spec.  We really do not want to have OS specific ACPI tables, though.
+
+So, correct acpi_get_psd() so that it does not return an error if there
+is no _PSD method present, but does return a failure when the method can
+not be executed properly.  This allows _PSD to be optional as it should
+be.
+
+Signed-off-by: Al Stone <ahs3@redhat.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/cppc_acpi.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
+index e5b47f032d9af..7bf1948b1223b 100644
+--- a/drivers/acpi/cppc_acpi.c
++++ b/drivers/acpi/cppc_acpi.c
+@@ -365,8 +365,10 @@ static int acpi_get_psd(struct cpc_desc *cpc_ptr, acpi_handle handle)
+       union acpi_object  *psd = NULL;
+       struct acpi_psd_package *pdomain;
+-      status = acpi_evaluate_object_typed(handle, "_PSD", NULL, &buffer,
+-                      ACPI_TYPE_PACKAGE);
++      status = acpi_evaluate_object_typed(handle, "_PSD", NULL,
++                                          &buffer, ACPI_TYPE_PACKAGE);
++      if (status == AE_NOT_FOUND)     /* _PSD is optional */
++              return 0;
+       if (ACPI_FAILURE(status))
+               return -ENODEV;
+-- 
+2.20.1
+
diff --git a/queue-4.14/acpi-custom_method-fix-memory-leaks.patch b/queue-4.14/acpi-custom_method-fix-memory-leaks.patch
new file mode 100644 (file)
index 0000000..52910d3
--- /dev/null
@@ -0,0 +1,48 @@
+From f2b799735a129c56ee5dfb9c3935ad52b3c5a37e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 16 Aug 2019 00:08:27 -0500
+Subject: ACPI: custom_method: fix memory leaks
+
+From: Wenwen Wang <wenwen@cs.uga.edu>
+
+[ Upstream commit 03d1571d9513369c17e6848476763ebbd10ec2cb ]
+
+In cm_write(), 'buf' is allocated through kzalloc(). In the following
+execution, if an error occurs, 'buf' is not deallocated, leading to memory
+leaks. To fix this issue, free 'buf' before returning the error.
+
+Fixes: 526b4af47f44 ("ACPI: Split out custom_method functionality into an own driver")
+Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/custom_method.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/acpi/custom_method.c b/drivers/acpi/custom_method.c
+index c68e72414a67a..435bd0ffc8c02 100644
+--- a/drivers/acpi/custom_method.c
++++ b/drivers/acpi/custom_method.c
+@@ -48,8 +48,10 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
+       if ((*ppos > max_size) ||
+           (*ppos + count > max_size) ||
+           (*ppos + count < count) ||
+-          (count > uncopied_bytes))
++          (count > uncopied_bytes)) {
++              kfree(buf);
+               return -EINVAL;
++      }
+       if (copy_from_user(buf + (*ppos), user_buf, count)) {
+               kfree(buf);
+@@ -69,6 +71,7 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf,
+               add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE);
+       }
++      kfree(buf);
+       return count;
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/acpi-pci-fix-acpi_pci_irq_enable-memory-leak.patch b/queue-4.14/acpi-pci-fix-acpi_pci_irq_enable-memory-leak.patch
new file mode 100644 (file)
index 0000000..0142044
--- /dev/null
@@ -0,0 +1,41 @@
+From 247fcbc4286fcef9bed3a00af7626b64a8711414 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 20 Aug 2019 22:44:19 -0500
+Subject: ACPI / PCI: fix acpi_pci_irq_enable() memory leak
+
+From: Wenwen Wang <wenwen@cs.uga.edu>
+
+[ Upstream commit 29b49958cf73b439b17fa29e9a25210809a6c01c ]
+
+In acpi_pci_irq_enable(), 'entry' is allocated by kzalloc() in
+acpi_pci_irq_check_entry() (invoked from acpi_pci_irq_lookup()). However,
+it is not deallocated if acpi_pci_irq_valid() returns false, leading to a
+memory leak. To fix this issue, free 'entry' before returning 0.
+
+Fixes: e237a5518425 ("x86/ACPI/PCI: Recognize that Interrupt Line 255 means "not connected"")
+Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/pci_irq.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
+index c576a6fe4ebb3..94ded9513c73b 100644
+--- a/drivers/acpi/pci_irq.c
++++ b/drivers/acpi/pci_irq.c
+@@ -462,8 +462,10 @@ int acpi_pci_irq_enable(struct pci_dev *dev)
+                * No IRQ known to the ACPI subsystem - maybe the BIOS /
+                * driver reported one, then use it. Exit in any case.
+                */
+-              if (!acpi_pci_irq_valid(dev, pin))
++              if (!acpi_pci_irq_valid(dev, pin)) {
++                      kfree(entry);
+                       return 0;
++              }
+               if (acpi_isa_register_gsi(dev))
+                       dev_warn(&dev->dev, "PCI INT %c: no GSI\n",
+-- 
+2.20.1
+
diff --git a/queue-4.14/acpi-processor-don-t-print-errors-for-processorids-0.patch b/queue-4.14/acpi-processor-don-t-print-errors-for-processorids-0.patch
new file mode 100644 (file)
index 0000000..93a07a0
--- /dev/null
@@ -0,0 +1,68 @@
+From 9eccfa96161ebaf0a515061c58f12ce46b02c81c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Aug 2019 13:10:37 +0200
+Subject: ACPI / processor: don't print errors for processorIDs == 0xff
+
+From: Jiri Slaby <jslaby@suse.cz>
+
+[ Upstream commit 2c2b005f549544c13ef4cfb0e4842949066889bc ]
+
+Some platforms define their processors in this manner:
+    Device (SCK0)
+    {
+       Name (_HID, "ACPI0004" /* Module Device */)  // _HID: Hardware ID
+       Name (_UID, "CPUSCK0")  // _UID: Unique ID
+       Processor (CP00, 0x00, 0x00000410, 0x06){}
+       Processor (CP01, 0x02, 0x00000410, 0x06){}
+       Processor (CP02, 0x04, 0x00000410, 0x06){}
+       Processor (CP03, 0x06, 0x00000410, 0x06){}
+       Processor (CP04, 0x01, 0x00000410, 0x06){}
+       Processor (CP05, 0x03, 0x00000410, 0x06){}
+       Processor (CP06, 0x05, 0x00000410, 0x06){}
+       Processor (CP07, 0x07, 0x00000410, 0x06){}
+       Processor (CP08, 0xFF, 0x00000410, 0x06){}
+       Processor (CP09, 0xFF, 0x00000410, 0x06){}
+       Processor (CP0A, 0xFF, 0x00000410, 0x06){}
+       Processor (CP0B, 0xFF, 0x00000410, 0x06){}
+...
+
+The processors marked as 0xff are invalid, there are only 8 of them in
+this case.
+
+So do not print an error on ids == 0xff, just print an info message.
+Actually, we could return ENODEV even on the first CPU with ID 0xff, but
+ACPI spec does not forbid the 0xff value to be a processor ID. Given
+0xff could be a correct one, we would break working systems if we
+returned ENODEV.
+
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/acpi_processor.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
+index ccf07674a2a09..f81c434ce4c59 100644
+--- a/drivers/acpi/acpi_processor.c
++++ b/drivers/acpi/acpi_processor.c
+@@ -281,9 +281,13 @@ static int acpi_processor_get_info(struct acpi_device *device)
+       }
+       if (acpi_duplicate_processor_id(pr->acpi_id)) {
+-              dev_err(&device->dev,
+-                      "Failed to get unique processor _UID (0x%x)\n",
+-                      pr->acpi_id);
++              if (pr->acpi_id == 0xff)
++                      dev_info_once(&device->dev,
++                              "Entry not well-defined, consider updating BIOS\n");
++              else
++                      dev_err(&device->dev,
++                              "Failed to get unique processor _UID (0x%x)\n",
++                              pr->acpi_id);
+               return -ENODEV;
+       }
+-- 
+2.20.1
+
diff --git a/queue-4.14/alsa-hda-drop-unsol-event-handler-for-intel-hdmi-cod.patch b/queue-4.14/alsa-hda-drop-unsol-event-handler-for-intel-hdmi-cod.patch
new file mode 100644 (file)
index 0000000..6c30cbb
--- /dev/null
@@ -0,0 +1,50 @@
+From cabc779a393a11bf466ba5d27604d70923d278c5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 13 Aug 2019 17:11:28 +0200
+Subject: ALSA: hda - Drop unsol event handler for Intel HDMI codecs
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit f2dbe87c5ac1f88e6007ba1f1374f4bd8a197fb6 ]
+
+We don't need to deal with the unsol events for Intel chips that are
+tied with the graphics via audio component notifier.  Although the
+presence of the audio component is checked at the beginning of
+hdmi_unsol_event(), better to short cut by dropping unsol_event ops.
+
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204565
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_hdmi.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
+index f5803f9bba9bb..f214055972150 100644
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -2555,13 +2555,20 @@ static void i915_pin_cvt_fixup(struct hda_codec *codec,
+ /* precondition and allocation for Intel codecs */
+ static int alloc_intel_hdmi(struct hda_codec *codec)
+ {
++      int err;
++
+       /* requires i915 binding */
+       if (!codec->bus->core.audio_component) {
+               codec_info(codec, "No i915 binding for Intel HDMI/DP codec\n");
+               return -ENODEV;
+       }
+-      return alloc_generic_hdmi(codec);
++      err = alloc_generic_hdmi(codec);
++      if (err < 0)
++              return err;
++      /* no need to handle unsol events */
++      codec->patch_ops.unsol_event = NULL;
++      return 0;
+ }
+ /* parse and post-process for Intel codecs */
+-- 
+2.20.1
+
diff --git a/queue-4.14/alsa-hda-flush-interrupts-on-disabling.patch b/queue-4.14/alsa-hda-flush-interrupts-on-disabling.patch
new file mode 100644 (file)
index 0000000..9888083
--- /dev/null
@@ -0,0 +1,77 @@
+From 290e8a281e78d28da0da6408ee6771d2e2303627 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 20 Jul 2019 12:33:37 +0100
+Subject: ALSA: hda: Flush interrupts on disabling
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+[ Upstream commit caa8422d01e983782548648e125fd617cadcec3f ]
+
+I was looking at
+
+<4> [241.835158] general protection fault: 0000 [#1] PREEMPT SMP PTI
+<4> [241.835181] CPU: 1 PID: 214 Comm: kworker/1:3 Tainted: G     U            5.2.0-CI-CI_DRM_6509+ #1
+<4> [241.835199] Hardware name: Dell Inc.                 OptiPlex 745                 /0GW726, BIOS 2.3.1  05/21/2007
+<4> [241.835234] Workqueue: events snd_hdac_bus_process_unsol_events [snd_hda_core]
+<4> [241.835256] RIP: 0010:input_handle_event+0x16d/0x5e0
+<4> [241.835270] Code: 48 8b 93 58 01 00 00 8b 52 08 89 50 04 8b 83 f8 06 00 00 48 8b 93 00 07 00 00 8d 70 01 48 8d 04 c2 83 e1 08 89 b3 f8 06 00 00 <66> 89 28 66 44 89 60 02 44 89 68 04 8b 93 f8 06 00 00 0f 84 fd fe
+<4> [241.835304] RSP: 0018:ffffc9000019fda0 EFLAGS: 00010046
+<4> [241.835317] RAX: 6b6b6b6ec6c6c6c3 RBX: ffff8880290fefc8 RCX: 0000000000000000
+<4> [241.835332] RDX: 000000006b6b6b6b RSI: 000000006b6b6b6c RDI: 0000000000000046
+<4> [241.835347] RBP: 0000000000000005 R08: 0000000000000000 R09: 0000000000000001
+<4> [241.835362] R10: ffffc9000019faa0 R11: 0000000000000000 R12: 0000000000000004
+<4> [241.835377] R13: 0000000000000000 R14: ffff8880290ff1d0 R15: 0000000000000293
+<4> [241.835392] FS:  0000000000000000(0000) GS:ffff88803de80000(0000) knlGS:0000000000000000
+<4> [241.835409] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+<4> [241.835422] CR2: 00007ffe9a99e9b7 CR3: 000000002f588000 CR4: 00000000000006e0
+<4> [241.835436] Call Trace:
+<4> [241.835449]  input_event+0x45/0x70
+<4> [241.835464]  snd_jack_report+0xdc/0x100
+<4> [241.835490]  snd_hda_jack_report_sync+0x83/0xc0 [snd_hda_codec]
+<4> [241.835512]  snd_hdac_bus_process_unsol_events+0x5a/0x70 [snd_hda_core]
+<4> [241.835530]  process_one_work+0x245/0x610
+
+which has the hallmarks of a worker queued from interrupt after it was
+supposedly cancelled (note the POISON_FREE), and I could not see where
+the interrupt would be flushed on shutdown so added the likely suspects.
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111174
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/hda/hdac_controller.c | 2 ++
+ sound/pci/hda/hda_intel.c   | 2 +-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/sound/hda/hdac_controller.c b/sound/hda/hdac_controller.c
+index 778b42ba90b80..3377f0bc28280 100644
+--- a/sound/hda/hdac_controller.c
++++ b/sound/hda/hdac_controller.c
+@@ -442,6 +442,8 @@ static void azx_int_disable(struct hdac_bus *bus)
+       list_for_each_entry(azx_dev, &bus->stream_list, list)
+               snd_hdac_stream_updateb(azx_dev, SD_CTL, SD_INT_MASK, 0);
++      synchronize_irq(bus->irq);
++
+       /* disable SIE for all streams */
+       snd_hdac_chip_writeb(bus, INTCTL, 0);
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
+index 96e9b3944b925..b42ab80ee6078 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -1413,9 +1413,9 @@ static int azx_free(struct azx *chip)
+       }
+       if (bus->chip_init) {
++              azx_stop_chip(chip);
+               azx_clear_irq_pending(chip);
+               azx_stop_all_streams(chip);
+-              azx_stop_chip(chip);
+       }
+       if (bus->irq >= 0)
+-- 
+2.20.1
+
diff --git a/queue-4.14/alsa-hda-realtek-blacklist-pc-beep-for-lenovo-thinkc.patch b/queue-4.14/alsa-hda-realtek-blacklist-pc-beep-for-lenovo-thinkc.patch
new file mode 100644 (file)
index 0000000..2968c8e
--- /dev/null
@@ -0,0 +1,37 @@
+From 42b439b68c2aef1ad253d18dbe6bbe577ab041f4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Aug 2019 09:58:07 +0200
+Subject: ALSA: hda/realtek - Blacklist PC beep for Lenovo ThinkCentre M73/93
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 051c78af14fcd74a22b5af45548ad9d588247cc7 ]
+
+Lenovo ThinkCentre M73 and M93 don't seem to have a proper beep
+although the driver tries to probe and set up blindly.
+Blacklist these machines for suppressing the beep creation.
+
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204635
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_realtek.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 6deb96a301d3d..4f35ac2606708 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -977,6 +977,9 @@ static const struct snd_pci_quirk beep_white_list[] = {
+       SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
+       SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
+       SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
++      /* blacklist -- no beep available */
++      SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
++      SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
+       {}
+ };
+-- 
+2.20.1
+
diff --git a/queue-4.14/alsa-hda-show-the-fatal-corb-rirb-error-more-clearly.patch b/queue-4.14/alsa-hda-show-the-fatal-corb-rirb-error-more-clearly.patch
new file mode 100644 (file)
index 0000000..a855382
--- /dev/null
@@ -0,0 +1,44 @@
+From 552cf4165a6f956066bdb6b4dc845f0339b8ad64 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 26 Jul 2019 11:42:34 +0200
+Subject: ALSA: hda - Show the fatal CORB/RIRB error more clearly
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit dd65f7e19c6961ba6a69f7c925021b7a270cb950 ]
+
+The last fallback of CORB/RIRB communication error recovery is to turn
+on the single command mode, and this last resort usually means that
+something is really screwed up.  Instead of a normal dev_err(), show
+the error more clearly with dev_WARN() with the caller stack trace.
+
+Also, show the bus-reset fallback also as an error, too.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/hda_controller.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
+index a41c1bec7c88c..8fcb421193e02 100644
+--- a/sound/pci/hda/hda_controller.c
++++ b/sound/pci/hda/hda_controller.c
+@@ -877,10 +877,13 @@ static int azx_rirb_get_response(struct hdac_bus *bus, unsigned int addr,
+        */
+       if (hbus->allow_bus_reset && !hbus->response_reset && !hbus->in_reset) {
+               hbus->response_reset = 1;
++              dev_err(chip->card->dev,
++                      "No response from codec, resetting bus: last cmd=0x%08x\n",
++                      bus->last_cmd[addr]);
+               return -EAGAIN; /* give a chance to retry */
+       }
+-      dev_err(chip->card->dev,
++      dev_WARN(chip->card->dev,
+               "azx_get_response timeout, switching to single_cmd mode: last cmd=0x%08x\n",
+               bus->last_cmd[addr]);
+       chip->single_cmd = 1;
+-- 
+2.20.1
+
diff --git a/queue-4.14/alsa-i2c-ak4xxx-adda-fix-a-possible-null-pointer-der.patch b/queue-4.14/alsa-i2c-ak4xxx-adda-fix-a-possible-null-pointer-der.patch
new file mode 100644 (file)
index 0000000..6ea8c43
--- /dev/null
@@ -0,0 +1,55 @@
+From 4c55e3f9766cc5135fd122b59c8cb3915ca5f778 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 26 Jul 2019 10:14:42 +0800
+Subject: ALSA: i2c: ak4xxx-adda: Fix a possible null pointer dereference in
+ build_adc_controls()
+
+From: Jia-Ju Bai <baijiaju1990@gmail.com>
+
+[ Upstream commit 2127c01b7f63b06a21559f56a8c81a3c6535bd1a ]
+
+In build_adc_controls(), there is an if statement on line 773 to check
+whether ak->adc_info is NULL:
+    if (! ak->adc_info ||
+        ! ak->adc_info[mixer_ch].switch_name)
+
+When ak->adc_info is NULL, it is used on line 792:
+    knew.name = ak->adc_info[mixer_ch].selector_name;
+
+Thus, a possible null-pointer dereference may occur.
+
+To fix this bug, referring to lines 773 and 774, ak->adc_info
+and ak->adc_info[mixer_ch].selector_name are checked before being used.
+
+This bug is found by a static analysis tool STCheck written by us.
+
+Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/i2c/other/ak4xxx-adda.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c
+index bf377dc192aa7..d33e02c317129 100644
+--- a/sound/i2c/other/ak4xxx-adda.c
++++ b/sound/i2c/other/ak4xxx-adda.c
+@@ -789,11 +789,12 @@ static int build_adc_controls(struct snd_akm4xxx *ak)
+                               return err;
+                       memset(&knew, 0, sizeof(knew));
+-                      knew.name = ak->adc_info[mixer_ch].selector_name;
+-                      if (!knew.name) {
++                      if (!ak->adc_info ||
++                              !ak->adc_info[mixer_ch].selector_name) {
+                               knew.name = "Capture Channel";
+                               knew.index = mixer_ch + ak->idx_offset * 2;
+-                      }
++                      } else
++                              knew.name = ak->adc_info[mixer_ch].selector_name;
+                       knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+                       knew.info = ak4xxx_capture_source_info;
+-- 
+2.20.1
+
diff --git a/queue-4.14/alsa-usb-audio-skip-bsynchaddress-endpoint-check-if-.patch b/queue-4.14/alsa-usb-audio-skip-bsynchaddress-endpoint-check-if-.patch
new file mode 100644 (file)
index 0000000..1e21362
--- /dev/null
@@ -0,0 +1,39 @@
+From 003f0cdfe47a3f428a09e2b455083244c650ff10 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 2 Aug 2019 13:52:14 +0200
+Subject: ALSA: usb-audio: Skip bSynchAddress endpoint check if it is invalid
+
+From: Ard van Breemen <ard@kwaak.net>
+
+[ Upstream commit 1b34121d9f26d272b0b2334209af6b6fc82d4bf1 ]
+
+The Linux kernel assumes that get_endpoint(alts,0) and
+get_endpoint(alts,1) are eachothers feedback endpoints.
+To reassure that validity it will test bsynchaddress to comply with that
+assumption. But if the bsyncaddress is 0 (invalid), it will flag that as
+a wrong assumption and return an error.
+Fix: Skip the test if bSynchAddress is 0.
+Note: those with a valid bSynchAddress should have a code quirck added.
+
+Signed-off-by: Ard van Breemen <ard@kwaak.net>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/usb/pcm.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
+index b1a1eb1f65aa3..ff38fca1781b6 100644
+--- a/sound/usb/pcm.c
++++ b/sound/usb/pcm.c
+@@ -470,6 +470,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs,
+       }
+       ep = get_endpoint(alts, 1)->bEndpointAddress;
+       if (get_endpoint(alts, 0)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
++          get_endpoint(alts, 0)->bSynchAddress != 0 &&
+           ((is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress | USB_DIR_IN)) ||
+            (!is_playback && ep != (unsigned int)(get_endpoint(alts, 0)->bSynchAddress & ~USB_DIR_IN)))) {
+               dev_err(&dev->dev,
+-- 
+2.20.1
+
diff --git a/queue-4.14/arm-dts-exynos-mark-ldo10-as-always-on-on-peach-pit-.patch b/queue-4.14/arm-dts-exynos-mark-ldo10-as-always-on-on-peach-pit-.patch
new file mode 100644 (file)
index 0000000..bdfcd52
--- /dev/null
@@ -0,0 +1,60 @@
+From f3555e690078fdc839a43164e9098fec82c709f7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 30 Aug 2019 14:52:42 +0200
+Subject: ARM: dts: exynos: Mark LDO10 as always-on on Peach Pit/Pi Chromebooks
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+[ Upstream commit 5b0eeeaa37615df37a9a30929b73e9defe61ca84 ]
+
+Commit aff138bf8e37 ("ARM: dts: exynos: Add TMU nodes regulator supply
+for Peach boards") assigned LDO10 to Exynos Thermal Measurement Unit,
+but it turned out that it supplies also some other critical parts and
+board freezes/crashes when it is turned off.
+
+The mentioned commit made Exynos TMU a consumer of that regulator and in
+typical case Exynos TMU driver keeps it enabled from early boot. However
+there are such configurations (example is multi_v7_defconfig), in which
+some of the regulators are compiled as modules and are not available
+from early boot. In such case it may happen that LDO10 is turned off by
+regulator core, because it has no consumers yet (in this case consumer
+drivers cannot get it, because the supply regulators for it are not yet
+available). This in turn causes the board to crash. This patch restores
+'always-on' property for the LDO10 regulator.
+
+Fixes: aff138bf8e37 ("ARM: dts: exynos: Add TMU nodes regulator supply for Peach boards")
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/exynos5420-peach-pit.dts | 1 +
+ arch/arm/boot/dts/exynos5800-peach-pi.dts  | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts b/arch/arm/boot/dts/exynos5420-peach-pit.dts
+index c91eff8475a87..7ccee2cfe4812 100644
+--- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
++++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts
+@@ -426,6 +426,7 @@
+                               regulator-name = "vdd_ldo10";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
++                              regulator-always-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
+index daad5d425cf5c..0900b38f60b4f 100644
+--- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
++++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
+@@ -426,6 +426,7 @@
+                               regulator-name = "vdd_ldo10";
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <1800000>;
++                              regulator-always-on;
+                               regulator-state-mem {
+                                       regulator-off-in-suspend;
+                               };
+-- 
+2.20.1
+
diff --git a/queue-4.14/arm-dts-imx7d-cl-som-imx7-make-ethernet-work-again.patch b/queue-4.14/arm-dts-imx7d-cl-som-imx7-make-ethernet-work-again.patch
new file mode 100644 (file)
index 0000000..18ede49
--- /dev/null
@@ -0,0 +1,79 @@
+From 3320cea1a4cbd56964821f89e382c623c9f417f7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Aug 2019 04:12:27 +0100
+Subject: ARM: dts: imx7d: cl-som-imx7: make ethernet work again
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: André Draszik <git@andred.net>
+
+[ Upstream commit 9846a4524ac90b63496580b7ad50674b40d92a8f ]
+
+Recent changes to the atheros at803x driver caused
+ethernet to stop working on this board.
+In particular commit 6d4cd041f0af
+("net: phy: at803x: disable delay only for RGMII mode")
+and commit cd28d1d6e52e
+("net: phy: at803x: Disable phy delay for RGMII mode")
+fix the AR8031 driver to configure the phy's (RX/TX)
+delays as per the 'phy-mode' in the device tree.
+
+This now prevents ethernet from working on this board.
+
+It used to work before those commits, because the
+AR8031 comes out of reset with RX delay enabled, and
+the at803x driver didn't touch the delay configuration
+at all when "rgmii" mode was selected, and because
+arch/arm/mach-imx/mach-imx7d.c:ar8031_phy_fixup()
+unconditionally enables TX delay.
+
+Since above commits ar8031_phy_fixup() also has no
+effect anymore, and the end-result is that all delays
+are disabled in the phy, no ethernet.
+
+Update the device tree to restore functionality.
+
+Signed-off-by: André Draszik <git@andred.net>
+CC: Ilya Ledvich <ilya@compulab.co.il>
+CC: Igor Grinberg <grinberg@compulab.co.il>
+CC: Rob Herring <robh+dt@kernel.org>
+CC: Mark Rutland <mark.rutland@arm.com>
+CC: Shawn Guo <shawnguo@kernel.org>
+CC: Sascha Hauer <s.hauer@pengutronix.de>
+CC: Pengutronix Kernel Team <kernel@pengutronix.de>
+CC: Fabio Estevam <festevam@gmail.com>
+CC: NXP Linux Team <linux-imx@nxp.com>
+CC: devicetree@vger.kernel.org
+CC: linux-arm-kernel@lists.infradead.org
+Signed-off-by: Shawn Guo <shawnguo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/imx7d-cl-som-imx7.dts | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/boot/dts/imx7d-cl-som-imx7.dts b/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
+index 3cc1fb9ce4418..60a28281d3d16 100644
+--- a/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
++++ b/arch/arm/boot/dts/imx7d-cl-som-imx7.dts
+@@ -43,7 +43,7 @@
+                         <&clks IMX7D_ENET1_TIME_ROOT_CLK>;
+       assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
+       assigned-clock-rates = <0>, <100000000>;
+-      phy-mode = "rgmii";
++      phy-mode = "rgmii-id";
+       phy-handle = <&ethphy0>;
+       fsl,magic-packet;
+       status = "okay";
+@@ -69,7 +69,7 @@
+                         <&clks IMX7D_ENET2_TIME_ROOT_CLK>;
+       assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>;
+       assigned-clock-rates = <0>, <100000000>;
+-      phy-mode = "rgmii";
++      phy-mode = "rgmii-id";
+       phy-handle = <&ethphy1>;
+       fsl,magic-packet;
+       status = "okay";
+-- 
+2.20.1
+
diff --git a/queue-4.14/arm64-kpti-ensure-patched-kernel-text-is-fetched-fro.patch b/queue-4.14/arm64-kpti-ensure-patched-kernel-text-is-fetched-fro.patch
new file mode 100644 (file)
index 0000000..ccd63c6
--- /dev/null
@@ -0,0 +1,61 @@
+From cdfdf3c75e64677d1093fd66520a2d3acb57c3cc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 27 Aug 2019 18:12:57 +0100
+Subject: arm64: kpti: ensure patched kernel text is fetched from PoU
+
+From: Mark Rutland <mark.rutland@arm.com>
+
+[ Upstream commit f32c7a8e45105bd0af76872bf6eef0438ff12fb2 ]
+
+While the MMUs is disabled, I-cache speculation can result in
+instructions being fetched from the PoC. During boot we may patch
+instructions (e.g. for alternatives and jump labels), and these may be
+dirty at the PoU (and stale at the PoC).
+
+Thus, while the MMU is disabled in the KPTI pagetable fixup code we may
+load stale instructions into the I-cache, potentially leading to
+subsequent crashes when executing regions of code which have been
+modified at runtime.
+
+Similarly to commit:
+
+  8ec41987436d566f ("arm64: mm: ensure patched kernel text is fetched from PoU")
+
+... we can invalidate the I-cache after enabling the MMU to prevent such
+issues.
+
+The KPTI pagetable fixup code itself should be clean to the PoC per the
+boot protocol, so no maintenance is required for this code.
+
+Signed-off-by: Mark Rutland <mark.rutland@arm.com>
+Cc: Catalin Marinas <catalin.marinas@arm.com>
+Reviewed-by: James Morse <james.morse@arm.com>
+Signed-off-by: Will Deacon <will@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/mm/proc.S | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
+index 034a3a2a38ee8..65b0401521846 100644
+--- a/arch/arm64/mm/proc.S
++++ b/arch/arm64/mm/proc.S
+@@ -280,6 +280,15 @@ skip_pgd:
+       msr     sctlr_el1, x18
+       isb
++      /*
++       * Invalidate the local I-cache so that any instructions fetched
++       * speculatively from the PoC are discarded, since they may have
++       * been dynamically patched at the PoU.
++       */
++      ic      iallu
++      dsb     nsh
++      isb
++
+       /* Set the flag to zero to indicate that we're all done */
+       str     wzr, [flag_ptr]
+       ret
+-- 
+2.20.1
+
diff --git a/queue-4.14/asoc-dmaengine-make-the-pcm-name-equal-to-pcm-id-if-.patch b/queue-4.14/asoc-dmaengine-make-the-pcm-name-equal-to-pcm-id-if-.patch
new file mode 100644 (file)
index 0000000..8ba55d5
--- /dev/null
@@ -0,0 +1,47 @@
+From 7a6b57f13b06e9f8df6923cc0246d774abdaf900 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 Sep 2019 08:55:24 +0300
+Subject: ASoC: dmaengine: Make the pcm->name equal to pcm->id if the name is
+ not set
+
+From: Peter Ujfalusi <peter.ujfalusi@ti.com>
+
+[ Upstream commit 2ec42f3147e1610716f184b02e65d7f493eed925 ]
+
+Some tools use the snd_pcm_info_get_name() to try to identify PCMs or for
+other purposes.
+
+Currently it is left empty with the dmaengine-pcm, in this case copy the
+pcm->id string as pcm->name.
+
+For example IGT is using this to find the HDMI PCM for testing audio on it.
+
+Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
+Reported-by: Arthur She <arthur.she@linaro.org>
+Link: https://lore.kernel.org/r/20190906055524.7393-1-peter.ujfalusi@ti.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/soc-generic-dmaengine-pcm.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
+index d53786498b612..052778c6afad6 100644
+--- a/sound/soc/soc-generic-dmaengine-pcm.c
++++ b/sound/soc/soc-generic-dmaengine-pcm.c
+@@ -311,6 +311,12 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
+               if (!dmaengine_pcm_can_report_residue(dev, pcm->chan[i]))
+                       pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;
++
++              if (rtd->pcm->streams[i].pcm->name[0] == '\0') {
++                      strncpy(rtd->pcm->streams[i].pcm->name,
++                              rtd->pcm->streams[i].pcm->id,
++                              sizeof(rtd->pcm->streams[i].pcm->name));
++              }
+       }
+       return 0;
+-- 
+2.20.1
+
diff --git a/queue-4.14/asoc-es8316-fix-headphone-mixer-volume-table.patch b/queue-4.14/asoc-es8316-fix-headphone-mixer-volume-table.patch
new file mode 100644 (file)
index 0000000..cadcabd
--- /dev/null
@@ -0,0 +1,60 @@
+From 84d58cedb7324ffbe953a5f7f901bd17aa71e9a5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 27 Aug 2019 00:38:59 +0900
+Subject: ASoC: es8316: fix headphone mixer volume table
+
+From: Katsuhiro Suzuki <katsuhiro@katsuster.net>
+
+[ Upstream commit f972d02fee2496024cfd6f59021c9d89d54922a6 ]
+
+This patch fix setting table of Headphone mixer volume.
+Current code uses 4 ... 7 values but these values are prohibited.
+
+Correct settings are the following:
+  0000 -12dB
+  0001 -10.5dB
+  0010 -9dB
+  0011 -7.5dB
+  0100 -6dB
+  1000 -4.5dB
+  1001 -3dB
+  1010 -1.5dB
+  1011 0dB
+
+Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
+Reviewed-by: Daniel Drake <drake@endlessm.com>
+Link: https://lore.kernel.org/r/20190826153900.25969-1-katsuhiro@katsuster.net
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/es8316.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
+index da2d353af5ba2..949dbdc0445e4 100644
+--- a/sound/soc/codecs/es8316.c
++++ b/sound/soc/codecs/es8316.c
+@@ -46,7 +46,10 @@ static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(adc_vol_tlv, -9600, 50, 1);
+ static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_max_gain_tlv, -650, 150, 0);
+ static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_min_gain_tlv, -1200, 150, 0);
+ static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_target_tlv, -1650, 150, 0);
+-static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(hpmixer_gain_tlv, -1200, 150, 0);
++static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(hpmixer_gain_tlv,
++      0, 4, TLV_DB_SCALE_ITEM(-1200, 150, 0),
++      8, 11, TLV_DB_SCALE_ITEM(-450, 150, 0),
++);
+ static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(adc_pga_gain_tlv,
+       0, 0, TLV_DB_SCALE_ITEM(-350, 0, 0),
+@@ -84,7 +87,7 @@ static const struct snd_kcontrol_new es8316_snd_controls[] = {
+       SOC_DOUBLE_TLV("Headphone Playback Volume", ES8316_CPHP_ICAL_VOL,
+                      4, 0, 3, 1, hpout_vol_tlv),
+       SOC_DOUBLE_TLV("Headphone Mixer Volume", ES8316_HPMIX_VOL,
+-                     0, 4, 7, 0, hpmixer_gain_tlv),
++                     0, 4, 11, 0, hpmixer_gain_tlv),
+       SOC_ENUM("Playback Polarity", dacpol),
+       SOC_DOUBLE_R_TLV("DAC Playback Volume", ES8316_DAC_VOLL,
+-- 
+2.20.1
+
diff --git a/queue-4.14/asoc-rsnd-don-t-call-clk_get_rate-under-atomic-conte.patch b/queue-4.14/asoc-rsnd-don-t-call-clk_get_rate-under-atomic-conte.patch
new file mode 100644 (file)
index 0000000..dee78bd
--- /dev/null
@@ -0,0 +1,89 @@
+From 3d8a212d230657d3b7872b5ecfda4044f6a2c6d4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 6 Aug 2019 12:45:38 +0900
+Subject: ASoC: rsnd: don't call clk_get_rate() under atomic context
+
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+
+[ Upstream commit 06e8f5c842f2dbb232897ba967ea7b422745c271 ]
+
+ADG is using clk_get_rate() under atomic context, thus, we might
+have scheduling issue.
+To avoid this issue, we need to get/keep clk rate under
+non atomic context.
+
+We need to handle ADG as special device at Renesas Sound driver.
+From SW point of view, we want to impletent it as
+rsnd_mod_ops :: prepare, but it makes code just complicate.
+
+To avoid complicated code/patch, this patch adds new clk_rate[] array,
+and keep clk IN rate when rsnd_adg_clk_enable() was called.
+
+Reported-by: Leon Kong <Leon.KONG@cn.bosch.com>
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Tested-by: Leon Kong <Leon.KONG@cn.bosch.com>
+Link: https://lore.kernel.org/r/87v9vb0xkp.wl-kuninori.morimoto.gx@renesas.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/sh/rcar/adg.c | 21 +++++++++++++++------
+ 1 file changed, 15 insertions(+), 6 deletions(-)
+
+diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
+index eb7879bcc6a79..686401bcd1f53 100644
+--- a/sound/soc/sh/rcar/adg.c
++++ b/sound/soc/sh/rcar/adg.c
+@@ -33,6 +33,7 @@ struct rsnd_adg {
+       struct clk *clkout[CLKOUTMAX];
+       struct clk_onecell_data onecell;
+       struct rsnd_mod mod;
++      int clk_rate[CLKMAX];
+       u32 flags;
+       u32 ckr;
+       u32 rbga;
+@@ -110,9 +111,9 @@ static void __rsnd_adg_get_timesel_ratio(struct rsnd_priv *priv,
+       unsigned int val, en;
+       unsigned int min, diff;
+       unsigned int sel_rate[] = {
+-              clk_get_rate(adg->clk[CLKA]),   /* 0000: CLKA */
+-              clk_get_rate(adg->clk[CLKB]),   /* 0001: CLKB */
+-              clk_get_rate(adg->clk[CLKC]),   /* 0010: CLKC */
++              adg->clk_rate[CLKA],    /* 0000: CLKA */
++              adg->clk_rate[CLKB],    /* 0001: CLKB */
++              adg->clk_rate[CLKC],    /* 0010: CLKC */
+               adg->rbga_rate_for_441khz,      /* 0011: RBGA */
+               adg->rbgb_rate_for_48khz,       /* 0100: RBGB */
+       };
+@@ -328,7 +329,7 @@ int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigned int rate)
+        * AUDIO_CLKA/AUDIO_CLKB/AUDIO_CLKC/AUDIO_CLKI.
+        */
+       for_each_rsnd_clk(clk, adg, i) {
+-              if (rate == clk_get_rate(clk))
++              if (rate == adg->clk_rate[i])
+                       return sel_table[i];
+       }
+@@ -394,10 +395,18 @@ void rsnd_adg_clk_control(struct rsnd_priv *priv, int enable)
+       for_each_rsnd_clk(clk, adg, i) {
+               ret = 0;
+-              if (enable)
++              if (enable) {
+                       ret = clk_prepare_enable(clk);
+-              else
++
++                      /*
++                       * We shouldn't use clk_get_rate() under
++                       * atomic context. Let's keep it when
++                       * rsnd_adg_clk_enable() was called
++                       */
++                      adg->clk_rate[i] = clk_get_rate(adg->clk[i]);
++              } else {
+                       clk_disable_unprepare(clk);
++              }
+               if (ret < 0)
+                       dev_warn(dev, "can't use clk %d\n", i);
+-- 
+2.20.1
+
diff --git a/queue-4.14/asoc-sgtl5000-fix-charge-pump-source-assignment.patch b/queue-4.14/asoc-sgtl5000-fix-charge-pump-source-assignment.patch
new file mode 100644 (file)
index 0000000..89344ed
--- /dev/null
@@ -0,0 +1,55 @@
+From 0d2bc92ac2a7493f4d72499cb1d87a48847a9893 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 19 Jul 2019 10:05:37 +0000
+Subject: ASoC: sgtl5000: Fix charge pump source assignment
+
+From: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
+
+[ Upstream commit b6319b061ba279577fd7030a9848fbd6a17151e3 ]
+
+If VDDA != VDDIO and any of them is greater than 3.1V, charge pump
+source can be assigned automatically [1].
+
+[1] https://www.nxp.com/docs/en/data-sheet/SGTL5000.pdf
+
+Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
+Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
+Reviewed-by: Igor Opaniuk <igor.opaniuk@toradex.com>
+Reviewed-by: Fabio Estevam <festevam@gmail.com>
+Link: https://lore.kernel.org/r/20190719100524.23300-7-oleksandr.suvorov@toradex.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/sgtl5000.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
+index 0b11a2e01b2fc..b649675d190d2 100644
+--- a/sound/soc/codecs/sgtl5000.c
++++ b/sound/soc/codecs/sgtl5000.c
+@@ -1084,12 +1084,17 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
+                                       SGTL5000_INT_OSC_EN);
+               /* Enable VDDC charge pump */
+               ana_pwr |= SGTL5000_VDDC_CHRGPMP_POWERUP;
+-      } else if (vddio >= 3100 && vdda >= 3100) {
++      } else {
+               ana_pwr &= ~SGTL5000_VDDC_CHRGPMP_POWERUP;
+-              /* VDDC use VDDIO rail */
+-              lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD;
+-              lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO <<
+-                          SGTL5000_VDDC_MAN_ASSN_SHIFT;
++              /*
++               * if vddio == vdda the source of charge pump should be
++               * assigned manually to VDDIO
++               */
++              if (vddio == vdda) {
++                      lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD;
++                      lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO <<
++                                  SGTL5000_VDDC_MAN_ASSN_SHIFT;
++              }
+       }
+       snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL, lreg_ctrl);
+-- 
+2.20.1
+
diff --git a/queue-4.14/base-soc-export-soc_device_register-unregister-apis.patch b/queue-4.14/base-soc-export-soc_device_register-unregister-apis.patch
new file mode 100644 (file)
index 0000000..94e865c
--- /dev/null
@@ -0,0 +1,47 @@
+From 297de61ff72ff145a69798292d2bfc5b239c9d39 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 24 Jul 2019 04:05:12 +0530
+Subject: base: soc: Export soc_device_register/unregister APIs
+
+From: Vinod Koul <vkoul@kernel.org>
+
+[ Upstream commit f7ccc7a397cf2ef64aebb2f726970b93203858d2 ]
+
+Qcom Socinfo driver can be built as a module, so
+export these two APIs.
+
+Tested-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Vaishali Thakkar <vaishali.thakkar@linaro.org>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Reviewed-by: Stephen Boyd <swboyd@chromium.org>
+Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/base/soc.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/base/soc.c b/drivers/base/soc.c
+index 909dedae4c4e1..1242b2d2e01a2 100644
+--- a/drivers/base/soc.c
++++ b/drivers/base/soc.c
+@@ -155,6 +155,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
+ out1:
+       return ERR_PTR(ret);
+ }
++EXPORT_SYMBOL_GPL(soc_device_register);
+ /* Ensure soc_dev->attr is freed prior to calling soc_device_unregister. */
+ void soc_device_unregister(struct soc_device *soc_dev)
+@@ -164,6 +165,7 @@ void soc_device_unregister(struct soc_device *soc_dev)
+       device_unregister(&soc_dev->dev);
+       early_soc_dev_attr = NULL;
+ }
++EXPORT_SYMBOL_GPL(soc_device_unregister);
+ static int __init soc_bus_register(void)
+ {
+-- 
+2.20.1
+
diff --git a/queue-4.14/btrfs-extent-tree-make-sure-we-only-allocate-extents.patch b/queue-4.14/btrfs-extent-tree-make-sure-we-only-allocate-extents.patch
new file mode 100644 (file)
index 0000000..8376dc7
--- /dev/null
@@ -0,0 +1,115 @@
+From f0b7f07a200518a9d0b3b7126ca8f13c2ae05f82 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 16 Jul 2019 17:00:33 +0800
+Subject: btrfs: extent-tree: Make sure we only allocate extents from block
+ groups with the same type
+
+From: Qu Wenruo <wqu@suse.com>
+
+[ Upstream commit 2a28468e525f3924efed7f29f2bc5a2926e7e19a ]
+
+[BUG]
+With fuzzed image and MIXED_GROUPS super flag, we can hit the following
+BUG_ON():
+
+  kernel BUG at fs/btrfs/delayed-ref.c:491!
+  invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
+  CPU: 0 PID: 1849 Comm: sync Tainted: G           O      5.2.0-custom #27
+  RIP: 0010:update_existing_head_ref.cold+0x44/0x46 [btrfs]
+  Call Trace:
+   add_delayed_ref_head+0x20c/0x2d0 [btrfs]
+   btrfs_add_delayed_tree_ref+0x1fc/0x490 [btrfs]
+   btrfs_free_tree_block+0x123/0x380 [btrfs]
+   __btrfs_cow_block+0x435/0x500 [btrfs]
+   btrfs_cow_block+0x110/0x240 [btrfs]
+   btrfs_search_slot+0x230/0xa00 [btrfs]
+   ? __lock_acquire+0x105e/0x1e20
+   btrfs_insert_empty_items+0x67/0xc0 [btrfs]
+   alloc_reserved_file_extent+0x9e/0x340 [btrfs]
+   __btrfs_run_delayed_refs+0x78e/0x1240 [btrfs]
+   ? kvm_clock_read+0x18/0x30
+   ? __sched_clock_gtod_offset+0x21/0x50
+   btrfs_run_delayed_refs.part.0+0x4e/0x180 [btrfs]
+   btrfs_run_delayed_refs+0x23/0x30 [btrfs]
+   btrfs_commit_transaction+0x53/0x9f0 [btrfs]
+   btrfs_sync_fs+0x7c/0x1c0 [btrfs]
+   ? __ia32_sys_fdatasync+0x20/0x20
+   sync_fs_one_sb+0x23/0x30
+   iterate_supers+0x95/0x100
+   ksys_sync+0x62/0xb0
+   __ia32_sys_sync+0xe/0x20
+   do_syscall_64+0x65/0x240
+   entry_SYSCALL_64_after_hwframe+0x49/0xbe
+
+[CAUSE]
+This situation is caused by several factors:
+- Fuzzed image
+  The extent tree of this fs missed one backref for extent tree root.
+  So we can allocated space from that slot.
+
+- MIXED_BG feature
+  Super block has MIXED_BG flag.
+
+- No mixed block groups exists
+  All block groups are just regular ones.
+
+This makes data space_info->block_groups[] contains metadata block
+groups.  And when we reserve space for data, we can use space in
+metadata block group.
+
+Then we hit the following file operations:
+
+- fallocate
+  We need to allocate data extents.
+  find_free_extent() choose to use the metadata block to allocate space
+  from, and choose the space of extent tree root, since its backref is
+  missing.
+
+  This generate one delayed ref head with is_data = 1.
+
+- extent tree update
+  We need to update extent tree at run_delayed_ref time.
+
+  This generate one delayed ref head with is_data = 0, for the same
+  bytenr of old extent tree root.
+
+Then we trigger the BUG_ON().
+
+[FIX]
+The quick fix here is to check block_group->flags before using it.
+
+The problem can only happen for MIXED_GROUPS fs. Regular filesystems
+won't have space_info with DATA|METADATA flag, and no way to hit the
+bug.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203255
+Reported-by: Jungyeon Yoon <jungyeon.yoon@gmail.com>
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/extent-tree.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
+index 49766721b2b14..10dee82455581 100644
+--- a/fs/btrfs/extent-tree.c
++++ b/fs/btrfs/extent-tree.c
+@@ -7706,6 +7706,14 @@ static noinline int find_free_extent(struct btrfs_fs_info *fs_info,
+                        */
+                       if ((flags & extra) && !(block_group->flags & extra))
+                               goto loop;
++
++                      /*
++                       * This block group has different flags than we want.
++                       * It's possible that we have MIXED_GROUP flag but no
++                       * block group is mixed.  Just skip such block group.
++                       */
++                      btrfs_release_block_group(block_group, delalloc);
++                      continue;
+               }
+ have_block_group:
+-- 
+2.20.1
+
diff --git a/queue-4.14/dmaengine-bcm2835-print-error-in-case-setting-dma-ma.patch b/queue-4.14/dmaengine-bcm2835-print-error-in-case-setting-dma-ma.patch
new file mode 100644 (file)
index 0000000..2c63583
--- /dev/null
@@ -0,0 +1,39 @@
+From d0dbc951aa853f83b8135cc53706abe57b1740b3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 16 Jul 2019 19:15:18 +0200
+Subject: dmaengine: bcm2835: Print error in case setting DMA mask fails
+
+From: Stefan Wahren <wahrenst@gmx.net>
+
+[ Upstream commit 72503b25ee363827aafffc3e8d872e6a92a7e422 ]
+
+During enabling of the RPi 4, we found out that the driver doesn't provide
+a helpful error message in case setting DMA mask fails. So add one.
+
+Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
+Link: https://lore.kernel.org/r/1563297318-4900-1-git-send-email-wahrenst@gmx.net
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/bcm2835-dma.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
+index 6ba53bbd0e161..b984d00bc0558 100644
+--- a/drivers/dma/bcm2835-dma.c
++++ b/drivers/dma/bcm2835-dma.c
+@@ -891,8 +891,10 @@ static int bcm2835_dma_probe(struct platform_device *pdev)
+               pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
+       rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+-      if (rc)
++      if (rc) {
++              dev_err(&pdev->dev, "Unable to set DMA mask\n");
+               return rc;
++      }
+       od = devm_kzalloc(&pdev->dev, sizeof(*od), GFP_KERNEL);
+       if (!od)
+-- 
+2.20.1
+
diff --git a/queue-4.14/dmaengine-iop-adma-use-correct-printk-format-strings.patch b/queue-4.14/dmaengine-iop-adma-use-correct-printk-format-strings.patch
new file mode 100644 (file)
index 0000000..04b2ae1
--- /dev/null
@@ -0,0 +1,108 @@
+From 1b2b59a7f3d410de19d62b2e718f2ae93507421a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Aug 2019 18:33:17 +0200
+Subject: dmaengine: iop-adma: use correct printk format strings
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 00c9755524fbaa28117be774d7c92fddb5ca02f3 ]
+
+When compile-testing on other architectures, we get lots of warnings
+about incorrect format strings, like:
+
+   drivers/dma/iop-adma.c: In function 'iop_adma_alloc_slots':
+   drivers/dma/iop-adma.c:307:6: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]
+
+   drivers/dma/iop-adma.c: In function 'iop_adma_prep_dma_memcpy':
+>> drivers/dma/iop-adma.c:518:40: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'size_t {aka long unsigned int}' [-Wformat=]
+
+Use %zu for printing size_t as required, and cast the dma_addr_t
+arguments to 'u64' for printing with %llx. Ideally this should use
+the %pad format string, but that requires an lvalue argument that
+doesn't work here.
+
+Link: https://lore.kernel.org/r/20190809163334.489360-3-arnd@arndb.de
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/iop-adma.c | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
+index a410657f7bcd6..012584cf3c17b 100644
+--- a/drivers/dma/iop-adma.c
++++ b/drivers/dma/iop-adma.c
+@@ -125,9 +125,9 @@ static void __iop_adma_slot_cleanup(struct iop_adma_chan *iop_chan)
+       list_for_each_entry_safe(iter, _iter, &iop_chan->chain,
+                                       chain_node) {
+               pr_debug("\tcookie: %d slot: %d busy: %d "
+-                      "this_desc: %#x next_desc: %#x ack: %d\n",
++                      "this_desc: %#x next_desc: %#llx ack: %d\n",
+                       iter->async_tx.cookie, iter->idx, busy,
+-                      iter->async_tx.phys, iop_desc_get_next_desc(iter),
++                      iter->async_tx.phys, (u64)iop_desc_get_next_desc(iter),
+                       async_tx_test_ack(&iter->async_tx));
+               prefetch(_iter);
+               prefetch(&_iter->async_tx);
+@@ -315,9 +315,9 @@ iop_adma_alloc_slots(struct iop_adma_chan *iop_chan, int num_slots,
+                               int i;
+                               dev_dbg(iop_chan->device->common.dev,
+                                       "allocated slot: %d "
+-                                      "(desc %p phys: %#x) slots_per_op %d\n",
++                                      "(desc %p phys: %#llx) slots_per_op %d\n",
+                                       iter->idx, iter->hw_desc,
+-                                      iter->async_tx.phys, slots_per_op);
++                                      (u64)iter->async_tx.phys, slots_per_op);
+                               /* pre-ack all but the last descriptor */
+                               if (num_slots != slots_per_op)
+@@ -525,7 +525,7 @@ iop_adma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dma_dest,
+               return NULL;
+       BUG_ON(len > IOP_ADMA_MAX_BYTE_COUNT);
+-      dev_dbg(iop_chan->device->common.dev, "%s len: %u\n",
++      dev_dbg(iop_chan->device->common.dev, "%s len: %zu\n",
+               __func__, len);
+       spin_lock_bh(&iop_chan->lock);
+@@ -558,7 +558,7 @@ iop_adma_prep_dma_xor(struct dma_chan *chan, dma_addr_t dma_dest,
+       BUG_ON(len > IOP_ADMA_XOR_MAX_BYTE_COUNT);
+       dev_dbg(iop_chan->device->common.dev,
+-              "%s src_cnt: %d len: %u flags: %lx\n",
++              "%s src_cnt: %d len: %zu flags: %lx\n",
+               __func__, src_cnt, len, flags);
+       spin_lock_bh(&iop_chan->lock);
+@@ -591,7 +591,7 @@ iop_adma_prep_dma_xor_val(struct dma_chan *chan, dma_addr_t *dma_src,
+       if (unlikely(!len))
+               return NULL;
+-      dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n",
++      dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %zu\n",
+               __func__, src_cnt, len);
+       spin_lock_bh(&iop_chan->lock);
+@@ -629,7 +629,7 @@ iop_adma_prep_dma_pq(struct dma_chan *chan, dma_addr_t *dst, dma_addr_t *src,
+       BUG_ON(len > IOP_ADMA_XOR_MAX_BYTE_COUNT);
+       dev_dbg(iop_chan->device->common.dev,
+-              "%s src_cnt: %d len: %u flags: %lx\n",
++              "%s src_cnt: %d len: %zu flags: %lx\n",
+               __func__, src_cnt, len, flags);
+       if (dmaf_p_disabled_continue(flags))
+@@ -692,7 +692,7 @@ iop_adma_prep_dma_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
+               return NULL;
+       BUG_ON(len > IOP_ADMA_XOR_MAX_BYTE_COUNT);
+-      dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %u\n",
++      dev_dbg(iop_chan->device->common.dev, "%s src_cnt: %d len: %zu\n",
+               __func__, src_cnt, len);
+       spin_lock_bh(&iop_chan->lock);
+-- 
+2.20.1
+
diff --git a/queue-4.14/dmaengine-ti-edma-do-not-reset-reserved-param-slots.patch b/queue-4.14/dmaengine-ti-edma-do-not-reset-reserved-param-slots.patch
new file mode 100644 (file)
index 0000000..e1c0c50
--- /dev/null
@@ -0,0 +1,50 @@
+From 896154239dc1f5230c03a28e36590b10bbc853dd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 23 Aug 2019 15:56:14 +0300
+Subject: dmaengine: ti: edma: Do not reset reserved paRAM slots
+
+From: Peter Ujfalusi <peter.ujfalusi@ti.com>
+
+[ Upstream commit c5dbe60664b3660f5ac5854e21273ea2e7ff698f ]
+
+Skip resetting paRAM slots marked as reserved as they might be used by
+other cores.
+
+Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
+Link: https://lore.kernel.org/r/20190823125618.8133-2-peter.ujfalusi@ti.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/edma.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
+index a7ea20e7b8e94..519c24465dea4 100644
+--- a/drivers/dma/edma.c
++++ b/drivers/dma/edma.c
+@@ -2268,9 +2268,6 @@ static int edma_probe(struct platform_device *pdev)
+       ecc->default_queue = info->default_queue;
+-      for (i = 0; i < ecc->num_slots; i++)
+-              edma_write_slot(ecc, i, &dummy_paramset);
+-
+       if (info->rsv) {
+               /* Set the reserved slots in inuse list */
+               rsv_slots = info->rsv->rsv_slots;
+@@ -2283,6 +2280,12 @@ static int edma_probe(struct platform_device *pdev)
+               }
+       }
++      for (i = 0; i < ecc->num_slots; i++) {
++              /* Reset only unused - not reserved - paRAM slots */
++              if (!test_bit(i, ecc->slot_inuse))
++                      edma_write_slot(ecc, i, &dummy_paramset);
++      }
++
+       /* Clear the xbar mapped channels in unused list */
+       xbar_chans = info->xbar_chans;
+       if (xbar_chans) {
+-- 
+2.20.1
+
diff --git a/queue-4.14/drm-amd-powerplay-smu7-enforce-minimal-vbitimeout-v2.patch b/queue-4.14/drm-amd-powerplay-smu7-enforce-minimal-vbitimeout-v2.patch
new file mode 100644 (file)
index 0000000..dbf1a65
--- /dev/null
@@ -0,0 +1,41 @@
+From 5fd96da9e03bce535cd3fcb8b2b1a8351acc3f7b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 5 Aug 2019 21:14:18 +0200
+Subject: drm/amd/powerplay/smu7: enforce minimal VBITimeout (v2)
+
+From: Ahzo <Ahzo@tutanota.com>
+
+[ Upstream commit f659bb6dae58c113805f92822e4c16ddd3156b79 ]
+
+This fixes screen corruption/flickering on 75 Hz displays.
+
+v2: make print statement debug only (Alex)
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102646
+Reviewed-by: Evan Quan <evan.quan@amd.com>
+Signed-off-by: Ahzo <Ahzo@tutanota.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+index 336fdd8c7db08..61141bc3edfe9 100644
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+@@ -3972,6 +3972,11 @@ static int smu7_program_display_gap(struct pp_hwmgr *hwmgr)
+       data->frame_time_x2 = frame_time_in_us * 2 / 100;
++      if (data->frame_time_x2 < 280) {
++              pr_debug("%s: enforce minimal VBITimeout: %d -> 280\n", __func__, data->frame_time_x2);
++              data->frame_time_x2 = 280;
++      }
++
+       display_gap2 = pre_vbi_time_in_us * (ref_clock / 100);
+       cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixCG_DISPLAY_GAP_CNTL2, display_gap2);
+-- 
+2.20.1
+
diff --git a/queue-4.14/e1000e-add-workaround-for-possible-stalled-packet.patch b/queue-4.14/e1000e-add-workaround-for-possible-stalled-packet.patch
new file mode 100644 (file)
index 0000000..39a16b2
--- /dev/null
@@ -0,0 +1,61 @@
+From 01f0f5068965488556dca221086972732d3d2fb6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 8 Jul 2019 12:55:45 +0800
+Subject: e1000e: add workaround for possible stalled packet
+
+From: Kai-Heng Feng <kai.heng.feng@canonical.com>
+
+[ Upstream commit e5e9a2ecfe780975820e157b922edee715710b66 ]
+
+This works around a possible stalled packet issue, which may occur due to
+clock recovery from the PCH being too slow, when the LAN is transitioning
+from K1 at 1G link speed.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=204057
+
+Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
+Tested-by: Aaron Brown <aaron.f.brown@intel.com>
+Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/intel/e1000e/ich8lan.c | 10 ++++++++++
+ drivers/net/ethernet/intel/e1000e/ich8lan.h |  2 +-
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
+index 00eedf202e62d..1e990f9dd3794 100644
+--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
+@@ -1447,6 +1447,16 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)
+                       else
+                               phy_reg |= 0xFA;
+                       e1e_wphy_locked(hw, I217_PLL_CLOCK_GATE_REG, phy_reg);
++
++                      if (speed == SPEED_1000) {
++                              hw->phy.ops.read_reg_locked(hw, HV_PM_CTRL,
++                                                          &phy_reg);
++
++                              phy_reg |= HV_PM_CTRL_K1_CLK_REQ;
++
++                              hw->phy.ops.write_reg_locked(hw, HV_PM_CTRL,
++                                                           phy_reg);
++                      }
+               }
+               hw->phy.ops.release(hw);
+diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h
+index 00a36df02a3fd..88df80c0894b1 100644
+--- a/drivers/net/ethernet/intel/e1000e/ich8lan.h
++++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h
+@@ -228,7 +228,7 @@
+ /* PHY Power Management Control */
+ #define HV_PM_CTRL            PHY_REG(770, 17)
+-#define HV_PM_CTRL_PLL_STOP_IN_K1_GIGA        0x100
++#define HV_PM_CTRL_K1_CLK_REQ         0x200
+ #define HV_PM_CTRL_K1_ENABLE          0x4000
+ #define I217_PLL_CLOCK_GATE_REG       PHY_REG(772, 28)
+-- 
+2.20.1
+
diff --git a/queue-4.14/edac-altera-use-the-proper-type-for-the-irq-status-b.patch b/queue-4.14/edac-altera-use-the-proper-type-for-the-irq-status-b.patch
new file mode 100644 (file)
index 0000000..a09096b
--- /dev/null
@@ -0,0 +1,59 @@
+From f512c77dad74ce11be20c72beb4f361210b448c2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Jun 2019 16:47:17 +0300
+Subject: EDAC/altera: Use the proper type for the IRQ status bits
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+[ Upstream commit 8faa1cf6ed82f33009f63986c3776cc48af1b7b2 ]
+
+Smatch complains about the cast of a u32 pointer to unsigned long:
+
+  drivers/edac/altera_edac.c:1878 altr_edac_a10_irq_handler()
+  warn: passing casted pointer '&irq_status' to 'find_first_bit()'
+
+This code wouldn't work on a 64 bit big endian system because it would
+read past the end of &irq_status.
+
+ [ bp: massage. ]
+
+Fixes: 13ab8448d2c9 ("EDAC, altera: Add ECC Manager IRQ controller support")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Thor Thayer <thor.thayer@linux.intel.com>
+Cc: James Morse <james.morse@arm.com>
+Cc: kernel-janitors@vger.kernel.org
+Cc: linux-edac <linux-edac@vger.kernel.org>
+Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
+Cc: Tony Luck <tony.luck@intel.com>
+Link: https://lkml.kernel.org/r/20190624134717.GA1754@mwanda
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/edac/altera_edac.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
+index 38983f56ad0dd..d92090b127de7 100644
+--- a/drivers/edac/altera_edac.c
++++ b/drivers/edac/altera_edac.c
+@@ -1646,6 +1646,7 @@ static void altr_edac_a10_irq_handler(struct irq_desc *desc)
+       struct altr_arria10_edac *edac = irq_desc_get_handler_data(desc);
+       struct irq_chip *chip = irq_desc_get_chip(desc);
+       int irq = irq_desc_get_irq(desc);
++      unsigned long bits;
+       dberr = (irq == edac->db_irq) ? 1 : 0;
+       sm_offset = dberr ? A10_SYSMGR_ECC_INTSTAT_DERR_OFST :
+@@ -1655,7 +1656,8 @@ static void altr_edac_a10_irq_handler(struct irq_desc *desc)
+       regmap_read(edac->ecc_mgr_map, sm_offset, &irq_status);
+-      for_each_set_bit(bit, (unsigned long *)&irq_status, 32) {
++      bits = irq_status;
++      for_each_set_bit(bit, &bits, 32) {
+               irq = irq_linear_revmap(edac->domain, dberr * 32 + bit);
+               if (irq)
+                       generic_handle_irq(irq);
+-- 
+2.20.1
+
diff --git a/queue-4.14/edac-amd64-decode-syndrome-before-translating-addres.patch b/queue-4.14/edac-amd64-decode-syndrome-before-translating-addres.patch
new file mode 100644 (file)
index 0000000..7d02780
--- /dev/null
@@ -0,0 +1,70 @@
+From 7c0291b9277b572bb28d03bbf2148b7b1d294aa5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Aug 2019 00:00:00 +0000
+Subject: EDAC/amd64: Decode syndrome before translating address
+
+From: Yazen Ghannam <yazen.ghannam@amd.com>
+
+[ Upstream commit 8a2eaab7daf03b23ac902481218034ae2fae5e16 ]
+
+AMD Family 17h systems currently require address translation in order to
+report the system address of a DRAM ECC error. This is currently done
+before decoding the syndrome information. The syndrome information does
+not depend on the address translation, so the proper EDAC csrow/channel
+reporting can function without the address. However, the syndrome
+information will not be decoded if the address translation fails.
+
+Decode the syndrome information before doing the address translation.
+The syndrome information is architecturally defined in MCA_SYND and can
+be considered robust. The address translation is system-specific and may
+fail on newer systems without proper updates to the translation
+algorithm.
+
+Fixes: 713ad54675fd ("EDAC, amd64: Define and register UMC error decode function")
+Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
+Cc: James Morse <james.morse@arm.com>
+Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
+Cc: Tony Luck <tony.luck@intel.com>
+Link: https://lkml.kernel.org/r/20190821235938.118710-6-Yazen.Ghannam@amd.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/edac/amd64_edac.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
+index 35b847b51bfa9..40fb0e7ff8fd9 100644
+--- a/drivers/edac/amd64_edac.c
++++ b/drivers/edac/amd64_edac.c
+@@ -2501,13 +2501,6 @@ static void decode_umc_error(int node_id, struct mce *m)
+               goto log_error;
+       }
+-      if (umc_normaddr_to_sysaddr(m->addr, pvt->mc_node_id, err.channel, &sys_addr)) {
+-              err.err_code = ERR_NORM_ADDR;
+-              goto log_error;
+-      }
+-
+-      error_address_to_page_and_offset(sys_addr, &err);
+-
+       if (!(m->status & MCI_STATUS_SYNDV)) {
+               err.err_code = ERR_SYND;
+               goto log_error;
+@@ -2524,6 +2517,13 @@ static void decode_umc_error(int node_id, struct mce *m)
+       err.csrow = m->synd & 0x7;
++      if (umc_normaddr_to_sysaddr(m->addr, pvt->mc_node_id, err.channel, &sys_addr)) {
++              err.err_code = ERR_NORM_ADDR;
++              goto log_error;
++      }
++
++      error_address_to_page_and_offset(sys_addr, &err);
++
+ log_error:
+       __log_ecc_error(mci, &err, ecc_type);
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/edac-amd64-recognize-dram-device-type-ecc-capability.patch b/queue-4.14/edac-amd64-recognize-dram-device-type-ecc-capability.patch
new file mode 100644 (file)
index 0000000..d2a9cbf
--- /dev/null
@@ -0,0 +1,72 @@
+From 8f521bf5c31fc81a2c7776f0bcd226e80b2d660c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 21 Aug 2019 23:59:56 +0000
+Subject: EDAC/amd64: Recognize DRAM device type ECC capability
+
+From: Yazen Ghannam <yazen.ghannam@amd.com>
+
+[ Upstream commit f8be8e5680225ac9caf07d4545f8529b7395327f ]
+
+AMD Family 17h systems support x4 and x16 DRAM devices. However, the
+device type is not checked when setting mci.edac_ctl_cap.
+
+Set the appropriate capability flag based on the device type.
+
+Default to x8 DRAM device when neither the x4 or x16 bits are set.
+
+ [ bp: reverse cpk_en check to save an indentation level. ]
+
+Fixes: 2d09d8f301f5 ("EDAC, amd64: Determine EDAC MC capabilities on Fam17h")
+Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
+Cc: James Morse <james.morse@arm.com>
+Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
+Cc: Tony Luck <tony.luck@intel.com>
+Link: https://lkml.kernel.org/r/20190821235938.118710-3-Yazen.Ghannam@amd.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/edac/amd64_edac.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
+index 667f5ba0403c0..35b847b51bfa9 100644
+--- a/drivers/edac/amd64_edac.c
++++ b/drivers/edac/amd64_edac.c
+@@ -3101,12 +3101,15 @@ static bool ecc_enabled(struct pci_dev *F3, u16 nid)
+ static inline void
+ f17h_determine_edac_ctl_cap(struct mem_ctl_info *mci, struct amd64_pvt *pvt)
+ {
+-      u8 i, ecc_en = 1, cpk_en = 1;
++      u8 i, ecc_en = 1, cpk_en = 1, dev_x4 = 1, dev_x16 = 1;
+       for (i = 0; i < NUM_UMCS; i++) {
+               if (pvt->umc[i].sdp_ctrl & UMC_SDP_INIT) {
+                       ecc_en &= !!(pvt->umc[i].umc_cap_hi & UMC_ECC_ENABLED);
+                       cpk_en &= !!(pvt->umc[i].umc_cap_hi & UMC_ECC_CHIPKILL_CAP);
++
++                      dev_x4  &= !!(pvt->umc[i].dimm_cfg & BIT(6));
++                      dev_x16 &= !!(pvt->umc[i].dimm_cfg & BIT(7));
+               }
+       }
+@@ -3114,8 +3117,15 @@ f17h_determine_edac_ctl_cap(struct mem_ctl_info *mci, struct amd64_pvt *pvt)
+       if (ecc_en) {
+               mci->edac_ctl_cap |= EDAC_FLAG_SECDED;
+-              if (cpk_en)
++              if (!cpk_en)
++                      return;
++
++              if (dev_x4)
+                       mci->edac_ctl_cap |= EDAC_FLAG_S4ECD4ED;
++              else if (dev_x16)
++                      mci->edac_ctl_cap |= EDAC_FLAG_S16ECD16ED;
++              else
++                      mci->edac_ctl_cap |= EDAC_FLAG_S8ECD8ED;
+       }
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/edac-mc-fix-grain_bits-calculation.patch b/queue-4.14/edac-mc-fix-grain_bits-calculation.patch
new file mode 100644 (file)
index 0000000..d915f01
--- /dev/null
@@ -0,0 +1,80 @@
+From 9fed3a4b16c67addebbdcf8de45d665a091dc582 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Jun 2019 15:08:55 +0000
+Subject: EDAC/mc: Fix grain_bits calculation
+
+From: Robert Richter <rrichter@marvell.com>
+
+[ Upstream commit 3724ace582d9f675134985727fd5e9811f23c059 ]
+
+The grain in EDAC is defined as "minimum granularity for an error
+report, in bytes". The following calculation of the grain_bits in
+edac_mc is wrong:
+
+       grain_bits = fls_long(e->grain) + 1;
+
+Where grain_bits is defined as:
+
+       grain = 1 << grain_bits
+
+Example:
+
+       grain = 8       # 64 bit (8 bytes)
+       grain_bits = fls_long(8) + 1
+       grain_bits = 4 + 1 = 5
+
+       grain = 1 << grain_bits
+       grain = 1 << 5 = 32
+
+Replace it with the correct calculation:
+
+       grain_bits = fls_long(e->grain - 1);
+
+The example gives now:
+
+       grain_bits = fls_long(8 - 1)
+       grain_bits = fls_long(7)
+       grain_bits = 3
+
+       grain = 1 << 3 = 8
+
+Also, check if the hardware reports a reasonable grain != 0 and fallback
+with a warning to 1 byte granularity otherwise.
+
+ [ bp: massage a bit. ]
+
+Signed-off-by: Robert Richter <rrichter@marvell.com>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>
+Cc: James Morse <james.morse@arm.com>
+Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
+Cc: Tony Luck <tony.luck@intel.com>
+Link: https://lkml.kernel.org/r/20190624150758.6695-2-rrichter@marvell.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/edac/edac_mc.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
+index 80801c616395e..f7fa05fee45a1 100644
+--- a/drivers/edac/edac_mc.c
++++ b/drivers/edac/edac_mc.c
+@@ -1240,9 +1240,13 @@ void edac_mc_handle_error(const enum hw_event_mc_err_type type,
+       if (p > e->location)
+               *(p - 1) = '\0';
+-      /* Report the error via the trace interface */
+-      grain_bits = fls_long(e->grain) + 1;
++      /* Sanity-check driver-supplied grain value. */
++      if (WARN_ON_ONCE(!e->grain))
++              e->grain = 1;
++
++      grain_bits = fls_long(e->grain - 1);
++      /* Report the error via the trace interface */
+       if (IS_ENABLED(CONFIG_RAS))
+               trace_mc_event(type, e->msg, e->label, e->error_count,
+                              mci->mc_idx, e->top_layer, e->mid_layer,
+-- 
+2.20.1
+
diff --git a/queue-4.14/edac-pnd2-fix-ioremap-size-in-dnv_rd_reg.patch b/queue-4.14/edac-pnd2-fix-ioremap-size-in-dnv_rd_reg.patch
new file mode 100644 (file)
index 0000000..7ade3f6
--- /dev/null
@@ -0,0 +1,67 @@
+From db22cf3b68cbc7d6c14ad7a4f4fd3dcb626175ef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Aug 2019 14:18:02 +0000
+Subject: EDAC, pnd2: Fix ioremap() size in dnv_rd_reg()
+
+From: Stephen Douthit <stephend@silicom-usa.com>
+
+[ Upstream commit 29a3388bfcce7a6d087051376ea02bf8326a957b ]
+
+Depending on how BIOS has marked the reserved region containing the 32KB
+MCHBAR you can get warnings like:
+
+resource sanity check: requesting [mem 0xfed10000-0xfed1ffff], which spans more than reserved [mem 0xfed10000-0xfed17fff]
+caller dnv_rd_reg+0xc8/0x240 [pnd2_edac] mapping multiple BARs
+
+Not all of the mmio regions used in dnv_rd_reg() are the same size.  The
+MCHBAR window is 32KB and the sideband ports are 64KB.  Pass the correct
+size to ioremap() depending on which resource we're reading from.
+
+Signed-off-by: Stephen Douthit <stephend@silicom-usa.com>
+Signed-off-by: Tony Luck <tony.luck@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/edac/pnd2_edac.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
+index 7f9bb9d9fcdc4..641ff19b2f57a 100644
+--- a/drivers/edac/pnd2_edac.c
++++ b/drivers/edac/pnd2_edac.c
+@@ -266,11 +266,14 @@ static u64 get_sideband_reg_base_addr(void)
+       }
+ }
++#define DNV_MCHBAR_SIZE  0x8000
++#define DNV_SB_PORT_SIZE 0x10000
+ static int dnv_rd_reg(int port, int off, int op, void *data, size_t sz, char *name)
+ {
+       struct pci_dev *pdev;
+       char *base;
+       u64 addr;
++      unsigned long size;
+       if (op == 4) {
+               pdev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x1980, NULL);
+@@ -285,15 +288,17 @@ static int dnv_rd_reg(int port, int off, int op, void *data, size_t sz, char *na
+                       addr = get_mem_ctrl_hub_base_addr();
+                       if (!addr)
+                               return -ENODEV;
++                      size = DNV_MCHBAR_SIZE;
+               } else {
+                       /* MMIO via sideband register base address */
+                       addr = get_sideband_reg_base_addr();
+                       if (!addr)
+                               return -ENODEV;
+                       addr += (port << 16);
++                      size = DNV_SB_PORT_SIZE;
+               }
+-              base = ioremap((resource_size_t)addr, 0x10000);
++              base = ioremap((resource_size_t)addr, size);
+               if (!base)
+                       return -ENODEV;
+-- 
+2.20.1
+
diff --git a/queue-4.14/efi-cper-print-aer-info-of-pcie-fatal-error.patch b/queue-4.14/efi-cper-print-aer-info-of-pcie-fatal-error.patch
new file mode 100644 (file)
index 0000000..8e7ac32
--- /dev/null
@@ -0,0 +1,89 @@
+From 82b484b79da998feed6fa2ccdbd338de5a6549dd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 26 Jul 2019 09:43:37 +0800
+Subject: efi: cper: print AER info of PCIe fatal error
+
+From: Xiaofei Tan <tanxiaofei@huawei.com>
+
+[ Upstream commit b194a77fcc4001dc40aecdd15d249648e8a436d1 ]
+
+AER info of PCIe fatal error is not printed in the current driver.
+Because APEI driver will panic directly for fatal error, and can't
+run to the place of printing AER info.
+
+An example log is as following:
+{763}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 11
+{763}[Hardware Error]: event severity: fatal
+{763}[Hardware Error]:  Error 0, type: fatal
+{763}[Hardware Error]:   section_type: PCIe error
+{763}[Hardware Error]:   port_type: 0, PCIe end point
+{763}[Hardware Error]:   version: 4.0
+{763}[Hardware Error]:   command: 0x0000, status: 0x0010
+{763}[Hardware Error]:   device_id: 0000:82:00.0
+{763}[Hardware Error]:   slot: 0
+{763}[Hardware Error]:   secondary_bus: 0x00
+{763}[Hardware Error]:   vendor_id: 0x8086, device_id: 0x10fb
+{763}[Hardware Error]:   class_code: 000002
+Kernel panic - not syncing: Fatal hardware error!
+
+This issue was imported by the patch, '37448adfc7ce ("aerdrv: Move
+cper_print_aer() call out of interrupt context")'. To fix this issue,
+this patch adds print of AER info in cper_print_pcie() for fatal error.
+
+Here is the example log after this patch applied:
+{24}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 10
+{24}[Hardware Error]: event severity: fatal
+{24}[Hardware Error]:  Error 0, type: fatal
+{24}[Hardware Error]:   section_type: PCIe error
+{24}[Hardware Error]:   port_type: 0, PCIe end point
+{24}[Hardware Error]:   version: 4.0
+{24}[Hardware Error]:   command: 0x0546, status: 0x4010
+{24}[Hardware Error]:   device_id: 0000:01:00.0
+{24}[Hardware Error]:   slot: 0
+{24}[Hardware Error]:   secondary_bus: 0x00
+{24}[Hardware Error]:   vendor_id: 0x15b3, device_id: 0x1019
+{24}[Hardware Error]:   class_code: 000002
+{24}[Hardware Error]:   aer_uncor_status: 0x00040000, aer_uncor_mask: 0x00000000
+{24}[Hardware Error]:   aer_uncor_severity: 0x00062010
+{24}[Hardware Error]:   TLP Header: 000000c0 01010000 00000001 00000000
+Kernel panic - not syncing: Fatal hardware error!
+
+Fixes: 37448adfc7ce ("aerdrv: Move cper_print_aer() call out of interrupt context")
+Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
+Reviewed-by: James Morse <james.morse@arm.com>
+[ardb: put parens around terms of && operator]
+Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/firmware/efi/cper.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
+index ce23d5402bd66..db404aab82b2a 100644
+--- a/drivers/firmware/efi/cper.c
++++ b/drivers/firmware/efi/cper.c
+@@ -507,6 +507,21 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie,
+               printk(
+       "%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n",
+       pfx, pcie->bridge.secondary_status, pcie->bridge.control);
++
++      /* Fatal errors call __ghes_panic() before AER handler prints this */
++      if ((pcie->validation_bits & CPER_PCIE_VALID_AER_INFO) &&
++          (gdata->error_severity & CPER_SEV_FATAL)) {
++              struct aer_capability_regs *aer;
++
++              aer = (struct aer_capability_regs *)pcie->aer_info;
++              printk("%saer_uncor_status: 0x%08x, aer_uncor_mask: 0x%08x\n",
++                     pfx, aer->uncor_status, aer->uncor_mask);
++              printk("%saer_uncor_severity: 0x%08x\n",
++                     pfx, aer->uncor_severity);
++              printk("%sTLP Header: %08x %08x %08x %08x\n", pfx,
++                     aer->header_log.dw0, aer->header_log.dw1,
++                     aer->header_log.dw2, aer->header_log.dw3);
++      }
+ }
+ static void cper_print_tstamp(const char *pfx,
+-- 
+2.20.1
+
diff --git a/queue-4.14/hwmon-acpi_power_meter-change-log-level-for-unsafe-s.patch b/queue-4.14/hwmon-acpi_power_meter-change-log-level-for-unsafe-s.patch
new file mode 100644 (file)
index 0000000..e3b3c86
--- /dev/null
@@ -0,0 +1,51 @@
+From 9298ab5af8abd79a2eb632e39b02504a4781a1e3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 24 Jul 2019 11:01:10 +0300
+Subject: hwmon: (acpi_power_meter) Change log level for 'unsafe software power
+ cap'
+
+From: Wang Shenran <shenran268@gmail.com>
+
+[ Upstream commit 6e4d91aa071810deac2cd052161aefb376ecf04e ]
+
+At boot time, the acpi_power_meter driver logs the following error level
+message: "Ignoring unsafe software power cap". Having read about it from
+a few sources, it seems that the error message can be quite misleading.
+
+While the message can imply that Linux is ignoring the fact that the
+system is operating in potentially dangerous conditions, the truth is
+the driver found an ACPI_PMC object that supports software power
+capping. The driver simply decides not to use it, perhaps because it
+doesn't support the object.
+
+The best solution is probably changing the log level from error to warning.
+All sources I have found, regarding the error, have downplayed its
+significance. There is not much of a reason for it to be on error level,
+while causing potential confusions or misinterpretations.
+
+Signed-off-by: Wang Shenran <shenran268@gmail.com>
+Link: https://lore.kernel.org/r/20190724080110.6952-1-shenran268@gmail.com
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwmon/acpi_power_meter.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
+index 14a94d90c028a..ba3af4505d8fb 100644
+--- a/drivers/hwmon/acpi_power_meter.c
++++ b/drivers/hwmon/acpi_power_meter.c
+@@ -693,8 +693,8 @@ static int setup_attrs(struct acpi_power_meter_resource *resource)
+       if (resource->caps.flags & POWER_METER_CAN_CAP) {
+               if (!can_cap_in_hardware()) {
+-                      dev_err(&resource->acpi_dev->dev,
+-                              "Ignoring unsafe software power cap!\n");
++                      dev_warn(&resource->acpi_dev->dev,
++                               "Ignoring unsafe software power cap!\n");
+                       goto skip_unsafe_cap;
+               }
+-- 
+2.20.1
+
diff --git a/queue-4.14/ia64-unwind-fix-double-free-for-mod-arch.init_unw_ta.patch b/queue-4.14/ia64-unwind-fix-double-free-for-mod-arch.init_unw_ta.patch
new file mode 100644 (file)
index 0000000..afa7c94
--- /dev/null
@@ -0,0 +1,54 @@
+From 60f3f4a8825b54adaf4dc693d74044e38d35adb9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 6 Aug 2019 15:46:33 +0800
+Subject: ia64:unwind: fix double free for mod->arch.init_unw_table
+
+From: chenzefeng <chenzefeng2@huawei.com>
+
+[ Upstream commit c5e5c48c16422521d363c33cfb0dcf58f88c119b ]
+
+The function free_module in file kernel/module.c as follow:
+
+void free_module(struct module *mod) {
+       ......
+       module_arch_cleanup(mod);
+       ......
+       module_arch_freeing_init(mod);
+       ......
+}
+
+Both module_arch_cleanup and module_arch_freeing_init function
+would free the mod->arch.init_unw_table, which cause double free.
+
+Here, set mod->arch.init_unw_table = NULL after remove the unwind
+table to avoid double free.
+
+Signed-off-by: chenzefeng <chenzefeng2@huawei.com>
+Signed-off-by: Tony Luck <tony.luck@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/ia64/kernel/module.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
+index 853b5611a894d..95e8d130e1235 100644
+--- a/arch/ia64/kernel/module.c
++++ b/arch/ia64/kernel/module.c
+@@ -913,8 +913,12 @@ module_finalize (const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, struct module *mo
+ void
+ module_arch_cleanup (struct module *mod)
+ {
+-      if (mod->arch.init_unw_table)
++      if (mod->arch.init_unw_table) {
+               unw_remove_unwind_table(mod->arch.init_unw_table);
+-      if (mod->arch.core_unw_table)
++              mod->arch.init_unw_table = NULL;
++      }
++      if (mod->arch.core_unw_table) {
+               unw_remove_unwind_table(mod->arch.core_unw_table);
++              mod->arch.core_unw_table = NULL;
++      }
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/iommu-amd-silence-warnings-under-memory-pressure.patch b/queue-4.14/iommu-amd-silence-warnings-under-memory-pressure.patch
new file mode 100644 (file)
index 0000000..d079769
--- /dev/null
@@ -0,0 +1,64 @@
+From a1617e3860b4d2cd453c3196908f3ccaf6225105 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 28 Aug 2019 17:39:43 -0400
+Subject: iommu/amd: Silence warnings under memory pressure
+
+From: Qian Cai <cai@lca.pw>
+
+[ Upstream commit 3d708895325b78506e8daf00ef31549476e8586a ]
+
+When running heavy memory pressure workloads, the system is throwing
+endless warnings,
+
+smartpqi 0000:23:00.0: AMD-Vi: IOMMU mapping error in map_sg (io-pages:
+5 reason: -12)
+Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40
+07/10/2019
+swapper/10: page allocation failure: order:0, mode:0xa20(GFP_ATOMIC),
+nodemask=(null),cpuset=/,mems_allowed=0,4
+Call Trace:
+ <IRQ>
+ dump_stack+0x62/0x9a
+ warn_alloc.cold.43+0x8a/0x148
+ __alloc_pages_nodemask+0x1a5c/0x1bb0
+ get_zeroed_page+0x16/0x20
+ iommu_map_page+0x477/0x540
+ map_sg+0x1ce/0x2f0
+ scsi_dma_map+0xc6/0x160
+ pqi_raid_submit_scsi_cmd_with_io_request+0x1c3/0x470 [smartpqi]
+ do_IRQ+0x81/0x170
+ common_interrupt+0xf/0xf
+ </IRQ>
+
+because the allocation could fail from iommu_map_page(), and the volume
+of this call could be huge which may generate a lot of serial console
+output and cosumes all CPUs.
+
+Fix it by silencing the warning in this call site, and there is still a
+dev_err() later to notify the failure.
+
+Signed-off-by: Qian Cai <cai@lca.pw>
+Signed-off-by: Joerg Roedel <jroedel@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/iommu/amd_iommu.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
+index a1174e61daf4e..07b6cf58fd99b 100644
+--- a/drivers/iommu/amd_iommu.c
++++ b/drivers/iommu/amd_iommu.c
+@@ -2568,7 +2568,9 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
+                       bus_addr  = address + s->dma_address + (j << PAGE_SHIFT);
+                       phys_addr = (sg_phys(s) & PAGE_MASK) + (j << PAGE_SHIFT);
+-                      ret = iommu_map_page(domain, bus_addr, phys_addr, PAGE_SIZE, prot, GFP_ATOMIC);
++                      ret = iommu_map_page(domain, bus_addr, phys_addr,
++                                           PAGE_SIZE, prot,
++                                           GFP_ATOMIC | __GFP_NOWARN);
+                       if (ret)
+                               goto out_unmap;
+-- 
+2.20.1
+
diff --git a/queue-4.14/iommu-iova-avoid-false-sharing-on-fq_timer_on.patch b/queue-4.14/iommu-iova-avoid-false-sharing-on-fq_timer_on.patch
new file mode 100644 (file)
index 0000000..d5c7020
--- /dev/null
@@ -0,0 +1,51 @@
+From d5d701ebc94f12079f03d4b0918703dee7022785 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 28 Aug 2019 06:13:38 -0700
+Subject: iommu/iova: Avoid false sharing on fq_timer_on
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 0d87308cca2c124f9bce02383f1d9632c9be89c4 ]
+
+In commit 14bd9a607f90 ("iommu/iova: Separate atomic variables
+to improve performance") Jinyu Qi identified that the atomic_cmpxchg()
+in queue_iova() was causing a performance loss and moved critical fields
+so that the false sharing would not impact them.
+
+However, avoiding the false sharing in the first place seems easy.
+We should attempt the atomic_cmpxchg() no more than 100 times
+per second. Adding an atomic_read() will keep the cache
+line mostly shared.
+
+This false sharing came with commit 9a005a800ae8
+("iommu/iova: Add flush timer").
+
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Fixes: 9a005a800ae8 ('iommu/iova: Add flush timer')
+Cc: Jinyu Qi <jinyuqi@huawei.com>
+Cc: Joerg Roedel <jroedel@suse.de>
+Acked-by: Robin Murphy <robin.murphy@arm.com>
+Signed-off-by: Joerg Roedel <jroedel@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/iommu/iova.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
+index 9f35b9a0d6d86..4edf65dbbcab5 100644
+--- a/drivers/iommu/iova.c
++++ b/drivers/iommu/iova.c
+@@ -607,7 +607,9 @@ void queue_iova(struct iova_domain *iovad,
+       spin_unlock_irqrestore(&fq->lock, flags);
+-      if (atomic_cmpxchg(&iovad->fq_timer_on, 0, 1) == 0)
++      /* Avoid false sharing as much as possible. */
++      if (!atomic_read(&iovad->fq_timer_on) &&
++          !atomic_cmpxchg(&iovad->fq_timer_on, 0, 1))
+               mod_timer(&iovad->fq_timer,
+                         jiffies + msecs_to_jiffies(IOVA_FQ_TIMEOUT));
+-- 
+2.20.1
+
diff --git a/queue-4.14/kprobes-prohibit-probing-on-bug-and-warn-address.patch b/queue-4.14/kprobes-prohibit-probing-on-bug-and-warn-address.patch
new file mode 100644 (file)
index 0000000..910f295
--- /dev/null
@@ -0,0 +1,70 @@
+From dc9f5d21913db8053096a2bdeef34e82f4af28ed Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 Sep 2019 20:08:21 +0900
+Subject: kprobes: Prohibit probing on BUG() and WARN() address
+
+From: Masami Hiramatsu <mhiramat@kernel.org>
+
+[ Upstream commit e336b4027775cb458dc713745e526fa1a1996b2a ]
+
+Since BUG() and WARN() may use a trap (e.g. UD2 on x86) to
+get the address where the BUG() has occurred, kprobes can not
+do single-step out-of-line that instruction. So prohibit
+probing on such address.
+
+Without this fix, if someone put a kprobe on WARN(), the
+kernel will crash with invalid opcode error instead of
+outputing warning message, because kernel can not find
+correct bug address.
+
+Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
+Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
+Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
+Cc: David S . Miller <davem@davemloft.net>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Naveen N . Rao <naveen.n.rao@linux.ibm.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Steven Rostedt <rostedt@goodmis.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: https://lkml.kernel.org/r/156750890133.19112.3393666300746167111.stgit@devnote2
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/bug.h | 5 +++++
+ kernel/kprobes.c    | 3 ++-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/include/linux/bug.h b/include/linux/bug.h
+index da4231c905c85..f485974177914 100644
+--- a/include/linux/bug.h
++++ b/include/linux/bug.h
+@@ -45,6 +45,11 @@ int is_valid_bugaddr(unsigned long addr);
+ #else /* !CONFIG_GENERIC_BUG */
++static inline void *find_bug(unsigned long bugaddr)
++{
++      return NULL;
++}
++
+ static inline enum bug_trap_type report_bug(unsigned long bug_addr,
+                                           struct pt_regs *regs)
+ {
+diff --git a/kernel/kprobes.c b/kernel/kprobes.c
+index c43bc2bc5b2ca..f7a4602a76f98 100644
+--- a/kernel/kprobes.c
++++ b/kernel/kprobes.c
+@@ -1501,7 +1501,8 @@ static int check_kprobe_address_safe(struct kprobe *p,
+       /* Ensure it is not in reserved area nor out of text */
+       if (!kernel_text_address((unsigned long) p->addr) ||
+           within_kprobe_blacklist((unsigned long) p->addr) ||
+-          jump_label_text_reserved(p->addr, p->addr)) {
++          jump_label_text_reserved(p->addr, p->addr) ||
++          find_bug((unsigned long)p->addr)) {
+               ret = -EINVAL;
+               goto out;
+       }
+-- 
+2.20.1
+
diff --git a/queue-4.14/leds-leds-lp5562-allow-firmware-files-up-to-the-maxi.patch b/queue-4.14/leds-leds-lp5562-allow-firmware-files-up-to-the-maxi.patch
new file mode 100644 (file)
index 0000000..e994a71
--- /dev/null
@@ -0,0 +1,43 @@
+From 509248e0729592905b6d83f2d2c096f1e205c4f1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Jul 2019 14:56:06 -0700
+Subject: leds: leds-lp5562 allow firmware files up to the maximum length
+
+From: Nick Stoughton <nstoughton@logitech.com>
+
+[ Upstream commit ed2abfebb041473092b41527903f93390d38afa7 ]
+
+Firmware files are in ASCII, using 2 hex characters per byte. The
+maximum length of a firmware string is therefore
+
+16 (commands) * 2 (bytes per command) * 2 (characters per byte) = 64
+
+Fixes: ff45262a85db ("leds: add new LP5562 LED driver")
+Signed-off-by: Nick Stoughton <nstoughton@logitech.com>
+Acked-by: Pavel Machek <pavel@ucw.cz>
+Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/leds/leds-lp5562.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/leds/leds-lp5562.c b/drivers/leds/leds-lp5562.c
+index 05ffa34fb6ad0..9d9b673c873c6 100644
+--- a/drivers/leds/leds-lp5562.c
++++ b/drivers/leds/leds-lp5562.c
+@@ -263,7 +263,11 @@ static void lp5562_firmware_loaded(struct lp55xx_chip *chip)
+ {
+       const struct firmware *fw = chip->fw;
+-      if (fw->size > LP5562_PROGRAM_LENGTH) {
++      /*
++       * the firmware is encoded in ascii hex character, with 2 chars
++       * per byte
++       */
++      if (fw->size > (LP5562_PROGRAM_LENGTH * 2)) {
+               dev_err(&chip->cl->dev, "firmware data size overflow: %zu\n",
+                       fw->size);
+               return;
+-- 
+2.20.1
+
diff --git a/queue-4.14/libertas-add-missing-sentinel-at-end-of-if_usb.c-fw_.patch b/queue-4.14/libertas-add-missing-sentinel-at-end-of-if_usb.c-fw_.patch
new file mode 100644 (file)
index 0000000..8670ef9
--- /dev/null
@@ -0,0 +1,36 @@
+From 3f42a2225fe721d6ae7df372952995bae3205add Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 10 Jul 2019 13:31:38 +0000
+Subject: libertas: Add missing sentinel at end of if_usb.c fw_table
+
+From: Kevin Easton <kevin@guarana.org>
+
+[ Upstream commit 764f3f1ecffc434096e0a2b02f1a6cc964a89df6 ]
+
+This sentinel tells the firmware loading process when to stop.
+
+Reported-and-tested-by: syzbot+98156c174c5a2cad9f8f@syzkaller.appspotmail.com
+Signed-off-by: Kevin Easton <kevin@guarana.org>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/marvell/libertas/if_usb.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/wireless/marvell/libertas/if_usb.c
+index e4ae2b5a71c25..aad82ff568835 100644
+--- a/drivers/net/wireless/marvell/libertas/if_usb.c
++++ b/drivers/net/wireless/marvell/libertas/if_usb.c
+@@ -49,7 +49,8 @@ static const struct lbs_fw_table fw_table[] = {
+       { MODEL_8388, "libertas/usb8388_v5.bin", NULL },
+       { MODEL_8388, "libertas/usb8388.bin", NULL },
+       { MODEL_8388, "usb8388.bin", NULL },
+-      { MODEL_8682, "libertas/usb8682.bin", NULL }
++      { MODEL_8682, "libertas/usb8682.bin", NULL },
++      { 0, NULL, NULL }
+ };
+ static const struct usb_device_id if_usb_table[] = {
+-- 
+2.20.1
+
diff --git a/queue-4.14/libperf-fix-alignment-trap-with-xyarray-contents-in-.patch b/queue-4.14/libperf-fix-alignment-trap-with-xyarray-contents-in-.patch
new file mode 100644 (file)
index 0000000..602aad8
--- /dev/null
@@ -0,0 +1,58 @@
+From c8225f965a895752557dec06f97ee2a48af78335 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Aug 2019 09:07:01 +0000
+Subject: libperf: Fix alignment trap with xyarray contents in 'perf stat'
+
+From: Gerald BAEZA <gerald.baeza@st.com>
+
+[ Upstream commit d9c5c083416500e95da098c01be092b937def7fa ]
+
+Following the patch 'perf stat: Fix --no-scale', an alignment trap
+happens in process_counter_values() on ARMv7 platforms due to the
+attempt to copy non 64 bits aligned double words (pointed by 'count')
+via a NEON vectored instruction ('vld1' with 64 bits alignment
+constraint).
+
+This patch sets a 64 bits alignment constraint on 'contents[]' field in
+'struct xyarray' since the 'count' pointer used above points to such a
+structure.
+
+Signed-off-by: Gerald Baeza <gerald.baeza@st.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Alexandre Torgue <alexandre.torgue@st.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: http://lkml.kernel.org/r/1566464769-16374-1-git-send-email-gerald.baeza@st.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/util/xyarray.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tools/perf/util/xyarray.h b/tools/perf/util/xyarray.h
+index 7ffe562e7ae7f..2627b038b6f2a 100644
+--- a/tools/perf/util/xyarray.h
++++ b/tools/perf/util/xyarray.h
+@@ -2,6 +2,7 @@
+ #ifndef _PERF_XYARRAY_H_
+ #define _PERF_XYARRAY_H_ 1
++#include <linux/compiler.h>
+ #include <sys/types.h>
+ struct xyarray {
+@@ -10,7 +11,7 @@ struct xyarray {
+       size_t entries;
+       size_t max_x;
+       size_t max_y;
+-      char contents[];
++      char contents[] __aligned(8);
+ };
+ struct xyarray *xyarray__new(int xlen, int ylen, size_t entry_size);
+-- 
+2.20.1
+
diff --git a/queue-4.14/libtraceevent-change-users-plugin-directory.patch b/queue-4.14/libtraceevent-change-users-plugin-directory.patch
new file mode 100644 (file)
index 0000000..98529f5
--- /dev/null
@@ -0,0 +1,70 @@
+From 62741e623635167403c425d82c762d0bbaf9a10c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 5 Aug 2019 16:43:15 -0400
+Subject: libtraceevent: Change users plugin directory
+
+From: Tzvetomir Stoyanov <tstoyanov@vmware.com>
+
+[ Upstream commit e97fd1383cd77c467d2aed7fa4e596789df83977 ]
+
+To be compliant with XDG user directory layout, the user's plugin
+directory is changed from ~/.traceevent/plugins to
+~/.local/lib/traceevent/plugins/
+
+Suggested-by: Patrick McLean <chutzpah@gentoo.org>
+Signed-off-by: Tzvetomir Stoyanov <tstoyanov@vmware.com>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Patrick McLean <chutzpah@gentoo.org>
+Cc: linux-trace-devel@vger.kernel.org
+Link: https://lore.kernel.org/linux-trace-devel/20190313144206.41e75cf8@patrickm/
+Link: http://lore.kernel.org/linux-trace-devel/20190801074959.22023-4-tz.stoyanov@gmail.com
+Link: http://lore.kernel.org/lkml/20190805204355.344622683@goodmis.org
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/lib/traceevent/Makefile       | 6 +++---
+ tools/lib/traceevent/event-plugin.c | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
+index 46cd5f871ad76..a26c44cf31aa4 100644
+--- a/tools/lib/traceevent/Makefile
++++ b/tools/lib/traceevent/Makefile
+@@ -55,15 +55,15 @@ set_plugin_dir := 1
+ # Set plugin_dir to preffered global plugin location
+ # If we install under $HOME directory we go under
+-# $(HOME)/.traceevent/plugins
++# $(HOME)/.local/lib/traceevent/plugins
+ #
+ # We dont set PLUGIN_DIR in case we install under $HOME
+ # directory, because by default the code looks under:
+-# $(HOME)/.traceevent/plugins by default.
++# $(HOME)/.local/lib/traceevent/plugins by default.
+ #
+ ifeq ($(plugin_dir),)
+ ifeq ($(prefix),$(HOME))
+-override plugin_dir = $(HOME)/.traceevent/plugins
++override plugin_dir = $(HOME)/.local/lib/traceevent/plugins
+ set_plugin_dir := 0
+ else
+ override plugin_dir = $(libdir)/traceevent/plugins
+diff --git a/tools/lib/traceevent/event-plugin.c b/tools/lib/traceevent/event-plugin.c
+index a16756ae35267..5fe7889606a23 100644
+--- a/tools/lib/traceevent/event-plugin.c
++++ b/tools/lib/traceevent/event-plugin.c
+@@ -30,7 +30,7 @@
+ #include "event-parse.h"
+ #include "event-utils.h"
+-#define LOCAL_PLUGIN_DIR ".traceevent/plugins"
++#define LOCAL_PLUGIN_DIR ".local/lib/traceevent/plugins/"
+ static struct registered_plugin_options {
+       struct registered_plugin_options        *next;
+-- 
+2.20.1
+
diff --git a/queue-4.14/md-don-t-call-spare_active-in-md_reap_sync_thread-if.patch b/queue-4.14/md-don-t-call-spare_active-in-md_reap_sync_thread-if.patch
new file mode 100644 (file)
index 0000000..6a83194
--- /dev/null
@@ -0,0 +1,46 @@
+From e12a0717b1332ceb8dadaccea93c481da59ab235 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 24 Jul 2019 11:09:21 +0200
+Subject: md: don't call spare_active in md_reap_sync_thread if all member
+ devices can't work
+
+From: Guoqing Jiang <jgq516@gmail.com>
+
+[ Upstream commit 0d8ed0e9bf9643f27f4816dca61081784dedb38d ]
+
+When add one disk to array, the md_reap_sync_thread is responsible
+to activate the spare and set In_sync flag for the new member in
+spare_active().
+
+But if raid1 has one member disk A, and disk B is added to the array.
+Then we offline A before all the datas are synchronized from A to B,
+obviously B doesn't have the latest data as A, but B is still marked
+with In_sync flag.
+
+So let's not call spare_active under the condition, otherwise B is
+still showed with 'U' state which is not correct.
+
+Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
+Signed-off-by: Song Liu <songliubraving@fb.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/md/md.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/md/md.c b/drivers/md/md.c
+index 764ed9c466294..d185725e100c0 100644
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -8906,7 +8906,8 @@ void md_reap_sync_thread(struct mddev *mddev)
+       /* resync has finished, collect result */
+       md_unregister_thread(&mddev->sync_thread);
+       if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&
+-          !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) {
++          !test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery) &&
++          mddev->degraded != mddev->raid_disks) {
+               /* success...*/
+               /* activate any spares */
+               if (mddev->pers->spare_active(mddev)) {
+-- 
+2.20.1
+
diff --git a/queue-4.14/md-don-t-set-in_sync-if-array-is-frozen.patch b/queue-4.14/md-don-t-set-in_sync-if-array-is-frozen.patch
new file mode 100644 (file)
index 0000000..bb8c6cb
--- /dev/null
@@ -0,0 +1,55 @@
+From 604db093e520441e2b9efeeb27107b514c875136 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 24 Jul 2019 11:09:20 +0200
+Subject: md: don't set In_sync if array is frozen
+
+From: Guoqing Jiang <jgq516@gmail.com>
+
+[ Upstream commit 062f5b2ae12a153644c765e7ba3b0f825427be1d ]
+
+When a disk is added to array, the following path is called in mdadm.
+
+Manage_subdevs -> sysfs_freeze_array
+               -> Manage_add
+               -> sysfs_set_str(&info, NULL, "sync_action","idle")
+
+Then from kernel side, Manage_add invokes the path (add_new_disk ->
+validate_super = super_1_validate) to set In_sync flag.
+
+Since In_sync means "device is in_sync with rest of array", and the new
+added disk need to resync thread to help the synchronization of data.
+And md_reap_sync_thread would call spare_active to set In_sync for the
+new added disk finally. So don't set In_sync if array is in frozen.
+
+Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
+Signed-off-by: Song Liu <songliubraving@fb.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/md/md.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/md/md.c b/drivers/md/md.c
+index d185725e100c0..f86082ee62a69 100644
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -1763,8 +1763,15 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev)
+                               if (!(le32_to_cpu(sb->feature_map) &
+                                     MD_FEATURE_RECOVERY_BITMAP))
+                                       rdev->saved_raid_disk = -1;
+-                      } else
+-                              set_bit(In_sync, &rdev->flags);
++                      } else {
++                              /*
++                               * If the array is FROZEN, then the device can't
++                               * be in_sync with rest of array.
++                               */
++                              if (!test_bit(MD_RECOVERY_FROZEN,
++                                            &mddev->recovery))
++                                      set_bit(In_sync, &rdev->flags);
++                      }
+                       rdev->raid_disk = role;
+                       break;
+               }
+-- 
+2.20.1
+
diff --git a/queue-4.14/md-raid1-end-bio-when-the-device-faulty.patch b/queue-4.14/md-raid1-end-bio-when-the-device-faulty.patch
new file mode 100644 (file)
index 0000000..cf89206
--- /dev/null
@@ -0,0 +1,75 @@
+From a4b54ce888c7b2f82f5c81f447006e18a070e81a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 19 Jul 2019 13:48:46 +0800
+Subject: md/raid1: end bio when the device faulty
+
+From: Yufen Yu <yuyufen@huawei.com>
+
+[ Upstream commit eeba6809d8d58908b5ed1b5ceb5fcb09a98a7cad ]
+
+When write bio return error, it would be added to conf->retry_list
+and wait for raid1d thread to retry write and acknowledge badblocks.
+
+In narrow_write_error(), the error bio will be split in the unit of
+badblock shift (such as one sector) and raid1d thread issues them
+one by one. Until all of the splited bio has finished, raid1d thread
+can go on processing other things, which is time consuming.
+
+But, there is a scene for error handling that is not necessary.
+When the device has been set faulty, flush_bio_list() may end
+bios in pending_bio_list with error status. Since these bios
+has not been issued to the device actually, error handlding to
+retry write and acknowledge badblocks make no sense.
+
+Even without that scene, when the device is faulty, badblocks info
+can not be written out to the device. Thus, we also no need to
+handle the error IO.
+
+Signed-off-by: Yufen Yu <yuyufen@huawei.com>
+Signed-off-by: Song Liu <songliubraving@fb.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/md/raid1.c | 26 ++++++++++++++------------
+ 1 file changed, 14 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
+index 31c4391f6a62b..762d21c84774a 100644
+--- a/drivers/md/raid1.c
++++ b/drivers/md/raid1.c
+@@ -435,19 +435,21 @@ static void raid1_end_write_request(struct bio *bio)
+                   /* We never try FailFast to WriteMostly devices */
+                   !test_bit(WriteMostly, &rdev->flags)) {
+                       md_error(r1_bio->mddev, rdev);
+-                      if (!test_bit(Faulty, &rdev->flags))
+-                              /* This is the only remaining device,
+-                               * We need to retry the write without
+-                               * FailFast
+-                               */
+-                              set_bit(R1BIO_WriteError, &r1_bio->state);
+-                      else {
+-                              /* Finished with this branch */
+-                              r1_bio->bios[mirror] = NULL;
+-                              to_put = bio;
+-                      }
+-              } else
++              }
++
++              /*
++               * When the device is faulty, it is not necessary to
++               * handle write error.
++               * For failfast, this is the only remaining device,
++               * We need to retry the write without FailFast.
++               */
++              if (!test_bit(Faulty, &rdev->flags))
+                       set_bit(R1BIO_WriteError, &r1_bio->state);
++              else {
++                      /* Finished with this branch */
++                      r1_bio->bios[mirror] = NULL;
++                      to_put = bio;
++              }
+       } else {
+               /*
+                * Set R1BIO_Uptodate in our master bio, so that we
+-- 
+2.20.1
+
diff --git a/queue-4.14/md-raid1-fail-run-raid1-array-when-active-disk-less-.patch b/queue-4.14/md-raid1-fail-run-raid1-array-when-active-disk-less-.patch
new file mode 100644 (file)
index 0000000..e0de8d1
--- /dev/null
@@ -0,0 +1,78 @@
+From 32642a2c3e3989e7f4f9ee54f8cf460f6f6f18af Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 Sep 2019 21:12:41 +0800
+Subject: md/raid1: fail run raid1 array when active disk less than one
+
+From: Yufen Yu <yuyufen@huawei.com>
+
+[ Upstream commit 07f1a6850c5d5a65c917c3165692b5179ac4cb6b ]
+
+When run test case:
+  mdadm -CR /dev/md1 -l 1 -n 4 /dev/sd[a-d] --assume-clean --bitmap=internal
+  mdadm -S /dev/md1
+  mdadm -A /dev/md1 /dev/sd[b-c] --run --force
+
+  mdadm --zero /dev/sda
+  mdadm /dev/md1 -a /dev/sda
+
+  echo offline > /sys/block/sdc/device/state
+  echo offline > /sys/block/sdb/device/state
+  sleep 5
+  mdadm -S /dev/md1
+
+  echo running > /sys/block/sdb/device/state
+  echo running > /sys/block/sdc/device/state
+  mdadm -A /dev/md1 /dev/sd[a-c] --run --force
+
+mdadm run fail with kernel message as follow:
+[  172.986064] md: kicking non-fresh sdb from array!
+[  173.004210] md: kicking non-fresh sdc from array!
+[  173.022383] md/raid1:md1: active with 0 out of 4 mirrors
+[  173.022406] md1: failed to create bitmap (-5)
+
+In fact, when active disk in raid1 array less than one, we
+need to return fail in raid1_run().
+
+Reviewed-by: NeilBrown <neilb@suse.de>
+Signed-off-by: Yufen Yu <yuyufen@huawei.com>
+Signed-off-by: Song Liu <songliubraving@fb.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/md/raid1.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
+index 762d21c84774a..f46ac9db9edb2 100644
+--- a/drivers/md/raid1.c
++++ b/drivers/md/raid1.c
+@@ -3099,6 +3099,13 @@ static int raid1_run(struct mddev *mddev)
+                   !test_bit(In_sync, &conf->mirrors[i].rdev->flags) ||
+                   test_bit(Faulty, &conf->mirrors[i].rdev->flags))
+                       mddev->degraded++;
++      /*
++       * RAID1 needs at least one disk in active
++       */
++      if (conf->raid_disks - mddev->degraded < 1) {
++              ret = -EINVAL;
++              goto abort;
++      }
+       if (conf->raid_disks - mddev->degraded == 1)
+               mddev->recovery_cp = MaxSector;
+@@ -3132,8 +3139,12 @@ static int raid1_run(struct mddev *mddev)
+       ret =  md_integrity_register(mddev);
+       if (ret) {
+               md_unregister_thread(&mddev->thread);
+-              raid1_free(mddev, conf);
++              goto abort;
+       }
++      return 0;
++
++abort:
++      raid1_free(mddev, conf);
+       return ret;
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-cec-notifier-clear-cec_adap-in-cec_notifier_un.patch b/queue-4.14/media-cec-notifier-clear-cec_adap-in-cec_notifier_un.patch
new file mode 100644 (file)
index 0000000..d554383
--- /dev/null
@@ -0,0 +1,47 @@
+From 82e94fae192aaa0b37cf6541a2e116a5dc648fef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 23 Aug 2019 08:12:59 -0300
+Subject: media: cec-notifier: clear cec_adap in cec_notifier_unregister
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 14d5511691e5290103bc480998bc322e68f139d4 ]
+
+If cec_notifier_cec_adap_unregister() is called before
+cec_unregister_adapter() then everything is OK (and this is the
+case today). But if it is the other way around, then
+cec_notifier_unregister() is called first, and that doesn't
+set n->cec_adap to NULL.
+
+So if e.g. cec_notifier_set_phys_addr() is called after
+cec_notifier_unregister() but before cec_unregister_adapter()
+then n->cec_adap points to an unregistered and likely deleted
+cec adapter. So just set n->cec_adap->notifier and n->cec_adap
+to NULL for rubustness.
+
+Eventually cec_notifier_unregister will disappear and this will
+be simplified substantially.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/cec/cec-notifier.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/media/cec/cec-notifier.c b/drivers/media/cec/cec-notifier.c
+index 08b619d0ea1ef..cd04499df4892 100644
+--- a/drivers/media/cec/cec-notifier.c
++++ b/drivers/media/cec/cec-notifier.c
+@@ -130,6 +130,8 @@ void cec_notifier_unregister(struct cec_notifier *n)
+ {
+       mutex_lock(&n->lock);
+       n->callback = NULL;
++      n->cec_adap->notifier = NULL;
++      n->cec_adap = NULL;
+       mutex_unlock(&n->lock);
+       cec_notifier_put(n);
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-cpia2_usb-fix-memory-leaks.patch b/queue-4.14/media-cpia2_usb-fix-memory-leaks.patch
new file mode 100644 (file)
index 0000000..934ffcf
--- /dev/null
@@ -0,0 +1,39 @@
+From 89363904ad36e4c3ff97757bdf9f684b8ddbbe57 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 17 Aug 2019 02:27:46 -0300
+Subject: media: cpia2_usb: fix memory leaks
+
+From: Wenwen Wang <wenwen@cs.uga.edu>
+
+[ Upstream commit 1c770f0f52dca1a2323c594f01f5ec6f1dddc97f ]
+
+In submit_urbs(), 'cam->sbuf[i].data' is allocated through kmalloc_array().
+However, it is not deallocated if the following allocation for urbs fails.
+To fix this issue, free 'cam->sbuf[i].data' if usb_alloc_urb() fails.
+
+Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/cpia2/cpia2_usb.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/media/usb/cpia2/cpia2_usb.c b/drivers/media/usb/cpia2/cpia2_usb.c
+index 0964ff556f4ec..91b9eaa9b2ad7 100644
+--- a/drivers/media/usb/cpia2/cpia2_usb.c
++++ b/drivers/media/usb/cpia2/cpia2_usb.c
+@@ -684,6 +684,10 @@ static int submit_urbs(struct camera_data *cam)
+               if (!urb) {
+                       for (j = 0; j < i; j++)
+                               usb_free_urb(cam->sbuf[j].urb);
++                      for (j = 0; j < NUM_SBUF; j++) {
++                              kfree(cam->sbuf[j].data);
++                              cam->sbuf[j].data = NULL;
++                      }
+                       return -ENOMEM;
+               }
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-dib0700-fix-link-error-for-dibx000_i2c_set_spe.patch b/queue-4.14/media-dib0700-fix-link-error-for-dibx000_i2c_set_spe.patch
new file mode 100644 (file)
index 0000000..34e086b
--- /dev/null
@@ -0,0 +1,69 @@
+From c831ad75ecd7d44e8cdc8eb44a4c548fcd2e6799 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 28 Jun 2019 08:14:53 -0400
+Subject: media: dib0700: fix link error for dibx000_i2c_set_speed
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 765bb8610d305ee488b35d07e2a04ae52fb2df9c ]
+
+When CONFIG_DVB_DIB9000 is disabled, we can still compile code that
+now fails to link against dibx000_i2c_set_speed:
+
+drivers/media/usb/dvb-usb/dib0700_devices.o: In function `dib01x0_pmu_update.constprop.7':
+dib0700_devices.c:(.text.unlikely+0x1c9c): undefined reference to `dibx000_i2c_set_speed'
+
+The call sites are both through dib01x0_pmu_update(), which gets passed
+an 'i2c' pointer from dib9000_get_i2c_master(), which has returned
+NULL. Checking this pointer seems to be a good idea anyway, and it avoids
+the link failure in most cases.
+
+Sean Young found another case that is not fixed by that, where certain
+gcc versions leave an unused function in place that causes the link error,
+but adding an explict IS_ENABLED() check also solves this.
+
+Fixes: b7f54910ce01 ("V4L/DVB (4647): Added module for DiB0700 based devices")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/dvb-usb/dib0700_devices.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c
+index 9be1e658ef47e..969358f57d91a 100644
+--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
++++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
+@@ -2438,9 +2438,13 @@ static int dib9090_tuner_attach(struct dvb_usb_adapter *adap)
+               8, 0x0486,
+       };
++      if (!IS_ENABLED(CONFIG_DVB_DIB9000))
++              return -ENODEV;
+       if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL)
+               return -ENODEV;
+       i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
++      if (!i2c)
++              return -ENODEV;
+       if (dib01x0_pmu_update(i2c, data_dib190, 10) != 0)
+               return -ENODEV;
+       dib0700_set_i2c_speed(adap->dev, 1500);
+@@ -2516,10 +2520,14 @@ static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap)
+               0, 0x00ef,
+               8, 0x0406,
+       };
++      if (!IS_ENABLED(CONFIG_DVB_DIB9000))
++              return -ENODEV;
+       i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe);
+       if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL)
+               return -ENODEV;
+       i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0);
++      if (!i2c)
++              return -ENODEV;
+       if (dib01x0_pmu_update(i2c, data_dib190, 10) < 0)
+               return -ENODEV;
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-dvb-core-fix-a-memory-leak-bug.patch b/queue-4.14/media-dvb-core-fix-a-memory-leak-bug.patch
new file mode 100644 (file)
index 0000000..23a08d8
--- /dev/null
@@ -0,0 +1,42 @@
+From 9120463ba6d9ddd7b7042a050540da80905a7427 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 18 Aug 2019 00:45:40 -0300
+Subject: media: dvb-core: fix a memory leak bug
+
+From: Wenwen Wang <wenwen@cs.uga.edu>
+
+[ Upstream commit fcd5ce4b3936242e6679875a4d3c3acfc8743e15 ]
+
+In dvb_create_media_entity(), 'dvbdev->entity' is allocated through
+kzalloc(). Then, 'dvbdev->pads' is allocated through kcalloc(). However, if
+kcalloc() fails, the allocated 'dvbdev->entity' is not deallocated, leading
+to a memory leak bug. To fix this issue, free 'dvbdev->entity' before
+returning -ENOMEM.
+
+Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/dvb-core/dvbdev.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
+index 41aad0f99d73c..ba3c68fb9676b 100644
+--- a/drivers/media/dvb-core/dvbdev.c
++++ b/drivers/media/dvb-core/dvbdev.c
+@@ -316,8 +316,10 @@ static int dvb_create_media_entity(struct dvb_device *dvbdev,
+       if (npads) {
+               dvbdev->pads = kcalloc(npads, sizeof(*dvbdev->pads),
+                                      GFP_KERNEL);
+-              if (!dvbdev->pads)
++              if (!dvbdev->pads) {
++                      kfree(dvbdev->entity);
+                       return -ENOMEM;
++              }
+       }
+       switch (type) {
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-exynos4-is-fix-leaked-of_node-references.patch b/queue-4.14/media-exynos4-is-fix-leaked-of_node-references.patch
new file mode 100644 (file)
index 0000000..f0d669d
--- /dev/null
@@ -0,0 +1,65 @@
+From cafa1f4bbc581d14881b0c8b56b19634c6f34a77 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Jun 2019 23:01:15 -0400
+Subject: media: exynos4-is: fix leaked of_node references
+
+From: Wen Yang <wen.yang99@zte.com.cn>
+
+[ Upstream commit da79bf41a4d170ca93cc8f3881a70d734a071c37 ]
+
+The call to of_get_child_by_name returns a node pointer with refcount
+incremented thus it must be explicitly decremented after the last
+usage.
+
+Detected by coccinelle with the following warnings:
+drivers/media/platform/exynos4-is/fimc-is.c:813:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 807, but without a corresponding object release within this function.
+drivers/media/platform/exynos4-is/fimc-is.c:870:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 807, but without a corresponding object release within this function.
+drivers/media/platform/exynos4-is/fimc-is.c:885:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 807, but without a corresponding object release within this function.
+drivers/media/platform/exynos4-is/media-dev.c:545:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 541, but without a corresponding object release within this function.
+drivers/media/platform/exynos4-is/media-dev.c:528:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 499, but without a corresponding object release within this function.
+drivers/media/platform/exynos4-is/media-dev.c:534:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 499, but without a corresponding object release within this function.
+
+Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/exynos4-is/fimc-is.c   | 1 +
+ drivers/media/platform/exynos4-is/media-dev.c | 2 ++
+ 2 files changed, 3 insertions(+)
+
+diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c
+index 5ddb2321e9e48..0fe9be93fabe2 100644
+--- a/drivers/media/platform/exynos4-is/fimc-is.c
++++ b/drivers/media/platform/exynos4-is/fimc-is.c
+@@ -819,6 +819,7 @@ static int fimc_is_probe(struct platform_device *pdev)
+               return -ENODEV;
+       is->pmu_regs = of_iomap(node, 0);
++      of_node_put(node);
+       if (!is->pmu_regs)
+               return -ENOMEM;
+diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
+index d4656d5175d7e..b2eb830c0360a 100644
+--- a/drivers/media/platform/exynos4-is/media-dev.c
++++ b/drivers/media/platform/exynos4-is/media-dev.c
+@@ -496,6 +496,7 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd)
+                       continue;
+               ret = fimc_md_parse_port_node(fmd, port, index);
++              of_node_put(port);
+               if (ret < 0) {
+                       of_node_put(node);
+                       goto rpm_put;
+@@ -529,6 +530,7 @@ static int __of_get_csis_id(struct device_node *np)
+       if (!np)
+               return -EINVAL;
+       of_property_read_u32(np, "reg", &reg);
++      of_node_put(np);
+       return reg - FIMC_INPUT_MIPI_CSI2_0;
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-fdp1-reduce-fcp-not-found-message-level-to-deb.patch b/queue-4.14/media-fdp1-reduce-fcp-not-found-message-level-to-deb.patch
new file mode 100644 (file)
index 0000000..4e2af5b
--- /dev/null
@@ -0,0 +1,45 @@
+From 99be5bb739d1957eff207beab429f32e8848de12 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 9 Jul 2019 06:59:52 -0300
+Subject: media: fdp1: Reduce FCP not found message level to debug
+
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+
+[ Upstream commit 4fd22938569c14f6092c05880ca387409d78355f ]
+
+When support for the IPMMU is not enabled, the FDP driver may be
+probe-deferred multiple times, causing several messages to be printed
+like:
+
+    rcar_fdp1 fe940000.fdp1: FCP not found (-517)
+    rcar_fdp1 fe944000.fdp1: FCP not found (-517)
+
+Fix this by reducing the message level to debug level, as is done in the
+VSP1 driver.
+
+Fixes: 4710b752e029f3f8 ("[media] v4l: Add Renesas R-Car FDP1 Driver")
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/rcar_fdp1.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/media/platform/rcar_fdp1.c b/drivers/media/platform/rcar_fdp1.c
+index a889332d5d309..d8d406c79cfa1 100644
+--- a/drivers/media/platform/rcar_fdp1.c
++++ b/drivers/media/platform/rcar_fdp1.c
+@@ -2310,7 +2310,7 @@ static int fdp1_probe(struct platform_device *pdev)
+               fdp1->fcp = rcar_fcp_get(fcp_node);
+               of_node_put(fcp_node);
+               if (IS_ERR(fdp1->fcp)) {
+-                      dev_err(&pdev->dev, "FCP not found (%ld)\n",
++                      dev_dbg(&pdev->dev, "FCP not found (%ld)\n",
+                               PTR_ERR(fdp1->fcp));
+                       return PTR_ERR(fdp1->fcp);
+               }
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-gspca-zero-usb_buf-on-error.patch b/queue-4.14/media-gspca-zero-usb_buf-on-error.patch
new file mode 100644 (file)
index 0000000..0942929
--- /dev/null
@@ -0,0 +1,279 @@
+From f28770ea3412f0cbcd0ba7ac53032780c7392ee3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 16 Aug 2019 03:38:13 -0300
+Subject: media: gspca: zero usb_buf on error
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 4843a543fad3bf8221cf14e5d5f32d15cee89e84 ]
+
+If reg_r() fails, then gspca_dev->usb_buf was left uninitialized,
+and some drivers used the contents of that buffer in logic.
+
+This caused several syzbot errors:
+
+https://syzkaller.appspot.com/bug?extid=397fd082ce5143e2f67d
+https://syzkaller.appspot.com/bug?extid=1a35278dd0ebfb3a038a
+https://syzkaller.appspot.com/bug?extid=06ddf1788cfd048c5e82
+
+I analyzed the gspca drivers and zeroed the buffer where needed.
+
+Reported-and-tested-by: syzbot+1a35278dd0ebfb3a038a@syzkaller.appspotmail.com
+Reported-and-tested-by: syzbot+397fd082ce5143e2f67d@syzkaller.appspotmail.com
+Reported-and-tested-by: syzbot+06ddf1788cfd048c5e82@syzkaller.appspotmail.com
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/gspca/konica.c   |  5 +++++
+ drivers/media/usb/gspca/nw80x.c    |  5 +++++
+ drivers/media/usb/gspca/ov519.c    | 10 ++++++++++
+ drivers/media/usb/gspca/ov534.c    |  5 +++++
+ drivers/media/usb/gspca/ov534_9.c  |  1 +
+ drivers/media/usb/gspca/se401.c    |  5 +++++
+ drivers/media/usb/gspca/sn9c20x.c  |  5 +++++
+ drivers/media/usb/gspca/sonixb.c   |  5 +++++
+ drivers/media/usb/gspca/sonixj.c   |  5 +++++
+ drivers/media/usb/gspca/spca1528.c |  5 +++++
+ drivers/media/usb/gspca/sq930x.c   |  5 +++++
+ drivers/media/usb/gspca/sunplus.c  |  5 +++++
+ drivers/media/usb/gspca/vc032x.c   |  5 +++++
+ drivers/media/usb/gspca/w996Xcf.c  |  5 +++++
+ 14 files changed, 71 insertions(+)
+
+diff --git a/drivers/media/usb/gspca/konica.c b/drivers/media/usb/gspca/konica.c
+index 31b2117e8f1df..4fac3315cfe69 100644
+--- a/drivers/media/usb/gspca/konica.c
++++ b/drivers/media/usb/gspca/konica.c
+@@ -123,6 +123,11 @@ static void reg_r(struct gspca_dev *gspca_dev, u16 value, u16 index)
+       if (ret < 0) {
+               pr_err("reg_r err %d\n", ret);
+               gspca_dev->usb_err = ret;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(gspca_dev->usb_buf, 0, 2);
+       }
+ }
+diff --git a/drivers/media/usb/gspca/nw80x.c b/drivers/media/usb/gspca/nw80x.c
+index 5d2d0bcb038d3..4c95341864da4 100644
+--- a/drivers/media/usb/gspca/nw80x.c
++++ b/drivers/media/usb/gspca/nw80x.c
+@@ -1580,6 +1580,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
+       if (ret < 0) {
+               pr_err("reg_r err %d\n", ret);
+               gspca_dev->usb_err = ret;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
+               return;
+       }
+       if (len == 1)
+diff --git a/drivers/media/usb/gspca/ov519.c b/drivers/media/usb/gspca/ov519.c
+index cdb79c5f0c382..8106a47a0dd0e 100644
+--- a/drivers/media/usb/gspca/ov519.c
++++ b/drivers/media/usb/gspca/ov519.c
+@@ -2083,6 +2083,11 @@ static int reg_r(struct sd *sd, u16 index)
+       } else {
+               PERR("reg_r %02x failed %d\n", index, ret);
+               sd->gspca_dev.usb_err = ret;
++              /*
++               * Make sure the result is zeroed to avoid uninitialized
++               * values.
++               */
++              gspca_dev->usb_buf[0] = 0;
+       }
+       return ret;
+@@ -2111,6 +2116,11 @@ static int reg_r8(struct sd *sd,
+       } else {
+               PERR("reg_r8 %02x failed %d\n", index, ret);
+               sd->gspca_dev.usb_err = ret;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(gspca_dev->usb_buf, 0, 8);
+       }
+       return ret;
+diff --git a/drivers/media/usb/gspca/ov534.c b/drivers/media/usb/gspca/ov534.c
+index 32849ff86b09d..25c0d349fdab2 100644
+--- a/drivers/media/usb/gspca/ov534.c
++++ b/drivers/media/usb/gspca/ov534.c
+@@ -641,6 +641,11 @@ static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg)
+       if (ret < 0) {
+               pr_err("read failed %d\n", ret);
+               gspca_dev->usb_err = ret;
++              /*
++               * Make sure the result is zeroed to avoid uninitialized
++               * values.
++               */
++              gspca_dev->usb_buf[0] = 0;
+       }
+       return gspca_dev->usb_buf[0];
+ }
+diff --git a/drivers/media/usb/gspca/ov534_9.c b/drivers/media/usb/gspca/ov534_9.c
+index b2a92e518118f..dadfe1effbc2a 100644
+--- a/drivers/media/usb/gspca/ov534_9.c
++++ b/drivers/media/usb/gspca/ov534_9.c
+@@ -1153,6 +1153,7 @@ static u8 reg_r(struct gspca_dev *gspca_dev, u16 reg)
+       if (ret < 0) {
+               pr_err("reg_r err %d\n", ret);
+               gspca_dev->usb_err = ret;
++              return 0;
+       }
+       return gspca_dev->usb_buf[0];
+ }
+diff --git a/drivers/media/usb/gspca/se401.c b/drivers/media/usb/gspca/se401.c
+index 477da0664b7da..40b87717bb5c5 100644
+--- a/drivers/media/usb/gspca/se401.c
++++ b/drivers/media/usb/gspca/se401.c
+@@ -111,6 +111,11 @@ static void se401_read_req(struct gspca_dev *gspca_dev, u16 req, int silent)
+                       pr_err("read req failed req %#04x error %d\n",
+                              req, err);
+               gspca_dev->usb_err = err;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(gspca_dev->usb_buf, 0, READ_REQ_SIZE);
+       }
+ }
+diff --git a/drivers/media/usb/gspca/sn9c20x.c b/drivers/media/usb/gspca/sn9c20x.c
+index c605f78d61867..e013441fd30ab 100644
+--- a/drivers/media/usb/gspca/sn9c20x.c
++++ b/drivers/media/usb/gspca/sn9c20x.c
+@@ -918,6 +918,11 @@ static void reg_r(struct gspca_dev *gspca_dev, u16 reg, u16 length)
+       if (unlikely(result < 0 || result != length)) {
+               pr_err("Read register %02x failed %d\n", reg, result);
+               gspca_dev->usb_err = result;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
+       }
+ }
+diff --git a/drivers/media/usb/gspca/sonixb.c b/drivers/media/usb/gspca/sonixb.c
+index 5f3f2979540a6..22de65d840dd3 100644
+--- a/drivers/media/usb/gspca/sonixb.c
++++ b/drivers/media/usb/gspca/sonixb.c
+@@ -462,6 +462,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
+               dev_err(gspca_dev->v4l2_dev.dev,
+                       "Error reading register %02x: %d\n", value, res);
+               gspca_dev->usb_err = res;
++              /*
++               * Make sure the result is zeroed to avoid uninitialized
++               * values.
++               */
++              gspca_dev->usb_buf[0] = 0;
+       }
+ }
+diff --git a/drivers/media/usb/gspca/sonixj.c b/drivers/media/usb/gspca/sonixj.c
+index 5eeaf16ac5e82..c53002a5ccb7f 100644
+--- a/drivers/media/usb/gspca/sonixj.c
++++ b/drivers/media/usb/gspca/sonixj.c
+@@ -1170,6 +1170,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
+       if (ret < 0) {
+               pr_err("reg_r err %d\n", ret);
+               gspca_dev->usb_err = ret;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
+       }
+ }
+diff --git a/drivers/media/usb/gspca/spca1528.c b/drivers/media/usb/gspca/spca1528.c
+index 327ec901abe14..769a9d95d2fa0 100644
+--- a/drivers/media/usb/gspca/spca1528.c
++++ b/drivers/media/usb/gspca/spca1528.c
+@@ -80,6 +80,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
+       if (ret < 0) {
+               pr_err("reg_r err %d\n", ret);
+               gspca_dev->usb_err = ret;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
+       }
+ }
+diff --git a/drivers/media/usb/gspca/sq930x.c b/drivers/media/usb/gspca/sq930x.c
+index aa9a9411b8018..a3e261685ebd9 100644
+--- a/drivers/media/usb/gspca/sq930x.c
++++ b/drivers/media/usb/gspca/sq930x.c
+@@ -434,6 +434,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
+       if (ret < 0) {
+               pr_err("reg_r %04x failed %d\n", value, ret);
+               gspca_dev->usb_err = ret;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
+       }
+ }
+diff --git a/drivers/media/usb/gspca/sunplus.c b/drivers/media/usb/gspca/sunplus.c
+index 8c2785aea3cd0..d87fcff38310b 100644
+--- a/drivers/media/usb/gspca/sunplus.c
++++ b/drivers/media/usb/gspca/sunplus.c
+@@ -264,6 +264,11 @@ static void reg_r(struct gspca_dev *gspca_dev,
+       if (ret < 0) {
+               pr_err("reg_r err %d\n", ret);
+               gspca_dev->usb_err = ret;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
+       }
+ }
+diff --git a/drivers/media/usb/gspca/vc032x.c b/drivers/media/usb/gspca/vc032x.c
+index b935febf71468..c026c513f65f7 100644
+--- a/drivers/media/usb/gspca/vc032x.c
++++ b/drivers/media/usb/gspca/vc032x.c
+@@ -2915,6 +2915,11 @@ static void reg_r_i(struct gspca_dev *gspca_dev,
+       if (ret < 0) {
+               pr_err("reg_r err %d\n", ret);
+               gspca_dev->usb_err = ret;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(gspca_dev->usb_buf, 0, USB_BUF_SZ);
+       }
+ }
+ static void reg_r(struct gspca_dev *gspca_dev,
+diff --git a/drivers/media/usb/gspca/w996Xcf.c b/drivers/media/usb/gspca/w996Xcf.c
+index 728d2322c433a..cd10e717c7e53 100644
+--- a/drivers/media/usb/gspca/w996Xcf.c
++++ b/drivers/media/usb/gspca/w996Xcf.c
+@@ -143,6 +143,11 @@ static int w9968cf_read_sb(struct sd *sd)
+       } else {
+               pr_err("Read SB reg [01] failed\n");
+               sd->gspca_dev.usb_err = ret;
++              /*
++               * Make sure the buffer is zeroed to avoid uninitialized
++               * values.
++               */
++              memset(sd->gspca_dev.usb_buf, 0, 2);
+       }
+       udelay(W9968CF_I2C_BUS_DELAY);
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-hdpvr-add-device-num-check-and-handling.patch b/queue-4.14/media-hdpvr-add-device-num-check-and-handling.patch
new file mode 100644 (file)
index 0000000..9796567
--- /dev/null
@@ -0,0 +1,59 @@
+From 4c4d003329ebef701e9efd204d4f29cc6585b4ae Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Jul 2019 10:19:46 -0400
+Subject: media: hdpvr: Add device num check and handling
+
+From: Luke Nowakowski-Krijger <lnowakow@eng.ucsd.edu>
+
+[ Upstream commit d4a6a9537bc32811486282206ecfb7c53754b74d ]
+
+Add hdpvr device num check and error handling
+
+We need to increment the device count atomically before we checkout a
+device to make sure that we do not reach the max count, otherwise we get
+out-of-bounds errors as reported by syzbot.
+
+Reported-and-tested-by: syzbot+aac8d0d7205f112045d2@syzkaller.appspotmail.com
+
+Signed-off-by: Luke Nowakowski-Krijger <lnowakow@eng.ucsd.edu>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/hdpvr/hdpvr-core.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c
+index 1e8cbaf368961..416092c47ef40 100644
+--- a/drivers/media/usb/hdpvr/hdpvr-core.c
++++ b/drivers/media/usb/hdpvr/hdpvr-core.c
+@@ -275,6 +275,7 @@ static int hdpvr_probe(struct usb_interface *interface,
+ #endif
+       size_t buffer_size;
+       int i;
++      int dev_num;
+       int retval = -ENOMEM;
+       /* allocate memory for our device state and initialize it */
+@@ -379,8 +380,17 @@ static int hdpvr_probe(struct usb_interface *interface,
+       }
+ #endif
++      dev_num = atomic_inc_return(&dev_nr);
++      if (dev_num >= HDPVR_MAX) {
++              v4l2_err(&dev->v4l2_dev,
++                       "max device number reached, device register failed\n");
++              atomic_dec(&dev_nr);
++              retval = -ENODEV;
++              goto reg_fail;
++      }
++
+       retval = hdpvr_register_videodev(dev, &interface->dev,
+-                                  video_nr[atomic_inc_return(&dev_nr)]);
++                                  video_nr[dev_num]);
+       if (retval < 0) {
+               v4l2_err(&dev->v4l2_dev, "registering videodev failed\n");
+               goto reg_fail;
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-hdpvr-add-terminating-0-at-end-of-string.patch b/queue-4.14/media-hdpvr-add-terminating-0-at-end-of-string.patch
new file mode 100644 (file)
index 0000000..0b59fa9
--- /dev/null
@@ -0,0 +1,40 @@
+From 653d9d995256eb35e541b5c65cc0717af2eba438 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 15 Aug 2019 10:00:33 -0300
+Subject: media: hdpvr: add terminating 0 at end of string
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 8b8900b729e4f31f12ac1127bde137c775c327e6 ]
+
+dev->usbc_buf was passed as argument for %s, but it was not safeguarded
+by a terminating 0.
+
+This caused this syzbot issue:
+
+https://syzkaller.appspot.com/bug?extid=79d18aac4bf1770dd050
+
+Reported-and-tested-by: syzbot+79d18aac4bf1770dd050@syzkaller.appspotmail.com
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/hdpvr/hdpvr-core.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c
+index 416092c47ef40..dd82948b1cb05 100644
+--- a/drivers/media/usb/hdpvr/hdpvr-core.c
++++ b/drivers/media/usb/hdpvr/hdpvr-core.c
+@@ -141,6 +141,7 @@ static int device_authorization(struct hdpvr_device *dev)
+       dev->fw_ver = dev->usbc_buf[1];
++      dev->usbc_buf[46] = '\0';
+       v4l2_info(&dev->v4l2_dev, "firmware version 0x%x dated %s\n",
+                         dev->fw_ver, &dev->usbc_buf[2]);
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-i2c-ov5640-check-for-devm_gpiod_get_optional-e.patch b/queue-4.14/media-i2c-ov5640-check-for-devm_gpiod_get_optional-e.patch
new file mode 100644 (file)
index 0000000..614bba4
--- /dev/null
@@ -0,0 +1,43 @@
+From e48326eba6296e877fa47524a8985361f06e50f7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 28 Jun 2019 07:00:34 -0400
+Subject: media: i2c: ov5640: Check for devm_gpiod_get_optional() error
+
+From: Fabio Estevam <festevam@gmail.com>
+
+[ Upstream commit 8791a102ce579346cea9d2f911afef1c1985213c ]
+
+The power down and reset GPIO are optional, but the return value
+from devm_gpiod_get_optional() needs to be checked and propagated
+in the case of error, so that probe deferral can work.
+
+Signed-off-by: Fabio Estevam <festevam@gmail.com>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/i2c/ov5640.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
+index acf5c8a55bbd2..69f564b0837a7 100644
+--- a/drivers/media/i2c/ov5640.c
++++ b/drivers/media/i2c/ov5640.c
+@@ -2261,9 +2261,14 @@ static int ov5640_probe(struct i2c_client *client,
+       /* request optional power down pin */
+       sensor->pwdn_gpio = devm_gpiod_get_optional(dev, "powerdown",
+                                                   GPIOD_OUT_HIGH);
++      if (IS_ERR(sensor->pwdn_gpio))
++              return PTR_ERR(sensor->pwdn_gpio);
++
+       /* request optional reset pin */
+       sensor->reset_gpio = devm_gpiod_get_optional(dev, "reset",
+                                                    GPIOD_OUT_HIGH);
++      if (IS_ERR(sensor->reset_gpio))
++              return PTR_ERR(sensor->reset_gpio);
+       v4l2_i2c_subdev_init(&sensor->sd, client, &ov5640_subdev_ops);
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-i2c-ov5645-fix-power-sequence.patch b/queue-4.14/media-i2c-ov5645-fix-power-sequence.patch
new file mode 100644 (file)
index 0000000..9524dd7
--- /dev/null
@@ -0,0 +1,122 @@
+From e5963cdc7d736fac97f444485497d7afaf2626de Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Aug 2019 08:05:40 -0300
+Subject: media: i2c: ov5645: Fix power sequence
+
+From: Ezequiel Garcia <ezequiel@collabora.com>
+
+[ Upstream commit 092e8eb90a7dc7dd210cd4e2ea36075d0a7f96af ]
+
+This is mostly a port of Jacopo's fix:
+
+  commit aa4bb8b8838ffcc776a79f49a4d7476b82405349
+  Author: Jacopo Mondi <jacopo@jmondi.org>
+  Date:   Fri Jul 6 05:51:52 2018 -0400
+
+  media: ov5640: Re-work MIPI startup sequence
+
+In the OV5645 case, the changes are:
+
+- At set_power(1) time power up MIPI Tx/Rx and set data and clock lanes in
+  LP11 during 'sleep' and 'idle' with MIPI clock in non-continuous mode.
+- At set_power(0) time power down MIPI Tx/Rx (in addition to the current
+  power down of regulators and clock gating).
+- At s_stream time enable/disable the MIPI interface output.
+
+With this commit the sensor is able to enter LP-11 mode during power up,
+as expected by some CSI-2 controllers.
+
+Many thanks to Fabio Estevam for his help debugging this issue.
+
+Tested-by: Fabio Estevam <festevam@gmail.com>
+Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
+Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
+Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/i2c/ov5645.c | 26 ++++++++++++++++++--------
+ 1 file changed, 18 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
+index 2d96c18497593..de15a13443e47 100644
+--- a/drivers/media/i2c/ov5645.c
++++ b/drivers/media/i2c/ov5645.c
+@@ -53,6 +53,8 @@
+ #define               OV5645_CHIP_ID_HIGH_BYTE        0x56
+ #define OV5645_CHIP_ID_LOW            0x300b
+ #define               OV5645_CHIP_ID_LOW_BYTE         0x45
++#define OV5645_IO_MIPI_CTRL00         0x300e
++#define OV5645_PAD_OUTPUT00           0x3019
+ #define OV5645_AWB_MANUAL_CONTROL     0x3406
+ #define               OV5645_AWB_MANUAL_ENABLE        BIT(0)
+ #define OV5645_AEC_PK_MANUAL          0x3503
+@@ -63,6 +65,7 @@
+ #define               OV5645_ISP_VFLIP                BIT(2)
+ #define OV5645_TIMING_TC_REG21                0x3821
+ #define               OV5645_SENSOR_MIRROR            BIT(1)
++#define OV5645_MIPI_CTRL00            0x4800
+ #define OV5645_PRE_ISP_TEST_SETTING_1 0x503d
+ #define               OV5645_TEST_PATTERN_MASK        0x3
+ #define               OV5645_SET_TEST_PATTERN(x)      ((x) & OV5645_TEST_PATTERN_MASK)
+@@ -129,7 +132,6 @@ static const struct reg_value ov5645_global_init_setting[] = {
+       { 0x3503, 0x07 },
+       { 0x3002, 0x1c },
+       { 0x3006, 0xc3 },
+-      { 0x300e, 0x45 },
+       { 0x3017, 0x00 },
+       { 0x3018, 0x00 },
+       { 0x302e, 0x0b },
+@@ -358,7 +360,10 @@ static const struct reg_value ov5645_global_init_setting[] = {
+       { 0x3a1f, 0x14 },
+       { 0x0601, 0x02 },
+       { 0x3008, 0x42 },
+-      { 0x3008, 0x02 }
++      { 0x3008, 0x02 },
++      { OV5645_IO_MIPI_CTRL00, 0x40 },
++      { OV5645_MIPI_CTRL00, 0x24 },
++      { OV5645_PAD_OUTPUT00, 0x70 }
+ };
+ static const struct reg_value ov5645_setting_sxga[] = {
+@@ -743,13 +748,9 @@ static int ov5645_s_power(struct v4l2_subdev *sd, int on)
+                               goto exit;
+                       }
+-                      ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0,
+-                                             OV5645_SYSTEM_CTRL0_STOP);
+-                      if (ret < 0) {
+-                              ov5645_set_power_off(ov5645);
+-                              goto exit;
+-                      }
++                      usleep_range(500, 1000);
+               } else {
++                      ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x58);
+                       ov5645_set_power_off(ov5645);
+               }
+       }
+@@ -1069,11 +1070,20 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable)
+                       dev_err(ov5645->dev, "could not sync v4l2 controls\n");
+                       return ret;
+               }
++
++              ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x45);
++              if (ret < 0)
++                      return ret;
++
+               ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0,
+                                      OV5645_SYSTEM_CTRL0_START);
+               if (ret < 0)
+                       return ret;
+       } else {
++              ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x40);
++              if (ret < 0)
++                      return ret;
++
+               ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0,
+                                      OV5645_SYSTEM_CTRL0_STOP);
+               if (ret < 0)
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-iguanair-add-sanity-checks.patch b/queue-4.14/media-iguanair-add-sanity-checks.patch
new file mode 100644 (file)
index 0000000..708bed0
--- /dev/null
@@ -0,0 +1,61 @@
+From 3b05c2289ee3ac68903fe5b6a3fe32a0939694d5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Jul 2019 05:50:44 -0300
+Subject: media: iguanair: add sanity checks
+
+From: Oliver Neukum <oneukum@suse.com>
+
+[ Upstream commit ab1cbdf159beba7395a13ab70bc71180929ca064 ]
+
+The driver needs to check the endpoint types, too, as opposed
+to the number of endpoints. This also requires moving the check earlier.
+
+Reported-by: syzbot+01a77b82edaa374068e1@syzkaller.appspotmail.com
+Signed-off-by: Oliver Neukum <oneukum@suse.com>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/rc/iguanair.c | 15 +++++++--------
+ 1 file changed, 7 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
+index 30e24da672268..3c2e248ceca87 100644
+--- a/drivers/media/rc/iguanair.c
++++ b/drivers/media/rc/iguanair.c
+@@ -427,6 +427,10 @@ static int iguanair_probe(struct usb_interface *intf,
+       int ret, pipein, pipeout;
+       struct usb_host_interface *idesc;
++      idesc = intf->altsetting;
++      if (idesc->desc.bNumEndpoints < 2)
++              return -ENODEV;
++
+       ir = kzalloc(sizeof(*ir), GFP_KERNEL);
+       rc = rc_allocate_device(RC_DRIVER_IR_RAW);
+       if (!ir || !rc) {
+@@ -441,18 +445,13 @@ static int iguanair_probe(struct usb_interface *intf,
+       ir->urb_in = usb_alloc_urb(0, GFP_KERNEL);
+       ir->urb_out = usb_alloc_urb(0, GFP_KERNEL);
+-      if (!ir->buf_in || !ir->packet || !ir->urb_in || !ir->urb_out) {
++      if (!ir->buf_in || !ir->packet || !ir->urb_in || !ir->urb_out ||
++          !usb_endpoint_is_int_in(&idesc->endpoint[0].desc) ||
++          !usb_endpoint_is_int_out(&idesc->endpoint[1].desc)) {
+               ret = -ENOMEM;
+               goto out;
+       }
+-      idesc = intf->altsetting;
+-
+-      if (idesc->desc.bNumEndpoints < 2) {
+-              ret = -ENODEV;
+-              goto out;
+-      }
+-
+       ir->rc = rc;
+       ir->dev = &intf->dev;
+       ir->udev = udev;
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-imx-mipi-csi-2-don-t-fail-if-initial-state-tim.patch b/queue-4.14/media-imx-mipi-csi-2-don-t-fail-if-initial-state-tim.patch
new file mode 100644 (file)
index 0000000..ba68c77
--- /dev/null
@@ -0,0 +1,75 @@
+From c963325a887c74ddbc4cc23885302601089f76ea Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Jun 2019 19:29:12 -0300
+Subject: media: imx: mipi csi-2: Don't fail if initial state times-out
+
+From: Ezequiel Garcia <ezequiel@collabora.com>
+
+[ Upstream commit 0d5078c7172c46db6c58718d817b9fcf769554b4 ]
+
+Not all sensors will be able to guarantee a proper initial state.
+This may be either because the driver is not properly written,
+or (probably unlikely) because the hardware won't support it.
+
+While the right solution in the former case is to fix the sensor
+driver, the real world not always allows right solutions, due to lack
+of available documentation and support on these sensors.
+
+Let's relax this requirement, and allow the driver to support stream start,
+even if the sensor initial sequence wasn't the expected.
+
+Also improve the warning message to better explain the problem and provide
+a hint that the sensor driver needs to be fixed.
+
+Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
+Signed-off-by: Fabio Estevam <festevam@gmail.com>
+Reviewed-by: Steve Longerbeam <slongerbeam@gmail.com>
+Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/media/imx/imx6-mipi-csi2.c | 12 ++++--------
+ 1 file changed, 4 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c
+index 5061f3f524fd5..c28f65c5427d1 100644
+--- a/drivers/staging/media/imx/imx6-mipi-csi2.c
++++ b/drivers/staging/media/imx/imx6-mipi-csi2.c
+@@ -247,7 +247,7 @@ static int __maybe_unused csi2_dphy_wait_ulp(struct csi2_dev *csi2)
+ }
+ /* Waits for low-power LP-11 state on data and clock lanes. */
+-static int csi2_dphy_wait_stopstate(struct csi2_dev *csi2)
++static void csi2_dphy_wait_stopstate(struct csi2_dev *csi2)
+ {
+       u32 mask, reg;
+       int ret;
+@@ -258,11 +258,9 @@ static int csi2_dphy_wait_stopstate(struct csi2_dev *csi2)
+       ret = readl_poll_timeout(csi2->base + CSI2_PHY_STATE, reg,
+                                (reg & mask) == mask, 0, 500000);
+       if (ret) {
+-              v4l2_err(&csi2->sd, "LP-11 timeout, phy_state = 0x%08x\n", reg);
+-              return ret;
++              v4l2_warn(&csi2->sd, "LP-11 wait timeout, likely a sensor driver bug, expect capture failures.\n");
++              v4l2_warn(&csi2->sd, "phy_state = 0x%08x\n", reg);
+       }
+-
+-      return 0;
+ }
+ /* Wait for active clock on the clock lane. */
+@@ -320,9 +318,7 @@ static int csi2_start(struct csi2_dev *csi2)
+       csi2_enable(csi2, true);
+       /* Step 5 */
+-      ret = csi2_dphy_wait_stopstate(csi2);
+-      if (ret)
+-              goto err_assert_reset;
++      csi2_dphy_wait_stopstate(csi2);
+       /* Step 6 */
+       ret = v4l2_subdev_call(csi2->src_sd, video, s_stream, 1);
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-mtk-cir-lower-de-glitch-counter-for-rc-mm-prot.patch b/queue-4.14/media-mtk-cir-lower-de-glitch-counter-for-rc-mm-prot.patch
new file mode 100644 (file)
index 0000000..a7a90f7
--- /dev/null
@@ -0,0 +1,51 @@
+From bb6c0f5be5576bec4b5de07ae607320b5db116cb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 12 Jul 2019 18:47:00 -0400
+Subject: media: mtk-cir: lower de-glitch counter for rc-mm protocol
+
+From: Sean Young <sean@mess.org>
+
+[ Upstream commit 5dd4b89dc098bf22cd13e82a308f42a02c102b2b ]
+
+The rc-mm protocol can't be decoded by the mtk-cir since the de-glitch
+filter removes pulses/spaces shorter than 294 microseconds.
+
+Tested on a BananaPi R2.
+
+Signed-off-by: Sean Young <sean@mess.org>
+Acked-by: Sean Wang <sean.wang@kernel.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/rc/mtk-cir.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c
+index e88eb64e8e693..00a4a0dfcab87 100644
+--- a/drivers/media/rc/mtk-cir.c
++++ b/drivers/media/rc/mtk-cir.c
+@@ -44,6 +44,11 @@
+ /* Fields containing pulse width data */
+ #define MTK_WIDTH_MASK                  (GENMASK(7, 0))
++/* IR threshold */
++#define MTK_IRTHD              0x14
++#define MTK_DG_CNT_MASK                (GENMASK(12, 8))
++#define MTK_DG_CNT(x)          ((x) << 8)
++
+ /* Bit to enable interrupt */
+ #define MTK_IRINT_EN            BIT(0)
+@@ -411,6 +416,9 @@ static int mtk_ir_probe(struct platform_device *pdev)
+       mtk_w32_mask(ir, val, ir->data->fields[MTK_HW_PERIOD].mask,
+                    ir->data->fields[MTK_HW_PERIOD].reg);
++      /* Set de-glitch counter */
++      mtk_w32_mask(ir, MTK_DG_CNT(1), MTK_DG_CNT_MASK, MTK_IRTHD);
++
+       /* Enable IR and PWM */
+       val = mtk_r32(ir, MTK_CONFIG_HIGH_REG);
+       val |= MTK_OK_COUNT(ir->data->ok_count) |  MTK_PWM_EN | MTK_IR_EN;
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-mtk-mdp-fix-reference-count-on-old-device-tree.patch b/queue-4.14/media-mtk-mdp-fix-reference-count-on-old-device-tree.patch
new file mode 100644 (file)
index 0000000..5d170d8
--- /dev/null
@@ -0,0 +1,42 @@
+From 6c993d768346a7e119b56ba3e52b2e31e6b52214 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 21 Jun 2019 08:32:50 -0300
+Subject: media: mtk-mdp: fix reference count on old device tree
+
+From: Matthias Brugger <matthias.bgg@gmail.com>
+
+[ Upstream commit 864919ea0380e62adb2503b89825fe358acb8216 ]
+
+of_get_next_child() increments the reference count of the returning
+device_node. Decrement it in the check if we are using the old or the
+new DTB.
+
+Fixes: ba1f1f70c2c0 ("[media] media: mtk-mdp: Fix mdp device tree")
+Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
+Acked-by: Houlong Wei <houlong.wei@mediatek.com>
+[hverkuil-cisco@xs4all.nl: use node instead of parent as temp variable]
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
+index bbb24fb95b951..3deb0549b1a13 100644
+--- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
++++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
+@@ -118,7 +118,9 @@ static int mtk_mdp_probe(struct platform_device *pdev)
+       mutex_init(&mdp->vpulock);
+       /* Old dts had the components as child nodes */
+-      if (of_get_next_child(dev->of_node, NULL)) {
++      node = of_get_next_child(dev->of_node, NULL);
++      if (node) {
++              of_node_put(node);
+               parent = dev->of_node;
+               dev_warn(dev, "device tree is out of date\n");
+       } else {
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-omap3isp-don-t-set-streaming-state-on-random-s.patch b/queue-4.14/media-omap3isp-don-t-set-streaming-state-on-random-s.patch
new file mode 100644 (file)
index 0000000..398f2c8
--- /dev/null
@@ -0,0 +1,50 @@
+From 2289b536bddd4517f53294bfd18645930ad5baa6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Aug 2019 11:21:27 -0300
+Subject: media: omap3isp: Don't set streaming state on random subdevs
+
+From: Sakari Ailus <sakari.ailus@linux.intel.com>
+
+[ Upstream commit 7ef57be07ac146e70535747797ef4aee0f06e9f9 ]
+
+The streaming state should be set to the first upstream sub-device only,
+not everywhere, for a sub-device driver itself knows how to best control
+the streaming state of its own upstream sub-devices.
+
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/omap3isp/isp.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
+index c834fea5f9b00..b34b6a604f92f 100644
+--- a/drivers/media/platform/omap3isp/isp.c
++++ b/drivers/media/platform/omap3isp/isp.c
+@@ -727,6 +727,10 @@ static int isp_pipeline_enable(struct isp_pipeline *pipe,
+                                       s_stream, mode);
+                       pipe->do_propagation = true;
+               }
++
++              /* Stop at the first external sub-device. */
++              if (subdev->dev != isp->dev)
++                      break;
+       }
+       return 0;
+@@ -841,6 +845,10 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe)
+                                                     &subdev->entity);
+                       failure = -ETIMEDOUT;
+               }
++
++              /* Stop at the first external sub-device. */
++              if (subdev->dev != isp->dev)
++                      break;
+       }
+       return failure;
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-omap3isp-set-device-on-omap3isp-subdevs.patch b/queue-4.14/media-omap3isp-set-device-on-omap3isp-subdevs.patch
new file mode 100644 (file)
index 0000000..372c50b
--- /dev/null
@@ -0,0 +1,101 @@
+From 414c34b0655877c6fc5093375aa30f1de3ae6147 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Aug 2019 11:19:00 -0300
+Subject: media: omap3isp: Set device on omap3isp subdevs
+
+From: Sakari Ailus <sakari.ailus@linux.intel.com>
+
+[ Upstream commit e9eb103f027725053a4b02f93d7f2858b56747ce ]
+
+The omap3isp driver registered subdevs without the dev field being set. Do
+that now.
+
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/omap3isp/ispccdc.c    | 1 +
+ drivers/media/platform/omap3isp/ispccp2.c    | 1 +
+ drivers/media/platform/omap3isp/ispcsi2.c    | 1 +
+ drivers/media/platform/omap3isp/isppreview.c | 1 +
+ drivers/media/platform/omap3isp/ispresizer.c | 1 +
+ drivers/media/platform/omap3isp/ispstat.c    | 2 ++
+ 6 files changed, 7 insertions(+)
+
+diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
+index b66276ab5765d..a2c18ab8167ee 100644
+--- a/drivers/media/platform/omap3isp/ispccdc.c
++++ b/drivers/media/platform/omap3isp/ispccdc.c
+@@ -2605,6 +2605,7 @@ int omap3isp_ccdc_register_entities(struct isp_ccdc_device *ccdc,
+       int ret;
+       /* Register the subdev and video node. */
++      ccdc->subdev.dev = vdev->mdev->dev;
+       ret = v4l2_device_register_subdev(vdev, &ccdc->subdev);
+       if (ret < 0)
+               goto error;
+diff --git a/drivers/media/platform/omap3isp/ispccp2.c b/drivers/media/platform/omap3isp/ispccp2.c
+index e062939d0d054..47b0d3fe87d80 100644
+--- a/drivers/media/platform/omap3isp/ispccp2.c
++++ b/drivers/media/platform/omap3isp/ispccp2.c
+@@ -1034,6 +1034,7 @@ int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2,
+       int ret;
+       /* Register the subdev and video nodes. */
++      ccp2->subdev.dev = vdev->mdev->dev;
+       ret = v4l2_device_register_subdev(vdev, &ccp2->subdev);
+       if (ret < 0)
+               goto error;
+diff --git a/drivers/media/platform/omap3isp/ispcsi2.c b/drivers/media/platform/omap3isp/ispcsi2.c
+index a4d3d030e81e2..e45292a1bf6c5 100644
+--- a/drivers/media/platform/omap3isp/ispcsi2.c
++++ b/drivers/media/platform/omap3isp/ispcsi2.c
+@@ -1201,6 +1201,7 @@ int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2,
+       int ret;
+       /* Register the subdev and video nodes. */
++      csi2->subdev.dev = vdev->mdev->dev;
+       ret = v4l2_device_register_subdev(vdev, &csi2->subdev);
+       if (ret < 0)
+               goto error;
+diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c
+index ac30a0f837801..e981eb2330f18 100644
+--- a/drivers/media/platform/omap3isp/isppreview.c
++++ b/drivers/media/platform/omap3isp/isppreview.c
+@@ -2228,6 +2228,7 @@ int omap3isp_preview_register_entities(struct isp_prev_device *prev,
+       int ret;
+       /* Register the subdev and video nodes. */
++      prev->subdev.dev = vdev->mdev->dev;
+       ret = v4l2_device_register_subdev(vdev, &prev->subdev);
+       if (ret < 0)
+               goto error;
+diff --git a/drivers/media/platform/omap3isp/ispresizer.c b/drivers/media/platform/omap3isp/ispresizer.c
+index 0b6a87508584f..2035e3c6a9dee 100644
+--- a/drivers/media/platform/omap3isp/ispresizer.c
++++ b/drivers/media/platform/omap3isp/ispresizer.c
+@@ -1684,6 +1684,7 @@ int omap3isp_resizer_register_entities(struct isp_res_device *res,
+       int ret;
+       /* Register the subdev and video nodes. */
++      res->subdev.dev = vdev->mdev->dev;
+       ret = v4l2_device_register_subdev(vdev, &res->subdev);
+       if (ret < 0)
+               goto error;
+diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c
+index 47cbc7e3d825a..24c07939aeddb 100644
+--- a/drivers/media/platform/omap3isp/ispstat.c
++++ b/drivers/media/platform/omap3isp/ispstat.c
+@@ -1018,6 +1018,8 @@ void omap3isp_stat_unregister_entities(struct ispstat *stat)
+ int omap3isp_stat_register_entities(struct ispstat *stat,
+                                   struct v4l2_device *vdev)
+ {
++      stat->subdev.dev = vdev->mdev->dev;
++
+       return v4l2_device_register_subdev(vdev, &stat->subdev);
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-ov9650-add-a-sanity-check.patch b/queue-4.14/media-ov9650-add-a-sanity-check.patch
new file mode 100644 (file)
index 0000000..6f1ecb8
--- /dev/null
@@ -0,0 +1,49 @@
+From 4250006c5469bc477426f8d206d9d7ad11479b38 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Aug 2019 11:55:07 -0300
+Subject: media: ov9650: add a sanity check
+
+From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+
+[ Upstream commit 093347abc7a4e0490e3c962ecbde2dc272a8f708 ]
+
+As pointed by cppcheck:
+
+       [drivers/media/i2c/ov9650.c:706]: (error) Shifting by a negative value is undefined behaviour
+       [drivers/media/i2c/ov9650.c:707]: (error) Shifting by a negative value is undefined behaviour
+       [drivers/media/i2c/ov9650.c:721]: (error) Shifting by a negative value is undefined behaviour
+
+Prevent mangling with gains with invalid values.
+
+As pointed by Sylvester, this should never happen in practice,
+as min value of V4L2_CID_GAIN control is 16 (gain is always >= 16
+and m is always >= 0), but it is too hard for a static analyzer
+to get this, as the logic with validates control min/max is
+elsewhere inside V4L2 core.
+
+Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/i2c/ov9650.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
+index 6ffb460e8589e..565903c3172d1 100644
+--- a/drivers/media/i2c/ov9650.c
++++ b/drivers/media/i2c/ov9650.c
+@@ -710,6 +710,11 @@ static int ov965x_set_gain(struct ov965x *ov965x, int auto_gain)
+               for (m = 6; m >= 0; m--)
+                       if (gain >= (1 << m) * 16)
+                               break;
++
++              /* Sanity check: don't adjust the gain with a negative value */
++              if (m < 0)
++                      return -EINVAL;
++
+               rgain = (gain - ((1 << m) * 16)) / (1 << m);
+               rgain |= (((1 << m) - 1) << 4);
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-radio-si470x-kill-urb-on-error.patch b/queue-4.14/media-radio-si470x-kill-urb-on-error.patch
new file mode 100644 (file)
index 0000000..a34f6c7
--- /dev/null
@@ -0,0 +1,59 @@
+From 34e49ed597934684cd0c75911ad3274d068ed3ac Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 15 Aug 2019 09:40:52 -0300
+Subject: media: radio/si470x: kill urb on error
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 0d616f2a3fdbf1304db44d451d9f07008556923b ]
+
+In the probe() function radio->int_in_urb was not killed if an
+error occurred in the probe sequence. It was also missing in
+the disconnect.
+
+This caused this syzbot issue:
+
+https://syzkaller.appspot.com/bug?extid=2d4fc2a0c45ad8da7e99
+
+Reported-and-tested-by: syzbot+2d4fc2a0c45ad8da7e99@syzkaller.appspotmail.com
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/radio/si470x/radio-si470x-usb.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c
+index c311f9951d806..aec528f52ca12 100644
+--- a/drivers/media/radio/si470x/radio-si470x-usb.c
++++ b/drivers/media/radio/si470x/radio-si470x-usb.c
+@@ -737,7 +737,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
+       /* start radio */
+       retval = si470x_start_usb(radio);
+       if (retval < 0)
+-              goto err_all;
++              goto err_buf;
+       /* set initial frequency */
+       si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */
+@@ -752,6 +752,8 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
+       return 0;
+ err_all:
++      usb_kill_urb(radio->int_in_urb);
++err_buf:
+       kfree(radio->buffer);
+ err_ctrl:
+       v4l2_ctrl_handler_free(&radio->hdl);
+@@ -825,6 +827,7 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf)
+       mutex_lock(&radio->lock);
+       v4l2_device_disconnect(&radio->v4l2_dev);
+       video_unregister_device(&radio->videodev);
++      usb_kill_urb(radio->int_in_urb);
+       usb_set_intfdata(intf, NULL);
+       mutex_unlock(&radio->lock);
+       v4l2_device_put(&radio->v4l2_dev);
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-rc-imon-allow-imon-rc-protocol-for-ffdc-7e-dev.patch b/queue-4.14/media-rc-imon-allow-imon-rc-protocol-for-ffdc-7e-dev.patch
new file mode 100644 (file)
index 0000000..11503ec
--- /dev/null
@@ -0,0 +1,53 @@
+From bbda473ef7dd123603bbc32617517e2591ae5a26 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Jul 2019 13:37:46 -0300
+Subject: media: rc: imon: Allow iMON RC protocol for ffdc 7e device
+
+From: Darius Rad <alpha@area49.net>
+
+[ Upstream commit b20a6e298bcb8cb8ae18de26baaf462a6418515b ]
+
+Allow selecting the IR protocol, MCE or iMON, for a device that
+identifies as follows (with config id 0x7e):
+
+15c2:ffdc SoundGraph Inc. iMON PAD Remote Controller
+
+As the driver is structured to default to iMON when both RC
+protocols are supported, existing users of this device (using MCE
+protocol) will need to manually switch to MCE (RC-6) protocol from
+userspace (with ir-keytable, sysfs).
+
+Signed-off-by: Darius Rad <alpha@area49.net>
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/rc/imon.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
+index 0c46155a8e9da..a7547c88e4c36 100644
+--- a/drivers/media/rc/imon.c
++++ b/drivers/media/rc/imon.c
+@@ -1963,12 +1963,17 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
+               break;
+       /* iMON VFD, MCE IR */
+       case 0x46:
+-      case 0x7e:
+       case 0x9e:
+               dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR");
+               detected_display_type = IMON_DISPLAY_TYPE_VFD;
+               allowed_protos = RC_PROTO_BIT_RC6_MCE;
+               break;
++      /* iMON VFD, iMON or MCE IR */
++      case 0x7e:
++              dev_info(ictx->dev, "0xffdc iMON VFD, iMON or MCE IR");
++              detected_display_type = IMON_DISPLAY_TYPE_VFD;
++              allowed_protos |= RC_PROTO_BIT_RC6_MCE;
++              break;
+       /* iMON LCD, MCE IR */
+       case 0x9f:
+               dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR");
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-saa7134-fix-terminology-around-saa7134_i2c_eep.patch b/queue-4.14/media-saa7134-fix-terminology-around-saa7134_i2c_eep.patch
new file mode 100644 (file)
index 0000000..c97cbf7
--- /dev/null
@@ -0,0 +1,61 @@
+From d6ec23713b4204f2df4ddf643ce6ee5bc055ad81 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 20 Aug 2019 19:05:55 -0300
+Subject: media: saa7134: fix terminology around
+ saa7134_i2c_eeprom_md7134_gate()
+
+From: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
+
+[ Upstream commit 9d802222a3405599d6e1984d9324cddf592ea1f4 ]
+
+saa7134_i2c_eeprom_md7134_gate() function and the associated comment uses
+an inverted i2c gate open / closed terminology.
+Let's fix this.
+
+Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+[hverkuil-cisco@xs4all.nl: fix alignment checkpatch warning]
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/pci/saa7134/saa7134-i2c.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/media/pci/saa7134/saa7134-i2c.c b/drivers/media/pci/saa7134/saa7134-i2c.c
+index 8f2ed632840f7..f70a799836840 100644
+--- a/drivers/media/pci/saa7134/saa7134-i2c.c
++++ b/drivers/media/pci/saa7134/saa7134-i2c.c
+@@ -351,7 +351,11 @@ static struct i2c_client saa7134_client_template = {
+ /* ----------------------------------------------------------- */
+-/* On Medion 7134 reading EEPROM needs DVB-T demod i2c gate open */
++/*
++ * On Medion 7134 reading the SAA7134 chip config EEPROM needs DVB-T
++ * demod i2c gate closed due to an address clash between this EEPROM
++ * and the demod one.
++ */
+ static void saa7134_i2c_eeprom_md7134_gate(struct saa7134_dev *dev)
+ {
+       u8 subaddr = 0x7, dmdregval;
+@@ -368,14 +372,14 @@ static void saa7134_i2c_eeprom_md7134_gate(struct saa7134_dev *dev)
+       ret = i2c_transfer(&dev->i2c_adap, i2cgatemsg_r, 2);
+       if ((ret == 2) && (dmdregval & 0x2)) {
+-              pr_debug("%s: DVB-T demod i2c gate was left closed\n",
++              pr_debug("%s: DVB-T demod i2c gate was left open\n",
+                        dev->name);
+               data[0] = subaddr;
+               data[1] = (dmdregval & ~0x2);
+               if (i2c_transfer(&dev->i2c_adap, i2cgatemsg_w, 1) != 1)
+-                      pr_err("%s: EEPROM i2c gate open failure\n",
+-                        dev->name);
++                      pr_err("%s: EEPROM i2c gate close failure\n",
++                             dev->name);
+       }
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-saa7146-add-cleanup-in-hexium_attach.patch b/queue-4.14/media-saa7146-add-cleanup-in-hexium_attach.patch
new file mode 100644 (file)
index 0000000..9cbf023
--- /dev/null
@@ -0,0 +1,38 @@
+From 41b0c705c9d712fd5480d59ed44a2ea6344ee899 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 18 Aug 2019 02:40:14 -0300
+Subject: media: saa7146: add cleanup in hexium_attach()
+
+From: Wenwen Wang <wenwen@cs.uga.edu>
+
+[ Upstream commit 42e64117d3b4a759013f77bbcf25ab6700e55de7 ]
+
+If saa7146_register_device() fails, no cleanup is executed, leading to
+memory/resource leaks. To fix this issue, perform necessary cleanup work
+before returning the error.
+
+Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/pci/saa7146/hexium_gemini.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c
+index 934332f1fd8e6..a527d86b93a77 100644
+--- a/drivers/media/pci/saa7146/hexium_gemini.c
++++ b/drivers/media/pci/saa7146/hexium_gemini.c
+@@ -304,6 +304,9 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
+       ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER);
+       if (ret < 0) {
+               pr_err("cannot register capture v4l2 device. skipping.\n");
++              saa7146_vv_release(dev);
++              i2c_del_adapter(&hexium->i2c_adapter);
++              kfree(hexium);
+               return ret;
+       }
+-- 
+2.20.1
+
diff --git a/queue-4.14/media-ttusb-dec-fix-info-leak-in-ttusb_dec_send_comm.patch b/queue-4.14/media-ttusb-dec-fix-info-leak-in-ttusb_dec_send_comm.patch
new file mode 100644 (file)
index 0000000..cf3538f
--- /dev/null
@@ -0,0 +1,40 @@
+From 8f06bf8b7713dba1ab9281d61660a19d52d2e61a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 31 Jul 2019 12:19:05 -0300
+Subject: media: ttusb-dec: Fix info-leak in ttusb_dec_send_command()
+
+From: Tomas Bortoli <tomasbortoli@gmail.com>
+
+[ Upstream commit a10feaf8c464c3f9cfdd3a8a7ce17e1c0d498da1 ]
+
+The function at issue does not always initialize each byte allocated
+for 'b' and can therefore leak uninitialized memory to a USB device in
+the call to usb_bulk_msg()
+
+Use kzalloc() instead of kmalloc()
+
+Signed-off-by: Tomas Bortoli <tomasbortoli@gmail.com>
+Reported-by: syzbot+0522702e9d67142379f1@syzkaller.appspotmail.com
+Signed-off-by: Sean Young <sean@mess.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/ttusb-dec/ttusb_dec.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c
+index cdefb5dfbbdcd..cad2746158160 100644
+--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
++++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
+@@ -330,7 +330,7 @@ static int ttusb_dec_send_command(struct ttusb_dec *dec, const u8 command,
+       dprintk("%s\n", __func__);
+-      b = kmalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL);
++      b = kzalloc(COMMAND_PACKET_SIZE + 4, GFP_KERNEL);
+       if (!b)
+               return -ENOMEM;
+-- 
+2.20.1
+
diff --git a/queue-4.14/mmc-core-clarify-sdio_irq_pending-flag-for-mmc_cap2_.patch b/queue-4.14/mmc-core-clarify-sdio_irq_pending-flag-for-mmc_cap2_.patch
new file mode 100644 (file)
index 0000000..05d8ae8
--- /dev/null
@@ -0,0 +1,103 @@
+From f150cac8bdfa9c43f2da633e05f4cc855edd88ef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 8 Sep 2019 12:12:30 +0200
+Subject: mmc: core: Clarify sdio_irq_pending flag for
+ MMC_CAP2_SDIO_IRQ_NOTHREAD
+
+From: Ulf Hansson <ulf.hansson@linaro.org>
+
+[ Upstream commit 36d57efb4af534dd6b442ea0b9a04aa6dfa37abe ]
+
+The sdio_irq_pending flag is used to let host drivers indicate that it has
+signaled an IRQ. If that is the case and we only have a single SDIO func
+that have claimed an SDIO IRQ, our assumption is that we can avoid reading
+the SDIO_CCCR_INTx register and just call the SDIO func irq handler
+immediately. This makes sense, but the flag is set/cleared in a somewhat
+messy order, let's fix that up according to below.
+
+First, the flag is currently set in sdio_run_irqs(), which is executed as a
+work that was scheduled from sdio_signal_irq(). To make it more implicit
+that the host have signaled an IRQ, let's instead immediately set the flag
+in sdio_signal_irq(). This also makes the behavior consistent with host
+drivers that uses the legacy, mmc_signal_sdio_irq() API. This have no
+functional impact, because we don't expect host drivers to call
+sdio_signal_irq() until after the work (sdio_run_irqs()) have been executed
+anyways.
+
+Second, currently we never clears the flag when using the sdio_run_irqs()
+work, but only when using the sdio_irq_thread(). Let make the behavior
+consistent, by moving the flag to be cleared inside the common
+process_sdio_pending_irqs() function. Additionally, tweak the behavior of
+the flag slightly, by avoiding to clear it unless we processed the SDIO
+IRQ. The purpose with this at this point, is to keep the information about
+whether there have been an SDIO IRQ signaled by the host, so at system
+resume we can decide to process it without reading the SDIO_CCCR_INTx
+register.
+
+Tested-by: Matthias Kaehlcke <mka@chromium.org>
+Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Reviewed-by: Douglas Anderson <dianders@chromium.org>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/core/sdio_irq.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
+index 2fdd84c67f191..0656d740b0dd2 100644
+--- a/drivers/mmc/core/sdio_irq.c
++++ b/drivers/mmc/core/sdio_irq.c
+@@ -35,6 +35,7 @@ static int process_sdio_pending_irqs(struct mmc_host *host)
+ {
+       struct mmc_card *card = host->card;
+       int i, ret, count;
++      bool sdio_irq_pending = host->sdio_irq_pending;
+       unsigned char pending;
+       struct sdio_func *func;
+@@ -42,13 +43,16 @@ static int process_sdio_pending_irqs(struct mmc_host *host)
+       if (mmc_card_suspended(card))
+               return 0;
++      /* Clear the flag to indicate that we have processed the IRQ. */
++      host->sdio_irq_pending = false;
++
+       /*
+        * Optimization, if there is only 1 function interrupt registered
+        * and we know an IRQ was signaled then call irq handler directly.
+        * Otherwise do the full probe.
+        */
+       func = card->sdio_single_irq;
+-      if (func && host->sdio_irq_pending) {
++      if (func && sdio_irq_pending) {
+               func->irq_handler(func);
+               return 1;
+       }
+@@ -100,7 +104,6 @@ void sdio_run_irqs(struct mmc_host *host)
+ {
+       mmc_claim_host(host);
+       if (host->sdio_irqs) {
+-              host->sdio_irq_pending = true;
+               process_sdio_pending_irqs(host);
+               if (host->ops->ack_sdio_irq)
+                       host->ops->ack_sdio_irq(host);
+@@ -119,6 +122,7 @@ void sdio_irq_work(struct work_struct *work)
+ void sdio_signal_irq(struct mmc_host *host)
+ {
++      host->sdio_irq_pending = true;
+       queue_delayed_work(system_wq, &host->sdio_irq_work, 0);
+ }
+ EXPORT_SYMBOL_GPL(sdio_signal_irq);
+@@ -163,7 +167,6 @@ static int sdio_irq_thread(void *_host)
+               if (ret)
+                       break;
+               ret = process_sdio_pending_irqs(host);
+-              host->sdio_irq_pending = false;
+               mmc_release_host(host);
+               /*
+-- 
+2.20.1
+
diff --git a/queue-4.14/mmc-sdhci-fix-incorrect-switch-to-hs-mode.patch b/queue-4.14/mmc-sdhci-fix-incorrect-switch-to-hs-mode.patch
new file mode 100644 (file)
index 0000000..c22ae15
--- /dev/null
@@ -0,0 +1,56 @@
+From 0811b153527be935b98a44591f2b419025d9f509 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 3 Sep 2019 07:51:14 -0400
+Subject: mmc: sdhci: Fix incorrect switch to HS mode
+
+From: Al Cooper <alcooperx@gmail.com>
+
+[ Upstream commit c894e33ddc1910e14d6f2a2016f60ab613fd8b37 ]
+
+When switching from any MMC speed mode that requires 1.8v
+(HS200, HS400 and HS400ES) to High Speed (HS) mode, the system
+ends up configured for SDR12 with a 50MHz clock which is an illegal
+mode.
+
+This happens because the SDHCI_CTRL_VDD_180 bit in the
+SDHCI_HOST_CONTROL2 register is left set and when this bit is
+set, the speed mode is controlled by the SDHCI_CTRL_UHS field
+in the SDHCI_HOST_CONTROL2 register. The SDHCI_CTRL_UHS field
+will end up being set to 0 (SDR12) by sdhci_set_uhs_signaling()
+because there is no UHS mode being set.
+
+The fix is to change sdhci_set_uhs_signaling() to set the
+SDHCI_CTRL_UHS field to SDR25 (which is the same as HS) for
+any switch to HS mode.
+
+This was found on a new eMMC controller that does strict checking
+of the speed mode and the corresponding clock rate. It caused the
+switch to HS400 mode to fail because part of the sequence to switch
+to HS400 requires a switch from HS200 to HS before going to HS400.
+
+Suggested-by: Adrian Hunter <adrian.hunter@intel.com>
+Signed-off-by: Al Cooper <alcooperx@gmail.com>
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/sdhci.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
+index 9540fda7fc6ba..3741d4c846e5e 100644
+--- a/drivers/mmc/host/sdhci.c
++++ b/drivers/mmc/host/sdhci.c
+@@ -1635,7 +1635,9 @@ void sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
+               ctrl_2 |= SDHCI_CTRL_UHS_SDR104;
+       else if (timing == MMC_TIMING_UHS_SDR12)
+               ctrl_2 |= SDHCI_CTRL_UHS_SDR12;
+-      else if (timing == MMC_TIMING_UHS_SDR25)
++      else if (timing == MMC_TIMING_SD_HS ||
++               timing == MMC_TIMING_MMC_HS ||
++               timing == MMC_TIMING_UHS_SDR25)
+               ctrl_2 |= SDHCI_CTRL_UHS_SDR25;
+       else if (timing == MMC_TIMING_UHS_SDR50)
+               ctrl_2 |= SDHCI_CTRL_UHS_SDR50;
+-- 
+2.20.1
+
diff --git a/queue-4.14/nbd-add-missing-config-put.patch b/queue-4.14/nbd-add-missing-config-put.patch
new file mode 100644 (file)
index 0000000..52160ec
--- /dev/null
@@ -0,0 +1,48 @@
+From 33dc7872306e1a1a533a5291622e8a01899ca357 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 13 Aug 2019 11:39:51 -0500
+Subject: nbd: add missing config put
+
+From: Mike Christie <mchristi@redhat.com>
+
+[ Upstream commit 887e975c4172d0d5670c39ead2f18ba1e4ec8133 ]
+
+Fix bug added with the patch:
+
+commit 8f3ea35929a0806ad1397db99a89ffee0140822a
+Author: Josef Bacik <josef@toxicpanda.com>
+Date:   Mon Jul 16 12:11:35 2018 -0400
+
+    nbd: handle unexpected replies better
+
+where if the timeout handler runs when the completion path is and we fail
+to grab the mutex in the timeout handler we will leave a config reference
+and cannot free the config later.
+
+Reviewed-by: Josef Bacik <josef@toxicpanda.com>
+Signed-off-by: Mike Christie <mchristi@redhat.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/nbd.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
+index b77e9281c039d..e4b049f281f50 100644
+--- a/drivers/block/nbd.c
++++ b/drivers/block/nbd.c
+@@ -340,8 +340,10 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
+       }
+       config = nbd->config;
+-      if (!mutex_trylock(&cmd->lock))
++      if (!mutex_trylock(&cmd->lock)) {
++              nbd_config_put(nbd);
+               return BLK_EH_RESET_TIMER;
++      }
+       if (config->num_connections > 1) {
+               dev_err_ratelimited(nbd_to_dev(nbd),
+-- 
+2.20.1
+
diff --git a/queue-4.14/net-lpc-enet-fix-printk-format-strings.patch b/queue-4.14/net-lpc-enet-fix-printk-format-strings.patch
new file mode 100644 (file)
index 0000000..cf0ce18
--- /dev/null
@@ -0,0 +1,64 @@
+From 9d916449aee5892fc31c0a0c98f679659209ae65 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 9 Aug 2019 16:40:35 +0200
+Subject: net: lpc-enet: fix printk format strings
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit de6f97b2bace0e2eb6c3a86e124d1e652a587b56 ]
+
+compile-testing this driver on other architectures showed
+multiple warnings:
+
+  drivers/net/ethernet/nxp/lpc_eth.c: In function 'lpc_eth_drv_probe':
+  drivers/net/ethernet/nxp/lpc_eth.c:1337:19: warning: format '%d' expects argument of type 'int', but argument 4 has type 'resource_size_t {aka long long unsigned int}' [-Wformat=]
+
+  drivers/net/ethernet/nxp/lpc_eth.c:1342:19: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]
+
+Use format strings that work on all architectures.
+
+Link: https://lore.kernel.org/r/20190809144043.476786-10-arnd@arndb.de
+Reported-by: kbuild test robot <lkp@intel.com>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/nxp/lpc_eth.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
+index 08381ef8bdb48..41d30f55c946b 100644
+--- a/drivers/net/ethernet/nxp/lpc_eth.c
++++ b/drivers/net/ethernet/nxp/lpc_eth.c
+@@ -1371,13 +1371,14 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
+       pldat->dma_buff_base_p = dma_handle;
+       netdev_dbg(ndev, "IO address space     :%pR\n", res);
+-      netdev_dbg(ndev, "IO address size      :%d\n", resource_size(res));
++      netdev_dbg(ndev, "IO address size      :%zd\n",
++                      (size_t)resource_size(res));
+       netdev_dbg(ndev, "IO address (mapped)  :0x%p\n",
+                       pldat->net_base);
+       netdev_dbg(ndev, "IRQ number           :%d\n", ndev->irq);
+-      netdev_dbg(ndev, "DMA buffer size      :%d\n", pldat->dma_buff_size);
+-      netdev_dbg(ndev, "DMA buffer P address :0x%08x\n",
+-                      pldat->dma_buff_base_p);
++      netdev_dbg(ndev, "DMA buffer size      :%zd\n", pldat->dma_buff_size);
++      netdev_dbg(ndev, "DMA buffer P address :%pad\n",
++                      &pldat->dma_buff_base_p);
+       netdev_dbg(ndev, "DMA buffer V address :0x%p\n",
+                       pldat->dma_buff_base_v);
+@@ -1424,8 +1425,8 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
+       if (ret)
+               goto err_out_unregister_netdev;
+-      netdev_info(ndev, "LPC mac at 0x%08x irq %d\n",
+-             res->start, ndev->irq);
++      netdev_info(ndev, "LPC mac at 0x%08lx irq %d\n",
++             (unsigned long)res->start, ndev->irq);
+       phydev = ndev->phydev;
+-- 
+2.20.1
+
diff --git a/queue-4.14/nvmet-fix-data-units-read-and-written-counters-in-sm.patch b/queue-4.14/nvmet-fix-data-units-read-and-written-counters-in-sm.patch
new file mode 100644 (file)
index 0000000..60fd94f
--- /dev/null
@@ -0,0 +1,65 @@
+From af14488229fe9e2a70dbb980c7a5bc4ba8077b02 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Aug 2019 02:22:36 +0000
+Subject: nvmet: fix data units read and written counters in SMART log
+
+From: Tom Wu <tomwu@mellanox.com>
+
+[ Upstream commit 3bec2e3754becebd4c452999adb49bc62c575ea4 ]
+
+In nvme spec 1.3 there is a definition for data write/read counters
+from SMART log, (See section 5.14.1.2):
+       This value is reported in thousands (i.e., a value of 1
+       corresponds to 1000 units of 512 bytes read) and is rounded up.
+
+However, in nvme target where value is reported with actual units,
+but not thousands of units as the spec requires.
+
+Signed-off-by: Tom Wu <tomwu@mellanox.com>
+Reviewed-by: Israel Rukshin <israelr@mellanox.com>
+Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
+Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/target/admin-cmd.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
+index c4a0bf36e7521..0e94fd737eb4e 100644
+--- a/drivers/nvme/target/admin-cmd.c
++++ b/drivers/nvme/target/admin-cmd.c
+@@ -49,9 +49,11 @@ static u16 nvmet_get_smart_log_nsid(struct nvmet_req *req,
+       }
+       host_reads = part_stat_read(ns->bdev->bd_part, ios[READ]);
+-      data_units_read = part_stat_read(ns->bdev->bd_part, sectors[READ]);
++      data_units_read = DIV_ROUND_UP(part_stat_read(ns->bdev->bd_part,
++              sectors[READ]), 1000);
+       host_writes = part_stat_read(ns->bdev->bd_part, ios[WRITE]);
+-      data_units_written = part_stat_read(ns->bdev->bd_part, sectors[WRITE]);
++      data_units_written = DIV_ROUND_UP(part_stat_read(ns->bdev->bd_part,
++              sectors[WRITE]), 1000);
+       put_unaligned_le64(host_reads, &slog->host_reads[0]);
+       put_unaligned_le64(data_units_read, &slog->data_units_read[0]);
+@@ -77,11 +79,11 @@ static u16 nvmet_get_smart_log_all(struct nvmet_req *req,
+       rcu_read_lock();
+       list_for_each_entry_rcu(ns, &ctrl->subsys->namespaces, dev_link) {
+               host_reads += part_stat_read(ns->bdev->bd_part, ios[READ]);
+-              data_units_read +=
+-                      part_stat_read(ns->bdev->bd_part, sectors[READ]);
++              data_units_read += DIV_ROUND_UP(
++                      part_stat_read(ns->bdev->bd_part, sectors[READ]), 1000);
+               host_writes += part_stat_read(ns->bdev->bd_part, ios[WRITE]);
+-              data_units_written +=
+-                      part_stat_read(ns->bdev->bd_part, sectors[WRITE]);
++              data_units_written += DIV_ROUND_UP(
++                      part_stat_read(ns->bdev->bd_part, sectors[WRITE]), 1000);
+       }
+       rcu_read_unlock();
+-- 
+2.20.1
+
diff --git a/queue-4.14/perf-ftrace-use-cap_sys_admin-instead-of-euid-0.patch b/queue-4.14/perf-ftrace-use-cap_sys_admin-instead-of-euid-0.patch
new file mode 100644 (file)
index 0000000..59ee889
--- /dev/null
@@ -0,0 +1,61 @@
+From 3e909c01c55e02867711e6489e3c4faac852e795 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Aug 2019 10:44:17 -0400
+Subject: perf ftrace: Use CAP_SYS_ADMIN instead of euid==0
+
+From: Igor Lubashev <ilubashe@akamai.com>
+
+[ Upstream commit c766f3df635de14295e410c6dd5410bc416c24a0 ]
+
+The kernel requires CAP_SYS_ADMIN instead of euid==0 to mount debugfs
+for ftrace.  Make perf do the same.
+
+Signed-off-by: Igor Lubashev <ilubashe@akamai.com>
+Acked-by: Jiri Olsa <jolsa@kernel.org>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
+Cc: James Morris <jmorris@namei.org>
+Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
+Cc: linux-arm-kernel@lists.infradead.org
+Link: http://lkml.kernel.org/r/bd8763b72ed4d58d0b42d44fbc7eb474d32e53a3.1565188228.git.ilubashe@akamai.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/builtin-ftrace.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
+index 13a33fb71a6da..6f07c5541fdea 100644
+--- a/tools/perf/builtin-ftrace.c
++++ b/tools/perf/builtin-ftrace.c
+@@ -14,6 +14,7 @@
+ #include <signal.h>
+ #include <fcntl.h>
+ #include <poll.h>
++#include <linux/capability.h>
+ #include "debug.h"
+ #include <subcmd/parse-options.h>
+@@ -22,6 +23,7 @@
+ #include "target.h"
+ #include "cpumap.h"
+ #include "thread_map.h"
++#include "util/cap.h"
+ #include "util/config.h"
+@@ -270,7 +272,7 @@ static int __cmd_ftrace(struct perf_ftrace *ftrace, int argc, const char **argv)
+               .events = POLLIN,
+       };
+-      if (geteuid() != 0) {
++      if (!perf_cap__capable(CAP_SYS_ADMIN)) {
+               pr_err("ftrace only works for root!\n");
+               return -1;
+       }
+-- 
+2.20.1
+
diff --git a/queue-4.14/perf-record-support-aarch64-random-socket_id-assignm.patch b/queue-4.14/perf-record-support-aarch64-random-socket_id-assignm.patch
new file mode 100644 (file)
index 0000000..5b0c6e6
--- /dev/null
@@ -0,0 +1,80 @@
+From 6e3817bdd30be4423d4a60a90ffdbc6e3da080d9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 2 Aug 2019 11:48:57 +0800
+Subject: perf record: Support aarch64 random socket_id assignment
+
+From: Tan Xiaojun <tanxiaojun@huawei.com>
+
+[ Upstream commit 0a4d8fb229dd78f9e0752817339e19e903b37a60 ]
+
+Same as in the commit 01766229533f ("perf record: Support s390 random
+socket_id assignment"), aarch64 also have this problem.
+
+Without this fix:
+
+  [root@localhost perf]# ./perf report --header -I -v
+  ...
+  socket_id number is too big.You may need to upgrade the perf tool.
+
+  # ========
+  # captured on    : Thu Aug  1 22:58:38 2019
+  # header version : 1
+  ...
+  # Core ID and Socket ID information is not available
+  ...
+
+With this fix:
+  [root@localhost perf]# ./perf report --header -I -v
+  ...
+  cpumask list: 0-31
+  cpumask list: 32-63
+  cpumask list: 64-95
+  cpumask list: 96-127
+
+  # ========
+  # captured on    : Thu Aug  1 22:58:38 2019
+  # header version : 1
+  ...
+  # CPU 0: Core ID 0, Socket ID 36
+  # CPU 1: Core ID 1, Socket ID 36
+  ...
+  # CPU 126: Core ID 126, Socket ID 8442
+  # CPU 127: Core ID 127, Socket ID 8442
+  ...
+
+Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com>
+Acked-by: Jiri Olsa <jolsa@kernel.org>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
+Cc: Kan Liang <kan.liang@linux.intel.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Song Liu <songliubraving@fb.com>
+Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Cc: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
+Link: http://lkml.kernel.org/r/1564717737-21602-1-git-send-email-tanxiaojun@huawei.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/util/header.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
+index 6da7afa7d328e..e1fe446f65daa 100644
+--- a/tools/perf/util/header.c
++++ b/tools/perf/util/header.c
+@@ -1882,8 +1882,10 @@ static int process_cpu_topology(struct feat_fd *ff, void *data __maybe_unused)
+       /* On s390 the socket_id number is not related to the numbers of cpus.
+        * The socket_id number might be higher than the numbers of cpus.
+        * This depends on the configuration.
++       * AArch64 is the same.
+        */
+-      if (ph->env.arch && !strncmp(ph->env.arch, "s390", 4))
++      if (ph->env.arch && (!strncmp(ph->env.arch, "s390", 4)
++                        || !strncmp(ph->env.arch, "aarch64", 7)))
+               do_core_id_test = false;
+       for (i = 0; i < (u32)cpu_nr; i++) {
+-- 
+2.20.1
+
diff --git a/queue-4.14/perf-test-vfs_getname-disable-.perfconfig-to-get-def.patch b/queue-4.14/perf-test-vfs_getname-disable-.perfconfig-to-get-def.patch
new file mode 100644 (file)
index 0000000..11782fd
--- /dev/null
@@ -0,0 +1,79 @@
+From a107434a913ec4e188ae66f019c5014f58a59ae5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Jul 2019 11:37:44 -0300
+Subject: perf test vfs_getname: Disable ~/.perfconfig to get default output
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+[ Upstream commit 4fe94ce1c6ba678b5f12b94bb9996eea4fc99e85 ]
+
+To get the expected output we have to ignore whatever changes the user
+has in its ~/.perfconfig file, so set PERF_CONFIG to /dev/null to
+achieve that.
+
+Before:
+
+  # egrep 'trace|show_' ~/.perfconfig
+  [trace]
+       show_zeros = yes
+       show_duration = no
+       show_timestamp = no
+       show_arg_names = no
+       show_prefix = yes
+  # echo $PERF_CONFIG
+
+  # perf test "trace + vfs_getname"
+  70: Check open filename arg using perf trace + vfs_getname: FAILED!
+  # export PERF_CONFIG=/dev/null
+  # perf test "trace + vfs_getname"
+  70: Check open filename arg using perf trace + vfs_getname: Ok
+  #
+
+After:
+
+  # egrep 'trace|show_' ~/.perfconfig
+  [trace]
+       show_zeros = yes
+       show_duration = no
+       show_timestamp = no
+       show_arg_names = no
+       show_prefix = yes
+  # echo $PERF_CONFIG
+
+  # perf test "trace + vfs_getname"
+  70: Check open filename arg using perf trace + vfs_getname: Ok
+  #
+
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Taeung Song <treeze.taeung@gmail.com>
+Link: https://lkml.kernel.org/n/tip-3up27pexg5i3exuzqrvt4m8u@git.kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/tests/shell/trace+probe_vfs_getname.sh | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/tools/perf/tests/shell/trace+probe_vfs_getname.sh b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
+index 2a9ef080efd02..a8a516dec4ed2 100755
+--- a/tools/perf/tests/shell/trace+probe_vfs_getname.sh
++++ b/tools/perf/tests/shell/trace+probe_vfs_getname.sh
+@@ -30,6 +30,10 @@ if [ $err -ne 0 ] ; then
+       exit $err
+ fi
++# Do not use whatever ~/.perfconfig file, it may change the output
++# via trace.{show_timestamp,show_prefix,etc}
++export PERF_CONFIG=/dev/null
++
+ trace_open_vfs_getname
+ err=$?
+ rm -f ${file}
+-- 
+2.20.1
+
diff --git a/queue-4.14/perf-trace-beauty-ioctl-fix-off-by-one-error-in-cmd-.patch b/queue-4.14/perf-trace-beauty-ioctl-fix-off-by-one-error-in-cmd-.patch
new file mode 100644 (file)
index 0000000..80f95f0
--- /dev/null
@@ -0,0 +1,84 @@
+From e59dd21e6c32afa204c236d91760f0f288c2186f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Aug 2019 20:36:25 -0700
+Subject: perf trace beauty ioctl: Fix off-by-one error in cmd->string table
+
+From: Benjamin Peterson <benjamin@python.org>
+
+[ Upstream commit b92675f4a9c02dd78052645597dac9e270679ddf ]
+
+While tracing a program that calls isatty(3), I noticed that strace
+reported TCGETS for the request argument of the underlying ioctl(2)
+syscall while perf trace reported TCSETS. strace is corrrect. The bug in
+perf was due to the tty ioctl beauty table starting at 0x5400 rather
+than 0x5401.
+
+Committer testing:
+
+  Using augmented_raw_syscalls.o and settings to make 'perf trace'
+  use strace formatting, i.e. with this in ~/.perfconfig
+
+  # cat ~/.perfconfig
+  [trace]
+       add_events = /home/acme/git/linux/tools/perf/examples/bpf/augmented_raw_syscalls.c
+       show_zeros = yes
+       show_duration = no
+       no_inherit = yes
+       show_timestamp = no
+       show_arg_names = no
+       args_alignment = 40
+       show_prefix = yes
+
+  # strace -e ioctl stty > /dev/null
+  ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
+  ioctl(1, TIOCGWINSZ, 0x7fff8a9b0860)    = -1 ENOTTY (Inappropriate ioctl for device)
+  ioctl(1, TCGETS, 0x7fff8a9b0540)        = -1 ENOTTY (Inappropriate ioctl for device)
+  +++ exited with 0 +++
+  #
+
+Before:
+
+  # perf trace -e ioctl stty > /dev/null
+  ioctl(0, TCSETS, 0x7fff2cf79f20)        = 0
+  ioctl(1, TIOCSWINSZ, 0x7fff2cf79f40)    = -1 ENOTTY (Inappropriate ioctl for device)
+  ioctl(1, TCSETS, 0x7fff2cf79c20)        = -1 ENOTTY (Inappropriate ioctl for device)
+  #
+
+After:
+
+  # perf trace -e ioctl stty > /dev/null
+  ioctl(0, TCGETS, 0x7ffed0763920)        = 0
+  ioctl(1, TIOCGWINSZ, 0x7ffed0763940)    = -1 ENOTTY (Inappropriate ioctl for device)
+  ioctl(1, TCGETS, 0x7ffed0763620)        = -1 ENOTTY (Inappropriate ioctl for device)
+  #
+
+Signed-off-by: Benjamin Peterson <benjamin@python.org>
+Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Jiri Olsa <jolsa@redhat.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Fixes: 1cc47f2d46206d67285aea0ca7e8450af571da13 ("perf trace beauty ioctl: Improve 'cmd' beautifier")
+Link: http://lkml.kernel.org/r/20190823033625.18814-1-benjamin@python.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/trace/beauty/ioctl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/perf/trace/beauty/ioctl.c b/tools/perf/trace/beauty/ioctl.c
+index 1be3b4cf08270..82346ca06f171 100644
+--- a/tools/perf/trace/beauty/ioctl.c
++++ b/tools/perf/trace/beauty/ioctl.c
+@@ -22,7 +22,7 @@
+ static size_t ioctl__scnprintf_tty_cmd(int nr, int dir, char *bf, size_t size)
+ {
+       static const char *ioctl_tty_cmd[] = {
+-      "TCGETS", "TCSETS", "TCSETSW", "TCSETSF", "TCGETA", "TCSETA", "TCSETAW",
++      [_IOC_NR(TCGETS)] = "TCGETS", "TCSETS", "TCSETSW", "TCSETSF", "TCGETA", "TCSETA", "TCSETAW",
+       "TCSETAF", "TCSBRK", "TCXONC", "TCFLSH", "TIOCEXCL", "TIOCNXCL", "TIOCSCTTY",
+       "TIOCGPGRP", "TIOCSPGRP", "TIOCOUTQ", "TIOCSTI", "TIOCGWINSZ", "TIOCSWINSZ",
+       "TIOCMGET", "TIOCMBIS", "TIOCMBIC", "TIOCMSET", "TIOCGSOFTCAR", "TIOCSSOFTCAR",
+-- 
+2.20.1
+
diff --git a/queue-4.14/pm-devfreq-exynos-bus-correct-clock-enable-sequence.patch b/queue-4.14/pm-devfreq-exynos-bus-correct-clock-enable-sequence.patch
new file mode 100644 (file)
index 0000000..8cfee6a
--- /dev/null
@@ -0,0 +1,101 @@
+From 0bbd9e5cb31898b1d9d0b3a0a799a4d0ec414854 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Aug 2019 15:38:35 +0200
+Subject: PM / devfreq: exynos-bus: Correct clock enable sequence
+
+From: Kamil Konieczny <k.konieczny@partner.samsung.com>
+
+[ Upstream commit 2c2b20e0da89c76759ee28c6824413ab2fa3bfc6 ]
+
+Regulators should be enabled before clocks to avoid h/w hang. This
+require change in exynos_bus_probe() to move exynos_bus_parse_of()
+after exynos_bus_parent_parse_of() and change in error handling.
+Similar change is needed in exynos_bus_exit() where clock should be
+disabled before regulators.
+
+Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com>
+Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
+Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/devfreq/exynos-bus.c | 31 +++++++++++++++++--------------
+ 1 file changed, 17 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
+index 49f68929e024f..25ff31eb1044c 100644
+--- a/drivers/devfreq/exynos-bus.c
++++ b/drivers/devfreq/exynos-bus.c
+@@ -194,11 +194,10 @@ static void exynos_bus_exit(struct device *dev)
+       if (ret < 0)
+               dev_warn(dev, "failed to disable the devfreq-event devices\n");
+-      if (bus->regulator)
+-              regulator_disable(bus->regulator);
+-
+       dev_pm_opp_of_remove_table(dev);
+       clk_disable_unprepare(bus->clk);
++      if (bus->regulator)
++              regulator_disable(bus->regulator);
+ }
+ /*
+@@ -386,6 +385,7 @@ static int exynos_bus_probe(struct platform_device *pdev)
+       struct exynos_bus *bus;
+       int ret, max_state;
+       unsigned long min_freq, max_freq;
++      bool passive = false;
+       if (!np) {
+               dev_err(dev, "failed to find devicetree node\n");
+@@ -399,27 +399,27 @@ static int exynos_bus_probe(struct platform_device *pdev)
+       bus->dev = &pdev->dev;
+       platform_set_drvdata(pdev, bus);
+-      /* Parse the device-tree to get the resource information */
+-      ret = exynos_bus_parse_of(np, bus);
+-      if (ret < 0)
+-              return ret;
+-
+       profile = devm_kzalloc(dev, sizeof(*profile), GFP_KERNEL);
+-      if (!profile) {
+-              ret = -ENOMEM;
+-              goto err;
+-      }
++      if (!profile)
++              return -ENOMEM;
+       node = of_parse_phandle(dev->of_node, "devfreq", 0);
+       if (node) {
+               of_node_put(node);
+-              goto passive;
++              passive = true;
+       } else {
+               ret = exynos_bus_parent_parse_of(np, bus);
++              if (ret < 0)
++                      return ret;
+       }
++      /* Parse the device-tree to get the resource information */
++      ret = exynos_bus_parse_of(np, bus);
+       if (ret < 0)
+-              goto err;
++              goto err_reg;
++
++      if (passive)
++              goto passive;
+       /* Initialize the struct profile and governor data for parent device */
+       profile->polling_ms = 50;
+@@ -509,6 +509,9 @@ static int exynos_bus_probe(struct platform_device *pdev)
+ err:
+       dev_pm_opp_of_remove_table(dev);
+       clk_disable_unprepare(bus->clk);
++err_reg:
++      if (!passive)
++              regulator_disable(bus->regulator);
+       return ret;
+ }
+-- 
+2.20.1
+
diff --git a/queue-4.14/pm-devfreq-passive-fix-compiler-warning.patch b/queue-4.14/pm-devfreq-passive-fix-compiler-warning.patch
new file mode 100644 (file)
index 0000000..b04eedb
--- /dev/null
@@ -0,0 +1,35 @@
+From 2a64025ee2dc239f037aea02e2e2d25911d50115 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 26 Aug 2019 21:37:37 +0900
+Subject: PM / devfreq: passive: fix compiler warning
+
+From: MyungJoo Ham <myungjoo.ham@samsung.com>
+
+[ Upstream commit 0465814831a926ce2f83e8f606d067d86745234e ]
+
+The recent commit of
+PM / devfreq: passive: Use non-devm notifiers
+had incurred compiler warning, "unused variable 'dev'".
+
+Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
+Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/devfreq/governor_passive.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c
+index 4222d3c1efb98..d2ebdb7fd7518 100644
+--- a/drivers/devfreq/governor_passive.c
++++ b/drivers/devfreq/governor_passive.c
+@@ -152,7 +152,6 @@ static int devfreq_passive_notifier_call(struct notifier_block *nb,
+ static int devfreq_passive_event_handler(struct devfreq *devfreq,
+                               unsigned int event, void *data)
+ {
+-      struct device *dev = devfreq->dev.parent;
+       struct devfreq_passive_data *p_data
+                       = (struct devfreq_passive_data *)devfreq->data;
+       struct devfreq *parent = (struct devfreq *)p_data->parent;
+-- 
+2.20.1
+
diff --git a/queue-4.14/pm-devfreq-passive-use-non-devm-notifiers.patch b/queue-4.14/pm-devfreq-passive-use-non-devm-notifiers.patch
new file mode 100644 (file)
index 0000000..914afe9
--- /dev/null
@@ -0,0 +1,69 @@
+From 0b6e6464cb006d40ebff9f87f36e504eb087634f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 8 Aug 2019 19:54:08 +0300
+Subject: PM / devfreq: passive: Use non-devm notifiers
+
+From: Leonard Crestez <leonard.crestez@nxp.com>
+
+[ Upstream commit 0ef7c7cce43f6ecc2b96d447e69b2900a9655f7c ]
+
+The devfreq passive governor registers and unregisters devfreq
+transition notifiers on DEVFREQ_GOV_START/GOV_STOP using devm wrappers.
+
+If devfreq itself is registered with devm then a warning is triggered on
+rmmod from devm_devfreq_unregister_notifier. Call stack looks like this:
+
+       devm_devfreq_unregister_notifier+0x30/0x40
+       devfreq_passive_event_handler+0x4c/0x88
+       devfreq_remove_device.part.8+0x6c/0x9c
+       devm_devfreq_dev_release+0x18/0x20
+       release_nodes+0x1b0/0x220
+       devres_release_all+0x78/0x84
+       device_release_driver_internal+0x100/0x1c0
+       driver_detach+0x4c/0x90
+       bus_remove_driver+0x7c/0xd0
+       driver_unregister+0x2c/0x58
+       platform_driver_unregister+0x10/0x18
+       imx_devfreq_platdrv_exit+0x14/0xd40 [imx_devfreq]
+
+This happens because devres_release_all will first remove all the nodes
+into a separate todo list so the nested devres_release from
+devm_devfreq_unregister_notifier won't find anything.
+
+Fix the warning by calling the non-devm APIS for frequency notification.
+Using devm wrappers is not actually useful for a governor anyway: it
+relies on the devfreq core to correctly match the GOV_START/GOV_STOP
+notifications.
+
+Fixes: 996133119f57 ("PM / devfreq: Add new passive governor")
+Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
+Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
+Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/devfreq/governor_passive.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c
+index 673ad8cc9a1d0..4222d3c1efb98 100644
+--- a/drivers/devfreq/governor_passive.c
++++ b/drivers/devfreq/governor_passive.c
+@@ -168,12 +168,12 @@ static int devfreq_passive_event_handler(struct devfreq *devfreq,
+                       p_data->this = devfreq;
+               nb->notifier_call = devfreq_passive_notifier_call;
+-              ret = devm_devfreq_register_notifier(dev, parent, nb,
++              ret = devfreq_register_notifier(parent, nb,
+                                       DEVFREQ_TRANSITION_NOTIFIER);
+               break;
+       case DEVFREQ_GOV_STOP:
+-              devm_devfreq_unregister_notifier(dev, parent, nb,
+-                                      DEVFREQ_TRANSITION_NOTIFIER);
++              WARN_ON(devfreq_unregister_notifier(parent, nb,
++                                      DEVFREQ_TRANSITION_NOTIFIER));
+               break;
+       default:
+               break;
+-- 
+2.20.1
+
diff --git a/queue-4.14/raid5-don-t-increment-read_errors-on-eilseq-return.patch b/queue-4.14/raid5-don-t-increment-read_errors-on-eilseq-return.patch
new file mode 100644 (file)
index 0000000..2f42270
--- /dev/null
@@ -0,0 +1,46 @@
+From fb06e7228d3d737d7d27415e37acfbb626a4f821 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 6 Sep 2019 09:21:33 -0400
+Subject: raid5: don't increment read_errors on EILSEQ return
+
+From: Nigel Croxon <ncroxon@redhat.com>
+
+[ Upstream commit b76b4715eba0d0ed574f58918b29c1b2f0fa37a8 ]
+
+While MD continues to count read errors returned by the lower layer.
+If those errors are -EILSEQ, instead of -EIO, it should NOT increase
+the read_errors count.
+
+When RAID6 is set up on dm-integrity target that detects massive
+corruption, the leg will be ejected from the array.  Even if the
+issue is correctable with a sector re-write and the array has
+necessary redundancy to correct it.
+
+The leg is ejected because it runs up the rdev->read_errors beyond
+conf->max_nr_stripes.  The return status in dm-drypt when there is
+a data integrity error is -EILSEQ (BLK_STS_PROTECTION).
+
+Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
+Signed-off-by: Song Liu <songliubraving@fb.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/md/raid5.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
+index cc0bd528136db..9f2059e185f7f 100644
+--- a/drivers/md/raid5.c
++++ b/drivers/md/raid5.c
+@@ -2538,7 +2538,8 @@ static void raid5_end_read_request(struct bio * bi)
+               int set_bad = 0;
+               clear_bit(R5_UPTODATE, &sh->dev[i].flags);
+-              atomic_inc(&rdev->read_errors);
++              if (!(bi->bi_status == BLK_STS_PROTECTION))
++                      atomic_inc(&rdev->read_errors);
+               if (test_bit(R5_ReadRepl, &sh->dev[i].flags))
+                       pr_warn_ratelimited(
+                               "md/raid:%s: read error on replacement device (sector %llu on %s).\n",
+-- 
+2.20.1
+
diff --git a/queue-4.14/raid5-don-t-set-stripe_handle-to-stripe-which-is-in-.patch b/queue-4.14/raid5-don-t-set-stripe_handle-to-stripe-which-is-in-.patch
new file mode 100644 (file)
index 0000000..b376c8f
--- /dev/null
@@ -0,0 +1,75 @@
+From 213a963f273616994f4fefa36c67af6d4fb4f2ee Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 11 Sep 2019 10:06:29 +0200
+Subject: raid5: don't set STRIPE_HANDLE to stripe which is in batch list
+
+From: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
+
+[ Upstream commit 6ce220dd2f8ea71d6afc29b9a7524c12e39f374a ]
+
+If stripe in batch list is set with STRIPE_HANDLE flag, then the stripe
+could be set with STRIPE_ACTIVE by the handle_stripe function. And if
+error happens to the batch_head at the same time, break_stripe_batch_list
+is called, then below warning could happen (the same report in [1]), it
+means a member of batch list was set with STRIPE_ACTIVE.
+
+[7028915.431770] stripe state: 2001
+[7028915.431815] ------------[ cut here ]------------
+[7028915.431828] WARNING: CPU: 18 PID: 29089 at drivers/md/raid5.c:4614 break_stripe_batch_list+0x203/0x240 [raid456]
+[...]
+[7028915.431879] CPU: 18 PID: 29089 Comm: kworker/u82:5 Tainted: G           O    4.14.86-1-storage #4.14.86-1.2~deb9
+[7028915.431881] Hardware name: Supermicro SSG-2028R-ACR24L/X10DRH-iT, BIOS 3.1 06/18/2018
+[7028915.431888] Workqueue: raid5wq raid5_do_work [raid456]
+[7028915.431890] task: ffff9ab0ef36d7c0 task.stack: ffffb72926f84000
+[7028915.431896] RIP: 0010:break_stripe_batch_list+0x203/0x240 [raid456]
+[7028915.431898] RSP: 0018:ffffb72926f87ba8 EFLAGS: 00010286
+[7028915.431900] RAX: 0000000000000012 RBX: ffff9aaa84a98000 RCX: 0000000000000000
+[7028915.431901] RDX: 0000000000000000 RSI: ffff9ab2bfa15458 RDI: ffff9ab2bfa15458
+[7028915.431902] RBP: ffff9aaa8fb4e900 R08: 0000000000000001 R09: 0000000000002eb4
+[7028915.431903] R10: 00000000ffffffff R11: 0000000000000000 R12: ffff9ab1736f1b00
+[7028915.431904] R13: 0000000000000000 R14: ffff9aaa8fb4e900 R15: 0000000000000001
+[7028915.431906] FS:  0000000000000000(0000) GS:ffff9ab2bfa00000(0000) knlGS:0000000000000000
+[7028915.431907] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[7028915.431908] CR2: 00007ff953b9f5d8 CR3: 0000000bf4009002 CR4: 00000000003606e0
+[7028915.431909] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+[7028915.431910] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+[7028915.431910] Call Trace:
+[7028915.431923]  handle_stripe+0x8e7/0x2020 [raid456]
+[7028915.431930]  ? __wake_up_common_lock+0x89/0xc0
+[7028915.431935]  handle_active_stripes.isra.58+0x35f/0x560 [raid456]
+[7028915.431939]  raid5_do_work+0xc6/0x1f0 [raid456]
+
+Also commit 59fc630b8b5f9f ("RAID5: batch adjacent full stripe write")
+said "If a stripe is added to batch list, then only the first stripe
+of the list should be put to handle_list and run handle_stripe."
+
+So don't set STRIPE_HANDLE to stripe which is already in batch list,
+otherwise the stripe could be put to handle_list and run handle_stripe,
+then the above warning could be triggered.
+
+[1]. https://www.spinics.net/lists/raid/msg62552.html
+
+Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
+Signed-off-by: Song Liu <songliubraving@fb.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/md/raid5.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
+index 65608c6b68361..cc0bd528136db 100644
+--- a/drivers/md/raid5.c
++++ b/drivers/md/raid5.c
+@@ -5718,7 +5718,8 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi)
+                               do_flush = false;
+                       }
+-                      set_bit(STRIPE_HANDLE, &sh->state);
++                      if (!sh->batch_head)
++                              set_bit(STRIPE_HANDLE, &sh->state);
+                       clear_bit(STRIPE_DELAYED, &sh->state);
+                       if ((!sh->batch_head || sh == sh->batch_head) &&
+                           (bi->bi_opf & REQ_SYNC) &&
+-- 
+2.20.1
+
diff --git a/queue-4.14/ras-fix-prototype-warnings.patch b/queue-4.14/ras-fix-prototype-warnings.patch
new file mode 100644 (file)
index 0000000..38858e9
--- /dev/null
@@ -0,0 +1,73 @@
+From 0e45bff82eb795dec8fb99b2a518c428c634b370 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 7 Aug 2019 18:59:29 -0400
+Subject: RAS: Fix prototype warnings
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Valdis KlÄ“tnieks <valdis.kletnieks@vt.edu>
+
+[ Upstream commit 0a54b809a3a2c31e1055b45b03708eb730222be1 ]
+
+When building with C=2 and/or W=1, legitimate warnings are issued about
+missing prototypes:
+
+    CHECK   drivers/ras/debugfs.c
+  drivers/ras/debugfs.c:4:15: warning: symbol 'ras_debugfs_dir' was not declared. Should it be static?
+  drivers/ras/debugfs.c:8:5: warning: symbol 'ras_userspace_consumers' was not declared. Should it be static?
+  drivers/ras/debugfs.c:38:12: warning: symbol 'ras_add_daemon_trace' was not declared. Should it be static?
+  drivers/ras/debugfs.c:54:13: warning: symbol 'ras_debugfs_init' was not declared. Should it be static?
+    CC      drivers/ras/debugfs.o
+  drivers/ras/debugfs.c:8:5: warning: no previous prototype for 'ras_userspace_consumers' [-Wmissing-prototypes]
+      8 | int ras_userspace_consumers(void)
+        |     ^~~~~~~~~~~~~~~~~~~~~~~
+  drivers/ras/debugfs.c:38:12: warning: no previous prototype for 'ras_add_daemon_trace' [-Wmissing-prototypes]
+     38 | int __init ras_add_daemon_trace(void)
+        |            ^~~~~~~~~~~~~~~~~~~~
+  drivers/ras/debugfs.c:54:13: warning: no previous prototype for 'ras_debugfs_init' [-Wmissing-prototypes]
+     54 | void __init ras_debugfs_init(void)
+        |             ^~~~~~~~~~~~~~~~
+
+Provide the proper includes.
+
+ [ bp: Take care of the same warnings for cec.c too. ]
+
+Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Tony Luck <tony.luck@intel.com>
+Cc: linux-edac@vger.kernel.org
+Cc: x86@kernel.org
+Link: http://lkml.kernel.org/r/7168.1565218769@turing-police
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/ras/cec.c     | 1 +
+ drivers/ras/debugfs.c | 2 ++
+ 2 files changed, 3 insertions(+)
+
+diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
+index 97cf40a522be3..02e65bdbadcae 100644
+--- a/drivers/ras/cec.c
++++ b/drivers/ras/cec.c
+@@ -1,6 +1,7 @@
+ // SPDX-License-Identifier: GPL-2.0
+ #include <linux/mm.h>
+ #include <linux/gfp.h>
++#include <linux/ras.h>
+ #include <linux/kernel.h>
+ #include <asm/mce.h>
+diff --git a/drivers/ras/debugfs.c b/drivers/ras/debugfs.c
+index 501603057dffe..12a161377f4f8 100644
+--- a/drivers/ras/debugfs.c
++++ b/drivers/ras/debugfs.c
+@@ -1,4 +1,6 @@
+ #include <linux/debugfs.h>
++#include <linux/ras.h>
++#include "debugfs.h"
+ struct dentry *ras_debugfs_dir;
+-- 
+2.20.1
+
diff --git a/queue-4.14/regulator-lm363x-fix-off-by-one-n_voltages-for-lm363.patch b/queue-4.14/regulator-lm363x-fix-off-by-one-n_voltages-for-lm363.patch
new file mode 100644 (file)
index 0000000..256d5f1
--- /dev/null
@@ -0,0 +1,53 @@
+From e7fac05f8019801be7b724d680aa2cd35d0c8dff Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 26 Jun 2019 21:26:31 +0800
+Subject: regulator: lm363x: Fix off-by-one n_voltages for lm3632
+ ldo_vpos/ldo_vneg
+
+From: Axel Lin <axel.lin@ingics.com>
+
+[ Upstream commit 1e2cc8c5e0745b545d4974788dc606d678b6e564 ]
+
+According to the datasheet https://www.ti.com/lit/ds/symlink/lm3632a.pdf
+Table 20. VPOS Bias Register Field Descriptions VPOS[5:0]
+Sets the Positive Display Bias (LDO) Voltage (50 mV per step)
+000000: 4 V
+000001: 4.05 V
+000010: 4.1 V
+....................
+011101: 5.45 V
+011110: 5.5 V (Default)
+011111: 5.55 V
+....................
+100111: 5.95 V
+101000: 6 V
+Note: Codes 101001 to 111111 map to 6 V
+
+The LM3632_LDO_VSEL_MAX should be 0b101000 (0x28), so the maximum voltage
+can match the datasheet.
+
+Fixes: 3a8d1a73a037 ("regulator: add LM363X driver")
+Signed-off-by: Axel Lin <axel.lin@ingics.com>
+Link: https://lore.kernel.org/r/20190626132632.32629-1-axel.lin@ingics.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/lm363x-regulator.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/regulator/lm363x-regulator.c b/drivers/regulator/lm363x-regulator.c
+index ce5f7d9ad475f..30f576a5daf18 100644
+--- a/drivers/regulator/lm363x-regulator.c
++++ b/drivers/regulator/lm363x-regulator.c
+@@ -33,7 +33,7 @@
+ /* LM3632 */
+ #define LM3632_BOOST_VSEL_MAX         0x26
+-#define LM3632_LDO_VSEL_MAX           0x29
++#define LM3632_LDO_VSEL_MAX           0x28
+ #define LM3632_VBOOST_MIN             4500000
+ #define LM3632_VLDO_MIN                       4000000
+-- 
+2.20.1
+
diff --git a/queue-4.14/s390-crypto-xts-aes-s390-fix-extra-run-time-crypto-s.patch b/queue-4.14/s390-crypto-xts-aes-s390-fix-extra-run-time-crypto-s.patch
new file mode 100644 (file)
index 0000000..b13b653
--- /dev/null
@@ -0,0 +1,56 @@
+From 09eb25e057b2c0d97d96af9ba2a3730aaaf3fd09 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 5 Sep 2019 09:38:17 +0200
+Subject: s390/crypto: xts-aes-s390 fix extra run-time crypto self tests
+ finding
+
+From: Harald Freudenberger <freude@linux.ibm.com>
+
+[ Upstream commit 9e323d45ba94262620a073a3f9945ca927c07c71 ]
+
+With 'extra run-time crypto self tests' enabled, the selftest
+for s390-xts fails with
+
+  alg: skcipher: xts-aes-s390 encryption unexpectedly succeeded on
+  test vector "random: len=0 klen=64"; expected_error=-22,
+  cfg="random: inplace use_digest nosimd src_divs=[2.61%@+4006,
+  84.44%@+21, 1.55%@+13, 4.50%@+344, 4.26%@+21, 2.64%@+27]"
+
+This special case with nbytes=0 is not handled correctly and this
+fix now makes sure that -EINVAL is returned when there is en/decrypt
+called with 0 bytes to en/decrypt.
+
+Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
+Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/s390/crypto/aes_s390.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
+index 591cbdf615af0..1a906dd7ca7d9 100644
+--- a/arch/s390/crypto/aes_s390.c
++++ b/arch/s390/crypto/aes_s390.c
+@@ -572,6 +572,9 @@ static int xts_aes_encrypt(struct blkcipher_desc *desc,
+       struct s390_xts_ctx *xts_ctx = crypto_blkcipher_ctx(desc->tfm);
+       struct blkcipher_walk walk;
++      if (!nbytes)
++              return -EINVAL;
++
+       if (unlikely(!xts_ctx->fc))
+               return xts_fallback_encrypt(desc, dst, src, nbytes);
+@@ -586,6 +589,9 @@ static int xts_aes_decrypt(struct blkcipher_desc *desc,
+       struct s390_xts_ctx *xts_ctx = crypto_blkcipher_ctx(desc->tfm);
+       struct blkcipher_walk walk;
++      if (!nbytes)
++              return -EINVAL;
++
+       if (unlikely(!xts_ctx->fc))
+               return xts_fallback_decrypt(desc, dst, src, nbytes);
+-- 
+2.20.1
+
diff --git a/queue-4.14/sched-core-fix-cpu-controller-for-rt_group_sched.patch b/queue-4.14/sched-core-fix-cpu-controller-for-rt_group_sched.patch
new file mode 100644 (file)
index 0000000..c08616a
--- /dev/null
@@ -0,0 +1,84 @@
+From 2f436329e81bd54d9a2e2a718c26de2359f0f17c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 19 Jul 2019 08:34:55 +0200
+Subject: sched/core: Fix CPU controller for !RT_GROUP_SCHED
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Juri Lelli <juri.lelli@redhat.com>
+
+[ Upstream commit a07db5c0865799ebed1f88be0df50c581fb65029 ]
+
+On !CONFIG_RT_GROUP_SCHED configurations it is currently not possible to
+move RT tasks between cgroups to which CPU controller has been attached;
+but it is oddly possible to first move tasks around and then make them
+RT (setschedule to FIFO/RR).
+
+E.g.:
+
+  # mkdir /sys/fs/cgroup/cpu,cpuacct/group1
+  # chrt -fp 10 $$
+  # echo $$ > /sys/fs/cgroup/cpu,cpuacct/group1/tasks
+  bash: echo: write error: Invalid argument
+  # chrt -op 0 $$
+  # echo $$ > /sys/fs/cgroup/cpu,cpuacct/group1/tasks
+  # chrt -fp 10 $$
+  # cat /sys/fs/cgroup/cpu,cpuacct/group1/tasks
+  2345
+  2598
+  # chrt -p 2345
+  pid 2345's current scheduling policy: SCHED_FIFO
+  pid 2345's current scheduling priority: 10
+
+Also, as Michal noted, it is currently not possible to enable CPU
+controller on unified hierarchy with !CONFIG_RT_GROUP_SCHED (if there
+are any kernel RT threads in root cgroup, they can't be migrated to the
+newly created CPU controller's root in cgroup_update_dfl_csses()).
+
+Existing code comes with a comment saying the "we don't support RT-tasks
+being in separate groups". Such comment is however stale and belongs to
+pre-RT_GROUP_SCHED times. Also, it doesn't make much sense for
+!RT_GROUP_ SCHED configurations, since checks related to RT bandwidth
+are not performed at all in these cases.
+
+Make moving RT tasks between CPU controller groups viable by removing
+special case check for RT (and DEADLINE) tasks.
+
+Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Reviewed-by: Michal Koutný <mkoutny@suse.com>
+Reviewed-by: Daniel Bristot de Oliveira <bristot@redhat.com>
+Acked-by: Tejun Heo <tj@kernel.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: lizefan@huawei.com
+Cc: longman@redhat.com
+Cc: luca.abeni@santannapisa.it
+Cc: rostedt@goodmis.org
+Link: https://lkml.kernel.org/r/20190719063455.27328-1-juri.lelli@redhat.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/sched/core.c | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c
+index ff128e281d1c6..3d24d401b9d42 100644
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -6342,10 +6342,6 @@ static int cpu_cgroup_can_attach(struct cgroup_taskset *tset)
+ #ifdef CONFIG_RT_GROUP_SCHED
+               if (!sched_rt_can_attach(css_tg(css), task))
+                       return -EINVAL;
+-#else
+-              /* We don't support RT-tasks being in separate groups */
+-              if (task->sched_class != &fair_sched_class)
+-                      return -EINVAL;
+ #endif
+               /*
+                * Serialize against wake_up_new_task() such that if its
+-- 
+2.20.1
+
diff --git a/queue-4.14/sched-fair-fix-imbalance-due-to-cpu-affinity.patch b/queue-4.14/sched-fair-fix-imbalance-due-to-cpu-affinity.patch
new file mode 100644 (file)
index 0000000..f025d8e
--- /dev/null
@@ -0,0 +1,66 @@
+From 3750345faaaf4804a2d7e8f848d8b20e3ed55959 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Jul 2019 17:47:02 +0200
+Subject: sched/fair: Fix imbalance due to CPU affinity
+
+From: Vincent Guittot <vincent.guittot@linaro.org>
+
+[ Upstream commit f6cad8df6b30a5d2bbbd2e698f74b4cafb9fb82b ]
+
+The load_balance() has a dedicated mecanism to detect when an imbalance
+is due to CPU affinity and must be handled at parent level. In this case,
+the imbalance field of the parent's sched_group is set.
+
+The description of sg_imbalanced() gives a typical example of two groups
+of 4 CPUs each and 4 tasks each with a cpumask covering 1 CPU of the first
+group and 3 CPUs of the second group. Something like:
+
+       { 0 1 2 3 } { 4 5 6 7 }
+               *     * * *
+
+But the load_balance fails to fix this UC on my octo cores system
+made of 2 clusters of quad cores.
+
+Whereas the load_balance is able to detect that the imbalanced is due to
+CPU affinity, it fails to fix it because the imbalance field is cleared
+before letting parent level a chance to run. In fact, when the imbalance is
+detected, the load_balance reruns without the CPU with pinned tasks. But
+there is no other running tasks in the situation described above and
+everything looks balanced this time so the imbalance field is immediately
+cleared.
+
+The imbalance field should not be cleared if there is no other task to move
+when the imbalance is detected.
+
+Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: https://lkml.kernel.org/r/1561996022-28829-1-git-send-email-vincent.guittot@linaro.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/sched/fair.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
+index c298d47888ed8..808db3566ddbc 100644
+--- a/kernel/sched/fair.c
++++ b/kernel/sched/fair.c
+@@ -8359,9 +8359,10 @@ static int load_balance(int this_cpu, struct rq *this_rq,
+ out_balanced:
+       /*
+        * We reach balance although we may have faced some affinity
+-       * constraints. Clear the imbalance flag if it was set.
++       * constraints. Clear the imbalance flag only if other tasks got
++       * a chance to move and fix the imbalance.
+        */
+-      if (sd_parent) {
++      if (sd_parent && !(env.flags & LBF_ALL_PINNED)) {
+               int *group_imbalance = &sd_parent->groups->sgc->imbalance;
+               if (*group_imbalance)
+-- 
+2.20.1
+
diff --git a/queue-4.14/sched-fair-use-rq_lock-unlock-in-online_fair_sched_g.patch b/queue-4.14/sched-fair-use-rq_lock-unlock-in-online_fair_sched_g.patch
new file mode 100644 (file)
index 0000000..17ad7bb
--- /dev/null
@@ -0,0 +1,74 @@
+From dd968cc32f88354474519f7dd5043c4416b13223 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 1 Aug 2019 09:37:49 -0400
+Subject: sched/fair: Use rq_lock/unlock in online_fair_sched_group
+
+From: Phil Auld <pauld@redhat.com>
+
+[ Upstream commit a46d14eca7b75fffe35603aa8b81df654353d80f ]
+
+Enabling WARN_DOUBLE_CLOCK in /sys/kernel/debug/sched_features causes
+warning to fire in update_rq_clock. This seems to be caused by onlining
+a new fair sched group not using the rq lock wrappers.
+
+  [] rq->clock_update_flags & RQCF_UPDATED
+  [] WARNING: CPU: 5 PID: 54385 at kernel/sched/core.c:210 update_rq_clock+0xec/0x150
+
+  [] Call Trace:
+  []  online_fair_sched_group+0x53/0x100
+  []  cpu_cgroup_css_online+0x16/0x20
+  []  online_css+0x1c/0x60
+  []  cgroup_apply_control_enable+0x231/0x3b0
+  []  cgroup_mkdir+0x41b/0x530
+  []  kernfs_iop_mkdir+0x61/0xa0
+  []  vfs_mkdir+0x108/0x1a0
+  []  do_mkdirat+0x77/0xe0
+  []  do_syscall_64+0x55/0x1d0
+  []  entry_SYSCALL_64_after_hwframe+0x44/0xa9
+
+Using the wrappers in online_fair_sched_group instead of the raw locking
+removes this warning.
+
+[ tglx: Use rq_*lock_irq() ]
+
+Signed-off-by: Phil Auld <pauld@redhat.com>
+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Vincent Guittot <vincent.guittot@linaro.org>
+Cc: Ingo Molnar <mingo@kernel.org>
+Link: https://lkml.kernel.org/r/20190801133749.11033-1-pauld@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/sched/fair.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
+index 808db3566ddbc..55a33009f9a54 100644
+--- a/kernel/sched/fair.c
++++ b/kernel/sched/fair.c
+@@ -9423,18 +9423,18 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
+ void online_fair_sched_group(struct task_group *tg)
+ {
+       struct sched_entity *se;
++      struct rq_flags rf;
+       struct rq *rq;
+       int i;
+       for_each_possible_cpu(i) {
+               rq = cpu_rq(i);
+               se = tg->se[i];
+-
+-              raw_spin_lock_irq(&rq->lock);
++              rq_lock_irq(rq, &rf);
+               update_rq_clock(rq);
+               attach_entity_cfs_rq(se);
+               sync_throttle(tg, i);
+-              raw_spin_unlock_irq(&rq->lock);
++              rq_unlock_irq(rq, &rf);
+       }
+ }
+-- 
+2.20.1
+
index eac7df9d2efcd9e98d4a21227c0b0c4b929fa0b8..0bc32acc8a2113313fceb860e27d70caa7c78813 100644 (file)
@@ -50,3 +50,91 @@ appletalk-enforce-cap_net_raw-for-raw-sockets.patch
 ax25-enforce-cap_net_raw-for-raw-sockets.patch
 ieee802154-enforce-cap_net_raw-for-raw-sockets.patch
 nfc-enforce-cap_net_raw-for-raw-sockets.patch
+alsa-hda-flush-interrupts-on-disabling.patch
+regulator-lm363x-fix-off-by-one-n_voltages-for-lm363.patch
+asoc-sgtl5000-fix-charge-pump-source-assignment.patch
+dmaengine-bcm2835-print-error-in-case-setting-dma-ma.patch
+leds-leds-lp5562-allow-firmware-files-up-to-the-maxi.patch
+media-dib0700-fix-link-error-for-dibx000_i2c_set_spe.patch
+media-mtk-cir-lower-de-glitch-counter-for-rc-mm-prot.patch
+media-exynos4-is-fix-leaked-of_node-references.patch
+media-hdpvr-add-device-num-check-and-handling.patch
+media-i2c-ov5640-check-for-devm_gpiod_get_optional-e.patch
+sched-fair-fix-imbalance-due-to-cpu-affinity.patch
+sched-core-fix-cpu-controller-for-rt_group_sched.patch
+x86-reboot-always-use-nmi-fallback-when-shutdown-via.patch
+x86-apic-soft-disable-apic-before-initializing-it.patch
+alsa-hda-show-the-fatal-corb-rirb-error-more-clearly.patch
+alsa-i2c-ak4xxx-adda-fix-a-possible-null-pointer-der.patch
+edac-mc-fix-grain_bits-calculation.patch
+media-iguanair-add-sanity-checks.patch
+base-soc-export-soc_device_register-unregister-apis.patch
+alsa-usb-audio-skip-bsynchaddress-endpoint-check-if-.patch
+ia64-unwind-fix-double-free-for-mod-arch.init_unw_ta.patch
+edac-altera-use-the-proper-type-for-the-irq-status-b.patch
+asoc-rsnd-don-t-call-clk_get_rate-under-atomic-conte.patch
+md-raid1-end-bio-when-the-device-faulty.patch
+md-don-t-call-spare_active-in-md_reap_sync_thread-if.patch
+md-don-t-set-in_sync-if-array-is-frozen.patch
+ras-fix-prototype-warnings.patch
+acpi-processor-don-t-print-errors-for-processorids-0.patch
+edac-pnd2-fix-ioremap-size-in-dnv_rd_reg.patch
+efi-cper-print-aer-info-of-pcie-fatal-error.patch
+sched-fair-use-rq_lock-unlock-in-online_fair_sched_g.patch
+media-gspca-zero-usb_buf-on-error.patch
+perf-test-vfs_getname-disable-.perfconfig-to-get-def.patch
+media-mtk-mdp-fix-reference-count-on-old-device-tree.patch
+media-fdp1-reduce-fcp-not-found-message-level-to-deb.patch
+media-rc-imon-allow-imon-rc-protocol-for-ffdc-7e-dev.patch
+dmaengine-iop-adma-use-correct-printk-format-strings.patch
+perf-ftrace-use-cap_sys_admin-instead-of-euid-0.patch
+perf-record-support-aarch64-random-socket_id-assignm.patch
+media-i2c-ov5645-fix-power-sequence.patch
+media-omap3isp-don-t-set-streaming-state-on-random-s.patch
+media-imx-mipi-csi-2-don-t-fail-if-initial-state-tim.patch
+net-lpc-enet-fix-printk-format-strings.patch
+arm-dts-imx7d-cl-som-imx7-make-ethernet-work-again.patch
+media-radio-si470x-kill-urb-on-error.patch
+media-hdpvr-add-terminating-0-at-end-of-string.patch
+nbd-add-missing-config-put.patch
+media-dvb-core-fix-a-memory-leak-bug.patch
+libperf-fix-alignment-trap-with-xyarray-contents-in-.patch
+edac-amd64-recognize-dram-device-type-ecc-capability.patch
+edac-amd64-decode-syndrome-before-translating-addres.patch
+pm-devfreq-passive-use-non-devm-notifiers.patch
+pm-devfreq-exynos-bus-correct-clock-enable-sequence.patch
+media-cec-notifier-clear-cec_adap-in-cec_notifier_un.patch
+media-saa7146-add-cleanup-in-hexium_attach.patch
+media-cpia2_usb-fix-memory-leaks.patch
+media-saa7134-fix-terminology-around-saa7134_i2c_eep.patch
+perf-trace-beauty-ioctl-fix-off-by-one-error-in-cmd-.patch
+media-ov9650-add-a-sanity-check.patch
+asoc-es8316-fix-headphone-mixer-volume-table.patch
+acpi-cppc-do-not-require-the-_psd-method.patch
+arm64-kpti-ensure-patched-kernel-text-is-fetched-fro.patch
+nvmet-fix-data-units-read-and-written-counters-in-sm.patch
+iommu-amd-silence-warnings-under-memory-pressure.patch
+iommu-iova-avoid-false-sharing-on-fq_timer_on.patch
+libtraceevent-change-users-plugin-directory.patch
+arm-dts-exynos-mark-ldo10-as-always-on-on-peach-pit-.patch
+acpi-custom_method-fix-memory-leaks.patch
+acpi-pci-fix-acpi_pci_irq_enable-memory-leak.patch
+hwmon-acpi_power_meter-change-log-level-for-unsafe-s.patch
+md-raid1-fail-run-raid1-array-when-active-disk-less-.patch
+dmaengine-ti-edma-do-not-reset-reserved-param-slots.patch
+kprobes-prohibit-probing-on-bug-and-warn-address.patch
+s390-crypto-xts-aes-s390-fix-extra-run-time-crypto-s.patch
+asoc-dmaengine-make-the-pcm-name-equal-to-pcm-id-if-.patch
+raid5-don-t-set-stripe_handle-to-stripe-which-is-in-.patch
+mmc-core-clarify-sdio_irq_pending-flag-for-mmc_cap2_.patch
+mmc-sdhci-fix-incorrect-switch-to-hs-mode.patch
+raid5-don-t-increment-read_errors-on-eilseq-return.patch
+libertas-add-missing-sentinel-at-end-of-if_usb.c-fw_.patch
+e1000e-add-workaround-for-possible-stalled-packet.patch
+alsa-hda-drop-unsol-event-handler-for-intel-hdmi-cod.patch
+drm-amd-powerplay-smu7-enforce-minimal-vbitimeout-v2.patch
+media-ttusb-dec-fix-info-leak-in-ttusb_dec_send_comm.patch
+alsa-hda-realtek-blacklist-pc-beep-for-lenovo-thinkc.patch
+btrfs-extent-tree-make-sure-we-only-allocate-extents.patch
+media-omap3isp-set-device-on-omap3isp-subdevs.patch
+pm-devfreq-passive-fix-compiler-warning.patch
diff --git a/queue-4.14/x86-apic-soft-disable-apic-before-initializing-it.patch b/queue-4.14/x86-apic-soft-disable-apic-before-initializing-it.patch
new file mode 100644 (file)
index 0000000..2dda288
--- /dev/null
@@ -0,0 +1,47 @@
+From db634dc19af201ad2b5e9282742dc9e2c002c4d3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 22 Jul 2019 20:47:08 +0200
+Subject: x86/apic: Soft disable APIC before initializing it
+
+From: Thomas Gleixner <tglx@linutronix.de>
+
+[ Upstream commit 2640da4cccf5cc613bf26f0998b9e340f4b5f69c ]
+
+If the APIC was already enabled on entry of setup_local_APIC() then
+disabling it soft via the SPIV register makes a lot of sense.
+
+That masks all LVT entries and brings it into a well defined state.
+
+Otherwise previously enabled LVTs which are not touched in the setup
+function stay unmasked and might surprise the just booting kernel.
+
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
+Link: https://lkml.kernel.org/r/20190722105219.068290579@linutronix.de
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/kernel/apic/apic.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
+index f8f9cfded97d3..ea2de324ab021 100644
+--- a/arch/x86/kernel/apic/apic.c
++++ b/arch/x86/kernel/apic/apic.c
+@@ -1384,6 +1384,14 @@ void setup_local_APIC(void)
+               return;
+       }
++      /*
++       * If this comes from kexec/kcrash the APIC might be enabled in
++       * SPIV. Soft disable it before doing further initialization.
++       */
++      value = apic_read(APIC_SPIV);
++      value &= ~APIC_SPIV_APIC_ENABLED;
++      apic_write(APIC_SPIV, value);
++
+ #ifdef CONFIG_X86_32
+       /* Pound the ESR really hard over the head with a big hammer - mbligh */
+       if (lapic_is_integrated() && apic->disable_esr) {
+-- 
+2.20.1
+
diff --git a/queue-4.14/x86-reboot-always-use-nmi-fallback-when-shutdown-via.patch b/queue-4.14/x86-reboot-always-use-nmi-fallback-when-shutdown-via.patch
new file mode 100644 (file)
index 0000000..ea306bb
--- /dev/null
@@ -0,0 +1,129 @@
+From da93bf84667c7c4ebc0a7d2393e8f4601c5301d6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 28 Jun 2019 14:28:13 +0200
+Subject: x86/reboot: Always use NMI fallback when shutdown via reboot vector
+ IPI fails
+
+From: Grzegorz Halat <ghalat@redhat.com>
+
+[ Upstream commit 747d5a1bf293dcb33af755a6d285d41b8c1ea010 ]
+
+A reboot request sends an IPI via the reboot vector and waits for all other
+CPUs to stop. If one or more CPUs are in critical regions with interrupts
+disabled then the IPI is not handled on those CPUs and the shutdown hangs
+if native_stop_other_cpus() is called with the wait argument set.
+
+Such a situation can happen when one CPU was stopped within a lock held
+section and another CPU is trying to acquire that lock with interrupts
+disabled. There are other scenarios which can cause such a lockup as well.
+
+In theory the shutdown should be attempted by an NMI IPI after the timeout
+period elapsed. Though the wait loop after sending the reboot vector IPI
+prevents this. It checks the wait request argument and the timeout. If wait
+is set, which is true for sys_reboot() then it won't fall through to the
+NMI shutdown method after the timeout period has finished.
+
+This was an oversight when the NMI shutdown mechanism was added to handle
+the 'reboot IPI is not working' situation. The mechanism was added to deal
+with stuck panic shutdowns, which do not have the wait request set, so the
+'wait request' case was probably not considered.
+
+Remove the wait check from the post reboot vector IPI wait loop and enforce
+that the wait loop in the NMI fallback path is invoked even if NMI IPIs are
+disabled or the registration of the NMI handler fails. That second wait
+loop will then hang if not all CPUs shutdown and the wait argument is set.
+
+[ tglx: Avoid the hard to parse line break in the NMI fallback path,
+       add comments and massage the changelog ]
+
+Fixes: 7d007d21e539 ("x86/reboot: Use NMI to assist in shutting down if IRQ fails")
+Signed-off-by: Grzegorz Halat <ghalat@redhat.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Don Zickus <dzickus@redhat.com>
+Link: https://lkml.kernel.org/r/20190628122813.15500-1-ghalat@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/kernel/smp.c | 46 +++++++++++++++++++++++++------------------
+ 1 file changed, 27 insertions(+), 19 deletions(-)
+
+diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
+index 04adc8d60aed8..b2b87b91f3361 100644
+--- a/arch/x86/kernel/smp.c
++++ b/arch/x86/kernel/smp.c
+@@ -181,6 +181,12 @@ asmlinkage __visible void smp_reboot_interrupt(void)
+       irq_exit();
+ }
++static int register_stop_handler(void)
++{
++      return register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback,
++                                  NMI_FLAG_FIRST, "smp_stop");
++}
++
+ static void native_stop_other_cpus(int wait)
+ {
+       unsigned long flags;
+@@ -214,39 +220,41 @@ static void native_stop_other_cpus(int wait)
+               apic->send_IPI_allbutself(REBOOT_VECTOR);
+               /*
+-               * Don't wait longer than a second if the caller
+-               * didn't ask us to wait.
++               * Don't wait longer than a second for IPI completion. The
++               * wait request is not checked here because that would
++               * prevent an NMI shutdown attempt in case that not all
++               * CPUs reach shutdown state.
+                */
+               timeout = USEC_PER_SEC;
+-              while (num_online_cpus() > 1 && (wait || timeout--))
++              while (num_online_cpus() > 1 && timeout--)
+                       udelay(1);
+       }
+-      
+-      /* if the REBOOT_VECTOR didn't work, try with the NMI */
+-      if ((num_online_cpus() > 1) && (!smp_no_nmi_ipi))  {
+-              if (register_nmi_handler(NMI_LOCAL, smp_stop_nmi_callback,
+-                                       NMI_FLAG_FIRST, "smp_stop"))
+-                      /* Note: we ignore failures here */
+-                      /* Hope the REBOOT_IRQ is good enough */
+-                      goto finish;
+-
+-              /* sync above data before sending IRQ */
+-              wmb();
+-              pr_emerg("Shutting down cpus with NMI\n");
++      /* if the REBOOT_VECTOR didn't work, try with the NMI */
++      if (num_online_cpus() > 1) {
++              /*
++               * If NMI IPI is enabled, try to register the stop handler
++               * and send the IPI. In any case try to wait for the other
++               * CPUs to stop.
++               */
++              if (!smp_no_nmi_ipi && !register_stop_handler()) {
++                      /* Sync above data before sending IRQ */
++                      wmb();
+-              apic->send_IPI_allbutself(NMI_VECTOR);
++                      pr_emerg("Shutting down cpus with NMI\n");
++                      apic->send_IPI_allbutself(NMI_VECTOR);
++              }
+               /*
+-               * Don't wait longer than a 10 ms if the caller
+-               * didn't ask us to wait.
++               * Don't wait longer than 10 ms if the caller didn't
++               * reqeust it. If wait is true, the machine hangs here if
++               * one or more CPUs do not reach shutdown state.
+                */
+               timeout = USEC_PER_MSEC * 10;
+               while (num_online_cpus() > 1 && (wait || timeout--))
+                       udelay(1);
+       }
+-finish:
+       local_irq_save(flags);
+       disable_local_APIC();
+       mcheck_cpu_clear(this_cpu_ptr(&cpu_info));
+-- 
+2.20.1
+