On Sun, Oct 06, 2024 at 03:07:01PM +0800, [email protected] wrote:
> From: Peng Fan <[email protected]>
> 
> For ARMv7, the alignment could be SECTION size. But for ARM64, use
> PAGE_SIZE.
> 
> Signed-off-by: Peng Fan <[email protected]>
> Signed-off-by: Alice Guo <[email protected]>
> Reviewed-by: Ye Li <[email protected]>
> ---
>  drivers/firmware/scmi/smt.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/firmware/scmi/smt.c b/drivers/firmware/scmi/smt.c
> index 67d2f45002..e9d401f0da 100644
> --- a/drivers/firmware/scmi/smt.c
> +++ b/drivers/firmware/scmi/smt.c
> @@ -29,6 +29,7 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct 
> scmi_smt *smt)
>       int ret;
>       struct ofnode_phandle_args args;
>       struct resource resource;
> +     u32 align_size __maybe_unused;
>  
>       ret = dev_read_phandle_with_args(dev, "shmem", NULL, 0, 0, &args);
>       if (ret)
> @@ -49,11 +50,15 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct 
> scmi_smt *smt)
>               return -ENOMEM;
>  
>  #ifdef CONFIG_ARM
> -     if (dcache_status())
> -             mmu_set_region_dcache_behaviour(ALIGN_DOWN((uintptr_t)smt->buf, 
> MMU_SECTION_SIZE),
> -                                             ALIGN(smt->size, 
> MMU_SECTION_SIZE),
> -                                             DCACHE_OFF);
> -
> +     if (dcache_status()) {
> +             if (IS_ENABLED(CONFIG_ARM64))
> +                     align_size = PAGE_SIZE;
> +             else
> +                     align_size = MMU_SECTION_SIZE;
> +
> +             mmu_set_region_dcache_behaviour(ALIGN_DOWN((uintptr_t)smt->buf, 
> align_size),
> +                                             ALIGN(smt->size, align_size), 
> DCACHE_OFF);
> +     }
>  #endif
>  
>       return 0;

You can move declaring align_size down to this stanza, no need to
__maybe_unused it.

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to