@@ -1047,14 +1047,69 @@ struct kvm_x86_msr_filter {
10471047};
10481048
10491049enum kvm_apicv_inhibit {
1050+
1051+ /********************************************************************/
1052+ /* INHIBITs that are relevant to both Intel's APICv and AMD's AVIC. */
1053+ /********************************************************************/
1054+
1055+ /*
1056+ * APIC acceleration is disabled by a module parameter
1057+ * and/or not supported in hardware.
1058+ */
10501059 APICV_INHIBIT_REASON_DISABLE ,
1060+
1061+ /*
1062+ * APIC acceleration is inhibited because AutoEOI feature is
1063+ * being used by a HyperV guest.
1064+ */
10511065 APICV_INHIBIT_REASON_HYPERV ,
1066+
1067+ /*
1068+ * APIC acceleration is inhibited because the userspace didn't yet
1069+ * enable the kernel/split irqchip.
1070+ */
1071+ APICV_INHIBIT_REASON_ABSENT ,
1072+
1073+ /* APIC acceleration is inhibited because KVM_GUESTDBG_BLOCKIRQ
1074+ * (out of band, debug measure of blocking all interrupts on this vCPU)
1075+ * was enabled, to avoid AVIC/APICv bypassing it.
1076+ */
1077+ APICV_INHIBIT_REASON_BLOCKIRQ ,
1078+
1079+ /******************************************************/
1080+ /* INHIBITs that are relevant only to the AMD's AVIC. */
1081+ /******************************************************/
1082+
1083+ /*
1084+ * AVIC is inhibited on a vCPU because it runs a nested guest.
1085+ *
1086+ * This is needed because unlike APICv, the peers of this vCPU
1087+ * cannot use the doorbell mechanism to signal interrupts via AVIC when
1088+ * a vCPU runs nested.
1089+ */
10521090 APICV_INHIBIT_REASON_NESTED ,
1091+
1092+ /*
1093+ * On SVM, the wait for the IRQ window is implemented with pending vIRQ,
1094+ * which cannot be injected when the AVIC is enabled, thus AVIC
1095+ * is inhibited while KVM waits for IRQ window.
1096+ */
10531097 APICV_INHIBIT_REASON_IRQWIN ,
1098+
1099+ /*
1100+ * PIT (i8254) 're-inject' mode, relies on EOI intercept,
1101+ * which AVIC doesn't support for edge triggered interrupts.
1102+ */
10541103 APICV_INHIBIT_REASON_PIT_REINJ ,
1104+
1105+ /*
1106+ * AVIC is inhibited because the guest has x2apic in its CPUID.
1107+ */
10551108 APICV_INHIBIT_REASON_X2APIC ,
1056- APICV_INHIBIT_REASON_BLOCKIRQ ,
1057- APICV_INHIBIT_REASON_ABSENT ,
1109+
1110+ /*
1111+ * AVIC is disabled because SEV doesn't support it.
1112+ */
10581113 APICV_INHIBIT_REASON_SEV ,
10591114};
10601115
0 commit comments