| /kernel/linux/linux-6.6/tools/testing/selftests/kvm/ |
| D | max_guest_memory_test.c | 1 // SPDX-License-Identifier: GPL-2.0 23 uint64_t gpa; in guest_code() local 25 for (gpa = start_gpa; gpa < end_gpa; gpa += stride) in guest_code() 26 *((volatile uint64_t *)gpa) = gpa; in guest_code() 64 struct kvm_vcpu *vcpu = info->vcpu; in vcpu_worker() 65 struct kvm_vm *vm = vcpu->vm; in vcpu_worker() 69 vcpu_args_set(vcpu, 3, info->start_gpa, info->end_gpa, vm->page_size); in vcpu_worker() 96 uint64_t gpa, nr_bytes; in spawn_workers() local 104 TEST_ASSERT(info, "Failed to allocate vCPU gpa ranges"); in spawn_workers() 106 nr_bytes = ((end_gpa - start_gpa) / nr_vcpus) & in spawn_workers() [all …]
|
| D | memslot_perf_test.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * A memslot-related performance benchmark. 36 #define MEM_TEST_SIZE (MEM_SIZE - MEM_EXTRA_SIZE) 45 #define MEM_TEST_MAP_SIZE (MEM_SIZE_MAP - MEM_EXTRA_SIZE) 68 * architecture slots memory-per-slot memory-on-last-slot 69 * -------------------------------------------------------------- 70 * x86-4KB 32763 16KB 160KB 71 * arm64-4KB 32766 16KB 112KB 72 * arm64-16KB 32766 16KB 112KB 73 * arm64-64KB 8192 64KB 128KB [all …]
|
| /kernel/linux/linux-5.10/arch/powerpc/kvm/ |
| D | book3s_64_mmu_radix.c | 1 // SPDX-License-Identifier: GPL-2.0-only 21 #include <asm/pte-walk.h> 40 /* Can't access quadrants 1 or 2 in non-HV mode, call the HV to do it */ in __kvmhv_copy_tofrom_guest_radix() 46 quadrant = 1; in __kvmhv_copy_tofrom_guest_radix() 60 if (quadrant == 1) { in __kvmhv_copy_tofrom_guest_radix() 75 if (quadrant == 1 && pid != old_pid) in __kvmhv_copy_tofrom_guest_radix() 90 int lpid = vcpu->kvm->arch.lpid; in kvmhv_copy_tofrom_guest_radix() 91 int pid = vcpu->arch.pid; in kvmhv_copy_tofrom_guest_radix() 95 return -EINVAL; in kvmhv_copy_tofrom_guest_radix() 98 if (vcpu->arch.nested) in kvmhv_copy_tofrom_guest_radix() [all …]
|
| D | book3s_hv_uvmem.c | 1 // SPDX-License-Identifier: GPL-2.0 10 * A pseries guest can be run as secure guest on Ultravisor-enabled 15 * The page-in or page-out requests from UV will come to HV as hcalls and 31 * kvm->arch.uvmem_lock is a per-guest lock that prevents concurrent 32 * page-in and page-out requests for the same GPA. Concurrent accesses 37 * migrate_vma routines and page-in/out routines. 39 * Per-guest mutex comes with a cost though. Mainly it serializes the 40 * fault path as page-out can occur when HV faults on accessing secure 41 * guest pages. Currently UV issues page-in requests for all the guest 43 * not a cause for concern. Also currently the number of page-outs caused [all …]
|
| /kernel/linux/linux-6.6/arch/powerpc/kvm/ |
| D | book3s_64_mmu_radix.c | 1 // SPDX-License-Identifier: GPL-2.0-only 22 #include <asm/pte-walk.h> 43 /* Can't access quadrants 1 or 2 in non-HV mode, call the HV to do it */ in __kvmhv_copy_tofrom_guest_radix() 52 quadrant = 1; in __kvmhv_copy_tofrom_guest_radix() 68 if (quadrant == 1) { in __kvmhv_copy_tofrom_guest_radix() 85 if (quadrant == 1 && pid != old_pid) in __kvmhv_copy_tofrom_guest_radix() 99 int lpid = vcpu->kvm->arch.lpid; in kvmhv_copy_tofrom_guest_radix() 100 int pid = vcpu->arch.pid; in kvmhv_copy_tofrom_guest_radix() 104 return -EINVAL; in kvmhv_copy_tofrom_guest_radix() 107 if (vcpu->arch.nested) in kvmhv_copy_tofrom_guest_radix() [all …]
|
| D | book3s_hv_uvmem.c | 1 // SPDX-License-Identifier: GPL-2.0 10 * A pseries guest can be run as secure guest on Ultravisor-enabled 15 * The page-in or page-out requests from UV will come to HV as hcalls and 31 * kvm->arch.uvmem_lock is a per-guest lock that prevents concurrent 32 * page-in and page-out requests for the same GPA. Concurrent accesses 37 * migrate_vma routines and page-in/out routines. 39 * Per-guest mutex comes with a cost though. Mainly it serializes the 40 * fault path as page-out can occur when HV faults on accessing secure 41 * guest pages. Currently UV issues page-in requests for all the guest 43 * not a cause for concern. Also currently the number of page-outs caused [all …]
|
| /kernel/linux/linux-6.6/arch/mips/kvm/ |
| D | mmu.c | 19 * KVM_MMU_CACHE_MIN_PAGES is the number of GPA page table translation levels 23 #define KVM_MMU_CACHE_MIN_PAGES 1 30 kvm_mmu_free_memory_cache(&vcpu->arch.mmu_page_cache); in kvm_mmu_free_memory_caches() 34 * kvm_pgd_init() - Initialise KVM GPA page directory. 35 * @page: Pointer to page directory (PGD) for KVM GPA. 37 * Initialise a KVM GPA page directory with pointers to the invalid table, i.e. 59 p[1] = entry; in kvm_pgd_init() 64 p[-3] = entry; in kvm_pgd_init() 65 p[-2] = entry; in kvm_pgd_init() 66 p[-1] = entry; in kvm_pgd_init() [all …]
|
| /kernel/linux/linux-5.10/arch/mips/kvm/ |
| D | mmu.c | 19 * KVM_MMU_CACHE_MIN_PAGES is the number of GPA page table translation levels 23 #define KVM_MMU_CACHE_MIN_PAGES 1 30 kvm_mmu_free_memory_cache(&vcpu->arch.mmu_page_cache); in kvm_mmu_free_memory_caches() 34 * kvm_pgd_init() - Initialise KVM GPA page directory. 35 * @page: Pointer to page directory (PGD) for KVM GPA. 37 * Initialise a KVM GPA page directory with pointers to the invalid table, i.e. 59 p[1] = entry; in kvm_pgd_init() 64 p[-3] = entry; in kvm_pgd_init() 65 p[-2] = entry; in kvm_pgd_init() 66 p[-1] = entry; in kvm_pgd_init() [all …]
|
| /kernel/linux/linux-5.10/tools/testing/selftests/kvm/lib/aarch64/ |
| D | ucall.c | 1 // SPDX-License-Identifier: GPL-2.0 12 static bool ucall_mmio_init(struct kvm_vm *vm, vm_paddr_t gpa) in ucall_mmio_init() argument 14 if (kvm_userspace_memory_region_find(vm, gpa, gpa + 1)) in ucall_mmio_init() 17 virt_pg_map(vm, gpa, gpa, 0); in ucall_mmio_init() 19 ucall_exit_mmio_addr = (vm_vaddr_t *)gpa; in ucall_mmio_init() 27 vm_paddr_t gpa, start, end, step, offset; in ucall_init() local 32 gpa = (vm_paddr_t)arg; in ucall_init() 33 ret = ucall_mmio_init(vm, gpa); in ucall_init() 34 TEST_ASSERT(ret, "Can't set ucall mmio address to %lx", gpa); in ucall_init() 47 * up from there in 1/16th allowed space sized steps. in ucall_init() [all …]
|
| /kernel/linux/linux-5.10/arch/loongarch/kvm/ |
| D | mmu.c | 1 // SPDX-License-Identifier: GPL-2.0 3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 8 #include <linux/page-flags.h> 17 * KVM_MMU_CACHE_MIN_PAGES is the number of GPA page table translation levels 21 #define KVM_MMU_CACHE_MIN_PAGES 1 37 static int kvm_tlb_flush_gpa(struct kvm_vcpu *vcpu, unsigned long gpa) in kvm_tlb_flush_gpa() argument 40 gpa &= (PAGE_MASK << 1); in kvm_tlb_flush_gpa() 41 invtlb(INVTLB_GID_ADDR, kvm_read_csr_gstat() & KVM_GSTAT_GID, gpa); in kvm_tlb_flush_gpa() 90 kvm_mmu_free_memory_cache(&vcpu->arch.mmu_page_cache); in kvm_mmu_free_memory_caches() 94 * kvm_pgd_alloc() - Allocate and initialise a KVM GPA page directory. [all …]
|
| /kernel/linux/linux-6.6/tools/testing/selftests/kvm/lib/ |
| D | memstress.c | 1 // SPDX-License-Identifier: GPL-2.0 51 struct memstress_vcpu_args *vcpu_args = &args->vcpu_args[vcpu_idx]; in memstress_guest_code() 59 rand_state = new_guest_random_state(args->random_seed + vcpu_idx); in memstress_guest_code() 61 gva = vcpu_args->gva; in memstress_guest_code() 62 pages = vcpu_args->pages; in memstress_guest_code() 65 GUEST_ASSERT(vcpu_args->vcpu_idx == vcpu_idx); in memstress_guest_code() 68 for (i = 0; i < sizeof(memstress_args); i += args->guest_page_size) in memstress_guest_code() 72 if (args->random_access) in memstress_guest_code() 77 addr = gva + (page * args->guest_page_size); in memstress_guest_code() 79 if (guest_random_u32(&rand_state) % 100 < args->write_percent) in memstress_guest_code() [all …]
|
| /kernel/linux/linux-6.6/arch/loongarch/include/asm/ |
| D | tlb.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 9 #include <asm/cpu-features.h> 53 /* Invalid all global=1 lines in current tlb */ 61 /* Invalid addr with global=1 or matched asid in current tlb */ 65 /* Invalid global=1, matched gid in guest tlb */ 73 /* Invalid global=1 , matched gid, asid and addr in guest tlb */ 75 /* Invalid all gid gva-->gpa guest tlb */ 77 /* Invalid all gid gpa-->hpa tlb */ 79 /* Invalid all gid tlb, including gva-->gpa and gpa-->hpa */ [all …]
|
| /kernel/linux/linux-6.6/arch/s390/kvm/ |
| D | gaccess.c | 1 // SPDX-License-Identifier: GPL-2.0 16 #include "kvm-s390.h" 23 unsigned long origin : 52; /* Region- or Segment-Table Origin */ 25 unsigned long g : 1; /* Subspace Group Control */ 26 unsigned long p : 1; /* Private Space Control */ 27 unsigned long s : 1; /* Storage-Alteration-Event Control */ 28 unsigned long x : 1; /* Space-Switch-Event Control */ 29 unsigned long r : 1; /* Real-Space Control */ 30 unsigned long : 1; 31 unsigned long dt : 2; /* Designation-Type Control */ [all …]
|
| D | vsie.c | 1 // SPDX-License-Identifier: GPL-2.0 22 #include "kvm-s390.h" 48 __u8 reserved[0x0700 - 0x0258]; /* 0x0258 */ 57 scb->ipa = 0x1000; in set_validity_icpt() 58 scb->ipb = ((__u32) reason_code) << 16; in set_validity_icpt() 59 scb->icptcode = ICPT_VALIDITY; in set_validity_icpt() 60 return 1; in set_validity_icpt() 66 atomic_or(PROG_REQUEST, &vsie_page->scb_s.prog20); in prefix_unmapped() 73 if (vsie_page->scb_s.prog0c & PROG_IN_SIE) in prefix_unmapped_sync() 74 atomic_or(CPUSTAT_STOP_INT, &vsie_page->scb_s.cpuflags); in prefix_unmapped_sync() [all …]
|
| D | gaccess.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 17 #include "kvm-s390.h" 20 * kvm_s390_real_to_abs - convert guest real address to guest absolute address 21 * @prefix - guest prefix 22 * @gra - guest real address 32 gra -= prefix; in _kvm_s390_real_to_abs() 37 * kvm_s390_real_to_abs - convert guest real address to guest absolute address 38 * @vcpu - guest virtual cpu 39 * @gra - guest real address 51 * _kvm_s390_logical_to_effective - convert guest logical to effective address [all …]
|
| /kernel/linux/linux-5.10/arch/loongarch/include/asm/ |
| D | tlb.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 9 #include <asm/cpu-features.h> 53 /* Invalid all global=1 lines in current tlb */ 61 /* Invalid addr with global=1 or matched asid in current tlb */ 65 /* Invalid global=1, matched gid in guest tlb */ 73 /* Invalid global=1 , matched gid, asid and addr in guest tlb */ 75 /* Invalid all gid gva-->gpa guest tlb */ 77 /* Invalid all gid gpa-->hpa tlb */ 79 /* Invalid all gid tlb, including gva-->gpa and gpa-->hpa */ 81 /* Invalid matched gid gva-->gpa guest tlb */ [all …]
|
| /kernel/linux/linux-6.6/arch/x86/kvm/ |
| D | cpuid.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 43 return vcpu->arch.maxphyaddr; in cpuid_maxphyaddr() 46 static inline bool kvm_vcpu_is_legal_gpa(struct kvm_vcpu *vcpu, gpa_t gpa) in kvm_vcpu_is_legal_gpa() argument 48 return !(gpa & vcpu->arch.reserved_gpa_bits); in kvm_vcpu_is_legal_gpa() 51 static inline bool kvm_vcpu_is_illegal_gpa(struct kvm_vcpu *vcpu, gpa_t gpa) in kvm_vcpu_is_illegal_gpa() argument 53 return !kvm_vcpu_is_legal_gpa(vcpu, gpa); in kvm_vcpu_is_illegal_gpa() 57 gpa_t gpa, gpa_t alignment) in kvm_vcpu_is_legal_aligned_gpa() argument 59 return IS_ALIGNED(gpa, alignment) && kvm_vcpu_is_legal_gpa(vcpu, gpa); in kvm_vcpu_is_legal_aligned_gpa() 62 static inline bool page_address_valid(struct kvm_vcpu *vcpu, gpa_t gpa) in page_address_valid() argument 64 return kvm_vcpu_is_legal_aligned_gpa(vcpu, gpa, PAGE_SIZE); in page_address_valid() [all …]
|
| /kernel/linux/linux-6.6/arch/x86/include/asm/uv/ |
| D | uv_hub.h | 9 * Copyright (C) 2007-2014 Silicon Graphics, Inc. All rights reserved. 33 * M - The low M bits of a physical address represent the offset 38 * N - Number of bits in the node portion of a socket physical 41 * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of 42 * routers always have low bit of 1, C/MBricks have low bit 44 * right shift the NASID by 1 to exclude the always-zero bit. 47 * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead 50 * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant 53 * GPA - (global physical address) a socket physical address converted 55 * physical addresses 1) need additional NASID (node) bits added [all …]
|
| /kernel/linux/linux-5.10/arch/x86/include/asm/uv/ |
| D | uv_hub.h | 9 * Copyright (C) 2007-2014 Silicon Graphics, Inc. All rights reserved. 33 * M - The low M bits of a physical address represent the offset 38 * N - Number of bits in the node portion of a socket physical 41 * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of 42 * routers always have low bit of 1, C/MBricks have low bit 44 * right shift the NASID by 1 to exclude the always-zero bit. 47 * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead 50 * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant 53 * GPA - (global physical address) a socket physical address converted 55 * physical addresses 1) need additional NASID (node) bits added [all …]
|
| /kernel/linux/linux-5.10/arch/s390/kvm/ |
| D | vsie.c | 1 // SPDX-License-Identifier: GPL-2.0 21 #include "kvm-s390.h" 47 __u8 reserved[0x0700 - 0x0258]; /* 0x0258 */ 56 scb->ipa = 0x1000; in set_validity_icpt() 57 scb->ipb = ((__u32) reason_code) << 16; in set_validity_icpt() 58 scb->icptcode = ICPT_VALIDITY; in set_validity_icpt() 59 return 1; in set_validity_icpt() 65 atomic_or(PROG_REQUEST, &vsie_page->scb_s.prog20); in prefix_unmapped() 72 if (vsie_page->scb_s.prog0c & PROG_IN_SIE) in prefix_unmapped_sync() 73 atomic_or(CPUSTAT_STOP_INT, &vsie_page->scb_s.cpuflags); in prefix_unmapped_sync() [all …]
|
| D | gaccess.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 17 #include "kvm-s390.h" 20 * kvm_s390_real_to_abs - convert guest real address to guest absolute address 21 * @prefix - guest prefix 22 * @gra - guest real address 32 gra -= prefix; in _kvm_s390_real_to_abs() 37 * kvm_s390_real_to_abs - convert guest real address to guest absolute address 38 * @vcpu - guest virtual cpu 39 * @gra - guest real address 51 * _kvm_s390_logical_to_effective - convert guest logical to effective address [all …]
|
| /kernel/linux/linux-6.6/arch/riscv/kvm/ |
| D | mmu.c | 1 // SPDX-License-Identifier: GPL-2.0 33 #define gstage_pgd_size (1UL << (HGATP_PAGE_SHIFT + gstage_pgd_xbits)) 37 #define gstage_gpa_size ((gpa_t)(1ULL << gstage_gpa_bits)) 47 if (level == (gstage_pgd_levels - 1)) in gstage_pte_index() 48 mask = (PTRS_PER_PTE * (1UL << gstage_pgd_xbits)) - 1; in gstage_pte_index() 50 mask = PTRS_PER_PTE - 1; in gstage_pte_index() 63 unsigned long psz = 1UL << 12; in gstage_page_size_to_level() 72 return -EINVAL; in gstage_page_size_to_level() 78 return -EINVAL; in gstage_level_to_page_order() 101 u32 current_level = gstage_pgd_levels - 1; in gstage_get_leaf_entry() [all …]
|
| D | tlb.c | 1 // SPDX-License-Identifier: GPL-2.0 16 #include <asm/insn-def.h> 21 gpa_t gpa, gpa_t gpsz, in kvm_riscv_local_hfence_gvma_vmid_gpa() argument 33 for (pos = gpa; pos < (gpa + gpsz); pos += BIT(order)) in kvm_riscv_local_hfence_gvma_vmid_gpa() 34 asm volatile (HINVAL_GVMA(%0, %1) in kvm_riscv_local_hfence_gvma_vmid_gpa() 38 for (pos = gpa; pos < (gpa + gpsz); pos += BIT(order)) in kvm_riscv_local_hfence_gvma_vmid_gpa() 39 asm volatile (HFENCE_GVMA(%0, %1) in kvm_riscv_local_hfence_gvma_vmid_gpa() 49 void kvm_riscv_local_hfence_gvma_gpa(gpa_t gpa, gpa_t gpsz, in kvm_riscv_local_hfence_gvma_gpa() argument 61 for (pos = gpa; pos < (gpa + gpsz); pos += BIT(order)) in kvm_riscv_local_hfence_gvma_gpa() 66 for (pos = gpa; pos < (gpa + gpsz); pos += BIT(order)) in kvm_riscv_local_hfence_gvma_gpa() [all …]
|
| /kernel/linux/linux-6.6/Documentation/virt/kvm/x86/ |
| D | mmu.rst | 1 .. SPDX-License-Identifier: GPL-2.0 13 - correctness: 18 - security: 21 - performance: 23 - scaling: 25 - hardware: 27 - integration: 31 - dirty tracking: 33 and framebuffer-based displays 34 - footprint: [all …]
|
| /kernel/linux/linux-5.10/Documentation/virt/kvm/ |
| D | mmu.rst | 1 .. SPDX-License-Identifier: GPL-2.0 13 - correctness: 18 - security: 21 - performance: 23 - scaling: 25 - hardware: 27 - integration: 31 - dirty tracking: 33 and framebuffer-based displays 34 - footprint: [all …]
|