Skip to content

Commit f414f9f

Browse files
committed
Merge tag 'pci-v6.18-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci
Pull pci fixes from Bjorn Helgaas: - Restore custom qcom ASPM enablement code so L1 PM Substates are enabled as they were in v6.17 even though the PCI core now enables just L0s and L1 by default (Bjorn Helgaas) - Size prefetchable bridge windows only when they actually exist, to avoid a WARN_ON() regression (Ilpo Järvinen) * tag 'pci-v6.18-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci: PCI: Do not size non-existing prefetchable window Revert "PCI: qcom: Remove custom ASPM enablement code"
2 parents 39bcf0f + 437aa64 commit f414f9f

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

drivers/pci/controller/dwc/pcie-qcom.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ struct qcom_pcie_ops {
247247
int (*get_resources)(struct qcom_pcie *pcie);
248248
int (*init)(struct qcom_pcie *pcie);
249249
int (*post_init)(struct qcom_pcie *pcie);
250+
void (*host_post_init)(struct qcom_pcie *pcie);
250251
void (*deinit)(struct qcom_pcie *pcie);
251252
void (*ltssm_enable)(struct qcom_pcie *pcie);
252253
int (*config_sid)(struct qcom_pcie *pcie);
@@ -1038,6 +1039,25 @@ static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie)
10381039
return 0;
10391040
}
10401041

1042+
static int qcom_pcie_enable_aspm(struct pci_dev *pdev, void *userdata)
1043+
{
1044+
/*
1045+
* Downstream devices need to be in D0 state before enabling PCI PM
1046+
* substates.
1047+
*/
1048+
pci_set_power_state_locked(pdev, PCI_D0);
1049+
pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL);
1050+
1051+
return 0;
1052+
}
1053+
1054+
static void qcom_pcie_host_post_init_2_7_0(struct qcom_pcie *pcie)
1055+
{
1056+
struct dw_pcie_rp *pp = &pcie->pci->pp;
1057+
1058+
pci_walk_bus(pp->bridge->bus, qcom_pcie_enable_aspm, NULL);
1059+
}
1060+
10411061
static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie)
10421062
{
10431063
struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0;
@@ -1312,9 +1332,19 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp *pp)
13121332
pcie->cfg->ops->deinit(pcie);
13131333
}
13141334

1335+
static void qcom_pcie_host_post_init(struct dw_pcie_rp *pp)
1336+
{
1337+
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
1338+
struct qcom_pcie *pcie = to_qcom_pcie(pci);
1339+
1340+
if (pcie->cfg->ops->host_post_init)
1341+
pcie->cfg->ops->host_post_init(pcie);
1342+
}
1343+
13151344
static const struct dw_pcie_host_ops qcom_pcie_dw_ops = {
13161345
.init = qcom_pcie_host_init,
13171346
.deinit = qcom_pcie_host_deinit,
1347+
.post_init = qcom_pcie_host_post_init,
13181348
};
13191349

13201350
/* Qcom IP rev.: 2.1.0 Synopsys IP rev.: 4.01a */
@@ -1376,6 +1406,7 @@ static const struct qcom_pcie_ops ops_1_9_0 = {
13761406
.get_resources = qcom_pcie_get_resources_2_7_0,
13771407
.init = qcom_pcie_init_2_7_0,
13781408
.post_init = qcom_pcie_post_init_2_7_0,
1409+
.host_post_init = qcom_pcie_host_post_init_2_7_0,
13791410
.deinit = qcom_pcie_deinit_2_7_0,
13801411
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
13811412
.config_sid = qcom_pcie_config_sid_1_9_0,
@@ -1386,6 +1417,7 @@ static const struct qcom_pcie_ops ops_1_21_0 = {
13861417
.get_resources = qcom_pcie_get_resources_2_7_0,
13871418
.init = qcom_pcie_init_2_7_0,
13881419
.post_init = qcom_pcie_post_init_2_7_0,
1420+
.host_post_init = qcom_pcie_host_post_init_2_7_0,
13891421
.deinit = qcom_pcie_deinit_2_7_0,
13901422
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
13911423
};

drivers/pci/setup-bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,7 @@ void __pci_bus_size_bridges(struct pci_bus *bus, struct list_head *realloc_head)
16041604
pbus_size_io(bus, realloc_head ? 0 : additional_io_size,
16051605
additional_io_size, realloc_head);
16061606

1607-
if (pref) {
1607+
if (pref && (pref->flags & IORESOURCE_PREFETCH)) {
16081608
pbus_size_mem(bus,
16091609
IORESOURCE_MEM | IORESOURCE_PREFETCH |
16101610
(pref->flags & IORESOURCE_MEM_64),

0 commit comments

Comments
 (0)