linux/arch/arm64/kvm/vgic
Marc Zyngier fe49fd940e KVM: arm64: Move VTCR_EL2 into struct s2_mmu
We currently have a global VTCR_EL2 value for each guest, even
if the guest uses NV. This implies that the guest's own S2 must
fit in the host's. This is odd, for multiple reasons:

- the PARange values and the number of IPA bits don't necessarily
  match: you can have 33 bits of IPA space, and yet you can only
  describe 32 or 36 bits of PARange

- When userspace set the IPA space, it creates a contract with the
  kernel saying "this is the IPA space I'm prepared to handle".
  At no point does it constraint the guest's own IPA space as
  long as the guest doesn't try to use a [I]PA outside of the
  IPA space set by userspace

- We don't even try to hide the value of ID_AA64MMFR0_EL1.PARange.

And then there is the consequence of the above: if a guest tries
to create a S2 that has for input address something that is larger
than the IPA space defined by the host, we inject a fatal exception.

This is no good. For all intent and purposes, a guest should be
able to have the S2 it really wants, as long as the *output* address
of that S2 isn't outside of the IPA space.

For that, we need to have a per-s2_mmu VTCR_EL2 setting, which
allows us to represent the full PARange. Move the vctr field into
the s2_mmu structure, which has no impact whatsoever, except for NV.

Note that once we are able to override ID_AA64MMFR0_EL1.PARange
from userspace, we'll also be able to restrict the size of the
shadow S2 that NV uses.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20231012205108.3937270-1-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
2023-10-23 18:48:46 +00:00
..
trace.h
vgic-debug.c KVM: arm64: Use config_lock to protect vgic state 2023-03-29 14:08:31 +01:00
vgic-init.c KVM: arm64: Restore GICv2-on-GICv3 functionality 2023-06-07 16:38:25 +01:00
vgic-irqfd.c KVM: arm64: vgic: Add memcg accounting to vgic allocations 2021-10-17 11:25:55 +01:00
vgic-its.c KVM: arm64: vgic: Wrap vgic_its_create() with config_lock 2023-05-19 10:20:00 +01:00
vgic-kvm-device.c KVM: arm64: Move VTCR_EL2 into struct s2_mmu 2023-10-23 18:48:46 +00:00
vgic-mmio-v2.c KVM: arm64: Don't read a HW interrupt pending state in user context 2022-06-07 16:28:19 +01:00
vgic-mmio-v3.c KVM: arm64: vgic: Fix a circular locking issue 2023-05-19 10:20:00 +01:00
vgic-mmio.c KVM: arm64: vgic: Fix a circular locking issue 2023-05-19 10:20:00 +01:00
vgic-mmio.h KVM: arm64: vgic-v3: Use u32 to manage the line level from userspace 2022-07-17 11:55:33 +01:00
vgic-v2.c KVM: arm64: vgic: Fix a circular locking issue 2023-05-19 10:20:00 +01:00
vgic-v3.c KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption 2023-07-13 22:23:34 +00:00
vgic-v4.c KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption 2023-07-13 22:23:34 +00:00
vgic.c Merge branch kvm-arm64/timer-vm-offsets into kvmarm-master/next 2023-04-21 09:36:40 +01:00
vgic.h KVM: arm64: Remove unused declarations 2023-08-15 20:27:32 +01:00