Skip to content

Commit f8693b3

Browse files
committed
Merge tag 'libata-5.7-2020-04-09' of git://git.kernel.dk/linux-block
Pull libata fixes from Jens Axboe: "A few followup changes/fixes for libata: - PMP removal fix (Kai-Heng) - Add remapped NVMe device attribute to sysfs (Kai-Heng) - Remove redundant assignment (Colin) - Add yet another Comet Lake ID (Jian-Hong)" * tag 'libata-5.7-2020-04-09' of git://git.kernel.dk/linux-block: ahci: Add Intel Comet Lake PCH RAID PCI ID ata: ahci: Add sysfs attribute to show remapped NVMe device count ata: ahci-imx: remove redundant assignment to ret libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set
2 parents 8df2a0a + 7667e63 commit f8693b3

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

drivers/ata/ahci.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
410410
{ PCI_VDEVICE(INTEL, 0x22a3), board_ahci_mobile }, /* Cherry Tr. AHCI */
411411
{ PCI_VDEVICE(INTEL, 0x5ae3), board_ahci_mobile }, /* ApolloLake AHCI */
412412
{ PCI_VDEVICE(INTEL, 0x34d3), board_ahci_mobile }, /* Ice Lake LP AHCI */
413+
{ PCI_VDEVICE(INTEL, 0x02d7), board_ahci_mobile }, /* Comet Lake PCH RAID */
413414

414415
/* JMicron 360/1/3/5/6, match class to avoid IDE function */
415416
{ PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
@@ -1495,7 +1496,7 @@ static irqreturn_t ahci_thunderx_irq_handler(int irq, void *dev_instance)
14951496
static void ahci_remap_check(struct pci_dev *pdev, int bar,
14961497
struct ahci_host_priv *hpriv)
14971498
{
1498-
int i, count = 0;
1499+
int i;
14991500
u32 cap;
15001501

15011502
/*
@@ -1516,13 +1517,14 @@ static void ahci_remap_check(struct pci_dev *pdev, int bar,
15161517
continue;
15171518

15181519
/* We've found a remapped device */
1519-
count++;
1520+
hpriv->remapped_nvme++;
15201521
}
15211522

1522-
if (!count)
1523+
if (!hpriv->remapped_nvme)
15231524
return;
15241525

1525-
dev_warn(&pdev->dev, "Found %d remapped NVMe devices.\n", count);
1526+
dev_warn(&pdev->dev, "Found %u remapped NVMe devices.\n",
1527+
hpriv->remapped_nvme);
15261528
dev_warn(&pdev->dev,
15271529
"Switch your BIOS from RAID to AHCI mode to use them.\n");
15281530

@@ -1642,6 +1644,18 @@ static void ahci_intel_pcs_quirk(struct pci_dev *pdev, struct ahci_host_priv *hp
16421644
}
16431645
}
16441646

1647+
static ssize_t remapped_nvme_show(struct device *dev,
1648+
struct device_attribute *attr,
1649+
char *buf)
1650+
{
1651+
struct ata_host *host = dev_get_drvdata(dev);
1652+
struct ahci_host_priv *hpriv = host->private_data;
1653+
1654+
return sprintf(buf, "%u\n", hpriv->remapped_nvme);
1655+
}
1656+
1657+
static DEVICE_ATTR_RO(remapped_nvme);
1658+
16451659
static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
16461660
{
16471661
unsigned int board_id = ent->driver_data;
@@ -1745,6 +1759,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
17451759
/* detect remapped nvme devices */
17461760
ahci_remap_check(pdev, ahci_pci_bar, hpriv);
17471761

1762+
sysfs_add_file_to_group(&pdev->dev.kobj,
1763+
&dev_attr_remapped_nvme.attr,
1764+
NULL);
1765+
17481766
/* must set flag prior to save config in order to take effect */
17491767
if (ahci_broken_devslp(pdev))
17501768
hpriv->flags |= AHCI_HFLAG_NO_DEVSLP;
@@ -1896,6 +1914,9 @@ static void ahci_shutdown_one(struct pci_dev *pdev)
18961914

18971915
static void ahci_remove_one(struct pci_dev *pdev)
18981916
{
1917+
sysfs_remove_file_from_group(&pdev->dev.kobj,
1918+
&dev_attr_remapped_nvme.attr,
1919+
NULL);
18991920
pm_runtime_get_noresume(&pdev->dev);
19001921
ata_pci_remove_one(pdev);
19011922
}

drivers/ata/ahci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ struct ahci_host_priv {
336336
u32 em_loc; /* enclosure management location */
337337
u32 em_buf_sz; /* EM buffer size in byte */
338338
u32 em_msg_type; /* EM message type */
339+
u32 remapped_nvme; /* NVMe remapped device count */
339340
bool got_runtime_pm; /* Did we do pm_runtime_get? */
340341
struct clk *clks[AHCI_MAX_CLKS]; /* Optional */
341342
struct reset_control *rsts; /* Optional */

drivers/ata/ahci_imx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ static int ahci_imx_softreset(struct ata_link *link, unsigned int *class,
782782
struct ata_host *host = dev_get_drvdata(ap->dev);
783783
struct ahci_host_priv *hpriv = host->private_data;
784784
struct imx_ahci_priv *imxpriv = hpriv->plat_data;
785-
int ret = -EIO;
785+
int ret;
786786

787787
if (imxpriv->type == AHCI_IMX53)
788788
ret = ahci_pmp_retry_srst_ops.softreset(link, class, deadline);

drivers/ata/libata-pmp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
763763

764764
if (dev->flags & ATA_DFLAG_DETACH) {
765765
detach = 1;
766+
rc = -ENODEV;
766767
goto fail;
767768
}
768769

0 commit comments

Comments
 (0)