From: Greg Kroah-Hartman Date: Mon, 16 Nov 2020 19:27:13 +0000 (+0100) Subject: 4.19-stable patches X-Git-Tag: v4.4.244~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ac5bb3d0601ef27908b61d0db267039af7243493;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: erofs-derive-atime-instead-of-leaving-it-empty.patch 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 --- diff --git a/queue-4.19/erofs-derive-atime-instead-of-leaving-it-empty.patch b/queue-4.19/erofs-derive-atime-instead-of-leaving-it-empty.patch new file mode 100644 index 00000000000..f8458a50a58 --- /dev/null +++ b/queue-4.19/erofs-derive-atime-instead-of-leaving-it-empty.patch @@ -0,0 +1,79 @@ +From d3938ee23e97bfcac2e0eb6b356875da73d700df Mon Sep 17 00:00:00 2001 +From: Gao Xiang +Date: Sun, 1 Nov 2020 03:51:02 +0800 +Subject: erofs: derive atime instead of leaving it empty + +From: Gao Xiang + +commit d3938ee23e97bfcac2e0eb6b356875da73d700df upstream. + +EROFS has _only one_ ondisk timestamp (ctime is currently +documented and recorded, we might also record mtime instead +with a new compat feature if needed) for each extended inode +since EROFS isn't mainly for archival purposes so no need to +keep all timestamps on disk especially for Android scenarios +due to security concerns. Also, romfs/cramfs don't have their +own on-disk timestamp, and squashfs only records mtime instead. + +Let's also derive access time from ondisk timestamp rather than +leaving it empty, and if mtime/atime for each file are really +needed for specific scenarios as well, we can also use xattrs +to record them then. + +Link: https://lore.kernel.org/r/20201031195102.21221-1-hsiangkao@aol.com +[ Gao Xiang: It'd be better to backport for user-friendly concern. ] +Fixes: 431339ba9042 ("staging: erofs: add inode operations") +Cc: stable # 4.19+ +Reported-by: nl6720 +Reviewed-by: Chao Yu +[ Gao Xiang: Manually backport to 4.19.y due to trivial conflicts. ] +Signed-off-by: Gao Xiang +Signed-off-by: Greg Kroah-Hartman +--- + drivers/staging/erofs/inode.c | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +--- a/drivers/staging/erofs/inode.c ++++ b/drivers/staging/erofs/inode.c +@@ -53,11 +53,9 @@ static int read_inode(struct inode *inod + i_gid_write(inode, le32_to_cpu(v2->i_gid)); + set_nlink(inode, le32_to_cpu(v2->i_nlink)); + +- /* ns timestamp */ +- inode->i_mtime.tv_sec = inode->i_ctime.tv_sec = +- le64_to_cpu(v2->i_ctime); +- inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = +- le32_to_cpu(v2->i_ctime_nsec); ++ /* extended inode has its own timestamp */ ++ inode->i_ctime.tv_sec = le64_to_cpu(v2->i_ctime); ++ inode->i_ctime.tv_nsec = le32_to_cpu(v2->i_ctime_nsec); + + inode->i_size = le64_to_cpu(v2->i_size); + } else if (__inode_version(advise) == EROFS_INODE_LAYOUT_V1) { +@@ -83,11 +81,9 @@ static int read_inode(struct inode *inod + i_gid_write(inode, le16_to_cpu(v1->i_gid)); + set_nlink(inode, le16_to_cpu(v1->i_nlink)); + +- /* use build time to derive all file time */ +- inode->i_mtime.tv_sec = inode->i_ctime.tv_sec = +- sbi->build_time; +- inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec = +- sbi->build_time_nsec; ++ /* use build time for compact inodes */ ++ inode->i_ctime.tv_sec = sbi->build_time; ++ inode->i_ctime.tv_nsec = sbi->build_time_nsec; + + inode->i_size = le32_to_cpu(v1->i_size); + } else { +@@ -97,6 +93,11 @@ static int read_inode(struct inode *inod + return -EIO; + } + ++ inode->i_mtime.tv_sec = inode->i_ctime.tv_sec; ++ inode->i_atime.tv_sec = inode->i_ctime.tv_sec; ++ inode->i_mtime.tv_nsec = inode->i_ctime.tv_nsec; ++ inode->i_atime.tv_nsec = inode->i_ctime.tv_nsec; ++ + /* measure inode.i_blocks as the generic filesystem */ + inode->i_blocks = ((inode->i_size - 1) >> 9) + 1; + return 0; diff --git a/queue-4.19/pinctrl-amd-fix-incorrect-way-to-disable-debounce-filter.patch b/queue-4.19/pinctrl-amd-fix-incorrect-way-to-disable-debounce-filter.patch new file mode 100644 index 00000000000..5fd527ae9ad --- /dev/null +++ b/queue-4.19/pinctrl-amd-fix-incorrect-way-to-disable-debounce-filter.patch @@ -0,0 +1,44 @@ +From 06abe8291bc31839950f7d0362d9979edc88a666 Mon Sep 17 00:00:00 2001 +From: Coiby Xu +Date: Fri, 6 Nov 2020 07:19:09 +0800 +Subject: pinctrl: amd: fix incorrect way to disable debounce filter + +From: Coiby Xu + +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 +Reviewed-by: Hans de Goede +Cc: Hans de Goede +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 +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -167,14 +167,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.19/pinctrl-amd-use-higher-precision-for-512-rtcclk.patch b/queue-4.19/pinctrl-amd-use-higher-precision-for-512-rtcclk.patch new file mode 100644 index 00000000000..705f48f4eb4 --- /dev/null +++ b/queue-4.19/pinctrl-amd-use-higher-precision-for-512-rtcclk.patch @@ -0,0 +1,40 @@ +From c64a6a0d4a928c63e5bc3b485552a8903a506c36 Mon Sep 17 00:00:00 2001 +From: Coiby Xu +Date: Fri, 6 Nov 2020 07:19:10 +0800 +Subject: pinctrl: amd: use higher precision for 512 RtcClk + +From: Coiby Xu + +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 +Suggested-by: Andy Shevchenko +Suggested-by: Hans de Goede +Signed-off-by: Coiby Xu +Reviewed-by: Andy Shevchenko +Reviewed-by: Hans de Goede +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 +Signed-off-by: Greg Kroah-Hartman + +--- + 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 +@@ -157,7 +157,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); diff --git a/queue-4.19/series b/queue-4.19/series index 00f4fdb5ee6..990eec92237 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -80,3 +80,7 @@ gpio-pcie-idio-24-enable-pex8311-interrupts.patch mmc-renesas_sdhi_core-add-missing-tmio_mmc_host_free-at-remove.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 +erofs-derive-atime-instead-of-leaving-it-empty.patch +swiotlb-fix-x86-don-t-panic-if-can-not-alloc-buffer-for-swiotlb.patch diff --git a/queue-4.19/swiotlb-fix-x86-don-t-panic-if-can-not-alloc-buffer-for-swiotlb.patch b/queue-4.19/swiotlb-fix-x86-don-t-panic-if-can-not-alloc-buffer-for-swiotlb.patch new file mode 100644 index 00000000000..8076615f211 --- /dev/null +++ b/queue-4.19/swiotlb-fix-x86-don-t-panic-if-can-not-alloc-buffer-for-swiotlb.patch @@ -0,0 +1,76 @@ +From e9696d259d0fb5d239e8c28ca41089838ea76d13 Mon Sep 17 00:00:00 2001 +From: Stefano Stabellini +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 + +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 +Tested-by: Elliott Mitchell +Signed-off-by: Stefano Stabellini +Reviewed-by: Christoph Hellwig +Cc: stable@vger.kernel.org +Signed-off-by: Konrad Rzeszutek Wilk +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/dma/swiotlb.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/kernel/dma/swiotlb.c ++++ b/kernel/dma/swiotlb.c +@@ -239,6 +239,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(); +@@ -270,9 +271,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; + } +@@ -376,6 +379,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(); +