[PATCH v6 0/6] LoongArch: KVM: Small enhancement about interrupt injection

Bibo Mao posted 6 patches 3 hours ago
arch/loongarch/include/asm/kvm_vcpu.h |  43 +++++++----
arch/loongarch/kvm/interrupt.c        | 100 ++++++++------------------
arch/loongarch/kvm/vcpu.c             |  35 ++++++---
3 files changed, 82 insertions(+), 96 deletions(-)
[PATCH v6 0/6] LoongArch: KVM: Small enhancement about interrupt injection
Posted by Bibo Mao 3 hours ago
Here add illegal parameter check in kvm_vcpu_ioctl_interrupt() since this
function is called from user mode. Also interrupt inject is handled with
batch method, rather one by one.

---
v5 ... v6:
  1. Remove INT_SWI0 interrupt injection in kvm_vcpu_ioctl_interrupt()
     since there is no corresponding INT_SWI0 interrupt clear. Here keep
     the smallest modification.
  2. Rename macro KVM_VIP_DELTA with VIP_DELTA, KVM_ESTAT_IRQ_MASK with
     KVM_ESTAT_INTI_MASK, and KVM_ESTAT_HWI_MASK with KVM_ESTAT_EXTI_MASK
     in patch 3.

v4 ... v5:
  1. Replace constant 2 with macro GINTC_VIP_DELTA in patch 4.
  2. Keep register CSR_GINTC bits unchanged except CPU_IP0 - CPU_IP7 in
     function _kvm_setcsr().
  3. Add new patch 6 which moves function call with kvm_deliver_intr()
     after smp_store_mb(vcpu->mode, IN_GUEST_MODE).

v3 ... v4:
  1. change type of local variable vector with unsigned int rather than
     int, and use abs() macro.
  2. Remove last patch since kvm_vcpu_sync_intr() does not sync cached
     AVEC interrupt to SW CSR_ISR state.
  3. Replace kvm_set_sw_gcsr() with kvm_write_sw_gcsr() in patch 5,
     since kvm_set_sw_gcsr() is ORed cached ESTAT interrupt bits,
     kvm_write_sw_gcsr() is to overwrite the whole SW ESTAT register.
  4. Modify typo issue about title and log message in patch 5, replace
     GSTAT with ESTAT

v2 ... v3:
  1. Split patch 1 into two smaller patches, one is smaller bugfix patch
     with irq validility check in kvm_vcpu_ioctl_interrupt(), so that it
     is easy to porting to old kernel.

v1 ... v2:
  1. Add irq validility check in function kvm_vcpu_ioctl_interrupt().
  2. Add valid bit check when set ESTAT CSR register.
  3. Merge two patches about interrupt clear and set with batch method into
     one.
---
Bibo Mao (6):
  LoongArch: KVM: Check irq validility in kvm_vcpu_ioctl_interrupt()
  LoongArch: KVM: Check msgint feature in interrupt post
  LoongArch: KVM: Use existing macro about interrupt bit mask
  LoongArch: KVM: Inject interrupt with batch method
  LoongArch: KVM: Add valid bit check when set ESTAT CSR register
  LoongArch: KVM: Deliver interrupt after IN_GUEST_MODE is set

 arch/loongarch/include/asm/kvm_vcpu.h |  43 +++++++----
 arch/loongarch/kvm/interrupt.c        | 100 ++++++++------------------
 arch/loongarch/kvm/vcpu.c             |  35 ++++++---
 3 files changed, 82 insertions(+), 96 deletions(-)


base-commit: 9716c086c8e8b141d35aa61f2e96a2e83de212a7
-- 
2.39.3