dpaa: Simplify CPU binding for bman and qman

If cpu-handle property doesn't exist simply iterate and assign the CPUs
in sequence rather than following the convoluted search which may not
bear fruit in some cases.  If cpu-handle doesn't exist for one portal it
probably doesn't exist for any of them.
This commit is contained in:
Justin Hibbits
2026-01-20 23:16:04 -05:00
parent 12444a4da5
commit c611ef5747
2 changed files with 18 additions and 61 deletions
+9 -30
View File
@@ -136,25 +136,6 @@ bman_portals_fdt_probe(device_t dev)
return (BUS_PROBE_DEFAULT);
}
static phandle_t
bman_portal_find_cpu(int cpu)
{
phandle_t node;
pcell_t reg;
node = OF_finddevice("/cpus");
if (node == -1)
return (node);
for (node = OF_child(node); node != 0; node = OF_peer(node)) {
if (OF_getprop(node, "reg", &reg, sizeof(reg)) <= 0)
continue;
if (reg == cpu)
return (node);
}
return (-1);
}
static int
bman_portals_fdt_attach(device_t dev)
{
@@ -185,17 +166,15 @@ bman_portals_fdt_attach(device_t dev)
}
/* Checkout related cpu */
if (OF_getprop(child, "cpu-handle", (void *)&cpu,
sizeof(cpu)) <= 0) {
cpu = bman_portal_find_cpu(cpus);
if (cpu <= 0)
continue;
}
/* Acquire cpu number */
cpu_node = OF_instance_to_package(cpu);
if (OF_getencprop(cpu_node, "reg", &cpu_num, sizeof(cpu_num)) <= 0) {
device_printf(dev, "Could not retrieve CPU number.\n");
return (ENXIO);
}
sizeof(cpu)) > 0) {
cpu_node = OF_instance_to_package(cpu);
/* Acquire cpu number */
if (OF_getencprop(cpu_node, "reg", &cpu_num, sizeof(cpu_num)) <= 0) {
device_printf(dev, "Could not retrieve CPU number.\n");
return (ENXIO);
}
} else
cpu_num = cpus;
cpus++;
+9 -31
View File
@@ -136,25 +136,6 @@ qman_portals_fdt_probe(device_t dev)
return (BUS_PROBE_DEFAULT);
}
static phandle_t
qman_portal_find_cpu(int cpu)
{
phandle_t node;
pcell_t reg;
node = OF_finddevice("/cpus");
if (node == -1)
return (-1);
for (node = OF_child(node); node != 0; node = OF_peer(node)) {
if (OF_getprop(node, "reg", &reg, sizeof(reg)) <= 0)
continue;
if (reg == cpu)
return (node);
}
return (-1);
}
static int
qman_portals_fdt_attach(device_t dev)
{
@@ -213,18 +194,15 @@ qman_portals_fdt_attach(device_t dev)
}
/* Checkout related cpu */
if (OF_getprop(child, "cpu-handle", (void *)&cpu,
sizeof(cpu)) <= 0) {
cpu = qman_portal_find_cpu(cpus);
if (cpu <= 0)
continue;
}
/* Acquire cpu number */
cpu_node = OF_instance_to_package(cpu);
if (OF_getencprop(cpu_node, "reg", &cpu_num, sizeof(cpu_num)) <= 0) {
device_printf(dev, "Could not retrieve CPU number.\n");
return (ENXIO);
}
sizeof(cpu)) > 0) {
cpu_node = OF_instance_to_package(cpu);
/* Acquire cpu number */
if (OF_getencprop(cpu_node, "reg", &cpu_num, sizeof(cpu_num)) <= 0) {
device_printf(dev, "Could not retrieve CPU number.\n");
return (ENXIO);
}
} else
cpu_num = cpus;
cpus++;
if (ofw_bus_gen_setup_devinfo(&ofw_di, child) != 0) {