[RFC PATCH 15/19] KVM: x86: Secure AVIC: Indicate APIC is enabled by guest SW _always_

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Kishon Vijay Abraham I <kvijayab@xxxxxxx>

Guest SW indicates APIC is enabled by writing to APIC_SPIV (
Bit 8: APIC Software Enable). However in the case of Secure AVIC,
APIC_SPIV is not propagated to hypervisor as Secure AVIC HW
itself can detect whether the Guest SW has enabled APIC or not and
handle accordingly.

To handle this case where the HW handles APIC SW Enable in the
hypervisor, always return 'true' from kvm_apic_sw_enabled() if
Secure AVIC is active. This would let hypervisor assume Guest SW
has always enabled APIC and prevent it from taking actions it
usually does when Guest SW has not enabled APIC.

This is especially used when accepting interrupts to be injected to
the Guest and for injecting LAPIC timer interrupts.

Signed-off-by: Kishon Vijay Abraham I <kvijayab@xxxxxxx>
Signed-off-by: Neeraj Upadhyay <Neeraj.Upadhyay@xxxxxxx>
---
 arch/x86/kvm/lapic.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h
index c9ef9bce438b..a1367689d53c 100644
--- a/arch/x86/kvm/lapic.h
+++ b/arch/x86/kvm/lapic.h
@@ -206,6 +206,9 @@ extern struct static_key_false_deferred apic_sw_disabled;
 
 static inline bool kvm_apic_sw_enabled(struct kvm_lapic *apic)
 {
+	if (apic->guest_apic_protected == APIC_STATE_PROTECTED_INJECTED_INTR)
+		return true;
+
 	if (static_branch_unlikely(&apic_sw_disabled.key))
 		return apic->sw_enabled;
 	return true;
-- 
2.34.1





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux