RISC-V: KVM: Use PAGE_KERNEL_IO in kvm_riscv_gstage_ioremap()
authorAnup Patel <apatel@ventanamicro.com>
Fri, 29 Jul 2022 11:45:12 +0000 (17:15 +0530)
committerAnup Patel <anup@brainfault.org>
Fri, 29 Jul 2022 11:45:12 +0000 (17:15 +0530)
When the host has Svpbmt extension, we should use page based memory
type 2 (i.e. IO) for IO mappings in the G-stage page table.

To achieve this, we replace use of PAGE_KERNEL with PAGE_KERNEL_IO
in the kvm_riscv_gstage_ioremap().

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/kvm/mmu.c

index f7862ca4c4c6c8c08b80d82a2968f06d1d152d07..bc545aef603443fe622e224c4f92a73c7c396b40 100644 (file)
@@ -361,7 +361,7 @@ int kvm_riscv_gstage_ioremap(struct kvm *kvm, gpa_t gpa,
        pfn = __phys_to_pfn(hpa);
 
        for (addr = gpa; addr < end; addr += PAGE_SIZE) {
-               pte = pfn_pte(pfn, PAGE_KERNEL);
+               pte = pfn_pte(pfn, PAGE_KERNEL_IO);
 
                if (!writable)
                        pte = pte_wrprotect(pte);