Commit 58ca1930 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: VMX: Make VMCS configuration/capabilities structs read-only after init

Tag vmcs_config and vmx_capability structs as __init, the canonical
configuration is generated during hardware_setup() and must never be
modified after that point.
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Message-Id: <20221130230934.1014142-31-seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent a578a0a9
...@@ -66,13 +66,13 @@ struct vmcs_config { ...@@ -66,13 +66,13 @@ struct vmcs_config {
u64 misc; u64 misc;
struct nested_vmx_msrs nested; struct nested_vmx_msrs nested;
}; };
extern struct vmcs_config vmcs_config; extern struct vmcs_config vmcs_config __ro_after_init;
struct vmx_capability { struct vmx_capability {
u32 ept; u32 ept;
u32 vpid; u32 vpid;
}; };
extern struct vmx_capability vmx_capability; extern struct vmx_capability vmx_capability __ro_after_init;
static inline bool cpu_has_vmx_basic_inout(void) static inline bool cpu_has_vmx_basic_inout(void)
{ {
......
...@@ -488,8 +488,8 @@ static DEFINE_PER_CPU(struct list_head, loaded_vmcss_on_cpu); ...@@ -488,8 +488,8 @@ static DEFINE_PER_CPU(struct list_head, loaded_vmcss_on_cpu);
static DECLARE_BITMAP(vmx_vpid_bitmap, VMX_NR_VPIDS); static DECLARE_BITMAP(vmx_vpid_bitmap, VMX_NR_VPIDS);
static DEFINE_SPINLOCK(vmx_vpid_lock); static DEFINE_SPINLOCK(vmx_vpid_lock);
struct vmcs_config vmcs_config; struct vmcs_config vmcs_config __ro_after_init;
struct vmx_capability vmx_capability; struct vmx_capability vmx_capability __ro_after_init;
#define VMX_SEGMENT_FIELD(seg) \ #define VMX_SEGMENT_FIELD(seg) \
[VCPU_SREG_##seg] = { \ [VCPU_SREG_##seg] = { \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment