From: Greg Kroah-Hartman Date: Wed, 22 Nov 2023 18:56:50 +0000 (+0000) Subject: 4.19-stable patches X-Git-Tag: v4.14.331~125 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=afc7c28526a84eab072dcf1edec9ec2e02169c65;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: genirq-generic_chip-make-irq_remove_generic_chip-irqdomain-aware.patch mmc-meson-gx-remove-setting-of-cmd_cfg_error.patch pci-keystone-don-t-discard-.probe-callback.patch pci-keystone-don-t-discard-.remove-callback.patch regmap-ensure-range-selector-registers-are-updated-after-cache-sync.patch --- diff --git a/queue-4.19/genirq-generic_chip-make-irq_remove_generic_chip-irqdomain-aware.patch b/queue-4.19/genirq-generic_chip-make-irq_remove_generic_chip-irqdomain-aware.patch new file mode 100644 index 00000000000..ea518db56ba --- /dev/null +++ b/queue-4.19/genirq-generic_chip-make-irq_remove_generic_chip-irqdomain-aware.patch @@ -0,0 +1,82 @@ +From 5e7afb2eb7b2a7c81e9f608cbdf74a07606fd1b5 Mon Sep 17 00:00:00 2001 +From: Herve Codina +Date: Tue, 24 Oct 2023 17:03:35 +0200 +Subject: genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware + +From: Herve Codina + +commit 5e7afb2eb7b2a7c81e9f608cbdf74a07606fd1b5 upstream. + +irq_remove_generic_chip() calculates the Linux interrupt number for removing the +handler and interrupt chip based on gc::irq_base as a linear function of +the bit positions of set bits in the @msk argument. + +When the generic chip is present in an irq domain, i.e. created with a call +to irq_alloc_domain_generic_chips(), gc::irq_base contains not the base +Linux interrupt number. It contains the base hardware interrupt for this +chip. It is set to 0 for the first chip in the domain, 0 + N for the next +chip, where $N is the number of hardware interrupts per chip. + +That means the Linux interrupt number cannot be calculated based on +gc::irq_base for irqdomain based chips without a domain map lookup, which +is currently missing. + +Rework the code to take the irqdomain case into account and calculate the +Linux interrupt number by a irqdomain lookup of the domain specific +hardware interrupt number. + +[ tglx: Massage changelog. Reshuffle the logic and add a proper comment. ] + +Fixes: cfefd21e693d ("genirq: Add chip suspend and resume callbacks") +Signed-off-by: Herve Codina +Signed-off-by: Thomas Gleixner +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20231024150335.322282-1-herve.codina@bootlin.com +Signed-off-by: Greg Kroah-Hartman +--- + kernel/irq/generic-chip.c | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) + +--- a/kernel/irq/generic-chip.c ++++ b/kernel/irq/generic-chip.c +@@ -537,21 +537,34 @@ EXPORT_SYMBOL_GPL(irq_setup_alt_chip); + void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk, + unsigned int clr, unsigned int set) + { +- unsigned int i = gc->irq_base; ++ unsigned int i, virq; + + raw_spin_lock(&gc_lock); + list_del(&gc->list); + raw_spin_unlock(&gc_lock); + +- for (; msk; msk >>= 1, i++) { ++ for (i = 0; msk; msk >>= 1, i++) { + if (!(msk & 0x01)) + continue; + ++ /* ++ * Interrupt domain based chips store the base hardware ++ * interrupt number in gc::irq_base. Otherwise gc::irq_base ++ * contains the base Linux interrupt number. ++ */ ++ if (gc->domain) { ++ virq = irq_find_mapping(gc->domain, gc->irq_base + i); ++ if (!virq) ++ continue; ++ } else { ++ virq = gc->irq_base + i; ++ } ++ + /* Remove handler first. That will mask the irq line */ +- irq_set_handler(i, NULL); +- irq_set_chip(i, &no_irq_chip); +- irq_set_chip_data(i, NULL); +- irq_modify_status(i, clr, set); ++ irq_set_handler(virq, NULL); ++ irq_set_chip(virq, &no_irq_chip); ++ irq_set_chip_data(virq, NULL); ++ irq_modify_status(virq, clr, set); + } + } + EXPORT_SYMBOL_GPL(irq_remove_generic_chip); diff --git a/queue-4.19/mmc-meson-gx-remove-setting-of-cmd_cfg_error.patch b/queue-4.19/mmc-meson-gx-remove-setting-of-cmd_cfg_error.patch new file mode 100644 index 00000000000..5f99af44268 --- /dev/null +++ b/queue-4.19/mmc-meson-gx-remove-setting-of-cmd_cfg_error.patch @@ -0,0 +1,36 @@ +From 57925e16c9f7d18012bcf45bfa658f92c087981a Mon Sep 17 00:00:00 2001 +From: Rong Chen +Date: Thu, 26 Oct 2023 15:31:56 +0800 +Subject: mmc: meson-gx: Remove setting of CMD_CFG_ERROR + +From: Rong Chen + +commit 57925e16c9f7d18012bcf45bfa658f92c087981a upstream. + +For the t7 and older SoC families, the CMD_CFG_ERROR has no effect. +Starting from SoC family C3, setting this bit without SG LINK data +address will cause the controller to generate an IRQ and stop working. + +To fix it, don't set the bit CMD_CFG_ERROR anymore. + +Fixes: 18f92bc02f17 ("mmc: meson-gx: make sure the descriptor is stopped on errors") +Signed-off-by: Rong Chen +Reviewed-by: Jerome Brunet +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20231026073156.2868310-1-rong.chen@amlogic.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/mmc/host/meson-gx-mmc.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/mmc/host/meson-gx-mmc.c ++++ b/drivers/mmc/host/meson-gx-mmc.c +@@ -931,7 +931,6 @@ static void meson_mmc_start_cmd(struct m + + cmd_cfg |= FIELD_PREP(CMD_CFG_CMD_INDEX_MASK, cmd->opcode); + cmd_cfg |= CMD_CFG_OWNER; /* owned by CPU */ +- cmd_cfg |= CMD_CFG_ERROR; /* stop in case of error */ + + meson_mmc_set_response_bits(cmd, &cmd_cfg); + diff --git a/queue-4.19/pci-keystone-don-t-discard-.probe-callback.patch b/queue-4.19/pci-keystone-don-t-discard-.probe-callback.patch new file mode 100644 index 00000000000..80114c43ded --- /dev/null +++ b/queue-4.19/pci-keystone-don-t-discard-.probe-callback.patch @@ -0,0 +1,51 @@ +From 7994db905c0fd692cf04c527585f08a91b560144 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= +Date: Sun, 1 Oct 2023 19:02:54 +0200 +Subject: PCI: keystone: Don't discard .probe() callback +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +commit 7994db905c0fd692cf04c527585f08a91b560144 upstream. + +The __init annotation makes the ks_pcie_probe() function disappear after +booting completes. However a device can also be bound later. In that case, +we try to call ks_pcie_probe(), but the backing memory is likely already +overwritten. + +The right thing to do is do always have the probe callback available. Note +that the (wrong) __refdata annotation prevented this issue to be noticed by +modpost. + +Fixes: 0c4ffcfe1fbc ("PCI: keystone: Add TI Keystone PCIe driver") +Link: https://lore.kernel.org/r/20231001170254.2506508-5-u.kleine-koenig@pengutronix.de +Signed-off-by: Uwe Kleine-König +Signed-off-by: Bjorn Helgaas +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/controller/dwc/pci-keystone.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/pci/controller/dwc/pci-keystone.c ++++ b/drivers/pci/controller/dwc/pci-keystone.c +@@ -385,7 +385,7 @@ static int ks_pcie_remove(struct platfor + return 0; + } + +-static int __init ks_pcie_probe(struct platform_device *pdev) ++static int ks_pcie_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; + struct dw_pcie *pci; +@@ -452,7 +452,7 @@ fail_clk: + return ret; + } + +-static struct platform_driver ks_pcie_driver __refdata = { ++static struct platform_driver ks_pcie_driver = { + .probe = ks_pcie_probe, + .remove = ks_pcie_remove, + .driver = { diff --git a/queue-4.19/pci-keystone-don-t-discard-.remove-callback.patch b/queue-4.19/pci-keystone-don-t-discard-.remove-callback.patch new file mode 100644 index 00000000000..c3842fee131 --- /dev/null +++ b/queue-4.19/pci-keystone-don-t-discard-.remove-callback.patch @@ -0,0 +1,52 @@ +From 200bddbb3f5202bbce96444fdc416305de14f547 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= +Date: Sun, 1 Oct 2023 19:02:53 +0200 +Subject: PCI: keystone: Don't discard .remove() callback +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +commit 200bddbb3f5202bbce96444fdc416305de14f547 upstream. + +With CONFIG_PCIE_KEYSTONE=y and ks_pcie_remove() marked with __exit, the +function is discarded from the driver. In this case a bound device can +still get unbound, e.g via sysfs. Then no cleanup code is run resulting in +resource leaks or worse. + +The right thing to do is do always have the remove callback available. +Note that this driver cannot be compiled as a module, so ks_pcie_remove() +was always discarded before this change and modpost couldn't warn about +this issue. Furthermore the __ref annotation also prevents a warning. + +Fixes: 0c4ffcfe1fbc ("PCI: keystone: Add TI Keystone PCIe driver") +Link: https://lore.kernel.org/r/20231001170254.2506508-4-u.kleine-koenig@pengutronix.de +Signed-off-by: Uwe Kleine-König +Signed-off-by: Bjorn Helgaas +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/controller/dwc/pci-keystone.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/pci/controller/dwc/pci-keystone.c ++++ b/drivers/pci/controller/dwc/pci-keystone.c +@@ -376,7 +376,7 @@ static const struct dw_pcie_ops dw_pcie_ + .link_up = ks_dw_pcie_link_up, + }; + +-static int __exit ks_pcie_remove(struct platform_device *pdev) ++static int ks_pcie_remove(struct platform_device *pdev) + { + struct keystone_pcie *ks_pcie = platform_get_drvdata(pdev); + +@@ -454,7 +454,7 @@ fail_clk: + + static struct platform_driver ks_pcie_driver __refdata = { + .probe = ks_pcie_probe, +- .remove = __exit_p(ks_pcie_remove), ++ .remove = ks_pcie_remove, + .driver = { + .name = "keystone-pcie", + .of_match_table = of_match_ptr(ks_pcie_of_match), diff --git a/queue-4.19/regmap-ensure-range-selector-registers-are-updated-after-cache-sync.patch b/queue-4.19/regmap-ensure-range-selector-registers-are-updated-after-cache-sync.patch new file mode 100644 index 00000000000..63119a42765 --- /dev/null +++ b/queue-4.19/regmap-ensure-range-selector-registers-are-updated-after-cache-sync.patch @@ -0,0 +1,90 @@ +From 0ec7731655de196bc1e4af99e495b38778109d22 Mon Sep 17 00:00:00 2001 +From: Mark Brown +Date: Thu, 26 Oct 2023 16:49:19 +0100 +Subject: regmap: Ensure range selector registers are updated after cache sync + +From: Mark Brown + +commit 0ec7731655de196bc1e4af99e495b38778109d22 upstream. + +When we sync the register cache we do so with the cache bypassed in order +to avoid overhead from writing the synced values back into the cache. If +the regmap has ranges and the selector register for those ranges is in a +register which is cached this has the unfortunate side effect of meaning +that the physical and cached copies of the selector register can be out of +sync after a cache sync. The cache will have whatever the selector was when +the sync started and the hardware will have the selector for the register +that was synced last. + +Fix this by rewriting all cached selector registers after every sync, +ensuring that the hardware and cache have the same content. This will +result in extra writes that wouldn't otherwise be needed but is simple +so hopefully robust. We don't read from the hardware since not all +devices have physical read support. + +Given that nobody noticed this until now it is likely that we are rarely if +ever hitting this case. + +Reported-by: Hector Martin +Cc: stable@vger.kernel.org +Signed-off-by: Mark Brown +Link: https://lore.kernel.org/r/20231026-regmap-fix-selector-sync-v1-1-633ded82770d@kernel.org +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman +--- + drivers/base/regmap/regcache.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +--- a/drivers/base/regmap/regcache.c ++++ b/drivers/base/regmap/regcache.c +@@ -329,6 +329,11 @@ static int regcache_default_sync(struct + return 0; + } + ++static int rbtree_all(const void *key, const struct rb_node *node) ++{ ++ return 0; ++} ++ + /** + * regcache_sync - Sync the register cache with the hardware. + * +@@ -346,6 +351,7 @@ int regcache_sync(struct regmap *map) + unsigned int i; + const char *name; + bool bypass; ++ struct rb_node *node; + + if (WARN_ON(map->cache_type == REGCACHE_NONE)) + return -EINVAL; +@@ -390,6 +396,30 @@ out: + map->async = false; + map->cache_bypass = bypass; + map->no_sync_defaults = false; ++ ++ /* ++ * If we did any paging with cache bypassed and a cached ++ * paging register then the register and cache state might ++ * have gone out of sync, force writes of all the paging ++ * registers. ++ */ ++ rb_for_each(node, 0, &map->range_tree, rbtree_all) { ++ struct regmap_range_node *this = ++ rb_entry(node, struct regmap_range_node, node); ++ ++ /* If there's nothing in the cache there's nothing to sync */ ++ ret = regcache_read(map, this->selector_reg, &i); ++ if (ret != 0) ++ continue; ++ ++ ret = _regmap_write(map, this->selector_reg, i); ++ if (ret != 0) { ++ dev_err(map->dev, "Failed to write %x = %x: %d\n", ++ this->selector_reg, i, ret); ++ break; ++ } ++ } ++ + map->unlock(map->lock_arg); + + regmap_async_complete(map); diff --git a/queue-4.19/series b/queue-4.19/series index e46035af5e9..96bc3b9c9db 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -52,3 +52,8 @@ audit-don-t-take-task_lock-in-audit_exe_compare-code-path.patch audit-don-t-warn_on_once-current-mm-in-audit_exe_compare.patch hvc-xen-fix-error-path-in-xen_hvc_init-to-always-register-frontend-driver.patch pci-sysfs-protect-driver-s-d3cold-preference-from-user-space.patch +regmap-ensure-range-selector-registers-are-updated-after-cache-sync.patch +mmc-meson-gx-remove-setting-of-cmd_cfg_error.patch +genirq-generic_chip-make-irq_remove_generic_chip-irqdomain-aware.patch +pci-keystone-don-t-discard-.remove-callback.patch +pci-keystone-don-t-discard-.probe-callback.patch