Commit 080a62e2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag '3.8-pci-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

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
...@@ -434,7 +434,8 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = { ...@@ -434,7 +434,8 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = {
.callback = set_scan_all, .callback = set_scan_all,
.ident = "Stratus/NEC ftServer", .ident = "Stratus/NEC ftServer",
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ftServer"), DMI_MATCH(DMI_SYS_VENDOR, "Stratus"),
DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"),
}, },
}, },
{} {}
......
...@@ -422,77 +422,60 @@ static ssize_t sriov_numvfs_show(struct device *dev, ...@@ -422,77 +422,60 @@ static ssize_t sriov_numvfs_show(struct device *dev,
} }
/* /*
* num_vfs > 0; number of vfs to enable * num_vfs > 0; number of VFs to enable
* num_vfs = 0; disable all vfs * num_vfs = 0; disable all VFs
* *
* Note: SRIOV spec doesn't allow partial VF * 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, static ssize_t sriov_numvfs_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
int num_vfs_enabled = 0; int ret;
int num_vfs; u16 num_vfs;
int ret = 0;
u16 total;
if (kstrtoint(buf, 0, &num_vfs) < 0) ret = kstrtou16(buf, 0, &num_vfs);
return -EINVAL; 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 */ /* is PF driver loaded w/callback */
if (!pdev->driver || !pdev->driver->sriov_configure) { if (!pdev->driver || !pdev->driver->sriov_configure) {
dev_info(&pdev->dev, dev_info(&pdev->dev, "Driver doesn't support SRIOV configuration via sysfs\n");
"Driver doesn't support SRIOV configuration via sysfs\n");
return -ENOSYS; return -ENOSYS;
} }
/* if enabling vf's ... */ if (num_vfs == 0) {
total = pci_sriov_get_totalvfs(pdev); /* disable VFs */
/* Requested VFs to enable < totalvfs and none enabled already */ ret = pdev->driver->sriov_configure(pdev, 0);
if ((num_vfs > 0) && (num_vfs <= total)) { if (ret < 0)
if (pdev->sriov->num_VFs == 0) { return ret;
num_vfs_enabled = return count;
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 */ /* enable VFs */
if (num_vfs == 0) { if (pdev->sriov->num_VFs) {
if (pdev->sriov->num_VFs != 0) { dev_warn(&pdev->dev, "%d VFs already enabled. Disable before enabling %d VFs\n",
ret = pdev->driver->sriov_configure(pdev, 0); pdev->sriov->num_VFs, num_vfs);
return ret ? ret : count; return -EBUSY;
} else {
dev_warn(&pdev->dev,
"All VFs disabled; no disable action taken\n");
return count;
}
} }
dev_err(&pdev->dev, ret = pdev->driver->sriov_configure(pdev, num_vfs);
"Invalid value for number of VFs to enable: %d\n", 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); static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs);
......
...@@ -134,10 +134,28 @@ static int pcie_port_runtime_resume(struct device *dev) ...@@ -134,10 +134,28 @@ static int pcie_port_runtime_resume(struct device *dev)
return 0; 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) 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 */ /* Delay for a short while to prevent too frequent suspend/resume */
pm_schedule_suspend(dev, 10); if (!pme_poll)
pm_schedule_suspend(dev, 10);
return -EBUSY; return -EBUSY;
} }
#else #else
......
...@@ -2725,7 +2725,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) ...@@ -2725,7 +2725,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
if (PCI_FUNC(dev->devfn)) if (PCI_FUNC(dev->devfn))
return; 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 * certain types of SD/MMC cards. Lowering the SD base
* clock frequency from 200Mhz to 50Mhz fixes this issue. * clock frequency from 200Mhz to 50Mhz fixes this issue.
* *
...@@ -2736,7 +2736,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) ...@@ -2736,7 +2736,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
* 0xf9 - Key register for 0x150 * 0xf9 - Key register for 0x150
* 0xfc - key register for 0xe1 * 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, 0xf9, 0xfc);
pci_write_config_byte(dev, 0x150, 0x10); pci_write_config_byte(dev, 0x150, 0x10);
pci_write_config_byte(dev, 0xf9, 0x00); pci_write_config_byte(dev, 0xf9, 0x00);
...@@ -2763,6 +2764,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) ...@@ -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_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_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_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); DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
#endif /*CONFIG_MMC_RICOH_MMC*/ #endif /*CONFIG_MMC_RICOH_MMC*/
......
...@@ -1568,6 +1568,7 @@ ...@@ -1568,6 +1568,7 @@
#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 #define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 #define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
#define PCI_DEVICE_ID_RICOH_R5C822 0x0822 #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_R5CE823 0xe823
#define PCI_DEVICE_ID_RICOH_R5C832 0x0832 #define PCI_DEVICE_ID_RICOH_R5C832 0x0832
#define PCI_DEVICE_ID_RICOH_R5C843 0x0843 #define PCI_DEVICE_ID_RICOH_R5C843 0x0843
......
...@@ -458,6 +458,8 @@ ...@@ -458,6 +458,8 @@
#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ #define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ #define PCI_EXP_LNKCAP 12 /* Link Capabilities */
#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ #define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */
#define PCI_EXP_LNKCAP_SLS_2_5GB 0x1 /* LNKCAP2 SLS Vector bit 0 (2.5GT/s) */
#define PCI_EXP_LNKCAP_SLS_5_0GB 0x2 /* LNKCAP2 SLS Vector bit 1 (5.0GT/s) */
#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */
#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment