/openbmc/linux/arch/x86/kvm/ |
H A D | irq_comm.c | 1 // SPDX-License-Identifier: GPL-2.0-only 18 #include <trace/events/kvm.h> 31 struct kvm *kvm, int irq_source_id, int level, in kvm_set_pic_irq() argument 34 struct kvm_pic *pic = kvm->arch.vpic; in kvm_set_pic_irq() 35 return kvm_pic_set_irq(pic, e->irqchip.pin, irq_source_id, level); in kvm_set_pic_irq() 39 struct kvm *kvm, int irq_source_id, int level, in kvm_set_ioapic_irq() argument 42 struct kvm_ioapic *ioapic = kvm->arch.vioapic; in kvm_set_ioapic_irq() 43 return kvm_ioapic_set_irq(ioapic, e->irqchip.pin, irq_source_id, level, in kvm_set_ioapic_irq() 47 int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, in kvm_irq_delivery_to_apic() argument 50 int r = -1; in kvm_irq_delivery_to_apic() [all …]
|
/openbmc/linux/virt/kvm/ |
H A D | eventfd.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * kvm eventfd support - use eventfd objects to signal various KVM events 13 #include <linux/kvm.h> 27 #include <trace/events/kvm.h> 29 #include <kvm/iodev.h> 36 kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args) in kvm_arch_irqfd_allowed() argument 46 struct kvm *kvm = irqfd->kvm; in irqfd_inject() local 48 if (!irqfd->resampler) { in irqfd_inject() 49 kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 1, in irqfd_inject() 51 kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irqfd->gsi, 0, in irqfd_inject() [all …]
|
H A D | kvm_main.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * Kernel-based Virtual Machine driver for Linux 5 * This module enables machines with Intel VT-x extensions to run virtual 16 #include <kvm/iodev.h> 19 #include <linux/kvm.h> 68 #include <trace/events/kvm.h> 84 /* Default doubles per-vcpu halt_poll_ns. */ 94 /* Default resets per-vcpu halt_poll_ns . */ 102 * kvm->lock --> kvm->slots_lock --> kvm->irq_lock 130 * - Prevent a compat task from opening /dev/kvm [all …]
|
H A D | irqchip.c | 1 // SPDX-License-Identifier: GPL-2.0-only 8 * This file is derived from virt/kvm/irq_comm.c. 19 #include <trace/events/kvm.h> 21 int kvm_irq_map_gsi(struct kvm *kvm, in kvm_irq_map_gsi() argument 28 irq_rt = srcu_dereference_check(kvm->irq_routing, &kvm->irq_srcu, in kvm_irq_map_gsi() 29 lockdep_is_held(&kvm->irq_lock)); in kvm_irq_map_gsi() 30 if (irq_rt && gsi < irq_rt->nr_rt_entries) { in kvm_irq_map_gsi() 31 hlist_for_each_entry(e, &irq_rt->map[gsi], link) { in kvm_irq_map_gsi() 40 int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin) in kvm_irq_map_chip_pin() argument 44 irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu); in kvm_irq_map_chip_pin() [all …]
|
/openbmc/linux/arch/x86/kvm/mmu/ |
H A D | page_track.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * Support KVM gust page tracking 23 bool kvm_page_track_write_tracking_enabled(struct kvm *kvm) in kvm_page_track_write_tracking_enabled() argument 26 !tdp_enabled || kvm_shadow_root_allocated(kvm); in kvm_page_track_write_tracking_enabled() 31 kvfree(slot->arch.gfn_write_track); in kvm_page_track_free_memslot() 32 slot->arch.gfn_write_track = NULL; in kvm_page_track_free_memslot() 38 const size_t size = sizeof(*slot->arch.gfn_write_track); in __kvm_page_track_write_tracking_alloc() 40 if (!slot->arch.gfn_write_track) in __kvm_page_track_write_tracking_alloc() 41 slot->arch.gfn_write_track = __vcalloc(npages, size, in __kvm_page_track_write_tracking_alloc() 44 return slot->arch.gfn_write_track ? 0 : -ENOMEM; in __kvm_page_track_write_tracking_alloc() [all …]
|
H A D | tdp_mmu.h | 1 // SPDX-License-Identifier: GPL-2.0 10 void kvm_mmu_init_tdp_mmu(struct kvm *kvm); 11 void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm); 17 return refcount_inc_not_zero(&root->tdp_mmu_root_count); in kvm_tdp_mmu_get_root() 20 void kvm_tdp_mmu_put_root(struct kvm *kvm, struct kvm_mmu_page *root, 23 bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, gfn_t start, gfn_t end, bool flush); 24 bool kvm_tdp_mmu_zap_sp(struct kvm *kvm, struct kvm_mmu_page *sp); 25 void kvm_tdp_mmu_zap_all(struct kvm *kvm); 26 void kvm_tdp_mmu_invalidate_all_roots(struct kvm *kvm); 27 void kvm_tdp_mmu_zap_invalidated_roots(struct kvm *kvm); [all …]
|
H A D | page_track.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 10 bool kvm_page_track_write_tracking_enabled(struct kvm *kvm); 14 int kvm_page_track_create_memslot(struct kvm *kvm, 18 void __kvm_write_track_add_gfn(struct kvm *kvm, struct kvm_memory_slot *slot, 20 void __kvm_write_track_remove_gfn(struct kvm *kvm, 23 bool kvm_gfn_is_write_tracked(struct kvm *kvm, 27 int kvm_page_track_init(struct kvm *kvm); 28 void kvm_page_track_cleanup(struct kvm *kvm); 30 void __kvm_page_track_write(struct kvm *kvm, gpa_t gpa, const u8 *new, int bytes); 31 void kvm_page_track_delete_slot(struct kvm *kvm, struct kvm_memory_slot *slot); [all …]
|
H A D | tdp_mmu.c | 1 // SPDX-License-Identifier: GPL-2.0 12 #include <trace/events/kvm.h> 15 void kvm_mmu_init_tdp_mmu(struct kvm *kvm) in kvm_mmu_init_tdp_mmu() argument 17 INIT_LIST_HEAD(&kvm->arch.tdp_mmu_roots); in kvm_mmu_init_tdp_mmu() 18 spin_lock_init(&kvm->arch.tdp_mmu_pages_lock); in kvm_mmu_init_tdp_mmu() 22 static __always_inline bool kvm_lockdep_assert_mmu_lock_held(struct kvm *kvm, in kvm_lockdep_assert_mmu_lock_held() argument 26 lockdep_assert_held_read(&kvm->mmu_lock); in kvm_lockdep_assert_mmu_lock_held() 28 lockdep_assert_held_write(&kvm->mmu_lock); in kvm_lockdep_assert_mmu_lock_held() 33 void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm) in kvm_mmu_uninit_tdp_mmu() argument 40 kvm_tdp_mmu_invalidate_all_roots(kvm); in kvm_mmu_uninit_tdp_mmu() [all …]
|
/openbmc/linux/arch/arm64/kvm/vgic/ |
H A D | vgic.h | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 8 #include <linux/irqchip/arm-gic-common.h> 14 #define VGIC_ADDR_UNDEF (-1) 46 * As per Documentation/virt/kvm/devices/arm-vgic-v3.rst, 67 * As per Documentation/virt/kvm/devices/arm-vgic-its.rst, 104 return vcpu->kvm->arch.vgic.implementation_rev; in vgic_get_implementation_rev() 110 if (irq->config == VGIC_CONFIG_EDGE) in irq_is_pending() 111 return irq->pending_latch; in irq_is_pending() 113 return irq->pending_latch || irq->line_level; in irq_is_pending() 118 return irq->config == VGIC_CONFIG_LEVEL && irq->hw; in vgic_irq_is_mapped_level() [all …]
|
H A D | vgic-init.c | 1 // SPDX-License-Identifier: GPL-2.0-only 10 #include <kvm/arm_vgic.h> 26 * - kvm_vgic_early_init(): initialization of static data that doesn't 30 * - vgic_init(): allocation and initialization of the generic data 37 * - kvm_vgic_vcpu_init(): initialization of static data that 45 * kvm_vgic_early_init() - Initialize static VGIC VCPU data structures 46 * @kvm: The VM whose VGIC districutor should be initialized 52 void kvm_vgic_early_init(struct kvm *kvm) in kvm_vgic_early_init() argument 54 struct vgic_dist *dist = &kvm->arch.vgic; in kvm_vgic_early_init() 56 INIT_LIST_HEAD(&dist->lpi_list_head); in kvm_vgic_early_init() [all …]
|
H A D | vgic-kvm-device.c | 1 // SPDX-License-Identifier: GPL-2.0-only 3 * VGIC: KVM DEVICE API 9 #include <kvm/arm_vgic.h> 17 int vgic_check_iorange(struct kvm *kvm, phys_addr_t ioaddr, in vgic_check_iorange() argument 22 return -EEXIST; in vgic_check_iorange() 25 return -EINVAL; in vgic_check_iorange() 28 return -EINVAL; in vgic_check_iorange() 30 if (addr & ~kvm_phys_mask(kvm) || addr + size > kvm_phys_size(kvm)) in vgic_check_iorange() 31 return -E2BIG; in vgic_check_iorange() 36 static int vgic_check_type(struct kvm *kvm, int type_needed) in vgic_check_type() argument [all …]
|
/openbmc/linux/arch/powerpc/include/asm/ |
H A D | kvm_book3s_uvmem.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 9 int kvmppc_uvmem_slot_init(struct kvm *kvm, const struct kvm_memory_slot *slot); 10 void kvmppc_uvmem_slot_free(struct kvm *kvm, 12 unsigned long kvmppc_h_svm_page_in(struct kvm *kvm, 16 unsigned long kvmppc_h_svm_page_out(struct kvm *kvm, 20 unsigned long kvmppc_h_svm_init_start(struct kvm *kvm); 21 unsigned long kvmppc_h_svm_init_done(struct kvm *kvm); 22 int kvmppc_send_page_to_uv(struct kvm *kvm, unsigned long gfn); 23 unsigned long kvmppc_h_svm_init_abort(struct kvm *kvm); 25 struct kvm *kvm, bool skip_page_out); [all …]
|
/openbmc/linux/arch/powerpc/kvm/ |
H A D | Makefile | 1 # SPDX-License-Identifier: GPL-2.0 3 # Makefile for Kernel-based Virtual Machine module 6 ccflags-y := -Ivirt/kvm -Iarch/powerpc/kvm 8 include $(srctree)/virt/kvm/Makefile.kvm 10 common-objs-y += powerpc.o emulate_loadstore.o 11 obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o 12 obj-$(CONFIG_KVM_BOOK3S_HANDLER) += book3s_exports.o 14 AFLAGS_booke_interrupts.o := -I$(objtree)/$(obj) 16 kvm-e500-objs := \ 17 $(common-objs-y) \ [all …]
|
H A D | book3s_hv_uvmem.c | 1 // SPDX-License-Identifier: GPL-2.0 4 * memory of KVM guests. 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 [all …]
|
H A D | book3s_64_mmu_hv.c | 1 // SPDX-License-Identifier: GPL-2.0-only 9 #include <linux/kvm.h> 23 #include <asm/book3s/64/mmu-hash.h> 26 #include <asm/ppc-opcode.h> 28 #include <asm/pte-walk.h> 47 static long kvmppc_virtmode_do_h_enter(struct kvm *kvm, unsigned long flags, 52 /* These fields read-only after init */ 53 struct kvm *kvm; member 57 /* These fields protected by kvm->arch.mmu_setup_lock */ 61 * -EBUSY allocation is in the progress, [all …]
|
H A D | book3s_64_mmu_radix.c | 1 // SPDX-License-Identifier: GPL-2.0-only 9 #include <linux/kvm.h> 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() 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() 108 lpid = vcpu->arch.nested->shadow_lpid; in kvmhv_copy_tofrom_guest_radix() 126 memset(to + (n - ret), 0, ret); in kvmhv_copy_from_guest_radix() [all …]
|
/openbmc/linux/arch/s390/kvm/ |
H A D | pv.c | 1 // SPDX-License-Identifier: GPL-2.0 8 #include <linux/kvm.h> 19 #include "kvm-s390.h" 21 bool kvm_s390_pv_is_protected(struct kvm *kvm) in kvm_s390_pv_is_protected() argument 23 lockdep_assert_held(&kvm->lock); in kvm_s390_pv_is_protected() 24 return !!kvm_s390_pv_get_handle(kvm); in kvm_s390_pv_is_protected() 30 lockdep_assert_held(&vcpu->mutex); in kvm_s390_pv_cpu_is_protected() 36 * struct pv_vm_to_be_destroyed - Represents a protected VM that needs to 46 * but which does not correspond any longer to an active KVM VM. It should 58 static void kvm_s390_clear_pv_state(struct kvm *kvm) in kvm_s390_clear_pv_state() argument [all …]
|
H A D | kvm-s390.c | 1 // SPDX-License-Identifier: GPL-2.0 13 #define KMSG_COMPONENT "kvm-s390" 21 #include <linux/kvm.h> 36 #include <asm/asm-offsets.h> 49 #include "kvm-s390.h" 55 #include "trace-s390.h" 195 /* allow nested virtualization in KVM (if enabled by user space) */ 222 * the feature is opt-in anyway 237 * defines in FACILITIES_KVM and the non-hypervisor managed bits. 256 /* available cpu features supported by kvm */ [all …]
|
H A D | kvm-s390.h | 1 /* SPDX-License-Identifier: GPL-2.0 */ 3 * definition for kvm on s390 16 #include <linux/kvm.h> 24 #define IS_TE_ENABLED(vcpu) ((vcpu->arch.sie_block->ecb & ECB_TE)) 27 ((*(char *)phys_to_virt((vcpu)->arch.sie_block->itdba) == TDB_FORMAT1)) 34 debug_sprintf_event((d_kvm)->arch.dbf, d_loglevel, d_string "\n", \ 37 "%d: " d_string "\n", (d_kvm)->userspace_pid, \ 49 debug_sprintf_event(d_kvm->arch.dbf, d_loglevel, d_string "\n", \ 55 debug_sprintf_event(d_vcpu->kvm->arch.dbf, d_loglevel, \ 56 "%02d[%016lx-%016lx]: " d_string "\n", d_vcpu->vcpu_id, \ [all …]
|
/openbmc/linux/include/linux/ |
H A D | kvm_host.h | 1 /* SPDX-License-Identifier: GPL-2.0-only */ 40 #include <linux/kvm.h> 54 * used in kvm, other bits are visible for userspace which are defined in 60 * Bit 63 of the memslot generation number is an "update in-progress flag", 73 * This mechanism is used to prevent getting hits in KVM's caches while a 74 * memslot update is in-progress, and to prevent cache hits *after* updating 121 * translated to pfn - it is not in slot or failed to 151 #define KVM_ERR_PTR_BAD_PAGE (ERR_PTR(-ENOENT)) 163 * Architecture-independent vcpu->requests bit members 164 * Bits 3-7 are reserved for more arch-independent bits. [all …]
|
/openbmc/linux/arch/riscv/kvm/ |
H A D | Makefile | 1 # SPDX-License-Identifier: GPL-2.0 3 # Makefile for RISC-V KVM support 6 ccflags-y += -I $(srctree)/$(src) 8 include $(srctree)/virt/kvm/Makefile.kvm 10 obj-$(CONFIG_KVM) += kvm.o 12 kvm-y += main.o 13 kvm-y += vm.o 14 kvm-y += vmid.o 15 kvm-y += tlb.o 16 kvm-y += mmu.o [all …]
|
H A 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() 72 return -EINVAL; in gstage_page_size_to_level() 78 return -EINVAL; in gstage_level_to_page_order() 97 static bool gstage_get_leaf_entry(struct kvm *kvm, gpa_t addr, in gstage_get_leaf_entry() argument 101 u32 current_level = gstage_pgd_levels - 1; in gstage_get_leaf_entry() 104 ptep = (pte_t *)kvm->arch.pgd; in gstage_get_leaf_entry() 114 current_level--; in gstage_get_leaf_entry() [all …]
|
H A D | aia_device.c | 1 // SPDX-License-Identifier: GPL-2.0 15 static void unlock_vcpus(struct kvm *kvm, int vcpu_lock_idx) in unlock_vcpus() argument 19 for (; vcpu_lock_idx >= 0; vcpu_lock_idx--) { in unlock_vcpus() 20 tmp_vcpu = kvm_get_vcpu(kvm, vcpu_lock_idx); in unlock_vcpus() 21 mutex_unlock(&tmp_vcpu->mutex); in unlock_vcpus() 25 static void unlock_all_vcpus(struct kvm *kvm) in unlock_all_vcpus() argument 27 unlock_vcpus(kvm, atomic_read(&kvm->online_vcpus) - 1); in unlock_all_vcpus() 30 static bool lock_all_vcpus(struct kvm *kvm) in lock_all_vcpus() argument 35 kvm_for_each_vcpu(c, tmp_vcpu, kvm) { in lock_all_vcpus() 36 if (!mutex_trylock(&tmp_vcpu->mutex)) { in lock_all_vcpus() [all …]
|
H A D | vm.c | 1 // SPDX-License-Identifier: GPL-2.0 30 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) in kvm_arch_init_vm() argument 34 r = kvm_riscv_gstage_alloc_pgd(kvm); in kvm_arch_init_vm() 38 r = kvm_riscv_gstage_vmid_init(kvm); in kvm_arch_init_vm() 40 kvm_riscv_gstage_free_pgd(kvm); in kvm_arch_init_vm() 44 kvm_riscv_aia_init_vm(kvm); in kvm_arch_init_vm() 46 kvm_riscv_guest_timer_init(kvm); in kvm_arch_init_vm() 51 void kvm_arch_destroy_vm(struct kvm *kvm) in kvm_arch_destroy_vm() argument 53 kvm_destroy_vcpus(kvm); in kvm_arch_destroy_vm() 55 kvm_riscv_aia_destroy_vm(kvm); in kvm_arch_destroy_vm() [all …]
|
/openbmc/qemu/docs/system/i386/ |
H A D | kvm-pv.rst | 1 Paravirtualized KVM features 5 ----------- 7 In some cases when implementing hardware interfaces in software is slow, ``KVM`` 11 ----- 13 Paravirtualized ``KVM`` features are represented as CPU flags. The following 14 features are enabled by default for any CPU model when ``KVM`` acceleration is 17 - ``kvmclock`` 18 - ``kvm-nopiodelay`` 19 - ``kvm-asyncpf`` 20 - ``kvm-steal-time`` [all …]
|