Skip to content

Commit

Permalink
Merge tag 'pci-v6.15-fixes-3' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/pci/pci

Pull PCI fixes from Bjorn Helgaas:

 - When releasing a start-aligned resource, e.g., a bridge window, save
   start/end/flags for the next assignment attempt; fixes a v6.15-rc1
   regression (Ilpo Järvinen)

 - Move set_pcie_speed.sh from TEST_PROGS to TEST_FILE; fixes a bwctrl
   selftest v6.15-rc1 regression (Ilpo Järvinen)

 - Add Manivannan Sadhasivam as maintainer of native host bridge and
   endpoint drivers (Manivannan Sadhasivam)

 - In endpoint test driver, defer IRQ allocation from .probe() until
   ioctl() to fix a regression on platforms where the Vendor/Device ID
   match doesn't include driver_data (Niklas Cassel)

* tag 'pci-v6.15-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
  misc: pci_endpoint_test: Defer IRQ allocation until ioctl(PCITEST_SET_IRQTYPE)
  MAINTAINERS: Move Manivannan Sadhasivam as PCI Native host bridge and endpoint maintainer
  selftests/pcie_bwctrl: Fix test progs list
  PCI: Restore assigned resources fully after release
  • Loading branch information
Linus Torvalds committed Apr 26, 2025
2 parents d22aad2 + 442caca commit 5bc1018
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
2 changes: 1 addition & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -18704,7 +18704,7 @@ F: drivers/pci/controller/pci-xgene-msi.c
PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS
M: Lorenzo Pieralisi <lpieralisi@kernel.org>
M: Krzysztof Wilczyński <kw@linux.com>
R: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
M: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
R: Rob Herring <robh@kernel.org>
L: linux-pci@vger.kernel.org
S: Supported
Expand Down
21 changes: 1 addition & 20 deletions drivers/misc/pci_endpoint_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ struct pci_endpoint_test {
struct pci_endpoint_test_data {
enum pci_barno test_reg_bar;
size_t alignment;
int irq_type;
};

static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test,
Expand Down Expand Up @@ -948,7 +947,6 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
test_reg_bar = data->test_reg_bar;
test->test_reg_bar = test_reg_bar;
test->alignment = data->alignment;
test->irq_type = data->irq_type;
}

init_completion(&test->irq_raised);
Expand All @@ -970,10 +968,6 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,

pci_set_master(pdev);

ret = pci_endpoint_test_alloc_irq_vectors(test, test->irq_type);
if (ret)
goto err_disable_irq;

for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) {
if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
base = pci_ioremap_bar(pdev, bar);
Expand Down Expand Up @@ -1009,18 +1003,14 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
goto err_ida_remove;
}

ret = pci_endpoint_test_request_irq(test);
if (ret)
goto err_kfree_test_name;

pci_endpoint_test_get_capabilities(test);

misc_device = &test->miscdev;
misc_device->minor = MISC_DYNAMIC_MINOR;
misc_device->name = kstrdup(name, GFP_KERNEL);
if (!misc_device->name) {
ret = -ENOMEM;
goto err_release_irq;
goto err_kfree_test_name;
}
misc_device->parent = &pdev->dev;
misc_device->fops = &pci_endpoint_test_fops;
Expand All @@ -1036,9 +1026,6 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
err_kfree_name:
kfree(misc_device->name);

err_release_irq:
pci_endpoint_test_release_irq(test);

err_kfree_test_name:
kfree(test->name);

Expand All @@ -1051,8 +1038,6 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
pci_iounmap(pdev, test->bar[bar]);
}

err_disable_irq:
pci_endpoint_test_free_irq_vectors(test);
pci_release_regions(pdev);

err_disable_pdev:
Expand Down Expand Up @@ -1092,23 +1077,19 @@ static void pci_endpoint_test_remove(struct pci_dev *pdev)
static const struct pci_endpoint_test_data default_data = {
.test_reg_bar = BAR_0,
.alignment = SZ_4K,
.irq_type = PCITEST_IRQ_TYPE_MSI,
};

static const struct pci_endpoint_test_data am654_data = {
.test_reg_bar = BAR_2,
.alignment = SZ_64K,
.irq_type = PCITEST_IRQ_TYPE_MSI,
};

static const struct pci_endpoint_test_data j721e_data = {
.alignment = 256,
.irq_type = PCITEST_IRQ_TYPE_MSI,
};

static const struct pci_endpoint_test_data rk3588_data = {
.alignment = SZ_64K,
.irq_type = PCITEST_IRQ_TYPE_MSI,
};

/*
Expand Down
4 changes: 4 additions & 0 deletions drivers/pci/setup-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ static void pdev_sort_resources(struct pci_dev *dev, struct list_head *head)
panic("%s: kzalloc() failed!\n", __func__);
tmp->res = r;
tmp->dev = dev;
tmp->start = r->start;
tmp->end = r->end;
tmp->flags = r->flags;

/* Fallback is smallest one or list is empty */
n = head;
Expand Down Expand Up @@ -545,6 +548,7 @@ static void __assign_resources_sorted(struct list_head *head,
pci_dbg(dev, "%s %pR: releasing\n", res_name, res);

release_resource(res);
restore_dev_resource(dev_res);
}
/* Restore start/end/flags from saved list */
list_for_each_entry(save_res, &save_head, list)
Expand Down
3 changes: 2 additions & 1 deletion tools/testing/selftests/pcie_bwctrl/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
TEST_PROGS = set_pcie_cooling_state.sh set_pcie_speed.sh
TEST_PROGS = set_pcie_cooling_state.sh
TEST_FILES = set_pcie_speed.sh
include ../lib.mk

0 comments on commit 5bc1018

Please sign in to comment.