Re: [PATCH v3 1/3] arm64: Add BBM Level 2 cpu feature

From: Ryan Roberts
Date: Thu Mar 13 2025 - 14:18:48 EST


On 13/03/2025 18:13, Mikołaj Lenczewski wrote:
> On Thu, Mar 13, 2025 at 10:21:51AM -0700, Yang Shi wrote:
>> On 3/13/25 3:41 AM, Mikołaj Lenczewski wrote:
>>> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
>>> index fb8752b42ec8..3e4cc917a07e 100644
>>> --- a/Documentation/admin-guide/kernel-parameters.txt
>>> +++ b/Documentation/admin-guide/kernel-parameters.txt
>>> @@ -453,6 +453,9 @@
>>> arm64.no32bit_el0 [ARM64] Unconditionally disable the execution of
>>> 32 bit applications.
>>>
>>> + arm64.nobbml2 [ARM64] Unconditionally disable Break-Before-Make Level
>>> + 2 support
>>
>> Hi Miko,
>>
>> A question about the kernel boot parameter. Can this parameter be used
>> in early boot stage? A quick look at the code shows it should be ok, for
>> example, cpu_has_bti() is called in map_kernel(). But I'd like to double
>> check because my patchset needs to check this parameter in map_mem() to
>> determine whether large block mapping can be used or not.
>>
>> And a nit below.
>
> I will need to double check exactly when the arm64 software overrides
> are finalised, but as long as those values are finalised in / before (?)
> the early boot stage then it should be fine? Will reply again once I
> check and have an answer.

This will work fine. The override is setup in the PI code before start_kernel().

>
>>> +static inline bool bbml2_possible(void)
>>> +{
>>> + return !arm64_test_sw_feature_override(ARM64_SW_FEATURE_OVERRIDE_NOBBML2);
>>> +}
>>
>> Can this be moved to cpufeature.h? My patch will use this, anyway I can
>> do it in my patchset.

I'd prefer to do the moving as part of the series that needs it moved.

Thanks,
Ryan

>>
>> Thanks,
>> Yang
>
> I can do so. In fact, on second thought, I will probably extend this to
> also include the `IS_ENABLED(CONFIG_ARM64_BBML2_NOABORT)` check as well,
> and then move it to cpufeature.h, instead of folding said check into
> has_bbml2_noabort().
>