platform: generic: allwinner: Optimize current hart scratch access
authorSamuel Holland <samuel.holland@sifive.com>
Mon, 18 Mar 2024 14:49:29 +0000 (07:49 -0700)
committerAnup Patel <anup@brainfault.org>
Fri, 5 Apr 2024 12:04:25 +0000 (17:34 +0530)
The address of the local scratch area is stored in each hart's mscratch
CSR. It is more efficient to read the CSR than to compute the address
from the hart ID.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
platform/generic/allwinner/sun20i-d1.c

index ed19d5d427c7fbdb3c37f314b12442bc94e313cc..ab2eee55864c33fcaa71a9ba1fa0d878a28ef341 100644 (file)
@@ -142,7 +142,7 @@ static void sun20i_d1_riscv_cfg_restore(void)
 
 static void sun20i_d1_riscv_cfg_init(void)
 {
-       u64 entry = sbi_hartid_to_scratch(0)->warmboot_addr;
+       u64 entry = sbi_scratch_thishart_ptr()->warmboot_addr;
 
        /* Enable MMIO access. */
        writel_relaxed(CCU_BGR_ENABLE, SUN20I_D1_CCU_BASE + RISCV_CFG_BGR_REG);