|
|
Log in / Subscribe / Register

LoongArch: KVM: Small enhancement about interrupt injection

From:  Bibo Mao <maobibo-AT-loongson.cn>
To:  Huacai Chen <chenhuacai-AT-kernel.org>
Subject:  [PATCH v4 0/5] LoongArch: KVM: Small enhancement about interrupt injection
Date:  Fri, 22 May 2026 14:49:40 +0800
Message-ID:  <20260522064945.614486-1-maobibo@loongson.cn>
Cc:  kernel-AT-xen0n.name, kvm-AT-vger.kernel.org, loongarch-AT-lists.linux.dev, linux-kernel-AT-vger.kernel.org
Archive-link:  Article

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.

---
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 (5):
  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

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


base-commit: 70eda68668d1476b459b64e69b8f36659fa9dfa8
-- 
2.39.3




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds