mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
KVM: x86: Move misc "VALID MASK" defines from kvm_host.h => x86.c
Move a variety of "VALID MASK" defines, e.g. that capture which flags in a given ioctl are supported by KVM, from kvm_host.h to x86.c. The set of valid flags/bits is very much a KVM-internal detail, as the values from the hardcoded #defines are often captured and massaged by KVM's setup code, i.e. *directly* using the macros outside of KVM x86 would be actively dangerous. No functional change intended. Reviewed-by: Yosry Ahmed <yosry@kernel.org> Reviewed-by: Kai Huang <kai.huang@intel.com> Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Binbin Wu <binbin.wu@linux.intel.com> Message-ID: <20260613000329.732085-23-seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
781ee15bd9
commit
462474588b
|
|
@ -78,12 +78,6 @@
|
||||||
#define KVM_DIRTY_LOG_MANUAL_CAPS (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | \
|
#define KVM_DIRTY_LOG_MANUAL_CAPS (KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE | \
|
||||||
KVM_DIRTY_LOG_INITIALLY_SET)
|
KVM_DIRTY_LOG_INITIALLY_SET)
|
||||||
|
|
||||||
#define KVM_BUS_LOCK_DETECTION_VALID_MODE (KVM_BUS_LOCK_DETECTION_OFF | \
|
|
||||||
KVM_BUS_LOCK_DETECTION_EXIT)
|
|
||||||
|
|
||||||
#define KVM_X86_NOTIFY_VMEXIT_VALID_BITS (KVM_X86_NOTIFY_VMEXIT_ENABLED | \
|
|
||||||
KVM_X86_NOTIFY_VMEXIT_USER)
|
|
||||||
|
|
||||||
/* x86-specific vcpu->requests bit members */
|
/* x86-specific vcpu->requests bit members */
|
||||||
#define KVM_REQ_MIGRATE_TIMER KVM_ARCH_REQ(0)
|
#define KVM_REQ_MIGRATE_TIMER KVM_ARCH_REQ(0)
|
||||||
#define KVM_REQ_REPORT_TPR_ACCESS KVM_ARCH_REQ(1)
|
#define KVM_REQ_REPORT_TPR_ACCESS KVM_ARCH_REQ(1)
|
||||||
|
|
@ -2406,34 +2400,6 @@ static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu)
|
||||||
|
|
||||||
int memslot_rmap_alloc(struct kvm_memory_slot *slot, unsigned long npages);
|
int memslot_rmap_alloc(struct kvm_memory_slot *slot, unsigned long npages);
|
||||||
|
|
||||||
#define KVM_CLOCK_VALID_FLAGS \
|
|
||||||
(KVM_CLOCK_TSC_STABLE | KVM_CLOCK_REALTIME | KVM_CLOCK_HOST_TSC)
|
|
||||||
|
|
||||||
#define KVM_X86_VALID_QUIRKS \
|
|
||||||
(KVM_X86_QUIRK_LINT0_REENABLED | \
|
|
||||||
KVM_X86_QUIRK_CD_NW_CLEARED | \
|
|
||||||
KVM_X86_QUIRK_LAPIC_MMIO_HOLE | \
|
|
||||||
KVM_X86_QUIRK_OUT_7E_INC_RIP | \
|
|
||||||
KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT | \
|
|
||||||
KVM_X86_QUIRK_FIX_HYPERCALL_INSN | \
|
|
||||||
KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS | \
|
|
||||||
KVM_X86_QUIRK_SLOT_ZAP_ALL | \
|
|
||||||
KVM_X86_QUIRK_STUFF_FEATURE_MSRS | \
|
|
||||||
KVM_X86_QUIRK_IGNORE_GUEST_PAT | \
|
|
||||||
KVM_X86_QUIRK_VMCS12_ALLOW_FREEZE_IN_SMM | \
|
|
||||||
KVM_X86_QUIRK_NESTED_SVM_SHARED_PAT)
|
|
||||||
|
|
||||||
#define KVM_X86_CONDITIONAL_QUIRKS \
|
|
||||||
(KVM_X86_QUIRK_CD_NW_CLEARED | \
|
|
||||||
KVM_X86_QUIRK_IGNORE_GUEST_PAT)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* KVM previously used a u32 field in kvm_run to indicate the hypercall was
|
|
||||||
* initiated from long mode. KVM now sets bit 0 to indicate long mode, but the
|
|
||||||
* remaining 31 lower bits must be 0 to preserve ABI.
|
|
||||||
*/
|
|
||||||
#define KVM_EXIT_HYPERCALL_MBZ GENMASK_ULL(31, 1)
|
|
||||||
|
|
||||||
static inline bool kvm_arch_has_irq_bypass(void)
|
static inline bool kvm_arch_has_irq_bypass(void)
|
||||||
{
|
{
|
||||||
return enable_device_posted_irqs;
|
return enable_device_posted_irqs;
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,12 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_host);
|
||||||
#define emul_to_vcpu(ctxt) \
|
#define emul_to_vcpu(ctxt) \
|
||||||
((struct kvm_vcpu *)(ctxt)->vcpu)
|
((struct kvm_vcpu *)(ctxt)->vcpu)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* KVM previously used a u32 field in kvm_run to indicate the hypercall was
|
||||||
|
* initiated from long mode. KVM now sets bit 0 to indicate long mode, but the
|
||||||
|
* remaining 31 lower bits must be 0 to preserve ABI.
|
||||||
|
*/
|
||||||
|
#define KVM_EXIT_HYPERCALL_MBZ GENMASK_ULL(31, 1)
|
||||||
#define KVM_EXIT_HYPERCALL_VALID_MASK (1 << KVM_HC_MAP_GPA_RANGE)
|
#define KVM_EXIT_HYPERCALL_VALID_MASK (1 << KVM_HC_MAP_GPA_RANGE)
|
||||||
|
|
||||||
#define KVM_CAP_PMU_VALID_MASK KVM_PMU_CAP_DISABLE
|
#define KVM_CAP_PMU_VALID_MASK KVM_PMU_CAP_DISABLE
|
||||||
|
|
@ -114,6 +120,33 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_host);
|
||||||
KVM_X2APIC_ENABLE_SUPPRESS_EOI_BROADCAST | \
|
KVM_X2APIC_ENABLE_SUPPRESS_EOI_BROADCAST | \
|
||||||
KVM_X2APIC_DISABLE_SUPPRESS_EOI_BROADCAST)
|
KVM_X2APIC_DISABLE_SUPPRESS_EOI_BROADCAST)
|
||||||
|
|
||||||
|
#define KVM_CLOCK_VALID_FLAGS \
|
||||||
|
(KVM_CLOCK_TSC_STABLE | KVM_CLOCK_REALTIME | KVM_CLOCK_HOST_TSC)
|
||||||
|
|
||||||
|
#define KVM_X86_VALID_QUIRKS \
|
||||||
|
(KVM_X86_QUIRK_LINT0_REENABLED | \
|
||||||
|
KVM_X86_QUIRK_CD_NW_CLEARED | \
|
||||||
|
KVM_X86_QUIRK_LAPIC_MMIO_HOLE | \
|
||||||
|
KVM_X86_QUIRK_OUT_7E_INC_RIP | \
|
||||||
|
KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT | \
|
||||||
|
KVM_X86_QUIRK_FIX_HYPERCALL_INSN | \
|
||||||
|
KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS | \
|
||||||
|
KVM_X86_QUIRK_SLOT_ZAP_ALL | \
|
||||||
|
KVM_X86_QUIRK_STUFF_FEATURE_MSRS | \
|
||||||
|
KVM_X86_QUIRK_IGNORE_GUEST_PAT | \
|
||||||
|
KVM_X86_QUIRK_VMCS12_ALLOW_FREEZE_IN_SMM | \
|
||||||
|
KVM_X86_QUIRK_NESTED_SVM_SHARED_PAT)
|
||||||
|
|
||||||
|
#define KVM_X86_CONDITIONAL_QUIRKS \
|
||||||
|
(KVM_X86_QUIRK_CD_NW_CLEARED | \
|
||||||
|
KVM_X86_QUIRK_IGNORE_GUEST_PAT)
|
||||||
|
|
||||||
|
#define KVM_BUS_LOCK_DETECTION_VALID_MODE (KVM_BUS_LOCK_DETECTION_OFF | \
|
||||||
|
KVM_BUS_LOCK_DETECTION_EXIT)
|
||||||
|
|
||||||
|
#define KVM_X86_NOTIFY_VMEXIT_VALID_BITS (KVM_X86_NOTIFY_VMEXIT_ENABLED | \
|
||||||
|
KVM_X86_NOTIFY_VMEXIT_USER)
|
||||||
|
|
||||||
static void process_nmi(struct kvm_vcpu *vcpu);
|
static void process_nmi(struct kvm_vcpu *vcpu);
|
||||||
static void store_regs(struct kvm_vcpu *vcpu);
|
static void store_regs(struct kvm_vcpu *vcpu);
|
||||||
static int sync_regs(struct kvm_vcpu *vcpu);
|
static int sync_regs(struct kvm_vcpu *vcpu);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user