Re: [RFC PATCH v3 4/4] arm64:numa: adding numa support for arm64 platforms.
From: Arnd Bergmann <hidden>
Date: 2015-01-06 19:59:04
Also in:
linux-arm-kernel
On Tuesday 06 January 2015 14:55:53 Ganapatrao Kulkarni wrote:
On Sat, Jan 3, 2015 at 2:40 AM, Arnd Bergmann [off-list ref] wrote:quoted
quoted
+int dt_get_cpu_node_id(int cpu) +{ + struct device_node *dn = NULL; + + while ((dn = of_find_node_by_type(dn, "cpu"))) { + const u32 *cell; + u64 hwid; + + /* + * A cpu node with missing "reg" property is + * considered invalid to build a cpu_logical_map + * entry. + */ + cell = of_get_property(dn, "reg", NULL); + if (!cell) { + pr_err("%s: missing reg property\n", dn->full_name); + return default_nid; + } + hwid = of_read_number(cell, of_n_addr_cells(dn)); + + if (cpu_logical_map(cpu) == hwid) + return of_node_to_nid_single(dn); + } + return NUMA_NO_NODE; +} +EXPORT_SYMBOL(dt_get_cpu_node_id);Maybe just expose a function to the device node for a CPU ID here, and expect callers to use of_node_to_nid?shall i make this wrapper function in dt_numa.c, which will use functions _of_node_to_nid and _of_cpu_to_node(cpu)
Yes, I guess that would work.
And, this function can be a weak function in numa.c which returns 0.
No, please don't use weak functions. You can either use IS_ENABLED() tricks to remove function calls at compile-time, or in the header file provide an inline function as an alternative to the extern declaration, based on a configuration symbol. Arnd -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html