Skip to content

Commit 5943a9b

Browse files
committed
Merge tag 'pci-v4.19-fixes-3' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Bjorn writes: "PCI fixes for v4.19: - Reprogram bridge prefetch registers to fix NVIDIA and Radeon issues after suspend/resume (Daniel Drake) - Fix mvebu I/O mapping creation sequence (Thomas Petazzoni) - Fix minor MAINTAINERS file match issue (Bjorn Helgaas)" * tag 'pci-v4.19-fixes-3' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: PCI: mvebu: Fix PCI I/O mapping creation sequence MAINTAINERS: Remove obsolete drivers/pci pattern from ACPI section PCI: Reprogram bridge prefetch registers on resume
2 parents b98d6cb + 95375f2 commit 5943a9b

File tree

3 files changed

+67
-13
lines changed

3 files changed

+67
-13
lines changed

MAINTAINERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ F: Documentation/ABI/testing/sysfs-bus-acpi
324324
F: Documentation/ABI/testing/configfs-acpi
325325
F: drivers/pci/*acpi*
326326
F: drivers/pci/*/*acpi*
327-
F: drivers/pci/*/*/*acpi*
328327
F: tools/power/acpi/
329328

330329
ACPI APEI

drivers/pci/controller/pci-mvebu.c

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,6 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
11451145
{
11461146
struct device *dev = &pcie->pdev->dev;
11471147
struct device_node *np = dev->of_node;
1148-
unsigned int i;
11491148
int ret;
11501149

11511150
INIT_LIST_HEAD(&pcie->resources);
@@ -1179,13 +1178,58 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie)
11791178
resource_size(&pcie->io) - 1);
11801179
pcie->realio.name = "PCI I/O";
11811180

1181+
pci_add_resource(&pcie->resources, &pcie->realio);
1182+
}
1183+
1184+
return devm_request_pci_bus_resources(dev, &pcie->resources);
1185+
}
1186+
1187+
/*
1188+
* This is a copy of pci_host_probe(), except that it does the I/O
1189+
* remap as the last step, once we are sure we won't fail.
1190+
*
1191+
* It should be removed once the I/O remap error handling issue has
1192+
* been sorted out.
1193+
*/
1194+
static int mvebu_pci_host_probe(struct pci_host_bridge *bridge)
1195+
{
1196+
struct mvebu_pcie *pcie;
1197+
struct pci_bus *bus, *child;
1198+
int ret;
1199+
1200+
ret = pci_scan_root_bus_bridge(bridge);
1201+
if (ret < 0) {
1202+
dev_err(bridge->dev.parent, "Scanning root bridge failed");
1203+
return ret;
1204+
}
1205+
1206+
pcie = pci_host_bridge_priv(bridge);
1207+
if (resource_size(&pcie->io) != 0) {
1208+
unsigned int i;
1209+
11821210
for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K)
11831211
pci_ioremap_io(i, pcie->io.start + i);
1212+
}
11841213

1185-
pci_add_resource(&pcie->resources, &pcie->realio);
1214+
bus = bridge->bus;
1215+
1216+
/*
1217+
* We insert PCI resources into the iomem_resource and
1218+
* ioport_resource trees in either pci_bus_claim_resources()
1219+
* or pci_bus_assign_resources().
1220+
*/
1221+
if (pci_has_flag(PCI_PROBE_ONLY)) {
1222+
pci_bus_claim_resources(bus);
1223+
} else {
1224+
pci_bus_size_bridges(bus);
1225+
pci_bus_assign_resources(bus);
1226+
1227+
list_for_each_entry(child, &bus->children, node)
1228+
pcie_bus_configure_settings(child);
11861229
}
11871230

1188-
return devm_request_pci_bus_resources(dev, &pcie->resources);
1231+
pci_bus_add_devices(bus);
1232+
return 0;
11891233
}
11901234

11911235
static int mvebu_pcie_probe(struct platform_device *pdev)
@@ -1268,7 +1312,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
12681312
bridge->align_resource = mvebu_pcie_align_resource;
12691313
bridge->msi = pcie->msi;
12701314

1271-
return pci_host_probe(bridge);
1315+
return mvebu_pci_host_probe(bridge);
12721316
}
12731317

12741318
static const struct of_device_id mvebu_pcie_of_match_table[] = {

drivers/pci/pci.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,12 +1289,12 @@ int pci_save_state(struct pci_dev *dev)
12891289
EXPORT_SYMBOL(pci_save_state);
12901290

12911291
static void pci_restore_config_dword(struct pci_dev *pdev, int offset,
1292-
u32 saved_val, int retry)
1292+
u32 saved_val, int retry, bool force)
12931293
{
12941294
u32 val;
12951295

12961296
pci_read_config_dword(pdev, offset, &val);
1297-
if (val == saved_val)
1297+
if (!force && val == saved_val)
12981298
return;
12991299

13001300
for (;;) {
@@ -1313,25 +1313,36 @@ static void pci_restore_config_dword(struct pci_dev *pdev, int offset,
13131313
}
13141314

13151315
static void pci_restore_config_space_range(struct pci_dev *pdev,
1316-
int start, int end, int retry)
1316+
int start, int end, int retry,
1317+
bool force)
13171318
{
13181319
int index;
13191320

13201321
for (index = end; index >= start; index--)
13211322
pci_restore_config_dword(pdev, 4 * index,
13221323
pdev->saved_config_space[index],
1323-
retry);
1324+
retry, force);
13241325
}
13251326

13261327
static void pci_restore_config_space(struct pci_dev *pdev)
13271328
{
13281329
if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
1329-
pci_restore_config_space_range(pdev, 10, 15, 0);
1330+
pci_restore_config_space_range(pdev, 10, 15, 0, false);
13301331
/* Restore BARs before the command register. */
1331-
pci_restore_config_space_range(pdev, 4, 9, 10);
1332-
pci_restore_config_space_range(pdev, 0, 3, 0);
1332+
pci_restore_config_space_range(pdev, 4, 9, 10, false);
1333+
pci_restore_config_space_range(pdev, 0, 3, 0, false);
1334+
} else if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
1335+
pci_restore_config_space_range(pdev, 12, 15, 0, false);
1336+
1337+
/*
1338+
* Force rewriting of prefetch registers to avoid S3 resume
1339+
* issues on Intel PCI bridges that occur when these
1340+
* registers are not explicitly written.
1341+
*/
1342+
pci_restore_config_space_range(pdev, 9, 11, 0, true);
1343+
pci_restore_config_space_range(pdev, 0, 8, 0, false);
13331344
} else {
1334-
pci_restore_config_space_range(pdev, 0, 15, 0);
1345+
pci_restore_config_space_range(pdev, 0, 15, 0, false);
13351346
}
13361347
}
13371348

0 commit comments

Comments
 (0)