Re: [PATCH 1/2] arm64: Rename WORKAROUND_1165522 to SPECULATIVE_AT

From: Steven Price
Date: Mon Nov 11 2019 - 11:07:46 EST


On 11/11/2019 15:42, Marc Zyngier wrote:
> Hi Steven,
>
> On 2019-11-11 15:21, Steven Price wrote:
>> Cortex-A55 is affected by a similar erratum, so rename the existing
>> workaround for errarum 1165522 so it can be used for both errata.
>
> nit: erratum

Thanks, I do seem to have trouble spelling it correctly :)

>>
>> Signed-off-by: Steven Price <steven.price@xxxxxxx>
>> ---
>> Âarch/arm64/KconfigÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ |Â 4 ++++
>> Âarch/arm64/include/asm/cpucaps.h | 2 +-
>> Âarch/arm64/include/asm/kvm_host.h |Â 2 +-
>> Âarch/arm64/include/asm/kvm_hyp.h | 3 +--
>> Âarch/arm64/kernel/cpu_errata.cÂÂÂ | 17 +++++++++++++----
>> Âarch/arm64/kvm/hyp/switch.cÂÂÂÂÂÂ |Â 2 +-
>> Âarch/arm64/kvm/hyp/tlb.cÂÂÂÂÂÂÂÂÂ |Â 4 ++--
>> Â7 files changed, 23 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index 3f047afb982c..6cb4eff602c6 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -510,9 +510,13 @@ config ARM64_ERRATUM_1418040
>>
>> ÂÂÂÂÂÂ If unsure, say Y.
>>
>> +config ARM64_WORKAROUND_SPECULATIVE_AT
>> +ÂÂÂ bool
>> +
>> Âconfig ARM64_ERRATUM_1165522
>> ÂÂÂÂ bool "Cortex-A76: Speculative AT instruction using out-of-context
>> translation regime could cause subsequent request to generate an
>> incorrect translation"
>> ÂÂÂÂ default y
>> +ÂÂÂ select ARM64_WORKAROUND_SPECULATIVE_AT
>
> I'd object that ARM64_ERRATUM_1319367 (and its big brother 1319537)
> are also related to speculative AT execution, and yet are not covered
> by this configuration symbol.

Good point.

> I can see three solutions to this:
>
> - Either you call it SPECULATIVE_AT_VHE and introduce SPECULATIVE_AT_NVHE
> Â for symmetry

Tempting...

> - Or you make SPECULATIVE_AT cover all the speculative AT errata, which
> Â may or may not work...

This actually sounds the neatest, but I'm not sure whether there's going
to be any conflicts between VHE/NVHE. I'll prototype this and see how
ugly it is.

> - Or even better, you just ammend the documentation to say that 1165522
> Â also covers the newly found A55 one (just like we have for A57/A72)

Well Mark Rutland disliked my initial thoughts about just including both
errata in one option like that - hence the refactoring in this patch.
Although of course that's exactly what's happened with 1319367/1319537...

> What do you think?

I'll have a go at SPECULATIVE_AT covering both VHE/NVHE - from an
initial look it seems like it should work and it would be neat if it
does. In particular it should avoid the necessity to require VHE when
the erratum is present.

Otherwise I guess SPECULATIVE_AT_{,N}VHE is probably second best.

Thanks,

Steve