libata-5.7-2020-04-09

-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAl6PxwoQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgplt0EADL0FRDalCOWYQ0RRjjXyiW0AjEntnMfKMP
 BluX/2MzuBVE8U3/5oX2AJJ17kVG1YHrYvqWBbgbX+kgvRguB2kswdPPyBFAiBif
 UzbqxA9K8t9Z9cqVrDm2+9sxrsaTTUiPeT7m4jQ9BfvLJw4rRhDN5c2iiyP3HYZi
 FMzLW3vzFFoau7myypm6bQu8cpuDEMh+tzOZDfrpEGePxUAD1Ogq0pFEDsCv9rw6
 tZTbAcTY7pwwC1hKHb5+K+PoydxNYrK00XKOEYvujd3IfzAoR+SF3/jcQV4Ev8of
 blQn5RU/pPToSRYfGpWYRAwquPHBdVhFH9l06C97WHF1u2IUBCRREN1+vtZZti67
 hPlwuOsAWhpFihtx/VyGuaAcZUCsCuymhJ4LRnLKtpTPKeCZRVFgPjIPfl/xPshB
 w3QM7MoSGDRag2w6+zUBUAW3srYcvYdQTxuhCu8os7zg2s+7u3Yfq07LYplNj0xZ
 mL7L4Pm5IZLu42HncbqVyD2p1kO4nQ+J12LvTFbviBDslhvpkX4WD9Uq+ACwb2NL
 u1ZAB6RkByPnZRipVKwYnfdocfOUe5eQHE4UXFHBBV9TwZQGU4wnpNBZUQHz4mNw
 SaiVzRoc4di0VgKN/tPZAvwR6vVVTmMKZgYTQXIqDPTjzfiUky85kNuAf6wMugXi
 hvv/EL9Hkw==
 =ydEh
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2020-04-10 10:26:28 -07:00
commit f8693b3eb5
4 changed files with 28 additions and 5 deletions

View File

@ -410,6 +410,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
{ PCI_VDEVICE(INTEL, 0x22a3), board_ahci_mobile }, /* Cherry Tr. AHCI */
{ PCI_VDEVICE(INTEL, 0x5ae3), board_ahci_mobile }, /* ApolloLake AHCI */
{ PCI_VDEVICE(INTEL, 0x34d3), board_ahci_mobile }, /* Ice Lake LP AHCI */
{ PCI_VDEVICE(INTEL, 0x02d7), board_ahci_mobile }, /* Comet Lake PCH RAID */
/* JMicron 360/1/3/5/6, match class to avoid IDE function */
{ 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)
static void ahci_remap_check(struct pci_dev *pdev, int bar,
struct ahci_host_priv *hpriv)
{
int i, count = 0;
int i;
u32 cap;
/*
@ -1516,13 +1517,14 @@ static void ahci_remap_check(struct pci_dev *pdev, int bar,
continue;
/* We've found a remapped device */
count++;
hpriv->remapped_nvme++;
}
if (!count)
if (!hpriv->remapped_nvme)
return;
dev_warn(&pdev->dev, "Found %d remapped NVMe devices.\n", count);
dev_warn(&pdev->dev, "Found %u remapped NVMe devices.\n",
hpriv->remapped_nvme);
dev_warn(&pdev->dev,
"Switch your BIOS from RAID to AHCI mode to use them.\n");
@ -1642,6 +1644,18 @@ static void ahci_intel_pcs_quirk(struct pci_dev *pdev, struct ahci_host_priv *hp
}
}
static ssize_t remapped_nvme_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct ata_host *host = dev_get_drvdata(dev);
struct ahci_host_priv *hpriv = host->private_data;
return sprintf(buf, "%u\n", hpriv->remapped_nvme);
}
static DEVICE_ATTR_RO(remapped_nvme);
static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
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)
/* detect remapped nvme devices */
ahci_remap_check(pdev, ahci_pci_bar, hpriv);
sysfs_add_file_to_group(&pdev->dev.kobj,
&dev_attr_remapped_nvme.attr,
NULL);
/* must set flag prior to save config in order to take effect */
if (ahci_broken_devslp(pdev))
hpriv->flags |= AHCI_HFLAG_NO_DEVSLP;
@ -1896,6 +1914,9 @@ static void ahci_shutdown_one(struct pci_dev *pdev)
static void ahci_remove_one(struct pci_dev *pdev)
{
sysfs_remove_file_from_group(&pdev->dev.kobj,
&dev_attr_remapped_nvme.attr,
NULL);
pm_runtime_get_noresume(&pdev->dev);
ata_pci_remove_one(pdev);
}

View File

@ -336,6 +336,7 @@ struct ahci_host_priv {
u32 em_loc; /* enclosure management location */
u32 em_buf_sz; /* EM buffer size in byte */
u32 em_msg_type; /* EM message type */
u32 remapped_nvme; /* NVMe remapped device count */
bool got_runtime_pm; /* Did we do pm_runtime_get? */
struct clk *clks[AHCI_MAX_CLKS]; /* Optional */
struct reset_control *rsts; /* Optional */

View File

@ -782,7 +782,7 @@ static int ahci_imx_softreset(struct ata_link *link, unsigned int *class,
struct ata_host *host = dev_get_drvdata(ap->dev);
struct ahci_host_priv *hpriv = host->private_data;
struct imx_ahci_priv *imxpriv = hpriv->plat_data;
int ret = -EIO;
int ret;
if (imxpriv->type == AHCI_IMX53)
ret = ahci_pmp_retry_srst_ops.softreset(link, class, deadline);

View File

@ -763,6 +763,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
if (dev->flags & ATA_DFLAG_DETACH) {
detach = 1;
rc = -ENODEV;
goto fail;
}