diff options
author | Shenming Lu <lushenming@huawei.com> | 2021-03-22 09:01:55 +0300 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2021-03-24 21:12:20 +0300 |
commit | 80317fe4a65375fae668672a1398a0fb73eb9023 (patch) | |
tree | 2874b4d4655f99b4bcbfb744d786bd5c7233bd7d /arch/arm64/kvm/vgic/vgic-v4.c | |
parent | c21bc068cdbe5613d3319ae171c3f2eb9f321352 (diff) | |
download | linux-80317fe4a65375fae668672a1398a0fb73eb9023.tar.xz |
KVM: arm64: GICv4.1: Add function to get VLPI state
With GICv4.1 and the vPE unmapped, which indicates the invalidation
of any VPT caches associated with the vPE, we can get the VLPI state
by peeking at the VPT. So we add a function for this.
Signed-off-by: Shenming Lu <lushenming@huawei.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210322060158.1584-4-lushenming@huawei.com
Diffstat (limited to 'arch/arm64/kvm/vgic/vgic-v4.c')
-rw-r--r-- | arch/arm64/kvm/vgic/vgic-v4.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm64/kvm/vgic/vgic-v4.c b/arch/arm64/kvm/vgic/vgic-v4.c index 66508b03094f..ac029ba3d337 100644 --- a/arch/arm64/kvm/vgic/vgic-v4.c +++ b/arch/arm64/kvm/vgic/vgic-v4.c @@ -203,6 +203,25 @@ void vgic_v4_configure_vsgis(struct kvm *kvm) kvm_arm_resume_guest(kvm); } +/* + * Must be called with GICv4.1 and the vPE unmapped, which + * indicates the invalidation of any VPT caches associated + * with the vPE, thus we can get the VLPI state by peeking + * at the VPT. + */ +void vgic_v4_get_vlpi_state(struct vgic_irq *irq, bool *val) +{ + struct its_vpe *vpe = &irq->target_vcpu->arch.vgic_cpu.vgic_v3.its_vpe; + int mask = BIT(irq->intid % BITS_PER_BYTE); + void *va; + u8 *ptr; + + va = page_address(vpe->vpt_page); + ptr = va + irq->intid / BITS_PER_BYTE; + + *val = !!(*ptr & mask); +} + /** * vgic_v4_init - Initialize the GICv4 data structures * @kvm: Pointer to the VM being initialized |