Re: [PATCH 2/3] cacheinfo: Check cache properties are present in DT

From: Conor Dooley
Date: Mon Mar 27 2023 - 10:03:01 EST


On Mon, Mar 27, 2023 at 01:59:50PM +0200, Pierre Gondois wrote:
> If a Device Tree (DT) is used, the presence of cache properties is
> assumed. Not finding any is not considered. For arm64 platforms,
> cache information can be fetched from the clidr_el1 register.
> Checking whether cache information is available in the DT
> allows to switch to using clidr_el1.
>
> init_of_cache_level()
> \-of_count_cache_leaves()
> will assume there a 2 cache leaves (L1 data/instruction caches), which
> can be different from clidr_el1 information.
>
> cache_setup_of_node() tries to read cache properties in the DT.
> If there are none, this is considered a success. Knowing no
> information was available would allow to switch to using clidr_el1.
>
> Signed-off-by: Pierre Gondois <pierre.gondois@xxxxxxx>

> +static bool of_check_cache_nodes(struct device_node *np)
> +{
> + struct device_node *next;
> +
> + if (of_property_read_bool(np, "cache-size") ||
> + of_property_read_bool(np, "i-cache-size") ||
> + of_property_read_bool(np, "d-cache-size") ||
> + of_property_read_bool(np, "cache-unified"))
> + return true;
> +

Rob's been purging use of the of_property_read family of functions
recently [1], should this use of_property_present() instead?

Cheers,
Conor.

1 - https://lore.kernel.org/all/?q=Use+of_property_present%28%29+for+testing+DT+property+presence+f%3Arob

Attachment: signature.asc
Description: PGP signature