mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-11 11:09:13 +00:00
svm: Fix AVIC incomplete IPI emulation
[ Upstream commit bb218fbcfa
]
In case of incomplete IPI with invalid interrupt type, the current
SVM driver does not properly emulate the IPI, and fails to boot
FreeBSD guests with multiple vcpus when enabling AVIC.
Fix this by update APIC ICR high/low registers, which also
emulate sending the IPI.
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
99b1dbe6ba
commit
0149b03ec2
1 changed files with 4 additions and 15 deletions
|
@ -4485,25 +4485,14 @@ static int avic_incomplete_ipi_interception(struct vcpu_svm *svm)
|
||||||
kvm_lapic_reg_write(apic, APIC_ICR, icrl);
|
kvm_lapic_reg_write(apic, APIC_ICR, icrl);
|
||||||
break;
|
break;
|
||||||
case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING: {
|
case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING: {
|
||||||
int i;
|
|
||||||
struct kvm_vcpu *vcpu;
|
|
||||||
struct kvm *kvm = svm->vcpu.kvm;
|
|
||||||
struct kvm_lapic *apic = svm->vcpu.arch.apic;
|
struct kvm_lapic *apic = svm->vcpu.arch.apic;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* At this point, we expect that the AVIC HW has already
|
* Update ICR high and low, then emulate sending IPI,
|
||||||
* set the appropriate IRR bits on the valid target
|
* which is handled when writing APIC_ICR.
|
||||||
* vcpus. So, we just need to kick the appropriate vcpu.
|
|
||||||
*/
|
*/
|
||||||
kvm_for_each_vcpu(i, vcpu, kvm) {
|
kvm_lapic_reg_write(apic, APIC_ICR2, icrh);
|
||||||
bool m = kvm_apic_match_dest(vcpu, apic,
|
kvm_lapic_reg_write(apic, APIC_ICR, icrl);
|
||||||
icrl & KVM_APIC_SHORT_MASK,
|
|
||||||
GET_APIC_DEST_FIELD(icrh),
|
|
||||||
icrl & KVM_APIC_DEST_MASK);
|
|
||||||
|
|
||||||
if (m && !avic_vcpu_is_running(vcpu))
|
|
||||||
kvm_vcpu_wake_up(vcpu);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AVIC_IPI_FAILURE_INVALID_TARGET:
|
case AVIC_IPI_FAILURE_INVALID_TARGET:
|
||||||
|
|
Loading…
Reference in a new issue