| /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() 43 (to != NULL) ? __pa(to): 0, in __kvmhv_copy_tofrom_guest_radix() 44 (from != NULL) ? __pa(from): 0, n); 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() 94 if (eaddr & (0x3FFUL << 52)) 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() 46 (to != NULL) ? __pa(to): 0, in __kvmhv_copy_tofrom_guest_radix() 47 (from != NULL) ? __pa(from): 0, n); in __kvmhv_copy_tofrom_guest_radix() 49 if (eaddr & (0xFFFUL << 52)) 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() 103 if (eaddr & (0x3FFUL << 52)) in kvmhv_copy_tofrom_guest_radix() 104 return -EINVAL; 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/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() 44 if (orig > 0) { in rendezvous_with_boss() 46 while (atomic_read(&rendezvous) > 0) in rendezvous_with_boss() 50 while (atomic_read(&rendezvous) < 0) in rendezvous_with_boss() 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() [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 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. 58 p[0] = 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() 71 * kvm_pgd_alloc() - Allocate and initialise a KVM GPA page directory. [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 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. 58 p[0] = 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() 71 * kvm_pgd_alloc() - Allocate and initialise a KVM GPA page directory. [all …]
|
| /kernel/linux/linux-6.6/drivers/virt/acrn/ |
| D | hypercall.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 14 #define HC_ID 0x80UL 16 #define HC_ID_GEN_BASE 0x0UL 17 #define HC_SOS_REMOVE_CPU _HC_ID(HC_ID, HC_ID_GEN_BASE + 0x01) 19 #define HC_ID_VM_BASE 0x10UL 20 #define HC_CREATE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x00) 21 #define HC_DESTROY_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x01) 22 #define HC_START_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x02) 23 #define HC_PAUSE_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x03) 24 #define HC_RESET_VM _HC_ID(HC_ID, HC_ID_VM_BASE + 0x05) [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() 49 * Note, we need to use VA-bits - 1 when calculating the allowed 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 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() 43 return 0; 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() 71 for (i = 0; i < pages; i++) { 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() [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> 50 INVTLB_ALL = 0x0, 52 INVTLB_CURRENT_ALL = 0x1, 54 INVTLB_CURRENT_GTRUE = 0x2, 55 /* Invalid all global=0 lines in current tlb */ 56 INVTLB_CURRENT_GFALSE = 0x3, 57 /* Invalid global=0 and matched asid lines in current tlb */ 58 INVTLB_GFALSE_AND_ASID = 0x4, [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> 50 INVTLB_ALL = 0x0, 52 INVTLB_CURRENT_ALL = 0x1, 54 INVTLB_CURRENT_GTRUE = 0x2, 55 /* Invalid all global=0 lines in current tlb */ 56 INVTLB_CURRENT_GFALSE = 0x3, 57 /* Invalid global=0 and matched asid lines in current tlb */ 58 INVTLB_GFALSE_AND_ASID = 0x4, 59 /* Invalid addr with global=0 and matched asid in current tlb */ [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 */ 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 */ 31 unsigned long dt : 2; /* Designation-Type Control */ 32 unsigned long tl : 2; /* Region- or Segment-Table Length */ 37 ASCE_TYPE_SEGMENT = 0, 46 unsigned long rto: 52;/* Region-Table Origin */ [all …]
|
| D | vsie.c | 1 // SPDX-License-Identifier: GPL-2.0 22 #include "kvm-s390.h" 26 struct kvm_s390_sie_block scb_s; /* 0x0000 */ 31 struct mcck_volatile_info mcck_info; /* 0x0200 */ 37 struct kvm_s390_sie_block *scb_o; /* 0x0218 */ 39 struct gmap *gmap; /* 0x0220 */ 41 unsigned long fault_addr; /* 0x0228 */ 43 gpa_t sca_gpa; /* 0x0230 */ 44 gpa_t itdba_gpa; /* 0x0238 */ 45 gpa_t gvrd_gpa; /* 0x0240 */ [all …]
|
| /kernel/linux/linux-6.6/virt/kvm/ |
| D | pfncache.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * Kernel-based Virtual Machine driver for Linux 5 * This module enables kernel and guest-mode vCPU access to guest physical 32 spin_lock(&kvm->gpc_lock); in gfn_to_pfn_cache_invalidate_start() 33 list_for_each_entry(gpc, &kvm->gpc_list, list) { in gfn_to_pfn_cache_invalidate_start() 34 write_lock_irq(&gpc->lock); in gfn_to_pfn_cache_invalidate_start() 37 if (gpc->valid && !is_error_noslot_pfn(gpc->pfn) && in gfn_to_pfn_cache_invalidate_start() 38 gpc->uhva >= start && gpc->uhva < end) { in gfn_to_pfn_cache_invalidate_start() 39 gpc->valid = false; in gfn_to_pfn_cache_invalidate_start() 45 if (gpc->usage & KVM_GUEST_USES_PFN) { in gfn_to_pfn_cache_invalidate_start() [all …]
|
| /kernel/linux/linux-5.10/drivers/gpu/drm/i915/gvt/ |
| D | page_track.c | 2 * Copyright(c) 2011-2017 Intel Corporation. All rights reserved. 27 * intel_vgpu_find_page_track - find page track rcord of guest page 37 return radix_tree_lookup(&vgpu->page_track_tree, gfn); in intel_vgpu_find_page_track() 41 * intel_vgpu_register_page_track - register a guest page to be tacked 58 return -EEXIST; in intel_vgpu_register_page_track() 62 return -ENOMEM; in intel_vgpu_register_page_track() 64 track->handler = handler; in intel_vgpu_register_page_track() 65 track->priv_data = priv; in intel_vgpu_register_page_track() 67 ret = radix_tree_insert(&vgpu->page_track_tree, gfn, track); in intel_vgpu_register_page_track() 73 return 0; in intel_vgpu_register_page_track() [all …]
|
| /kernel/linux/linux-6.6/drivers/gpu/drm/i915/gvt/ |
| D | page_track.c | 2 * Copyright(c) 2011-2017 Intel Corporation. All rights reserved. 27 * intel_vgpu_find_page_track - find page track rcord of guest page 37 return radix_tree_lookup(&vgpu->page_track_tree, gfn); in intel_vgpu_find_page_track() 41 * intel_vgpu_register_page_track - register a guest page to be tacked 58 return -EEXIST; in intel_vgpu_register_page_track() 62 return -ENOMEM; in intel_vgpu_register_page_track() 64 track->handler = handler; in intel_vgpu_register_page_track() 65 track->priv_data = priv; in intel_vgpu_register_page_track() 67 ret = radix_tree_insert(&vgpu->page_track_tree, gfn, track); in intel_vgpu_register_page_track() 73 return 0; in intel_vgpu_register_page_track() [all …]
|
| /kernel/linux/linux-5.10/arch/s390/kvm/ |
| D | vsie.c | 1 // SPDX-License-Identifier: GPL-2.0 21 #include "kvm-s390.h" 25 struct kvm_s390_sie_block scb_s; /* 0x0000 */ 30 struct mcck_volatile_info mcck_info; /* 0x0200 */ 36 struct kvm_s390_sie_block *scb_o; /* 0x0218 */ 38 struct gmap *gmap; /* 0x0220 */ 40 unsigned long fault_addr; /* 0x0228 */ 42 gpa_t sca_gpa; /* 0x0230 */ 43 gpa_t itdba_gpa; /* 0x0238 */ 44 gpa_t gvrd_gpa; /* 0x0240 */ [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 43 * equal to 0. Most addressing macros that target UV hub chips 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 57 * partition does not have a physical address 0. In addition, on [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 43 * equal to 0. Most addressing macros that target UV hub chips 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 57 * partition does not have a physical address 0. In addition, on [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/riscv/kvm/ |
| 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() 46 asm volatile(HFENCE_GVMA(zero, %0) : : "r" (vmid) : "memory"); in kvm_riscv_local_hfence_gvma_vmid_all() 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() [all …]
|
| D | mmu.c | 1 // SPDX-License-Identifier: GPL-2.0 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() 65 for (i = 0; i < gstage_pgd_levels; i++) { in gstage_page_size_to_level() 68 return 0; in gstage_page_size_to_level() 72 return -EINVAL; in gstage_page_size_to_level() 78 return -EINVAL; in gstage_level_to_page_order() 81 return 0; in gstage_level_to_page_order() 94 return 0; in gstage_level_to_page_size() [all …]
|
| /kernel/linux/linux-6.6/arch/x86/kvm/mmu/ |
| D | page_track.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 30 void __kvm_page_track_write(struct kvm *kvm, gpa_t gpa, const u8 *new, int bytes); 35 return !hlist_empty(&kvm->arch.track_notifier_head.track_notifier_list); in kvm_page_track_has_external_user() 38 static inline int kvm_page_track_init(struct kvm *kvm) { return 0; } in kvm_page_track_init() 41 static inline void __kvm_page_track_write(struct kvm *kvm, gpa_t gpa, in __kvm_page_track_write() argument 50 static inline void kvm_page_track_write(struct kvm_vcpu *vcpu, gpa_t gpa, in kvm_page_track_write() argument 53 __kvm_page_track_write(vcpu->kvm, gpa, new, bytes); in kvm_page_track_write() 55 kvm_mmu_track_write(vcpu, gpa, new, bytes); in kvm_page_track_write()
|