Tag the pre-computed offsets into the MSR permission bitmaps as read-only after init, and similarly tag add_msr_offset() and init_msrpm_offsets() as __init. The bitmaps themselves are dynamically configured, but the offsets, i.e. the set of MSRs that can be passed through to the guest, is static for a given instance of KVM. Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> --- arch/x86/kvm/svm/svm.c | 6 +++--- arch/x86/kvm/svm/svm.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 527f18d8cc44..e96c808fa8d3 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -65,7 +65,7 @@ MODULE_DEVICE_TABLE(x86cpu, svm_cpu_id); static bool erratum_383_found __read_mostly; -u32 msrpm_offsets[MSRPM_OFFSETS] __read_mostly; +u32 msrpm_offsets[MSRPM_OFFSETS] __ro_after_init; /* * Set osvw_len to higher value when updated Revision Guides @@ -860,7 +860,7 @@ static void svm_msr_filter_changed(struct kvm_vcpu *vcpu) } } -static void add_msr_offset(u32 offset) +__init static void add_msr_offset(u32 offset) { int i; @@ -887,7 +887,7 @@ static void add_msr_offset(u32 offset) BUG(); } -static void init_msrpm_offsets(void) +__init static void init_msrpm_offsets(void) { int i; diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h index 199a2ecef1ce..ca348e016729 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -31,7 +31,7 @@ #define MAX_DIRECT_ACCESS_MSRS 46 #define MSRPM_OFFSETS 32 -extern u32 msrpm_offsets[MSRPM_OFFSETS] __read_mostly; +extern u32 msrpm_offsets[MSRPM_OFFSETS] __ro_after_init; extern bool npt_enabled; extern int vgif; extern bool intercept_smi; -- 2.38.1.431.g37b22c650d-goog