]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Nov 2020 19:26:57 +0000 (20:26 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Nov 2020 19:26:57 +0000 (20:26 +0100)
added patches:
pinctrl-amd-fix-incorrect-way-to-disable-debounce-filter.patch
pinctrl-amd-use-higher-precision-for-512-rtcclk.patch
swiotlb-fix-x86-don-t-panic-if-can-not-alloc-buffer-for-swiotlb.patch

queue-4.14/pinctrl-amd-fix-incorrect-way-to-disable-debounce-filter.patch [new file with mode: 0644]
queue-4.14/pinctrl-amd-use-higher-precision-for-512-rtcclk.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/swiotlb-fix-x86-don-t-panic-if-can-not-alloc-buffer-for-swiotlb.patch [new file with mode: 0644]

diff --git a/queue-4.14/pinctrl-amd-fix-incorrect-way-to-disable-debounce-filter.patch b/queue-4.14/pinctrl-amd-fix-incorrect-way-to-disable-debounce-filter.patch
new file mode 100644 (file)
index 0000000..6ed86a5
--- /dev/null
@@ -0,0 +1,44 @@
+From 06abe8291bc31839950f7d0362d9979edc88a666 Mon Sep 17 00:00:00 2001
+From: Coiby Xu <coiby.xu@gmail.com>
+Date: Fri, 6 Nov 2020 07:19:09 +0800
+Subject: pinctrl: amd: fix incorrect way to disable debounce filter
+
+From: Coiby Xu <coiby.xu@gmail.com>
+
+commit 06abe8291bc31839950f7d0362d9979edc88a666 upstream.
+
+The correct way to disable debounce filter is to clear bit 5 and 6
+of the register.
+
+Cc: stable@vger.kerne.org
+Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Cc: Hans de Goede <hdegoede@redhat.com>
+Link: https://lore.kernel.org/linux-gpio/df2c008b-e7b5-4fdd-42ea-4d1c62b52139@redhat.com/
+Link: https://lore.kernel.org/r/20201105231912.69527-2-coiby.xu@gmail.com
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pinctrl/pinctrl-amd.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/pinctrl/pinctrl-amd.c
++++ b/drivers/pinctrl/pinctrl-amd.c
+@@ -154,14 +154,14 @@ static int amd_gpio_set_debounce(struct
+                       pin_reg |= BIT(DB_TMR_OUT_UNIT_OFF);
+                       pin_reg |= BIT(DB_TMR_LARGE_OFF);
+               } else {
+-                      pin_reg &= ~DB_CNTRl_MASK;
++                      pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF);
+                       ret = -EINVAL;
+               }
+       } else {
+               pin_reg &= ~BIT(DB_TMR_OUT_UNIT_OFF);
+               pin_reg &= ~BIT(DB_TMR_LARGE_OFF);
+               pin_reg &= ~DB_TMR_OUT_MASK;
+-              pin_reg &= ~DB_CNTRl_MASK;
++              pin_reg &= ~(DB_CNTRl_MASK << DB_CNTRL_OFF);
+       }
+       writel(pin_reg, gpio_dev->base + offset * 4);
+       raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
diff --git a/queue-4.14/pinctrl-amd-use-higher-precision-for-512-rtcclk.patch b/queue-4.14/pinctrl-amd-use-higher-precision-for-512-rtcclk.patch
new file mode 100644 (file)
index 0000000..3c41c4f
--- /dev/null
@@ -0,0 +1,40 @@
+From c64a6a0d4a928c63e5bc3b485552a8903a506c36 Mon Sep 17 00:00:00 2001
+From: Coiby Xu <coiby.xu@gmail.com>
+Date: Fri, 6 Nov 2020 07:19:10 +0800
+Subject: pinctrl: amd: use higher precision for 512 RtcClk
+
+From: Coiby Xu <coiby.xu@gmail.com>
+
+commit c64a6a0d4a928c63e5bc3b485552a8903a506c36 upstream.
+
+RTC is 32.768kHz thus 512 RtcClk equals 15625 usec. The documentation
+likely has dropped precision and that's why the driver mistakenly took
+the slightly deviated value.
+
+Cc: stable@vger.kernel.org
+Reported-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Suggested-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
+Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Link: https://lore.kernel.org/linux-gpio/2f4706a1-502f-75f0-9596-cc25b4933b6c@redhat.com/
+Link: https://lore.kernel.org/r/20201105231912.69527-3-coiby.xu@gmail.com
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pinctrl/pinctrl-amd.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/pinctrl/pinctrl-amd.c
++++ b/drivers/pinctrl/pinctrl-amd.c
+@@ -144,7 +144,7 @@ static int amd_gpio_set_debounce(struct
+                       pin_reg |= BIT(DB_TMR_OUT_UNIT_OFF);
+                       pin_reg &= ~BIT(DB_TMR_LARGE_OFF);
+               } else if (debounce < 250000) {
+-                      time = debounce / 15600;
++                      time = debounce / 15625;
+                       pin_reg |= time & DB_TMR_OUT_MASK;
+                       pin_reg &= ~BIT(DB_TMR_OUT_UNIT_OFF);
+                       pin_reg |= BIT(DB_TMR_LARGE_OFF);
index 726b29a590702a59886d4eeaf05dcf8895f25f76..fdc799cd966a1b31700dc184b1ecffb4a83a9634 100644 (file)
@@ -52,4 +52,7 @@ ocfs2-initialize-ip_next_orphan.patch
 selinux-fix-error-return-code-in-sel_ib_pkey_sid_slow.patch
 don-t-dump-the-threads-that-had-been-already-exiting-when-zapped.patch
 drm-gma500-fix-out-of-bounds-access-to-struct-drm_device.vblank.patch
+pinctrl-amd-use-higher-precision-for-512-rtcclk.patch
+pinctrl-amd-fix-incorrect-way-to-disable-debounce-filter.patch
+swiotlb-fix-x86-don-t-panic-if-can-not-alloc-buffer-for-swiotlb.patch
 btrfs-fix-potential-overflow-in-cluster_pages_for_defrag-on-32bit-arch.patch
diff --git a/queue-4.14/swiotlb-fix-x86-don-t-panic-if-can-not-alloc-buffer-for-swiotlb.patch b/queue-4.14/swiotlb-fix-x86-don-t-panic-if-can-not-alloc-buffer-for-swiotlb.patch
new file mode 100644 (file)
index 0000000..13d5938
--- /dev/null
@@ -0,0 +1,76 @@
+From e9696d259d0fb5d239e8c28ca41089838ea76d13 Mon Sep 17 00:00:00 2001
+From: Stefano Stabellini <stefano.stabellini@xilinx.com>
+Date: Mon, 26 Oct 2020 17:02:14 -0700
+Subject: swiotlb: fix "x86: Don't panic if can not alloc buffer for swiotlb"
+
+From: Stefano Stabellini <stefano.stabellini@xilinx.com>
+
+commit e9696d259d0fb5d239e8c28ca41089838ea76d13 upstream.
+
+kernel/dma/swiotlb.c:swiotlb_init gets called first and tries to
+allocate a buffer for the swiotlb. It does so by calling
+
+  memblock_alloc_low(PAGE_ALIGN(bytes), PAGE_SIZE);
+
+If the allocation must fail, no_iotlb_memory is set.
+
+Later during initialization swiotlb-xen comes in
+(drivers/xen/swiotlb-xen.c:xen_swiotlb_init) and given that io_tlb_start
+is != 0, it thinks the memory is ready to use when actually it is not.
+
+When the swiotlb is actually needed, swiotlb_tbl_map_single gets called
+and since no_iotlb_memory is set the kernel panics.
+
+Instead, if swiotlb-xen.c:xen_swiotlb_init knew the swiotlb hadn't been
+initialized, it would do the initialization itself, which might still
+succeed.
+
+Fix the panic by setting io_tlb_start to 0 on swiotlb initialization
+failure, and also by setting no_iotlb_memory to false on swiotlb
+initialization success.
+
+Fixes: ac2cbab21f31 ("x86: Don't panic if can not alloc buffer for swiotlb")
+
+Reported-by: Elliott Mitchell <ehem+xen@m5p.com>
+Tested-by: Elliott Mitchell <ehem+xen@m5p.com>
+Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Cc: stable@vger.kernel.org
+Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ lib/swiotlb.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/lib/swiotlb.c
++++ b/lib/swiotlb.c
+@@ -254,6 +254,7 @@ int __init swiotlb_init_with_tbl(char *t
+               io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
+       }
+       io_tlb_index = 0;
++      no_iotlb_memory = false;
+       if (verbose)
+               swiotlb_print_info();
+@@ -285,9 +286,11 @@ swiotlb_init(int verbose)
+       if (vstart && !swiotlb_init_with_tbl(vstart, io_tlb_nslabs, verbose))
+               return;
+-      if (io_tlb_start)
++      if (io_tlb_start) {
+               memblock_free_early(io_tlb_start,
+                                   PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
++              io_tlb_start = 0;
++      }
+       pr_warn("Cannot allocate buffer");
+       no_iotlb_memory = true;
+ }
+@@ -390,6 +393,7 @@ swiotlb_late_init_with_tbl(char *tlb, un
+               io_tlb_orig_addr[i] = INVALID_PHYS_ADDR;
+       }
+       io_tlb_index = 0;
++      no_iotlb_memory = false;
+       swiotlb_print_info();