Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: base: cacheinfo: fix boot error message when acpi is enabled

ARM64 enables both CONFIG_OF and CONFIG_ACPI and the firmware can pass
both ACPI tables and the device tree. Based on the kernel parameter, one
of the two will be chosen. If acpi is enabled, then device tree is not
unflattened.

Currently ARM64 platforms report:
"
Failed to find cpu0 device node
Unable to detect cache hierarchy from DT for CPU 0
"
which is incorrect when booting with ACPI. Also latest ACPI v6.1 has no
support for cache properties/hierarchy.

This patch adds check for unflattened device tree and also returns as
"not supported" if ACPI is runtime enabled.

It also removes the reference to DT from the error message as the cache
hierarchy can be detected from the firmware(OF/DT/ACPI)

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sudeep Holla and committed by
Greg Kroah-Hartman
55877ef4 fac51482

+8 -4
+8 -4
drivers/base/cacheinfo.c
··· 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 18 */ 19 + #include <linux/acpi.h> 19 20 #include <linux/bitops.h> 20 21 #include <linux/cacheinfo.h> 21 22 #include <linux/compiler.h> ··· 105 104 struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); 106 105 struct cacheinfo *this_leaf, *sib_leaf; 107 106 unsigned int index; 108 - int ret; 107 + int ret = 0; 109 108 110 109 if (this_cpu_ci->cpu_map_populated) 111 110 return 0; 112 111 113 - ret = cache_setup_of_node(cpu); 112 + if (of_have_populated_dt()) 113 + ret = cache_setup_of_node(cpu); 114 + else if (!acpi_disabled) 115 + /* No cache property/hierarchy support yet in ACPI */ 116 + ret = -ENOTSUPP; 114 117 if (ret) 115 118 return ret; 116 119 ··· 211 206 */ 212 207 ret = cache_shared_cpu_map_setup(cpu); 213 208 if (ret) { 214 - pr_warn("Unable to detect cache hierarchy from DT for CPU %d\n", 215 - cpu); 209 + pr_warn("Unable to detect cache hierarchy for CPU %d\n", cpu); 216 210 goto free_ci; 217 211 } 218 212 return 0;