Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pci-v7.0-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci

Pull pci fixes from Bjorn Helgaas:

- Fix bridge window selection bug that prevented resource assignment
(Kai-Heng Feng)

- Fix bridge window sizing, which failed to assign resources for
windows containing only optional resources (ROMs, SR-IOV BARs, etc)
(Ilpo Järvinen)

- Select CONFIGFS_FS when PCI_EPF_TEST is enabled to avoid a link error
(Arnd Bergmann)

- Fix recently merged Endpoint inbound submapping feature (Koichiro
Den)

* tag 'pci-v7.0-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
PCI: dwc: ep: Always clear IB maps on BAR update
PCI: dwc: ep: Return after clearing BAR-match inbound mapping
PCI: endpoint: pci-epf-test: Select configfs
PCI: Account fully optional bridge windows correctly
PCI: Validate window resource type in pbus_select_window_for_type()

+40 -20
+12 -3
drivers/pci/controller/dwc/pcie-designware-ep.c
··· 165 165 dw_pcie_disable_atu(pci, PCIE_ATU_REGION_DIR_IB, atu_index); 166 166 clear_bit(atu_index, ep->ib_window_map); 167 167 ep_func->bar_to_atu[bar] = 0; 168 + return; 168 169 } 169 170 170 171 /* Tear down all Address Match Mode mappings, if any. */ ··· 519 518 /* 520 519 * We can only dynamically change a BAR if the new BAR size and 521 520 * BAR flags do not differ from the existing configuration. 521 + * 522 + * Note: this safety check only works when the caller uses 523 + * a new struct pci_epf_bar in the second set_bar() call. 524 + * If the same instance is updated in place and passed in, 525 + * we cannot reliably detect invalid barno/size/flags 526 + * changes here. 522 527 */ 523 528 if (ep_func->epf_bar[bar]->barno != bar || 524 529 ep_func->epf_bar[bar]->size != size || ··· 533 526 534 527 /* 535 528 * When dynamically changing a BAR, tear down any existing 536 - * mappings before re-programming. 529 + * mappings before re-programming. This is redundant when 530 + * both the old and new mappings are BAR Match Mode, but 531 + * required to handle in-place updates and match-mode 532 + * changes reliably. 537 533 */ 538 - if (ep_func->epf_bar[bar]->num_submap || epf_bar->num_submap) 539 - dw_pcie_ep_clear_ib_maps(ep, func_no, bar); 534 + dw_pcie_ep_clear_ib_maps(ep, func_no, bar); 540 535 541 536 /* 542 537 * When dynamically changing a BAR, skip writing the BAR reg, as
+1
drivers/pci/endpoint/functions/Kconfig
··· 6 6 config PCI_EPF_TEST 7 7 tristate "PCI Endpoint Test driver" 8 8 depends on PCI_ENDPOINT 9 + select CONFIGFS_FS 9 10 select CRC32 10 11 help 11 12 Enable this configuration option to enable the test driver
+27 -17
drivers/pci/setup-bus.c
··· 224 224 225 225 switch (iores_type) { 226 226 case IORESOURCE_IO: 227 - return pci_bus_resource_n(bus, PCI_BUS_BRIDGE_IO_WINDOW); 227 + win = pci_bus_resource_n(bus, PCI_BUS_BRIDGE_IO_WINDOW); 228 + if (win && (win->flags & IORESOURCE_IO)) 229 + return win; 230 + return NULL; 228 231 229 232 case IORESOURCE_MEM: 230 233 mmio = pci_bus_resource_n(bus, PCI_BUS_BRIDGE_MEM_WINDOW); 231 234 mmio_pref = pci_bus_resource_n(bus, PCI_BUS_BRIDGE_PREF_MEM_WINDOW); 232 235 233 - if (!(type & IORESOURCE_PREFETCH) || 234 - !(mmio_pref->flags & IORESOURCE_MEM)) 236 + if (mmio && !(mmio->flags & IORESOURCE_MEM)) 237 + mmio = NULL; 238 + if (mmio_pref && !(mmio_pref->flags & IORESOURCE_MEM)) 239 + mmio_pref = NULL; 240 + 241 + if (!(type & IORESOURCE_PREFETCH) || !mmio_pref) 235 242 return mmio; 236 243 237 244 if ((type & IORESOURCE_MEM_64) || ··· 1224 1217 struct resource *res = pci_resource_n(dev, resno); 1225 1218 bool optional = pci_resource_is_optional(dev, resno); 1226 1219 resource_size_t r_size = resource_size(res); 1227 - struct pci_dev_resource *dev_res; 1220 + struct pci_dev_resource *dev_res = NULL; 1228 1221 1229 1222 if (!realloc_head) 1230 1223 return false; 1231 1224 1232 - if (!optional) { 1233 - /* 1234 - * Only bridges have optional sizes in realloc_head at this 1235 - * point. As res_to_dev_res() walks the entire realloc_head 1236 - * list, skip calling it when known unnecessary. 1237 - */ 1238 - if (!pci_resource_is_bridge_win(resno)) 1239 - return false; 1240 - 1225 + /* 1226 + * Only bridges have optional sizes in realloc_head at this 1227 + * point. As res_to_dev_res() walks the entire realloc_head 1228 + * list, skip calling it when known unnecessary. 1229 + */ 1230 + if (pci_resource_is_bridge_win(resno)) { 1241 1231 dev_res = res_to_dev_res(realloc_head, res); 1242 1232 if (dev_res) { 1243 1233 *children_add_size += dev_res->add_size; 1244 1234 *add_align = max(*add_align, dev_res->min_align); 1245 1235 } 1246 - 1247 - return false; 1248 1236 } 1249 1237 1250 - /* Put SRIOV requested res to the optional list */ 1251 - pci_dev_res_add_to_list(realloc_head, dev, res, 0, align); 1238 + if (!optional) 1239 + return false; 1240 + 1241 + /* 1242 + * Put requested res to the optional list if not there yet (SR-IOV, 1243 + * disabled ROM). Bridge windows with an optional part are already 1244 + * on the list. 1245 + */ 1246 + if (!dev_res) 1247 + pci_dev_res_add_to_list(realloc_head, dev, res, 0, align); 1252 1248 *children_add_size += r_size; 1253 1249 *add_align = max(align, *add_align); 1254 1250