mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
KVM: x86: Move "struct kvm_vcpu_hv" and all children from kvm_host.h => hyperv.h
Move "struct kvm_vcpu_hv" and all of its child structures to hyperv.h, guarded by CONFIG_KVM_HYPERV=y, as "struct kvm_vcpu_arch" holds a pointer to the structure, i.e. only needs the structure to be declared, not fully defined. No functional change intended. Reviewed-by: Kai Huang <kai.huang@intel.com> Link: https://patch.msgid.link/20260625220450.3354415-10-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
c3d35340a3
commit
ed6ee602bc
|
|
@ -648,95 +648,6 @@ struct kvm_mtrr {
|
|||
u64 deftype;
|
||||
};
|
||||
|
||||
/* Hyper-V SynIC timer */
|
||||
struct kvm_vcpu_hv_stimer {
|
||||
struct hrtimer timer;
|
||||
int index;
|
||||
union hv_stimer_config config;
|
||||
u64 count;
|
||||
u64 exp_time;
|
||||
struct hv_message msg;
|
||||
bool msg_pending;
|
||||
};
|
||||
|
||||
/* Hyper-V synthetic interrupt controller (SynIC)*/
|
||||
struct kvm_vcpu_hv_synic {
|
||||
u64 version;
|
||||
u64 control;
|
||||
u64 msg_page;
|
||||
u64 evt_page;
|
||||
atomic64_t sint[HV_SYNIC_SINT_COUNT];
|
||||
atomic_t sint_to_gsi[HV_SYNIC_SINT_COUNT];
|
||||
DECLARE_BITMAP(auto_eoi_bitmap, 256);
|
||||
DECLARE_BITMAP(vec_bitmap, 256);
|
||||
bool active;
|
||||
bool dont_zero_synic_pages;
|
||||
};
|
||||
|
||||
/* The maximum number of entries on the TLB flush fifo. */
|
||||
#define KVM_HV_TLB_FLUSH_FIFO_SIZE (16)
|
||||
/*
|
||||
* Note: the following 'magic' entry is made up by KVM to avoid putting
|
||||
* anything besides GVA on the TLB flush fifo. It is theoretically possible
|
||||
* to observe a request to flush 4095 PFNs starting from 0xfffffffffffff000
|
||||
* which will look identical. KVM's action to 'flush everything' instead of
|
||||
* flushing these particular addresses is, however, fully legitimate as
|
||||
* flushing more than requested is always OK.
|
||||
*/
|
||||
#define KVM_HV_TLB_FLUSHALL_ENTRY ((u64)-1)
|
||||
|
||||
enum hv_tlb_flush_fifos {
|
||||
HV_L1_TLB_FLUSH_FIFO,
|
||||
HV_L2_TLB_FLUSH_FIFO,
|
||||
HV_NR_TLB_FLUSH_FIFOS,
|
||||
};
|
||||
|
||||
struct kvm_vcpu_hv_tlb_flush_fifo {
|
||||
spinlock_t write_lock;
|
||||
DECLARE_KFIFO(entries, u64, KVM_HV_TLB_FLUSH_FIFO_SIZE);
|
||||
};
|
||||
|
||||
/* Hyper-V per vcpu emulation context */
|
||||
struct kvm_vcpu_hv {
|
||||
struct kvm_vcpu *vcpu;
|
||||
u32 vp_index;
|
||||
u64 hv_vapic;
|
||||
s64 runtime_offset;
|
||||
struct kvm_vcpu_hv_synic synic;
|
||||
struct kvm_hyperv_exit exit;
|
||||
struct kvm_vcpu_hv_stimer stimer[HV_SYNIC_STIMER_COUNT];
|
||||
DECLARE_BITMAP(stimer_pending_bitmap, HV_SYNIC_STIMER_COUNT);
|
||||
bool enforce_cpuid;
|
||||
struct {
|
||||
u32 features_eax; /* HYPERV_CPUID_FEATURES.EAX */
|
||||
u32 features_ebx; /* HYPERV_CPUID_FEATURES.EBX */
|
||||
u32 features_edx; /* HYPERV_CPUID_FEATURES.EDX */
|
||||
u32 enlightenments_eax; /* HYPERV_CPUID_ENLIGHTMENT_INFO.EAX */
|
||||
u32 enlightenments_ebx; /* HYPERV_CPUID_ENLIGHTMENT_INFO.EBX */
|
||||
u32 syndbg_cap_eax; /* HYPERV_CPUID_SYNDBG_PLATFORM_CAPABILITIES.EAX */
|
||||
u32 nested_eax; /* HYPERV_CPUID_NESTED_FEATURES.EAX */
|
||||
u32 nested_ebx; /* HYPERV_CPUID_NESTED_FEATURES.EBX */
|
||||
} cpuid_cache;
|
||||
|
||||
struct kvm_vcpu_hv_tlb_flush_fifo tlb_flush_fifo[HV_NR_TLB_FLUSH_FIFOS];
|
||||
|
||||
/*
|
||||
* Preallocated buffers for handling hypercalls that pass sparse vCPU
|
||||
* sets (for high vCPU counts, they're too large to comfortably fit on
|
||||
* the stack).
|
||||
*/
|
||||
u64 sparse_banks[HV_MAX_SPARSE_VCPU_BANKS];
|
||||
DECLARE_BITMAP(vcpu_mask, KVM_MAX_VCPUS);
|
||||
|
||||
struct hv_vp_assist_page vp_assist_page;
|
||||
|
||||
struct {
|
||||
u64 pa_page_gpa;
|
||||
u64 vm_id;
|
||||
u32 vp_id;
|
||||
} nested;
|
||||
};
|
||||
|
||||
struct kvm_hypervisor_cpuid {
|
||||
u32 base;
|
||||
u32 limit;
|
||||
|
|
@ -767,6 +678,8 @@ struct kvm_vcpu_xen {
|
|||
};
|
||||
#endif
|
||||
|
||||
struct kvm_vcpu_hv;
|
||||
|
||||
struct kvm_queued_exception {
|
||||
bool pending;
|
||||
bool injected;
|
||||
|
|
|
|||
|
|
@ -27,6 +27,96 @@
|
|||
|
||||
#ifdef CONFIG_KVM_HYPERV
|
||||
|
||||
|
||||
/* Hyper-V SynIC timer */
|
||||
struct kvm_vcpu_hv_stimer {
|
||||
struct hrtimer timer;
|
||||
int index;
|
||||
union hv_stimer_config config;
|
||||
u64 count;
|
||||
u64 exp_time;
|
||||
struct hv_message msg;
|
||||
bool msg_pending;
|
||||
};
|
||||
|
||||
/* Hyper-V synthetic interrupt controller (SynIC)*/
|
||||
struct kvm_vcpu_hv_synic {
|
||||
u64 version;
|
||||
u64 control;
|
||||
u64 msg_page;
|
||||
u64 evt_page;
|
||||
atomic64_t sint[HV_SYNIC_SINT_COUNT];
|
||||
atomic_t sint_to_gsi[HV_SYNIC_SINT_COUNT];
|
||||
DECLARE_BITMAP(auto_eoi_bitmap, 256);
|
||||
DECLARE_BITMAP(vec_bitmap, 256);
|
||||
bool active;
|
||||
bool dont_zero_synic_pages;
|
||||
};
|
||||
|
||||
/* The maximum number of entries on the TLB flush fifo. */
|
||||
#define KVM_HV_TLB_FLUSH_FIFO_SIZE (16)
|
||||
/*
|
||||
* Note: the following 'magic' entry is made up by KVM to avoid putting
|
||||
* anything besides GVA on the TLB flush fifo. It is theoretically possible
|
||||
* to observe a request to flush 4095 PFNs starting from 0xfffffffffffff000
|
||||
* which will look identical. KVM's action to 'flush everything' instead of
|
||||
* flushing these particular addresses is, however, fully legitimate as
|
||||
* flushing more than requested is always OK.
|
||||
*/
|
||||
#define KVM_HV_TLB_FLUSHALL_ENTRY ((u64)-1)
|
||||
|
||||
enum hv_tlb_flush_fifos {
|
||||
HV_L1_TLB_FLUSH_FIFO,
|
||||
HV_L2_TLB_FLUSH_FIFO,
|
||||
HV_NR_TLB_FLUSH_FIFOS,
|
||||
};
|
||||
|
||||
struct kvm_vcpu_hv_tlb_flush_fifo {
|
||||
spinlock_t write_lock;
|
||||
DECLARE_KFIFO(entries, u64, KVM_HV_TLB_FLUSH_FIFO_SIZE);
|
||||
};
|
||||
|
||||
/* Hyper-V per vcpu emulation context */
|
||||
struct kvm_vcpu_hv {
|
||||
struct kvm_vcpu *vcpu;
|
||||
u32 vp_index;
|
||||
u64 hv_vapic;
|
||||
s64 runtime_offset;
|
||||
struct kvm_vcpu_hv_synic synic;
|
||||
struct kvm_hyperv_exit exit;
|
||||
struct kvm_vcpu_hv_stimer stimer[HV_SYNIC_STIMER_COUNT];
|
||||
DECLARE_BITMAP(stimer_pending_bitmap, HV_SYNIC_STIMER_COUNT);
|
||||
bool enforce_cpuid;
|
||||
struct {
|
||||
u32 features_eax; /* HYPERV_CPUID_FEATURES.EAX */
|
||||
u32 features_ebx; /* HYPERV_CPUID_FEATURES.EBX */
|
||||
u32 features_edx; /* HYPERV_CPUID_FEATURES.EDX */
|
||||
u32 enlightenments_eax; /* HYPERV_CPUID_ENLIGHTMENT_INFO.EAX */
|
||||
u32 enlightenments_ebx; /* HYPERV_CPUID_ENLIGHTMENT_INFO.EBX */
|
||||
u32 syndbg_cap_eax; /* HYPERV_CPUID_SYNDBG_PLATFORM_CAPABILITIES.EAX */
|
||||
u32 nested_eax; /* HYPERV_CPUID_NESTED_FEATURES.EAX */
|
||||
u32 nested_ebx; /* HYPERV_CPUID_NESTED_FEATURES.EBX */
|
||||
} cpuid_cache;
|
||||
|
||||
struct kvm_vcpu_hv_tlb_flush_fifo tlb_flush_fifo[HV_NR_TLB_FLUSH_FIFOS];
|
||||
|
||||
/*
|
||||
* Preallocated buffers for handling hypercalls that pass sparse vCPU
|
||||
* sets (for high vCPU counts, they're too large to comfortably fit on
|
||||
* the stack).
|
||||
*/
|
||||
u64 sparse_banks[HV_MAX_SPARSE_VCPU_BANKS];
|
||||
DECLARE_BITMAP(vcpu_mask, KVM_MAX_VCPUS);
|
||||
|
||||
struct hv_vp_assist_page vp_assist_page;
|
||||
|
||||
struct {
|
||||
u64 pa_page_gpa;
|
||||
u64 vm_id;
|
||||
u32 vp_id;
|
||||
} nested;
|
||||
};
|
||||
|
||||
/* "Hv#1" signature */
|
||||
#define HYPERV_CPUID_SIGNATURE_EAX 0x31237648
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user