Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 080a62e2 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull PCI updates from Bjorn Helgaas:
 "Some fixes for v3.8.  They include a fix for the new SR-IOV sysfs
  management support, an expanded quirk for Ricoh SD card readers, a
  Stratus DMI quirk fix, and a PME polling fix."

* tag '3.8-pci-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
  PCI: Reduce Ricoh 0xe822 SD card reader base clock frequency to 50MHz
  PCI/PM: Do not suspend port if any subordinate device needs PME polling
  PCI: Add PCIe Link Capability link speed and width names
  PCI: Work around Stratus ftServer broken PCIe hierarchy (fix DMI check)
  PCI: Remove spurious error for sriov_numvfs store and simplify flow
parents 8a7eab2b 812089e0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -434,7 +434,8 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = {
		.callback = set_scan_all,
		.ident = "Stratus/NEC ftServer",
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "ftServer"),
			DMI_MATCH(DMI_SYS_VENDOR, "Stratus"),
			DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"),
		},
	},
	{}
+34 −51
Original line number Diff line number Diff line
@@ -422,77 +422,60 @@ static ssize_t sriov_numvfs_show(struct device *dev,
}

/*
 * num_vfs > 0; number of vfs to enable
 * num_vfs = 0; disable all vfs
 * num_vfs > 0; number of VFs to enable
 * num_vfs = 0; disable all VFs
 *
 * Note: SRIOV spec doesn't allow partial VF
 *       disable, so its all or none.
 *       disable, so it's all or none.
 */
static ssize_t sriov_numvfs_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf, size_t count)
{
	struct pci_dev *pdev = to_pci_dev(dev);
	int num_vfs_enabled = 0;
	int num_vfs;
	int ret = 0;
	u16 total;
	int ret;
	u16 num_vfs;

	if (kstrtoint(buf, 0, &num_vfs) < 0)
		return -EINVAL;
	ret = kstrtou16(buf, 0, &num_vfs);
	if (ret < 0)
		return ret;

	if (num_vfs > pci_sriov_get_totalvfs(pdev))
		return -ERANGE;

	if (num_vfs == pdev->sriov->num_VFs)
		return count;		/* no change */

	/* is PF driver loaded w/callback */
	if (!pdev->driver || !pdev->driver->sriov_configure) {
		dev_info(&pdev->dev,
			 "Driver doesn't support SRIOV configuration via sysfs\n");
		dev_info(&pdev->dev, "Driver doesn't support SRIOV configuration via sysfs\n");
		return -ENOSYS;
	}

	/* if enabling vf's ... */
	total = pci_sriov_get_totalvfs(pdev);
	/* Requested VFs to enable < totalvfs and none enabled already */
	if ((num_vfs > 0) && (num_vfs <= total)) {
		if (pdev->sriov->num_VFs == 0) {
			num_vfs_enabled =
				pdev->driver->sriov_configure(pdev, num_vfs);
			if ((num_vfs_enabled >= 0) &&
			    (num_vfs_enabled != num_vfs)) {
				dev_warn(&pdev->dev,
					 "Only %d VFs enabled\n",
					 num_vfs_enabled);
				return count;
			} else if (num_vfs_enabled < 0)
				/* error code from driver callback */
				return num_vfs_enabled;
		} else if (num_vfs == pdev->sriov->num_VFs) {
			dev_warn(&pdev->dev,
				 "%d VFs already enabled; no enable action taken\n",
				 num_vfs);
			return count;
		} else {
			dev_warn(&pdev->dev,
				 "%d VFs already enabled. Disable before enabling %d VFs\n",
				 pdev->sriov->num_VFs, num_vfs);
			return -EINVAL;
		}
	}

	/* disable vfs */
	if (num_vfs == 0) {
		if (pdev->sriov->num_VFs != 0) {
		/* disable VFs */
		ret = pdev->driver->sriov_configure(pdev, 0);
			return ret ? ret : count;
		} else {
			dev_warn(&pdev->dev,
				 "All VFs disabled; no disable action taken\n");
		if (ret < 0)
			return ret;
		return count;
	}

	/* enable VFs */
	if (pdev->sriov->num_VFs) {
		dev_warn(&pdev->dev, "%d VFs already enabled. Disable before enabling %d VFs\n",
			 pdev->sriov->num_VFs, num_vfs);
		return -EBUSY;
	}

	dev_err(&pdev->dev,
		"Invalid value for number of VFs to enable: %d\n", num_vfs);
	ret = pdev->driver->sriov_configure(pdev, num_vfs);
	if (ret < 0)
		return ret;

	return -EINVAL;
	if (ret != num_vfs)
		dev_warn(&pdev->dev, "%d VFs requested; only %d enabled\n",
			 num_vfs, ret);

	return count;
}

static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs);
+19 −1
Original line number Diff line number Diff line
@@ -134,9 +134,27 @@ static int pcie_port_runtime_resume(struct device *dev)
	return 0;
}

static int pci_dev_pme_poll(struct pci_dev *pdev, void *data)
{
	bool *pme_poll = data;

	if (pdev->pme_poll)
		*pme_poll = true;
	return 0;
}

static int pcie_port_runtime_idle(struct device *dev)
{
	struct pci_dev *pdev = to_pci_dev(dev);
	bool pme_poll = false;

	/*
	 * If any subordinate device needs pme poll, we should keep
	 * the port in D0, because we need port in D0 to poll it.
	 */
	pci_walk_bus(pdev->subordinate, pci_dev_pme_poll, &pme_poll);
	/* Delay for a short while to prevent too frequent suspend/resume */
	if (!pme_poll)
		pm_schedule_suspend(dev, 10);
	return -EBUSY;
}
+5 −2
Original line number Diff line number Diff line
@@ -2725,7 +2725,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
	if (PCI_FUNC(dev->devfn))
		return;
	/*
	 * RICOH 0xe823 SD/MMC card reader fails to recognize
	 * RICOH 0xe822 and 0xe823 SD/MMC card readers fail to recognize
	 * certain types of SD/MMC cards. Lowering the SD base
	 * clock frequency from 200Mhz to 50Mhz fixes this issue.
	 *
@@ -2736,7 +2736,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
	 * 0xf9  - Key register for 0x150
	 * 0xfc  - key register for 0xe1
	 */
	if (dev->device == PCI_DEVICE_ID_RICOH_R5CE823) {
	if (dev->device == PCI_DEVICE_ID_RICOH_R5CE822 ||
	    dev->device == PCI_DEVICE_ID_RICOH_R5CE823) {
		pci_write_config_byte(dev, 0xf9, 0xfc);
		pci_write_config_byte(dev, 0x150, 0x10);
		pci_write_config_byte(dev, 0xf9, 0x00);
@@ -2763,6 +2764,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
}
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
#endif /*CONFIG_MMC_RICOH_MMC*/
+1 −0
Original line number Diff line number Diff line
@@ -1568,6 +1568,7 @@
#define PCI_DEVICE_ID_RICOH_RL5C476	0x0476
#define PCI_DEVICE_ID_RICOH_RL5C478	0x0478
#define PCI_DEVICE_ID_RICOH_R5C822	0x0822
#define PCI_DEVICE_ID_RICOH_R5CE822	0xe822
#define PCI_DEVICE_ID_RICOH_R5CE823	0xe823
#define PCI_DEVICE_ID_RICOH_R5C832	0x0832
#define PCI_DEVICE_ID_RICOH_R5C843	0x0843
Loading