mbox series

[0/2] KVM: arm64: vgic-v3: Misc fixes

Message ID 20210126141156.39317-1-alexandru.elisei@arm.com (mailing list archive)
Headers show
Series KVM: arm64: vgic-v3: Misc fixes | expand

Message

Alexandru Elisei Jan. 26, 2021, 2:11 p.m. UTC
Two minor patches for stuff I found while reviewing Eric's VGIC fixes [1].

First patch should be straightforward documentation update.

I thought of the second patch when I was hacking kvmtool to read GICR_TYPER
from userspace. I was passing the raw MPIDR_EL1 value (the result of
KVM_GET_ONE_REG(MPIDR_EL1)) to KVM_DEV_ARM_VGIC_GRP_REDIST_REGS, which
obviously returned an error code. I started investigating and I thought
that the problem was caused by VGIC_TO_MPIDR not setting the RES1 bit (bit
31) from MPIDR_EL1. I actually wrote a patch to change that when I realized
that the macro wasn't supposed to create a valid MPIDR_EL1 value at all,
because the result of the macro is then compared to
kvm_vcpu_get_mpidr_aff().

I wrote patch #2 hoping that the change in the macro name will prevent
someone else from making the same mistake. On the other hand, using mpidr
to refer to the GICR_TYPER.Affinity_Value fields looks to be well
established in the kernel and in the documentation, so I'm not sure that
changing the macro name is really necessary.

[1] https://lore.kernel.org/kvmarm/20201212185010.26579-1-eric.auger@redhat.com/

Alexandru Elisei (2):
  Documentation: kvm: vgic-v3: Update return code for
    KVM_DEV_ARM_VGIC_GRP_CTRL
  KVM: arm64: vgic-v3: Rename VGIC_TO_MPIDR() to VGIC_TO_MPIDR_AFF()

 Documentation/virt/kvm/devices/arm-vgic-v3.rst |  4 +++-
 arch/arm64/kvm/vgic/vgic-kvm-device.c          | 12 ++++++------
 arch/arm64/kvm/vgic/vgic.h                     | 10 +++++-----
 3 files changed, 14 insertions(+), 12 deletions(-)