Commit d931b83e authored by Pierre Gondois's avatar Pierre Gondois Committed by Greg Kroah-Hartman
Browse files

cacheinfo: Make default acpi_get_cache_info() return an error



commit bd500361 ("ACPI: PPTT: Update acpi_find_last_cache_level()
to acpi_get_cache_info()")
updates the prototype of acpi_get_cache_info(). The cache 'levels'
is update through a pointer and not the return value of the function.

If CONFIG_ACPI_PPTT is not defined, acpi_get_cache_info() doesn't
update its *levels and *split_levels parameters and returns 0.
This can lead to a faulty behaviour.

Make acpi_get_cache_info() return an error code if CONFIG_ACPI_PPTT
is not defined.
Also,

In init_cache_level(), if no PPTT is present or CONFIG_ACPI_PPTT is
not defined, instead of aborting if acpi_get_cache_info() returns an
error code, just continue. This allows to try fetching the cache
information from clidr_el1.

Signed-off-by: default avatarPierre Gondois <pierre.gondois@arm.com>
Link: https://lore.kernel.org/r/20230124154053.355376-3-pierre.gondois@arm.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ecaef469
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -64,7 +64,7 @@ int init_cache_level(unsigned int cpu)
	} else {
	} else {
		ret = acpi_get_cache_info(cpu, &fw_level, NULL);
		ret = acpi_get_cache_info(cpu, &fw_level, NULL);
		if (ret < 0)
		if (ret < 0)
			return ret;
			fw_level = 0;
	}
	}


	if (fw_level < 0)
	if (fw_level < 0)
+1 −1
Original line number Original line Diff line number Diff line
@@ -100,7 +100,7 @@ static inline
int acpi_get_cache_info(unsigned int cpu,
int acpi_get_cache_info(unsigned int cpu,
			unsigned int *levels, unsigned int *split_levels)
			unsigned int *levels, unsigned int *split_levels)
{
{
	return 0;
	return -ENOENT;
}
}
#else
#else
int acpi_get_cache_info(unsigned int cpu,
int acpi_get_cache_info(unsigned int cpu,