[PATCH] KVM: arm64: nv: Fix RESx behaviour of disabled FGTs with negative polarity
Marc Zyngier
maz at kernel.org
Fri Jul 5 05:08:51 PDT 2024
On Fri, 14 Jun 2024 21:24:51 +0100,
Oliver Upton <oliver.upton at linux.dev> wrote:
>
> On Fri, 14 Jun 2024 13:58:58 +0100, Marc Zyngier wrote:
> > The Fine Grained Trap extension is pretty messy as it doesn't
> > consistently use the same polarity for all trap bits. A bunch
> > of them, added later in the life of the architecture, have a
> > *negative* priority.
> >
> > So if these bits are disabled, they must be RES1 and not RES0.
> > But that's not what the code implements, making the traps for
> > these negative trap bits being always on instead of disabled.
> >
> > [...]
>
> Applied to kvmarm/next, thanks!
>
> [1/1] KVM: arm64: nv: Fix RESx behaviour of disabled FGTs with negative polarity
> https://git.kernel.org/kvmarm/kvmarm/c/eb9d53d4a949
[+ Anshuman, as I've pointed him to this patch in the past]
OK, I think I have come to my senses, and came to the conclusion that:
- I am officially losing the plot (blame the political climate)
- this "fix" is total b*ll*cks and must be dropped/reverted
Let remember how this whole thing works. A "negative" trap bit has two
essential properties:
- it is writable
- it has an effect when set to 0
If the bit isn't implemented, it is RES0. Only RES0. Not RES1, which
this patch enforces. None of the FGT bits are ever RES1. So at least
on this front, this patch is broken and results in observable nonsense
on the guest side.
But there is more! We are already capable of distinguishing a bit that
traps because it is set to 0 from a bit that is RES0. check_fgt_bit()
already has all the logic, which is evaluated on any trap.
So we already have the proper filtering in place (a RES0 bit won't
result in a trap forwarded to a nested guest), the original code was
correct, and forcing FGT bits to RES1 is just a stupid regression.
Oliver, can you please drop or revert this patch from the kvmarm/next
branch please?
Thanks and sorry for the noise.
M.
--
Without deviation from the norm, progress is not possible.
More information about the linux-arm-kernel
mailing list