mbox series

[v2,0/2] LoongArch: KVM: Enhancement about PGD saving

Message ID 20250219033823.215630-1-maobibo@loongson.cn (mailing list archive)
Headers show
Series LoongArch: KVM: Enhancement about PGD saving | expand

Message

bibo mao Feb. 19, 2025, 3:38 a.m. UTC
There is enhancement about PGD saving about KVM hypervisor. Register
LOONGARCH_CSR_PGDL is shared between host kernel and KVM hypervisor.
For host kernel it is for user space pgd of VMM threads, secondary mmu
for KVM hypervisor. Both are not changed after VM is created, so it
can be saved as host_pgd and kvm_pgd in advanced.

Also it fixes GPA size typo issue, it should cpu_vabits rather than
cpu_vabits - 1. And inject data abort error to VM if it exceeds maximum.
GPA size. For example there will be data abort when executing command:
 # busybox devmem 0xc00000100008
  Bus error (core dumped)
Previous it is treated as MMIO address and let VMM handle this.

---
  v1 ... v2:
    1. Use name kvm_pgd rather than host_second_pgd for PGD of
       hypervisor.
    2. Fix GPA size typo issue and add page fault address checking.

---
Bibo Mao (2):
  LoongArch: KVM: Remove PGD saving during VM context switch
  LoongArch: KVM: Fix GPA size issue about VM

 arch/loongarch/include/asm/kvm_host.h |  2 ++
 arch/loongarch/kernel/asm-offsets.c   |  4 +---
 arch/loongarch/kvm/exit.c             |  6 ++++++
 arch/loongarch/kvm/switch.S           | 12 ++----------
 arch/loongarch/kvm/vcpu.c             |  8 ++++++++
 arch/loongarch/kvm/vm.c               |  7 ++++++-
 6 files changed, 25 insertions(+), 14 deletions(-)


base-commit: 2408a807bfc3f738850ef5ad5e3fd59d66168996