Skip to content

Commit a3c19d5

Browse files
sean-jcbonzini
authored andcommitted
KVM: SVM: Nullify vcpu_(un)blocking() hooks if AVIC is disabled
Nullify svm_x86_ops.vcpu_(un)blocking if AVIC/APICv is disabled as the hooks are necessary only to clear the vCPU's IsRunning entry in the Physical APIC and to update IRTE entries if the VM has a pass-through device attached. Opportunistically rename the helpers to clarify their AVIC relationship. Signed-off-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 54744e1 commit a3c19d5

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

arch/x86/kvm/svm/avic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ void avic_vcpu_put(struct kvm_vcpu *vcpu)
10271027
WRITE_ONCE(*(svm->avic_physical_id_cache), entry);
10281028
}
10291029

1030-
void svm_vcpu_blocking(struct kvm_vcpu *vcpu)
1030+
void avic_vcpu_blocking(struct kvm_vcpu *vcpu)
10311031
{
10321032
if (!kvm_vcpu_apicv_active(vcpu))
10331033
return;
@@ -1052,7 +1052,7 @@ void svm_vcpu_blocking(struct kvm_vcpu *vcpu)
10521052
preempt_enable();
10531053
}
10541054

1055-
void svm_vcpu_unblocking(struct kvm_vcpu *vcpu)
1055+
void avic_vcpu_unblocking(struct kvm_vcpu *vcpu)
10561056
{
10571057
int cpu;
10581058

arch/x86/kvm/svm/svm.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4391,8 +4391,8 @@ static struct kvm_x86_ops svm_x86_ops __initdata = {
43914391
.prepare_guest_switch = svm_prepare_guest_switch,
43924392
.vcpu_load = svm_vcpu_load,
43934393
.vcpu_put = svm_vcpu_put,
4394-
.vcpu_blocking = svm_vcpu_blocking,
4395-
.vcpu_unblocking = svm_vcpu_unblocking,
4394+
.vcpu_blocking = avic_vcpu_blocking,
4395+
.vcpu_unblocking = avic_vcpu_unblocking,
43964396

43974397
.update_exception_bitmap = svm_update_exception_bitmap,
43984398
.get_msr_feature = svm_get_msr_feature,
@@ -4682,6 +4682,9 @@ static __init int svm_hardware_setup(void)
46824682
pr_info("AVIC enabled\n");
46834683

46844684
amd_iommu_register_ga_log_notifier(&avic_ga_log_notifier);
4685+
} else {
4686+
svm_x86_ops.vcpu_blocking = NULL;
4687+
svm_x86_ops.vcpu_unblocking = NULL;
46854688
}
46864689

46874690
if (vls) {

arch/x86/kvm/svm/svm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,8 @@ int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec);
592592
bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu);
593593
int svm_update_pi_irte(struct kvm *kvm, unsigned int host_irq,
594594
uint32_t guest_irq, bool set);
595-
void svm_vcpu_blocking(struct kvm_vcpu *vcpu);
596-
void svm_vcpu_unblocking(struct kvm_vcpu *vcpu);
595+
void avic_vcpu_blocking(struct kvm_vcpu *vcpu);
596+
void avic_vcpu_unblocking(struct kvm_vcpu *vcpu);
597597

598598
/* sev.c */
599599

0 commit comments

Comments
 (0)