[PATCH] KVM: arm64: nv: Work around lack of pauth support in old toolchains

Aiqun Yu (Maria) quic_aiquny at quicinc.com
Tue Apr 23 05:00:55 PDT 2024



On 4/23/2024 4:24 PM, Arnd Bergmann wrote:
> On Tue, Apr 23, 2024, at 00:48, Marc Zyngier wrote:
>> We still support GCC 8.x, and it appears that this toolchain
>> does not understand "pauth" as a valid architectural extension.
>> After all, it's only been 8 years since ARMv8.3 was released...
> 
> Just to clarify: I'm fairly sure that all supported toolchains
> support ARMv8.3 and PACGA, the problem with ".arch_extension pauth\n"
> seems to be that it was retroactively made an optional
> feature for earlier architecture versions a few years after
> ARMv8.3, so most binutils versions we support understand
> pacga as an armv8.3 feature but reject the pauth name for the
> extension.
Kind of agree with Arnd here.
Shall the fix just remove the ".arch_extension pauth"?

I've tried gcc 7 failed with the pauth name for the extension.
After I remove the ".arch_extension pauth" and use "pacga" instruction
directly pass the gcc 7 compilation.

By the way, have a glance for gcc7/8/9/10 manual, from the gcc 10 manual
[1], seems gcc 10 was the first introduced the pauth as the extension
name support.
https://gcc.gnu.org/onlinedocs/gcc-10.5.0/gcc/AArch64-Options.html#g_t-march-and--mcpu-Feature-Modifiers
> 
>> This results in the NV ERETAx code breaking the build, as it relies
>> on this extention to make use of the PACGA instruction.
>>
>> Work around it by hand-assembling the instruction using a mind-bending
>> trick lifted from an old patch by Will. Magic.
>>
>> Fixes: e09faab353a6 ("KVM: arm64: nv: Add emulation for ERETAx instructions")
>> Reported-by: Linaro Kernel Functional Testing <lkft at linaro.org>
>> Signed-off-by: Marc Zyngier <maz at kernel.org>
> 
> I usually try to enclose these in a version check like
> "#if CONFIG_AS_VERSION >= 22800" so we can be sure we clean them up
> whenever the minimum version changes, but I assume you'll remember
> this one.
> 
> Acked-by: Arnd Bergmann <arnd at arndb.de>
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Thx and BRs,
Aiqun(Maria) Yu



More information about the linux-arm-kernel mailing list