[2/3] KVM: SVM: Make MSR permission bitmap offsets read-only after init
Commit Message
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@google.com>
---
arch/x86/kvm/svm/svm.c | 6 +++---
arch/x86/kvm/svm/svm.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
@@ -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;
@@ -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;