Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 133df27b authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cpu-topology: Don't error on more than CONFIG_NR_CPUS CPUs in device tree"

parents 6920b254 1e5ab21d
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -31,6 +31,16 @@
#include <asm/cputype.h>
#include <asm/topology.h>

/*
 * This function returns the logic cpu number of the node.
 * There are basically three kinds of return values:
 * (1) logic cpu number which is > 0.
 * (2) -ENODEV when the device tree(DT) node is valid and found in the DT but
 * there is no possible logical CPU in the kernel to match. This happens
 * when CONFIG_NR_CPUS is configure to be smaller than the number of
 * CPU nodes in DT. We need to just ignore this case.
 * (3) -1 if the node does not exist in the device tree
 */
static int __init get_cpu_for_node(struct device_node *node)
{
	struct device_node *cpu_node;
@@ -44,8 +54,8 @@ static int __init get_cpu_for_node(struct device_node *node)
	if (cpu >= 0)
		topology_parse_cpu_capacity(cpu_node, cpu);
	else
		pr_crit("Unable to find CPU node for %pOF\n", cpu_node);

		pr_info("CPU node for %pOF exist but the possible cpu range is :%*pbl\n",
			cpu_node, cpumask_pr_args(cpu_possible_mask));
	of_node_put(cpu_node);
	return cpu;
}
@@ -69,7 +79,7 @@ static int __init parse_core(struct device_node *core, int package_id,
				cpu_topology[cpu].package_id = package_id;
				cpu_topology[cpu].core_id = core_id;
				cpu_topology[cpu].thread_id = i;
			} else {
			} else if (cpu != -ENODEV) {
				pr_err("%pOF: Can't get CPU for thread\n",
				       t);
				of_node_put(t);
@@ -90,7 +100,7 @@ static int __init parse_core(struct device_node *core, int package_id,

		cpu_topology[cpu].package_id = package_id;
		cpu_topology[cpu].core_id = core_id;
	} else if (leaf) {
	} else if (leaf && cpu != -ENODEV) {
		pr_err("%pOF: Can't get CPU for leaf core\n", core);
		return -EINVAL;
	}