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-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci

Pull pci fixes from Bjorn Helgaas:

- Create pwrctrl devices only for DT nodes below a PCI controller that
describe PCI devices and are related to a power supply; this prevents
waiting indefinitely for pwrctrl drivers that will never probe
(Manivannan Sadhasivam)

- Restore endpoint BAR mapping on subrange setup failure to make
selftest reliable (Koichiro Den)

* tag 'pci-v7.0-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
PCI: endpoint: pci-epf-test: Roll back BAR mapping when subrange setup fails
PCI/pwrctrl: Create pwrctrl devices only for PCI device nodes
PCI/pwrctrl: Ensure that remote endpoint node parent has supply requirement

+46 -13
+5
drivers/pci/endpoint/functions/pci-epf-test.c
··· 894 894 dev_err(&epf->dev, "pci_epc_set_bar() failed: %d\n", ret); 895 895 bar->submap = old_submap; 896 896 bar->num_submap = old_nsub; 897 + ret = pci_epc_set_bar(epc, epf->func_no, epf->vfunc_no, bar); 898 + if (ret) 899 + dev_warn(&epf->dev, "Failed to restore the original BAR mapping: %d\n", 900 + ret); 901 + 897 902 kfree(submap); 898 903 goto err; 899 904 }
+41 -13
drivers/pci/pwrctrl/core.c
··· 268 268 } 269 269 EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices); 270 270 271 + /* 272 + * Check whether the pwrctrl device really needs to be created or not. The 273 + * pwrctrl device will only be created if the node satisfies below requirements: 274 + * 275 + * 1. Presence of compatible property with "pci" prefix to match against the 276 + * pwrctrl driver (AND) 277 + * 2. At least one of the power supplies defined in the devicetree node of the 278 + * device (OR) in the remote endpoint parent node to indicate pwrctrl 279 + * requirement. 280 + */ 281 + static bool pci_pwrctrl_is_required(struct device_node *np) 282 + { 283 + struct device_node *endpoint; 284 + const char *compat; 285 + int ret; 286 + 287 + ret = of_property_read_string(np, "compatible", &compat); 288 + if (ret < 0) 289 + return false; 290 + 291 + if (!strstarts(compat, "pci")) 292 + return false; 293 + 294 + if (of_pci_supply_present(np)) 295 + return true; 296 + 297 + if (of_graph_is_present(np)) { 298 + for_each_endpoint_of_node(np, endpoint) { 299 + struct device_node *remote __free(device_node) = 300 + of_graph_get_remote_port_parent(endpoint); 301 + if (remote) { 302 + if (of_pci_supply_present(remote)) 303 + return true; 304 + } 305 + } 306 + } 307 + 308 + return false; 309 + } 310 + 271 311 static int pci_pwrctrl_create_device(struct device_node *np, 272 312 struct device *parent) 273 313 { ··· 327 287 return 0; 328 288 } 329 289 330 - /* 331 - * Sanity check to make sure that the node has the compatible property 332 - * to allow driver binding. 333 - */ 334 - if (!of_property_present(np, "compatible")) 335 - return 0; 336 - 337 - /* 338 - * Check whether the pwrctrl device really needs to be created or not. 339 - * This is decided based on at least one of the power supplies defined 340 - * in the devicetree node of the device or the graph property. 341 - */ 342 - if (!of_pci_supply_present(np) && !of_graph_is_present(np)) { 290 + if (!pci_pwrctrl_is_required(np)) { 343 291 dev_dbg(parent, "Skipping OF node: %s\n", np->name); 344 292 return 0; 345 293 }