xen/arm: make pci_host_common_probe return the bridge

Some of the PCI host bridges require additional processing during the
probe phase. For that they need to access struct bridge of the probed
host, so return pointer to the new bridge from pci_host_common_probe.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Mykyta Poturai <mykyta_poturai@epam.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
This commit is contained in:
Oleksandr Andrushchenko authored and Stefano Stabellini committed 2025-06-17 15:32:39 -07:00
1 parent 92b72ab868
commit fdff9cfdda
4 files changed
+11 -10

No files matched your search

+3 -2
View File
@@ -18,6 +18,7 @@
#ifdef CONFIG_HAS_PCI
#include <asm/p2m.h>
#include <xen/err.h>
#define pci_to_dev(pcidev) (&(pcidev)->arch.dev)
@@ -97,8 +98,8 @@ struct pci_ecam_ops {
/* Default ECAM ops */
extern const struct pci_ecam_ops pci_generic_ecam_ops;
int pci_host_common_probe(struct dt_device_node *dev,
const struct pci_ecam_ops *ops);
struct pci_host_bridge *pci_host_common_probe(struct dt_device_node *dev,
const struct pci_ecam_ops *ops);
int pci_generic_config_read(struct pci_host_bridge *bridge, pci_sbdf_t sbdf,
uint32_t reg, uint32_t len, uint32_t *value);
int pci_generic_config_write(struct pci_host_bridge *bridge, pci_sbdf_t sbdf,
+6 -6
View File
@@ -208,8 +208,8 @@ static int pci_bus_find_domain_nr(struct dt_device_node *dev)
return domain;
}
int pci_host_common_probe(struct dt_device_node *dev,
const struct pci_ecam_ops *ops)
struct pci_host_bridge *pci_host_common_probe(struct dt_device_node *dev,
const struct pci_ecam_ops *ops)
{
struct pci_host_bridge *bridge;
struct pci_config_window *cfg;
@@ -217,11 +217,11 @@ int pci_host_common_probe(struct dt_device_node *dev,
int domain;
if ( dt_device_for_passthrough(dev) )
return 0;
return NULL;
bridge = pci_alloc_host_bridge();
if ( !bridge )
return -ENOMEM;
return ERR_PTR(-ENOMEM);
/* Parse and map our Configuration Space windows */
cfg = gen_pci_init(dev, ops);
@@ -244,12 +244,12 @@ int pci_host_common_probe(struct dt_device_node *dev,
bridge->segment = domain;
pci_add_host_bridge(bridge);
return 0;
return bridge;
err_exit:
xfree(bridge);
return err;
return ERR_PTR(err);
}
/*
+1 -1
View File
@@ -29,7 +29,7 @@ static const struct dt_device_match __initconstrel gen_pci_dt_match[] =
static int __init pci_host_generic_probe(struct dt_device_node *dev,
const void *data)
{
return pci_host_common_probe(dev, &pci_generic_ecam_ops);
return PTR_RET(pci_host_common_probe(dev, &pci_generic_ecam_ops));
}
DT_DEVICE_START(pci_gen, "PCI HOST GENERIC", DEVICE_PCI_HOSTBRIDGE)
+1 -1
View File
@@ -47,7 +47,7 @@ static const struct dt_device_match __initconstrel nwl_pcie_dt_match[] =
static int __init pci_host_generic_probe(struct dt_device_node *dev,
const void *data)
{
return pci_host_common_probe(dev, &nwl_pcie_ops);
return PTR_RET(pci_host_common_probe(dev, &nwl_pcie_ops));
}
DT_DEVICE_START(pci_gen, "PCI HOST ZYNQMP", DEVICE_PCI_HOSTBRIDGE)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.