diff options
author | Christoffer Dall <cdall@linaro.org> | 2017-03-21 22:05:22 +0100 |
---|---|---|
committer | Christoffer Dall <cdall@linaro.org> | 2017-04-04 14:33:59 +0200 |
commit | 6d56111c92d247bb64301029fe88365aa4caf16e (patch) | |
tree | 0ceec9bfeae39452c020baa35b99f91d9e4bae76 /virt/kvm/arm/vgic/vgic.h | |
parent | KVM: arm64: Ensure LRs are clear when they should be (diff) | |
download | linux-6d56111c92d247bb64301029fe88365aa4caf16e.tar.xz linux-6d56111c92d247bb64301029fe88365aa4caf16e.zip |
KVM: arm/arm64: vgic: Fix GICC_PMR uaccess on GICv3 and clarify ABI
As an oversight, for GICv2, we accidentally export the GICC_PMR register
in the format of the GICH_VMCR.VMPriMask field in the lower 5 bits of a
word, meaning that userspace must always use the lower 5 bits to
communicate with the KVM device and must shift the value left by 3
places to obtain the actual priority mask level.
Since GICv3 supports the full 8 bits of priority masking in the ICH_VMCR,
we have to fix the value we export when emulating a GICv2 on top of a
hardware GICv3 and exporting the emulated GICv2 state to userspace.
Take the chance to clarify this aspect of the ABI.
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
Diffstat (limited to '')
-rw-r--r-- | virt/kvm/arm/vgic/vgic.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/virt/kvm/arm/vgic/vgic.h b/virt/kvm/arm/vgic/vgic.h index 91566f5aac9b..6cf557e9f718 100644 --- a/virt/kvm/arm/vgic/vgic.h +++ b/virt/kvm/arm/vgic/vgic.h @@ -81,11 +81,18 @@ static inline bool irq_is_pending(struct vgic_irq *irq) return irq->pending_latch || irq->line_level; } +/* + * This struct provides an intermediate representation of the fields contained + * in the GICH_VMCR and ICH_VMCR registers, such that code exporting the GIC + * state to userspace can generate either GICv2 or GICv3 CPU interface + * registers regardless of the hardware backed GIC used. + */ struct vgic_vmcr { u32 ctlr; u32 abpr; u32 bpr; - u32 pmr; + u32 pmr; /* Priority mask field in the GICC_PMR and + * ICC_PMR_EL1 priority field format */ /* Below member variable are valid only for GICv3 */ u32 grpen0; u32 grpen1; |