Commit a36bfddd authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci:
  PCI: Set device power state to PCI_D0 for device without native PM support
  PCI hotplug: Always allow acpiphp to handle non-PCIe bridges
  PCI: fix ats compile failure
  PCI: defer enablement of SRIOV BARS
parents 384703b8 b51306c6
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/export.h> #include <linux/export.h>
#include <linux/pci-ats.h> #include <linux/pci-ats.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/slab.h>
#include "pci.h" #include "pci.h"
......
...@@ -132,6 +132,18 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -132,6 +132,18 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle)) if (!acpi_pci_check_ejectable(pbus, handle) && !is_dock_device(handle))
return AE_OK; return AE_OK;
pdev = pbus->self;
if (pdev && pci_is_pcie(pdev)) {
tmp = acpi_find_root_bridge_handle(pdev);
if (tmp) {
struct acpi_pci_root *root = acpi_pci_find_root(tmp);
if (root && (root->osc_control_set &
OSC_PCI_EXPRESS_NATIVE_HP_CONTROL))
return AE_OK;
}
}
acpi_evaluate_integer(handle, "_ADR", NULL, &adr); acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
device = (adr >> 16) & 0xffff; device = (adr >> 16) & 0xffff;
function = adr & 0xffff; function = adr & 0xffff;
...@@ -213,7 +225,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -213,7 +225,6 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
pdev = pci_get_slot(pbus, PCI_DEVFN(device, function)); pdev = pci_get_slot(pbus, PCI_DEVFN(device, function));
if (pdev) { if (pdev) {
pdev->current_state = PCI_D0;
slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON); slot->flags |= (SLOT_ENABLED | SLOT_POWEREDON);
pci_dev_put(pdev); pci_dev_put(pdev);
} }
...@@ -459,17 +470,8 @@ static int add_bridge(acpi_handle handle) ...@@ -459,17 +470,8 @@ static int add_bridge(acpi_handle handle)
{ {
acpi_status status; acpi_status status;
unsigned long long tmp; unsigned long long tmp;
struct acpi_pci_root *root;
acpi_handle dummy_handle; acpi_handle dummy_handle;
/*
* We shouldn't use this bridge if PCIe native hotplug control has been
* granted by the BIOS for it.
*/
root = acpi_pci_find_root(handle);
if (root && (root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL))
return -ENODEV;
/* if the bridge doesn't have _STA, we assume it is always there */ /* if the bridge doesn't have _STA, we assume it is always there */
status = acpi_get_handle(handle, "_STA", &dummy_handle); status = acpi_get_handle(handle, "_STA", &dummy_handle);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
...@@ -1385,19 +1387,11 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, ...@@ -1385,19 +1387,11 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type,
static acpi_status static acpi_status
find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
{ {
struct acpi_pci_root *root;
int *count = (int *)context; int *count = (int *)context;
if (!acpi_is_root_bridge(handle)) if (!acpi_is_root_bridge(handle))
return AE_OK; return AE_OK;
root = acpi_pci_find_root(handle);
if (!root)
return AE_OK;
if (root->osc_control_set & OSC_PCI_EXPRESS_NATIVE_HP_CONTROL)
return AE_OK;
(*count)++; (*count)++;
acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
handle_hotplug_event_bridge, NULL); handle_hotplug_event_bridge, NULL);
......
...@@ -283,6 +283,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) ...@@ -283,6 +283,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
struct resource *res; struct resource *res;
struct pci_dev *pdev; struct pci_dev *pdev;
struct pci_sriov *iov = dev->sriov; struct pci_sriov *iov = dev->sriov;
int bars = 0;
if (!nr_virtfn) if (!nr_virtfn)
return 0; return 0;
...@@ -307,6 +308,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) ...@@ -307,6 +308,7 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
nres = 0; nres = 0;
for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) { for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
bars |= (1 << (i + PCI_IOV_RESOURCES));
res = dev->resource + PCI_IOV_RESOURCES + i; res = dev->resource + PCI_IOV_RESOURCES + i;
if (res->parent) if (res->parent)
nres++; nres++;
...@@ -324,6 +326,11 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn) ...@@ -324,6 +326,11 @@ static int sriov_enable(struct pci_dev *dev, int nr_virtfn)
return -ENOMEM; return -ENOMEM;
} }
if (pci_enable_resources(dev, bars)) {
dev_err(&dev->dev, "SR-IOV: IOV BARS not allocated\n");
return -ENOMEM;
}
if (iov->link != dev->devfn) { if (iov->link != dev->devfn) {
pdev = pci_get_slot(dev->bus, iov->link); pdev = pci_get_slot(dev->bus, iov->link);
if (!pdev) if (!pdev)
......
...@@ -664,6 +664,9 @@ static int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state) ...@@ -664,6 +664,9 @@ static int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state)
error = platform_pci_set_power_state(dev, state); error = platform_pci_set_power_state(dev, state);
if (!error) if (!error)
pci_update_current_state(dev, state); pci_update_current_state(dev, state);
/* Fall back to PCI_D0 if native PM is not supported */
if (!dev->pm_cap)
dev->current_state = PCI_D0;
} else { } else {
error = -ENODEV; error = -ENODEV;
/* Fall back to PCI_D0 if native PM is not supported */ /* Fall back to PCI_D0 if native PM is not supported */
...@@ -1126,7 +1129,7 @@ static int __pci_enable_device_flags(struct pci_dev *dev, ...@@ -1126,7 +1129,7 @@ static int __pci_enable_device_flags(struct pci_dev *dev,
if (atomic_add_return(1, &dev->enable_cnt) > 1) if (atomic_add_return(1, &dev->enable_cnt) > 1)
return 0; /* already enabled */ return 0; /* already enabled */
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) for (i = 0; i < PCI_ROM_RESOURCE; i++)
if (dev->resource[i].flags & flags) if (dev->resource[i].flags & flags)
bars |= (1 << i); bars |= (1 << i);
......
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