KVM: arm64: Add helper vgic_write_guest_lock()
authorGavin Shan <gshan@redhat.com>
Thu, 26 Jan 2023 23:54:48 +0000 (07:54 +0800)
committerMarc Zyngier <maz@kernel.org>
Sun, 29 Jan 2023 18:46:11 +0000 (18:46 +0000)
commita23eaf9368aafa4defcc8904b20391b6ea07bb1e
tree1210434f2f7ad9a01966d8275afa5b4f68cc99d1
parentef3691683d7bfd0a2acf48812e4ffe894f10bfa8
KVM: arm64: Add helper vgic_write_guest_lock()

Currently, the unknown no-running-vcpu sites are reported when a
dirty page is tracked by mark_page_dirty_in_slot(). Until now, the
only known no-running-vcpu site is saving vgic/its tables through
KVM_DEV_ARM_{VGIC_GRP_CTRL, ITS_SAVE_TABLES} command on KVM device
"kvm-arm-vgic-its". Unfortunately, there are more unknown sites to
be handled and no-running-vcpu context will be allowed in these
sites: (1) KVM_DEV_ARM_{VGIC_GRP_CTRL, ITS_RESTORE_TABLES} command
on KVM device "kvm-arm-vgic-its" to restore vgic/its tables. The
vgic3 LPI pending status could be restored. (2) Save vgic3 pending
table through KVM_DEV_ARM_{VGIC_GRP_CTRL, VGIC_SAVE_PENDING_TABLES}
command on KVM device "kvm-arm-vgic-v3".

In order to handle those unknown cases, we need a unified helper
vgic_write_guest_lock(). struct vgic_dist::save_its_tables_in_progress
is also renamed to struct vgic_dist::save_tables_in_progress.

No functional change intended.

Suggested-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230126235451.469087-3-gshan@redhat.com
arch/arm64/kvm/vgic/vgic-its.c
arch/arm64/kvm/vgic/vgic.h
include/kvm/arm_vgic.h