[U-Boot] [PATCH 2/2] arm64: add better spin-table support
Masahiro Yamada
yamada.masahiro at socionext.com
Sun Jun 19 10:59:27 CEST 2016
2016-06-18 0:05 GMT+09:00 Mark Rutland <mark.rutland at arm.com>:
> On Fri, Jun 17, 2016 at 09:51:49PM +0900, Masahiro Yamada wrote:
>> There are two enable methods supported by ARM64 Linux; psci and
>> spin-table. The latter is simpler and easier to use for quick SoC
>> bring-up.
>>
>> So, I used the spin-table for my first ARMv8 SoC porting, but I
>> found its support in U-Boot was poor. It is true there exists a
>> code fragment for the spin code in arch/arm/cpu/armv8/start.S,
>> but I see some problems:
>>
>> - We must hard-code CPU_RELEASE_ADDR so that it matches the
>> "cpu-release-addr" property in the DT that comes from the
>> kernel tree.
>>
>> - The Documentation/arm64/booting.txt in Linux requires that
>> the release address must be zero-initialized, but it is not
>> cared by the common code in U-Boot. So, we must do it in a
>> board specific manner.
>>
>> - There is no systematic way to protect the spin code from the
>> kernel. U-Boot relocates itself during the boot, so it is
>> difficult to predict where the spin code will be located
>> after the relocation, which makes it even more difficult to
>> hard-code /memreserve/ in the DT of the kernel. One possible
>> work-around would be to pre-fetch the spin-code into the
>> I-cache of secondary CPUs, but this is an unsafe solution.
>>
>> So, here is a patch to solve the problems. In this approach, the DT
>> is run-time modified to reserve the spin code (+ cpu-release-addr).
>> Also, the "cpu-release-addr" property is set to an appropriate
>> address after the relocation, which means we no longer need the
>> hard-coded CPU_RELEASE_ADDR.
>>
>> Currently this patch only supports ARMv8, but theoretically nothing
>> about the spin-table is arch-specific. Perhaps, we might want to
>> support it on PowerPC in the future. So, I put the DT fixup code
>> into the common/ directory. Very little code must be written in
>> assembler, which went to the arch/arm/cpu/armv8/ directory.
>
> It's worth noting that while both arm64 and PPC have something called
> "spin-table", they're not quite the same. The arm64 version just reused
> the enable-method and property names for something different (and
> arch-specific).
>
> I have no strong feelings about where the code lives, however.
>
I did not know this. Thanks.
Maybe I should consider moving all the code to arch/arm/cpu/armv8/
and renaming CONFIG_SPIN_TABLE to CONFIG_ARMV8_SPIN_TABLE.
--
Best Regards
Masahiro Yamada
More information about the U-Boot
mailing list