Lines Matching +full:shadow +full:- +full:interrupts

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Kernel-based Virtual Machine driver for Linux
33 #include <asm/pvclock-abi.h>
37 #include <asm/msr-index.h>
86 /* x86-specific vcpu->requests bit members */
156 #define KVM_NR_PAGE_SIZES (KVM_MAX_HUGEPAGE_LEVEL - PG_LEVEL_4K + 1)
157 #define KVM_HPAGE_GFN_SHIFT(x) (((x) - 1) * 9)
160 #define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
239 * DR6_ACTIVE_LOW combines fixed-1 and active-low bits.
280 * IMPLICIT_ACCESS is a KVM-defined flag used to correctly perform SMAP checks
285 * PRIVATE_ACCESS is a KVM-defined flag us to indicate that a fault occurred
294 * The following bit is set with PV-EOI, unset on EOI.
295 * We detect PV-EOI changes by guest by comparing
296 * this bit with PV-EOI in guest memory.
305 * kvm_mmu_page_role tracks the properties of a shadow page (where shadow page
311 * Upper-level shadow pages having gptes are tracked for write-protection via
313 * not create more than 2^16-1 upper-level shadow pages at a single gfn,
316 * A unique shadow page (SP) for a gfn is created if and only if an existing SP
325 * - invalid shadow pages are not accounted, mirror pages are not shadowed,
328 * - quadrant will only be used if has_4_byte_gpte=1 (non-PAE paging);
332 * - the 4 bits of level are effectively limited to the values 2/3/4/5,
333 * as 4k SPs are not tracked (allowed to go unsync). In addition non-PAE
337 * - on top of this, smep_andnot_wp and smap_andnot_wp are only set if
340 * Therefore, the maximum number of possible upper-level shadow pages for a
376 * MMU re-configuration can be skipped. @valid bit is set on first usage so we
377 * don't treat all-zero structure as valid data.
380 * are for things that either (a) do not affect the validity of the shadow page
381 * or (b) are indirectly reflected in the shadow page's role. For example,
383 * tables (because KVM doesn't support Protection Keys with shadow paging), and
387 * If CR0.WP=1, KVM can reuse shadow pages for the guest regardless of SMEP and
443 #define KVM_MMU_ROOTS_ALL (BIT(1 + KVM_MMU_NUM_PREV_ROOTS) - 1)
451 * x86 supports 4 paging modes (5-level 64-bit, 4-level 64-bit, 3-level 32-bit,
452 * and 2-level 32-bit). The kvm_mmu structure abstracts the details of the
493 * check zero bits on shadow page table entries, these
572 * Overlay the bitmap with a 64-bit atomic so that all bits can be
593 * If a guest counter is cross-mapped to host counter with different
597 * after disabling interrupts and before perf_guest_get_msrs();
620 * Guest debug registers (DR0-3, DR6 and DR7) are saved/restored by
622 * DR0-3, DR6 and DR7 are set to their architectural INIT value on VM
636 /* Hyper-V SynIC timer */
647 /* Hyper-V synthetic interrupt controller (SynIC)*/
671 #define KVM_HV_TLB_FLUSHALL_ENTRY ((u64)-1)
684 /* Hyper-V per vcpu emulation context */
766 * Hardware-defined CPUID leafs that are either scattered by the kernel or are
781 NKVMCAPINTS = NR_KVM_CPU_CAPS - NCAPINTS,
832 /* Non-nested MMU for L1 */
893 /* Exception VM-Exits to be synthesized to L1. */
1055 /* be preempted when it's in kernel-mode(cpl=0) */
1061 /* Host CPU on which VM-entry was most recently attempted */
1103 struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1];
1110 * software-enabled local APIs to be in the same mode, each addressable APIC to
1140 /* Hyper-V synthetic debugger (SynDbg)*/
1152 /* Current state of Hyper-V TSC page clocksource */
1167 /* Hyper-V emulation context */
1175 /* Hyper-v based guest crash (NT kernel bugcheck) parameters */
1275 * (out of band, debug measure of blocking all interrupts on this vCPU)
1302 * cannot use the doorbell mechanism to signal interrupts via AVIC when
1315 * PIT (i8254) 're-inject' mode, relies on EOI intercept,
1316 * which AVIC doesn't support for edge triggered interrupts.
1361 * replaced by an NX huge page. A shadow page is on this list if its
1365 * memslot, etc... Note, zapping shadow pages on this list doesn't
1438 * preemption-disabled region, so it must be a raw spinlock.
1496 * If exit_on_emulation_error is set, and the in-kernel instruction
1548 * - tdp_mmu_roots (above)
1549 * - the link field of kvm_mmu_page structs used by the TDP MMU
1550 * - possible_nx_huge_pages[KVM_TDP_MMU];
1551 * - the possible_nx_huge_page_link field of kvm_mmu_page structs used
1562 * If set, at least one shadow root has been allocated. This flag
1583 * VM-scope maximum vCPU ID. Used to determine the size of structures
1592 * Memory caches used to allocate shadow pages when performing eager
1594 * splitting only allocates direct shadow pages.
1596 * Protected by kvm->slots_lock.
1608 * Protected by kvm->slots_lock.
1786 * Does not need to flush GPA->HPA mappings.
1787 * Can potentially get non-canonical addresses through INVLPGs, which
1794 * does not need to flush GPA->HPA mappings.
1998 DECLARE_STATIC_CALL(kvm_x86_##func, *(((struct kvm_x86_ops *)0)->func));
2001 #include <asm/kvm-x86-ops.h>
2023 return -ENOTSUPP; in kvm_arch_flush_remote_tlbs()
2031 return -EOPNOTSUPP; in kvm_arch_flush_remote_tlbs_range()
2038 /* Values are arbitrary, but must be non-zero. */
2045 ((vcpu) && (vcpu)->arch.handling_intr_from_guest && \
2046 (!!in_nmi() == ((vcpu)->arch.handling_intr_from_guest == KVM_HANDLING_NMI)))
2090 * EMULTYPE_NO_DECODE - Set when re-emulating an instruction (after completing
2095 * EMULTYPE_TRAP_UD - Set when emulating an intercepted #UD from hardware.
2100 * EMULTYPE_SKIP - Set when emulating solely to skip an instruction, i.e. to
2105 * EMULTYPE_ALLOW_RETRY_PF - Set when the emulator should resume the guest to
2109 * EMULTYPE_TRAP_UD_FORCED - Set when emulating an intercepted #UD that was
2116 * EMULTYPE_VMWARE_GP - Set when emulating an intercepted #GP for VMware
2121 * EMULTYPE_PF - Set when an intercepted #PF triggers the emulation, in which case
2124 * EMULTYPE_COMPLETE_USER_EXIT - Set when the emulator should update interruptibility
2125 * state and inject single-step #DBs after skipping
2128 * EMULTYPE_WRITE_PF_TO_SP - Set when emulating an intercepted page fault that
2138 * KVM unprotects (zaps) the shadow page for the target
2139 * gfn and resumes the guest to retry the non-emulatable
2141 * doesn't allow forward progress for a self-changing
2144 * !PRESENT fault, which results in a new shadow page
2305 #define kvm_arch_has_private_mem(kvm) ((kvm)->arch.has_private_mem)
2308 #define kvm_arch_has_readonly_mem(kvm) (!(kvm)->arch.has_protected_state)
2351 #define HF_GUEST_MASK (1 << 0) /* VCPU is in guest-mode */
2360 # define kvm_arch_vcpu_memslots_id(vcpu) ((vcpu)->arch.hflags & HF_SMM_MASK ? 1 : 0)
2422 return (irq->delivery_mode == APIC_DM_FIXED || in kvm_irq_is_postable()
2423 irq->delivery_mode == APIC_DM_LOWEST); in kvm_irq_is_postable()