Commit f8693b3e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
parents 8df2a0a6 7667e63c
Loading
Loading
Loading
Loading
+25 −4
Original line number Diff line number Diff line
@@ -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);
}
+1 −0
Original line number Diff line number Diff line
@@ -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 */
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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;
	}