[PW_SID:968804] MMU related improvements for KVM RISC-V#474
[PW_SID:968804] MMU related improvements for KVM RISC-V#474linux-riscv-bot wants to merge 14 commits into
Conversation
As-per the SBI specification, an SBI remote fence operation applies to the entire address space if either: 1) start_addr and size are both 0 2) size is equal to 2^XLEN-1 From the above, only #1 is checked by SBI SFENCE calls so fix the size parameter check in SBI SFENCE calls to cover #2 as well. Fixes: 13acfec ("RISC-V: KVM: Add remote HFENCE functions based on VCPU requests") Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The SBI specification clearly states that SBI HFENCE calls should return SBI_ERR_NOT_SUPPORTED when one of the target hart doesn’t support hypervisor extension (aka nested virtualization in-case of KVM RISC-V). Fixes: c7fa3c4 ("RISC-V: KVM: Treat SBI HFENCE calls as NOPs") Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The kvm_riscv_vcpu_alloc_vector_context() does return an error code upon failure so don't ignore this in kvm_arch_vcpu_create(). Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The kvm_riscv_vcpu_aia_init() does not return any failure so drop the return value which is always zero. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The kvm_riscv_local_tlb_sanitize() deals with sanitizing current VMID related TLB mappings when a VCPU is moved from one host CPU to another. Let's move kvm_riscv_local_tlb_sanitize() to VMID management sources and rename it to kvm_riscv_gstage_vmid_sanitize(). Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The KVM_REQ_HFENCE_GVMA_VMID_ALL is same as KVM_REQ_TLB_FLUSH so to avoid confusion let's replace KVM_REQ_HFENCE_GVMA_VMID_ALL with KVM_REQ_TLB_FLUSH. Also, rename kvm_riscv_hfence_gvma_vmid_all_process() to kvm_riscv_tlb_flush_process(). Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The gstage_set_pte() should flush remote TLB only when a leaf PTE changes so that unnecessary remote TLB flushes can be avoided. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The kvm_arch_flush_remote_tlbs_range() expected by KVM core can be easily implemented for RISC-V using kvm_riscv_hfence_gvma_vmid_gpa() hence provide it. Also with kvm_arch_flush_remote_tlbs_range() available for RISC-V, the mmu_wp_memory_region() can happily use kvm_flush_remote_tlbs_memslot() instead of kvm_flush_remote_tlbs(). Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The MMU, TLB, and VMID management for KVM RISC-V already exists as seprate sources so create separate headers along these lines. This further simplifies asm/kvm_host.h header. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Introduce struct kvm_gstage_mapping which represents a g-stage mapping at a particular page table level of the g-stage. Also, update the kvm_riscv_gstage_map() to return the g-stage mapping upon success. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Currently, the struct kvm_riscv_hfence does not have vmid field and various hfence processing functions always pick vmid assigned to the guest/VM. This prevents us from doing hfence operation on arbitrary vmid hence add vmid field to struct kvm_riscv_hfence and use it wherever applicable. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The upcoming nested virtualization can share g-stage page table management with the current host g-stage implementation hence factor-out g-stage page table management into separate sources and also use "kvm_riscv_mmu_" prefix for host g-stage functions. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Currently, all kvm_riscv_hfence_xyz() APIs assume VMID to be the host VMID of the Guest/VM which resticts use of these APIs only for host TLB maintenance. Let's allow passing VMID as parameter to all kvm_riscv_hfence_xyz() APIs so that they can be re-used for nested virtualization related TLB maintenance. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 1: "[01/13] RISC-V: KVM: Fix the size parameter check in SBI SFENCE calls" |
|
Patch 2: "[02/13] RISC-V: KVM: Don't treat SBI HFENCE calls as NOPs" |
|
Patch 2: "[02/13] RISC-V: KVM: Don't treat SBI HFENCE calls as NOPs" |
|
Patch 2: "[02/13] RISC-V: KVM: Don't treat SBI HFENCE calls as NOPs" |
|
Patch 2: "[02/13] RISC-V: KVM: Don't treat SBI HFENCE calls as NOPs" |
|
Patch 12: "[12/13] RISC-V: KVM: Factor-out g-stage page table management" |
|
Patch 12: "[12/13] RISC-V: KVM: Factor-out g-stage page table management" |
|
Patch 12: "[12/13] RISC-V: KVM: Factor-out g-stage page table management" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
|
Patch 13: "[13/13] RISC-V: KVM: Pass VMID as parameter to kvm_riscv_hfence_xyz() APIs" |
81a1dd8 to
5db9bbd
Compare
PR for series 968804 applied to workflow
Name: MMU related improvements for KVM RISC-V
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=968804
Version: 1