]> www.infradead.org Git - users/hch/misc.git/commit
ata: ahci: Make ahci_ignore_port() handle empty mask_port_map
authorNiklas Cassel <cassel@kernel.org>
Tue, 25 Feb 2025 14:16:12 +0000 (15:16 +0100)
committerNiklas Cassel <cassel@kernel.org>
Wed, 26 Feb 2025 10:24:30 +0000 (11:24 +0100)
commit130ff5c8b78e6fd05270a04985c50bce6a3de6c1
treec29d9fd41a9d8093bde38ebfd7fbebd6c0fc8217
parent2c202e6c4f4dd19d2e8c1dfac9df05170aa3934f
ata: ahci: Make ahci_ignore_port() handle empty mask_port_map

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 <m.szyprowski@samsung.com>
Closes: https://lore.kernel.org/linux-ide/10b31dd0-d0bb-4f76-9305-2195c3e17670@samsung.com/
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Co-developed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20250225141612.942170-2-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
drivers/ata/ahci.h
drivers/ata/libahci.c