riscv: KVM: Remove unnecessary vcpu kick
Subsystems (3)
PATCH v2 1/1 riscv: KVM: Remove unnecessary vcpu kick
Remove the unnecessary kick to the vCPU after writing to the vs_file of IMSIC in kvm_riscv_vcpu_aia_imsic_inject.
For vCPUs that are running, writing to the vs_file directly forwards the interrupt as an MSI to them and does not need an extra kick.
For vCPUs that are descheduled after emulating WFI, KVM will enable the guest external interrupt for that vCPU in kvm_riscv_aia_wakeon_hgei. This means that writing to the vs_file will cause a guest external interrupt, which will cause KVM to wake up the vCPU in hgei_interrupt to handle the interrupt properly.
---
v2: Revise the commit message to ensure it meets the required
standards for acceptance
arch/riscv/kvm/aia_imsic.c | 1 - 1 file changed, 1 deletion(-)
arch/riscv/kvm/aia_imsic.c +0 -1
@@ -974,7 +974,6 @@ int kvm_riscv_vcpu_aia_imsic_inject(struct kvm_vcpu *vcpu,if (imsic->vsfile_cpu >=0 ) {writel (iid, imsic->vsfile_va +IMSIC_MMIO_SETIPNUM_LE ); -kvm_vcpu_kick (vcpu); }else { eix = &imsic->swfile->eix[iid /BITS_PER_TYPE (u64)];set_bit (iid & (BITS_PER_TYPE (u64) -1 ), eix->eip);
Signature · 1 line
2.46.2
Quoted 34 lines · BillXiang
Remove the unnecessary kick to the vCPU after writing to the
vs_fileof IMSIC inkvm_riscv_vcpu_aia_imsic_inject.For vCPUs that are running, writing to the
vs_filedirectly forwards the interrupt as an MSI to them and does not need an extra kick.For vCPUs that are descheduled after emulating WFI, KVM will enable the guest external interrupt for that vCPU in
kvm_riscv_aia_wakeon_hgei. This means that writing to thevs_filewill cause a guest external interrupt, which will cause KVM to wake up the vCPU inhgei_interruptto handle the interrupt properly.Signed-off-by BillXiang <[email protected]>---
v2: Revise the commit message to ensure it meets the required
standards for acceptancearch/riscv/kvm/aia_imsic.c | 1 - 1 file changed, 1 deletion(-)arch/riscv/kvm/aia_imsic.c +0
-1@@ -974,7 +974,6 @@ int kvm_riscv_vcpu_aia_imsic_inject(struct kvm_vcpu *vcpu,if (imsic->vsfile_cpu >=0 ) {writel (iid, imsic->vsfile_va +IMSIC_MMIO_SETIPNUM_LE ); -kvm_vcpu_kick (vcpu); }else { eix = &imsic->swfile->eix[iid /BITS_PER_TYPE (u64)];set_bit (iid & (BITS_PER_TYPE (u64) -1 ), eix->eip);Signature · 1 line
2.46.2
2025-02-21T18:45:38+08:00, BillXiang <[email protected]>:
Quoted 12 lines
Remove the unnecessary kick to the vCPU after writing to the
vs_fileof IMSIC inkvm_riscv_vcpu_aia_imsic_inject.For vCPUs that are running, writing to the
vs_filedirectly forwards the interrupt as an MSI to them and does not need an extra kick.For vCPUs that are descheduled after emulating WFI, KVM will enable the guest external interrupt for that vCPU in
kvm_riscv_aia_wakeon_hgei. This means that writing to thevs_filewill cause a guest external interrupt, which will cause KVM to wake up the vCPU inhgei_interruptto handle the interrupt properly.
Quoted 4 lines
Signed-off-by BillXiang <[email protected]>---
v2: Revise the commit message to ensure it meets the required
standards for acceptance
Nice, thanks.
Anup Patel
maintainerQuoted 7 lines · BillXiang
Remove the unnecessary kick to the vCPU after writing to the
vs_fileof IMSIC inkvm_riscv_vcpu_aia_imsic_inject.For vCPUs that are running, writing to the
vs_filedirectly forwards the interrupt as an MSI to them and does not need an extra kick.
Quoted 7 lines
For vCPUs that are descheduled after emulating WFI, KVM will enable the guest external interrupt for that vCPU in
kvm_riscv_aia_wakeon_hgei. This means that writing to thevs_filewill cause a guest external interrupt, which will cause KVM to wake up the vCPU inhgei_interruptto handle the interrupt properly.Signed-off-by BillXiang <[email protected]>
Queued this patch as a fix for Linux-6.14-rcX.
Thanks,
Anup
Quoted 21 lines
---
v2: Revise the commit message to ensure it meets the required
standards for acceptancearch/riscv/kvm/aia_imsic.c | 1 - 1 file changed, 1 deletion(-)arch/riscv/kvm/aia_imsic.c +0
-2@@ -974,7 +974,6 @@ int kvm_riscv_vcpu_aia_imsic_inject(struct kvm_vcpu *vcpu,if (imsic->vsfile_cpu >=0 ) {writel (iid, imsic->vsfile_va +IMSIC_MMIO_SETIPNUM_LE ); -kvm_vcpu_kick (vcpu); }else { eix = &imsic->swfile->eix[iid /BITS_PER_TYPE (u64)];set_bit (iid & (BITS_PER_TYPE (u64) -1 ), eix->eip); --2.46.2
This patch was applied to riscv/linux.git (for-next) by Anup Patel <[email protected]>:
Hello:
This patch was applied to riscv/linux.git (for-next) by Anup Patel <[email protected]>:
Quoted 6 lines · On Fri, 21 Feb 2025 18:45:38 +0800 you wrote:
Remove the unnecessary kick to the vCPU after writing to the
vs_fileof IMSIC inkvm_riscv_vcpu_aia_imsic_inject.For vCPUs that are running, writing to the
vs_filedirectly forwards the interrupt as an MSI to them and does not need an extra kick.
Quoted 7 lines
For vCPUs that are descheduled after emulating WFI, KVM will enable the guest external interrupt for that vCPU in
kvm_riscv_aia_wakeon_hgei. This means that writing to thevs_filewill cause a guest external interrupt, which will cause KVM to wake up the vCPU inhgei_interruptto handle the interrupt properly.[...]
Here is the summary with links:
- [v2] riscv: KVM: Remove unnecessary vcpu kick
https://git.kernel.org/riscv/c/d252435aca44
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html