Interrupt AVEC is valid only if VM has msgint feature, and this feature
is checked in interrupt handling. Since interrupt handling is executing
in VM context switch, and it is hot path, here move the feature checking
in interrupt post rather than interrupt handling.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
switch (priority) {
case INT_AVEC:
- if (!kvm_guest_has_msgint(&vcpu->arch))
- break;
dmsintc_inject_irq(vcpu);
fallthrough;
case INT_TI:
switch (priority) {
case INT_AVEC:
- if (!kvm_guest_has_msgint(&vcpu->arch))
- break;
- fallthrough;
case INT_TI:
case INT_IPI:
case INT_SWI0:
if (vector >= EXCCODE_INT_NUM)
return -EINVAL;
+ if (!kvm_guest_has_msgint(&vcpu->arch) && (vector == INT_AVEC))
+ return -EINVAL;
+
if (intr > 0)
kvm_queue_irq(vcpu, intr);
else if (intr < 0)