[PATCH] arm64: guard AMU register access with ARM64_HAS_AMU_EXTN

Marek Vasut marek.vasut at mailbox.org
Wed Oct 22 08:31:04 PDT 2025


On 10/22/25 5:19 PM, Catalin Marinas wrote:

Hello Catalin,

>>>> We ensure that the AMU is available in the macro itself by checking
>>>> for ID_AA64PFR0_EL1.AMU. If the AMu isn't present on this CPU, we skip
>>>> the offending sysreg access. This is similar to what we do for the
>>>> PMU.
>>>>
>>>> Does your HW advertise an AMU, but doesn't actually have one?
>>>
>>> The hardware does have AMU, but it is currently blocked in old TFA
>>> version and access to this AMU register here causes a fault. That's
>>> why I have to disable ARM64_HAS_AMU_EXTN until the TFA is updated and
>>> the AMU access is made available on this hardware. But even if I do
>>> disable ARM64_HAS_AMU_EXTN=n , I get a fault.
>>
>> Well, I would tend to say that you are trying to update the wrong
>> piece of SW here. Crashing kernels should be a good incentive for the
>> board manufacturer to update their firmware pronto, specially when we
>> are talking of code that has been in the tree for over 5 years...
> 
> I agree.
> 
>>> This patch is mainly meant to prevent a surprise in case someone does
>>> set ARM64_HAS_AMU_EXTN=n , and the system still faults on AMU register
>>> access.
>>
>> But that doesn't really fix anything if you have a buggy firmware,
>> because you can't tell which CPUs have been correctly configured, and
>> which have not. I also don't really get why this hack works for you,
>> because the feature will be set as soon as one CPU advertises the
>> feature.
> 
> I think Marek also disables the config option and the feature won't be
> turned on.

Correct.

-- 
Best regards,
Marek Vasut



More information about the linux-arm-kernel mailing list