Commit 45b66dc1 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: RISC-V: Tag init functions and data with __init, __ro_after_init

Now that KVM setup is handled directly in riscv_kvm_init(), tag functions
and data that are used/set only during init with __init/__ro_after_init.
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Acked-by: default avatarAnup Patel <anup@brainfault.org>
Message-Id: <20221130230934.1014142-26-seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 20deee32
...@@ -296,11 +296,11 @@ int kvm_riscv_gstage_map(struct kvm_vcpu *vcpu, ...@@ -296,11 +296,11 @@ int kvm_riscv_gstage_map(struct kvm_vcpu *vcpu,
int kvm_riscv_gstage_alloc_pgd(struct kvm *kvm); int kvm_riscv_gstage_alloc_pgd(struct kvm *kvm);
void kvm_riscv_gstage_free_pgd(struct kvm *kvm); void kvm_riscv_gstage_free_pgd(struct kvm *kvm);
void kvm_riscv_gstage_update_hgatp(struct kvm_vcpu *vcpu); void kvm_riscv_gstage_update_hgatp(struct kvm_vcpu *vcpu);
void kvm_riscv_gstage_mode_detect(void); void __init kvm_riscv_gstage_mode_detect(void);
unsigned long kvm_riscv_gstage_mode(void); unsigned long __init kvm_riscv_gstage_mode(void);
int kvm_riscv_gstage_gpa_bits(void); int kvm_riscv_gstage_gpa_bits(void);
void kvm_riscv_gstage_vmid_detect(void); void __init kvm_riscv_gstage_vmid_detect(void);
unsigned long kvm_riscv_gstage_vmid_bits(void); unsigned long kvm_riscv_gstage_vmid_bits(void);
int kvm_riscv_gstage_vmid_init(struct kvm *kvm); int kvm_riscv_gstage_vmid_init(struct kvm *kvm);
bool kvm_riscv_gstage_vmid_ver_changed(struct kvm_vmid *vmid); bool kvm_riscv_gstage_vmid_ver_changed(struct kvm_vmid *vmid);
......
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
static unsigned long gstage_mode = (HGATP_MODE_SV39X4 << HGATP_MODE_SHIFT); static unsigned long gstage_mode __ro_after_init = (HGATP_MODE_SV39X4 << HGATP_MODE_SHIFT);
static unsigned long gstage_pgd_levels = 3; static unsigned long gstage_pgd_levels __ro_after_init = 3;
#define gstage_index_bits 9 #define gstage_index_bits 9
#else #else
static unsigned long gstage_mode = (HGATP_MODE_SV32X4 << HGATP_MODE_SHIFT); static unsigned long gstage_mode __ro_after_init = (HGATP_MODE_SV32X4 << HGATP_MODE_SHIFT);
static unsigned long gstage_pgd_levels = 2; static unsigned long gstage_pgd_levels __ro_after_init = 2;
#define gstage_index_bits 10 #define gstage_index_bits 10
#endif #endif
...@@ -758,7 +758,7 @@ void kvm_riscv_gstage_update_hgatp(struct kvm_vcpu *vcpu) ...@@ -758,7 +758,7 @@ void kvm_riscv_gstage_update_hgatp(struct kvm_vcpu *vcpu)
kvm_riscv_local_hfence_gvma_all(); kvm_riscv_local_hfence_gvma_all();
} }
void kvm_riscv_gstage_mode_detect(void) void __init kvm_riscv_gstage_mode_detect(void)
{ {
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
/* Try Sv57x4 G-stage mode */ /* Try Sv57x4 G-stage mode */
...@@ -782,7 +782,7 @@ void kvm_riscv_gstage_mode_detect(void) ...@@ -782,7 +782,7 @@ void kvm_riscv_gstage_mode_detect(void)
#endif #endif
} }
unsigned long kvm_riscv_gstage_mode(void) unsigned long __init kvm_riscv_gstage_mode(void)
{ {
return gstage_mode >> HGATP_MODE_SHIFT; return gstage_mode >> HGATP_MODE_SHIFT;
} }
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
static unsigned long vmid_version = 1; static unsigned long vmid_version = 1;
static unsigned long vmid_next; static unsigned long vmid_next;
static unsigned long vmid_bits; static unsigned long vmid_bits __ro_after_init;
static DEFINE_SPINLOCK(vmid_lock); static DEFINE_SPINLOCK(vmid_lock);
void kvm_riscv_gstage_vmid_detect(void) void __init kvm_riscv_gstage_vmid_detect(void)
{ {
unsigned long old; unsigned long old;
......
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