ata: ahci: Disable SXS for Hisilicon Kunpeng920
authorXingui Yang <yangxingui@huawei.com>
Fri, 12 Mar 2021 10:24:36 +0000 (18:24 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 31 Mar 2021 14:25:15 +0000 (08:25 -0600)
On Hisilicon Kunpeng920, ESP is set to 1 by default for all ports of
SATA controller. In some scenarios, some ports are not external SATA ports,
and it cause disks connected to these ports to be identified as removable
disks. So disable the SXS capability on the software side to prevent users
from mistakenly considering non-removable disks as removable disks and
performing related operations.

Signed-off-by: Xingui Yang <yangxingui@huawei.com>
Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com>
Reviewed-by: John Garry <john.garry@huawei.com>
Link: https://lore.kernel.org/r/1615544676-61926-1-git-send-email-luojiaxing@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/ata/ahci.c
drivers/ata/ahci.h
drivers/ata/libahci.c

index 00ba8e5a1ccc088c1fe47f02f3816ba980195e58..33192a8f687d664e3b62ff5e4cd2118e1bc324f5 100644 (file)
@@ -1772,6 +1772,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                hpriv->flags |= AHCI_HFLAG_NO_DEVSLP;
 
 #ifdef CONFIG_ARM64
+       if (pdev->vendor == PCI_VENDOR_ID_HUAWEI &&
+           pdev->device == 0xa235 &&
+           pdev->revision < 0x30)
+               hpriv->flags |= AHCI_HFLAG_NO_SXS;
+
        if (pdev->vendor == 0x177d && pdev->device == 0xa01c)
                hpriv->irq_handler = ahci_thunderx_irq_handler;
 #endif
index 98b8baa47dc5e0a5c2df816f5ee24127d59bc778..d1f284f0c83d98bb69ceec24c7e6560f7699f455 100644 (file)
@@ -242,6 +242,7 @@ enum {
                                                        suspend/resume */
        AHCI_HFLAG_IGN_NOTSUPP_POWER_ON = (1 << 27), /* ignore -EOPNOTSUPP
                                                        from phy_power_on() */
+       AHCI_HFLAG_NO_SXS               = (1 << 28), /* SXS not supported */
 
        /* ap->flags bits */
 
index ea5bf5f4cbed54953a0049ba7014021e48627bb5..fec2e9754aed20325d7b9ade7f97230a56a2d3eb 100644 (file)
@@ -493,6 +493,11 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv)
                cap |= HOST_CAP_ALPM;
        }
 
+       if ((cap & HOST_CAP_SXS) && (hpriv->flags & AHCI_HFLAG_NO_SXS)) {
+               dev_info(dev, "controller does not support SXS, disabling CAP_SXS\n");
+               cap &= ~HOST_CAP_SXS;
+       }
+
        if (hpriv->force_port_map && port_map != hpriv->force_port_map) {
                dev_info(dev, "forcing port_map 0x%x -> 0x%x\n",
                         port_map, hpriv->force_port_map);