[PATCH v4 01/26] arm64/cpuinfo: Restore define for AIVIVT cache type

Mark Rutland mark.rutland at arm.com
Wed Jun 22 04:09:33 PDT 2022


On Mon, Jun 20, 2022 at 01:43:42PM +0100, Mark Brown wrote:
> In 155433cb365ee466 ("arm64: cache: Remove support for ASID-tagged VIVT
> I-caches") we removed all the support fir AIVIVT cache types and renamed
> all references to the field to say "unknown" since support for AIVIVT
> caches was removed from the architecture. Since the correspoding removal
> from the architecture was done by documenting this value as reserved but
> still listing the original meaning and naming in order to facilitiate
> automatic generation of the headers for the system registers rename the
> kernel internal defines back to AIVIVT. The decoded value displayed to
> userspace is left as "RESERVED/UNKNOWN" so there is no user visible
> impact.

I'm not too keen on this, becuase architecturally AIVIVT does not exist in
ARMv8, and the real bug here is that the ARM ARM still calls this AIVIVT rather
than saying it's reserved.

> Signed-off-by: Mark Brown <broonie at kernel.org>
> ---
>  arch/arm64/include/asm/cache.h | 2 +-
>  arch/arm64/kernel/cpuinfo.c    | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
> index 7c2181c72116..23bfcd92f6ca 100644
> --- a/arch/arm64/include/asm/cache.h
> +++ b/arch/arm64/include/asm/cache.h
> @@ -25,7 +25,7 @@
>  #define CTR_L1IP(ctr)		(((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK)
>  
>  #define ICACHE_POLICY_VPIPT	0
> -#define ICACHE_POLICY_RESERVED	1
> +#define ICACHE_POLICY_AIVIVT	1
>  #define ICACHE_POLICY_VIPT	2
>  #define ICACHE_POLICY_PIPT	3

How about we just delete ICACHE_POLICY_RESERVED entirely...

> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
> index 8eff0a34ffd4..e3990b39126d 100644
> --- a/arch/arm64/kernel/cpuinfo.c
> +++ b/arch/arm64/kernel/cpuinfo.c
> @@ -35,7 +35,7 @@ static struct cpuinfo_arm64 boot_cpu_data;
>  
>  static const char *icache_policy_str[] = {
>  	[ICACHE_POLICY_VPIPT]		= "VPIPT",
> -	[ICACHE_POLICY_RESERVED]	= "RESERVED/UNKNOWN",
> +	[ICACHE_POLICY_AIVIVT]		= "RESERVED/UNKNOWN",
>  	[ICACHE_POLICY_VIPT]		= "VIPT",
>  	[ICACHE_POLICY_PIPT]		= "PIPT",
>  };

... then make this:

static inline const char *icache_policy_str(int l1ip)
{
	switch (l1ip) {
	case ICACHE_POLICY_VPIPT:
		return "VPIPT"
	case ICACHE_POLICY_VIPT:
		return "VIPT"
	case ICACHE_POLICY_PIPT:
		return "PIPT";
	default:
		return "RESERVED/UNKNOWN";
	}
}

> @@ -347,7 +347,7 @@ static void cpuinfo_detect_icache_policy(struct cpuinfo_arm64 *info)
>  	case ICACHE_POLICY_VPIPT:
>  		set_bit(ICACHEF_VPIPT, &__icache_flags);
>  		break;
> -	case ICACHE_POLICY_RESERVED:
> +	case ICACHE_POLICY_AIVIVT:
>  	case ICACHE_POLICY_VIPT:


... and make this:

	case ICACHE_POLICY_PIPT:
	default:

>  		/* Assume aliasing */
>  		set_bit(ICACHEF_ALIASING, &__icache_flags);
> -- 
> 2.30.2

... then in subsequent patches we don't need to define a bogus
ICACHE_POLICY_AIVIVT value in the scripted headers.

Thanks,
Mark.



More information about the linux-arm-kernel mailing list