From: Greg Kroah-Hartman Date: Wed, 5 Aug 2026 12:23:31 +0000 (+0200) Subject: 6.6-stable patches X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=4ebda7c2ebba789ce75ce48bb7ff0029e5240a86;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: ata-ahci-make-ahci_ignore_port-handle-empty-mask_port_map.patch ata-libahci_platform-do-not-set-mask_port_map-when-not-needed.patch --- diff --git a/queue-6.6/ata-ahci-make-ahci_ignore_port-handle-empty-mask_port_map.patch b/queue-6.6/ata-ahci-make-ahci_ignore_port-handle-empty-mask_port_map.patch new file mode 100644 index 0000000000..204d1049e7 --- /dev/null +++ b/queue-6.6/ata-ahci-make-ahci_ignore_port-handle-empty-mask_port_map.patch @@ -0,0 +1,74 @@ +From 130ff5c8b78e6fd05270a04985c50bce6a3de6c1 Mon Sep 17 00:00:00 2001 +From: Niklas Cassel +Date: Tue, 25 Feb 2025 15:16:12 +0100 +Subject: ata: ahci: Make ahci_ignore_port() handle empty mask_port_map +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Niklas Cassel + +commit 130ff5c8b78e6fd05270a04985c50bce6a3de6c1 upstream. + +Commit 8c87215dd3a2 ("ata: libahci_platform: support non-consecutive port +numbers") added a skip to ahci_platform_enable_phys() for ports that are +not in mask_port_map. + +The code in ahci_platform_get_resources(), will currently set mask_port_map +for each child "port" node it finds in the device tree. + +However, device trees that do not have any child "port" nodes will not have +mask_port_map set, and for non-device tree platforms mask_port_map will +only exist as a quirk for specific PCI device + vendor IDs, or as a kernel +module parameter, but will not be set by default. + +Therefore, the common thing is that mask_port_map is only set if you do not +want to use all ports (as defined by Offset 0Ch: PI – Ports Implemented +register), but instead only want to use the ports in mask_port_map. If +mask_port_map is not set, all ports are available. + +Thus, ahci_ignore_port() must be able to handle an empty mask_port_map. + +Fixes: 8c87215dd3a2 ("ata: libahci_platform: support non-consecutive port numbers") +Fixes: 2c202e6c4f4d ("ata: libahci_platform: Do not set mask_port_map when not needed") +Fixes: c9b5be909e65 ("ahci: Introduce ahci_ignore_port() helper") +Reported-by: Marek Szyprowski +Closes: https://lore.kernel.org/linux-ide/10b31dd0-d0bb-4f76-9305-2195c3e17670@samsung.com/ +Tested-by: Marek Szyprowski +Co-developed-by: Damien Le Moal +Signed-off-by: Damien Le Moal +Link: https://lore.kernel.org/r/20250225141612.942170-2-cassel@kernel.org +Signed-off-by: Niklas Cassel +Signed-off-by: Greg Kroah-Hartman +--- + drivers/ata/ahci.h | 8 ++++++-- + drivers/ata/libahci.c | 1 + + 2 files changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/ata/ahci.h ++++ b/drivers/ata/ahci.h +@@ -388,8 +388,12 @@ struct ahci_host_priv { + static inline bool ahci_ignore_port(struct ahci_host_priv *hpriv, + unsigned int portid) + { +- return portid >= hpriv->nports || +- !(hpriv->mask_port_map & (1 << portid)); ++ if (portid >= hpriv->nports) ++ return true; ++ /* mask_port_map not set means that all ports are available */ ++ if (!hpriv->mask_port_map) ++ return false; ++ return !(hpriv->mask_port_map & (1 << portid)); + } + + extern int ahci_ignore_sss; +--- a/drivers/ata/libahci.c ++++ b/drivers/ata/libahci.c +@@ -541,6 +541,7 @@ void ahci_save_initial_config(struct dev + hpriv->saved_port_map = port_map; + } + ++ /* mask_port_map not set means that all ports are available */ + if (hpriv->mask_port_map) { + dev_warn(dev, "masking port_map 0x%lx -> 0x%lx\n", + port_map, diff --git a/queue-6.6/ata-libahci_platform-do-not-set-mask_port_map-when-not-needed.patch b/queue-6.6/ata-libahci_platform-do-not-set-mask_port_map-when-not-needed.patch new file mode 100644 index 0000000000..491c5e9aaa --- /dev/null +++ b/queue-6.6/ata-libahci_platform-do-not-set-mask_port_map-when-not-needed.patch @@ -0,0 +1,62 @@ +From 2c202e6c4f4dd19d2e8c1dfac9df05170aa3934f Mon Sep 17 00:00:00 2001 +From: Damien Le Moal +Date: Sat, 8 Feb 2025 08:29:15 +0900 +Subject: ata: libahci_platform: Do not set mask_port_map when not needed + +From: Damien Le Moal + +commit 2c202e6c4f4dd19d2e8c1dfac9df05170aa3934f upstream. + +Commit 8c87215dd3a2 ("ata: libahci_platform: support non-consecutive +port numbers") modified ahci_platform_get_resources() to allow +identifying the ports of a controller that are defined as child nodes of +the controller node in order to support non-consecutive port numbers (as +defined by the platform device tree). + +However, this commit also erroneously sets bit 0 of +hpriv->mask_port_map when the platform devices tree does not define port +child nodes, to match the fact that the temporary default number of +ports used in that case is 1 (which is also consistent with the fact +that only index 0 of hpriv->phys[] is initialized with the call to +ahci_platform_get_phy(). But doing so causes ahci_platform_init_host() +to initialize and probe only the first port, even if this function +determines that the controller has in fact multiple ports using the +capability register of the controller (through a call to +ahci_nr_ports()). This can be seen with the ahci_mvebu driver (Armada +385 SoC) with the second port declared as "dummy": + +ahci-mvebu f10a8000.sata: masking port_map 0x3 -> 0x1 +ahci-mvebu f10a8000.sata: AHCI vers 0001.0000, 32 command slots, 6 Gbps, platform mode +ahci-mvebu f10a8000.sata: 1/2 ports implemented (port mask 0x1) +ahci-mvebu f10a8000.sata: flags: 64bit ncq sntf led only pmp fbs pio slum part sxs +scsi host0: ahci-mvebu +scsi host1: ahci-mvebu +ata1: SATA max UDMA/133 mmio [mem 0xf10a8000-0xf10a9fff] port 0x100 irq 40 lpm-pol 0 +ata2: DUMMY + +Fix this issue by removing setting bit 0 of hpriv->mask_port_map when +the platform device tree does not define port child nodes. + +Reported-by: Klaus Kudielka +Fixes: 8c87215dd3a2 ("ata: libahci_platform: support non-consecutive port numbers") +Tested-by: Klaus Kudielka +Signed-off-by: Damien Le Moal +Acked-by: Josua Mayer +Link: https://lore.kernel.org/r/20250207232915.1439174-1-dlemoal@kernel.org +Signed-off-by: Niklas Cassel +Signed-off-by: Greg Kroah-Hartman +--- + drivers/ata/libahci_platform.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/ata/libahci_platform.c ++++ b/drivers/ata/libahci_platform.c +@@ -660,8 +660,6 @@ struct ahci_host_priv *ahci_platform_get + * If no sub-node was found, keep this for device tree + * compatibility + */ +- hpriv->mask_port_map |= BIT(0); +- + rc = ahci_platform_get_phy(hpriv, 0, dev, dev->of_node); + if (rc) + goto err_out; diff --git a/queue-6.6/series b/queue-6.6/series index b9b3e13d73..a8cba4169d 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -203,3 +203,5 @@ drm-vmwgfx-use-check_add_overflow-for-shader-size-offset-bound.patch drm-vmwgfx-validate-external-bo-copy-bounds-for-both-stride-paths.patch spi-spi-cadence-enable-spi_controller_must_tx.patch hid-logitech-dj-fix-maxfield-check-in-dj-short-report-validation.patch +ata-libahci_platform-do-not-set-mask_port_map-when-not-needed.patch +ata-ahci-make-ahci_ignore_port-handle-empty-mask_port_map.patch