[PATCH v4 2/6] platform: generic: spacemit: k1: rename cache flush operation

E Shattow e at freeshell.de
Wed Oct 7 14:20:36 PDT 2026


Hi Troy,

On 9/10/26 07:00, Troy Mitchell wrote:
> From: Xianbin Zhu <xianbin.zhu at linux.spacemit.com>
> 
> MRAOP_ICACHE_INVALID is used to flush the local D-cache before a hart
> stops, so the name incorrectly describes I-cache invalidation. Rename
> it to MRAOP_CACHE_FLUSH without changing its encoded value.
> 
> Signed-off-by: Xianbin Zhu <xianbin.zhu at linux.spacemit.com>
> Co-developed-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>
> Signed-off-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>
> ---
>  lib/utils/hsm/fdt_hsm_spacemit.c       | 2 +-
>  platform/generic/include/spacemit/k1.h | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/utils/hsm/fdt_hsm_spacemit.c b/lib/utils/hsm/fdt_hsm_spacemit.c
> index 868e49bf..99c52335 100644
> --- a/lib/utils/hsm/fdt_hsm_spacemit.c
> +++ b/lib/utils/hsm/fdt_hsm_spacemit.c
> @@ -92,7 +92,7 @@ static int spacemit_hart_stop(void)
>  	asm volatile ("fence iorw, iorw");
>  
>  	/* flush local dcache */
> -	csr_write(CSR_MRAOP, MRAOP_ICACHE_INVALID);
> +	csr_write(CSR_MRAOP, MRAOP_CACHE_FLUSH);
>  	asm volatile ("fence iorw, iorw");
>  
>  	/* disable dcache */
> diff --git a/platform/generic/include/spacemit/k1.h b/platform/generic/include/spacemit/k1.h
> index 7095bc08..ac727b04 100644
> --- a/platform/generic/include/spacemit/k1.h
> +++ b/platform/generic/include/spacemit/k1.h
> @@ -20,8 +20,8 @@
>  /* ECC enable */
>  #define MSETUP_ECCE				BIT(16)
>  
> -/* icache invalidation */
> -#define MRAOP_ICACHE_INVALID			GENMASK(1, 0)
> +/* cache flush */

There is no mystery about the symbol name this comment describes, to
need a comment. If you want to explicitly write the comment as "D-cache
flush" that adds to the readability. Otherwise it appears to be a
redundant comment. Expand the description in comment so it adds value or
drop the comment, please.

> +#define MRAOP_CACHE_FLUSH			GENMASK(1, 0)
>  
>  #define PMU_AP_BASE				0xd4282800
>  
> 

With that,

Reviewed-by: E Shattow <e at freeshell.de>



More information about the opensbi mailing list