diff options
author | Marc Zyngier <maz@kernel.org> | 2024-08-27 17:25:10 +0200 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2024-08-27 19:32:55 +0200 |
commit | 795a0bbaeee2aa993338166bc063fe3c89373d2a (patch) | |
tree | 8d67f7d095eb175a3aee58807f6e55739f629bdb /arch/arm64/kvm/nested.c | |
parent | KVM: arm64: Force GICv3 trap activation when no irqchip is configured on VHE (diff) | |
download | linux-795a0bbaeee2aa993338166bc063fe3c89373d2a.tar.xz linux-795a0bbaeee2aa993338166bc063fe3c89373d2a.zip |
KVM: arm64: Add helper for last ditch idreg adjustments
We already have to perform a set of last-chance adjustments for
NV purposes. We will soon have to do the same for the GIC, so
introduce a helper for that exact purpose.
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240827152517.3909653-5-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/kvm/nested.c')
-rw-r--r-- | arch/arm64/kvm/nested.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c index bab27f9d8cc6..e2067c594e4a 100644 --- a/arch/arm64/kvm/nested.c +++ b/arch/arm64/kvm/nested.c @@ -954,19 +954,16 @@ static void set_sysreg_masks(struct kvm *kvm, int sr, u64 res0, u64 res1) int kvm_init_nv_sysregs(struct kvm *kvm) { u64 res0, res1; - int ret = 0; - mutex_lock(&kvm->arch.config_lock); + lockdep_assert_held(&kvm->arch.config_lock); if (kvm->arch.sysreg_masks) - goto out; + return 0; kvm->arch.sysreg_masks = kzalloc(sizeof(*(kvm->arch.sysreg_masks)), GFP_KERNEL_ACCOUNT); - if (!kvm->arch.sysreg_masks) { - ret = -ENOMEM; - goto out; - } + if (!kvm->arch.sysreg_masks) + return -ENOMEM; limit_nv_id_regs(kvm); @@ -1195,8 +1192,6 @@ int kvm_init_nv_sysregs(struct kvm *kvm) if (!kvm_has_feat(kvm, ID_AA64PFR0_EL1, AMU, V1P1)) res0 |= ~(res0 | res1); set_sysreg_masks(kvm, HAFGRTR_EL2, res0, res1); -out: - mutex_unlock(&kvm->arch.config_lock); - return ret; + return 0; } |