diff options
author | Maciej S. Szmigiero <maciej.szmigiero@oracle.com> | 2021-12-06 22:54:29 +0300 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-12-08 12:24:33 +0300 |
commit | 6a656832aa75784d02dccd8d37fc5c0896064c2e (patch) | |
tree | 4cfebc37006378bb99f4622058b51ae2aa1df3ab /arch/s390/kvm/kvm-s390.h | |
parent | ed922739c9199bf515a3e7fec3e319ce1edeef2a (diff) | |
download | linux-6a656832aa75784d02dccd8d37fc5c0896064c2e.tar.xz |
KVM: s390: Introduce kvm_s390_get_gfn_end()
And use it where s390 code would just access the memslot with the highest
gfn directly.
No functional change intended.
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-Id: <42496041d6af1c23b1cbba2636b344ca8d5fc3af.1638817641.git.maciej.szmigiero@oracle.com>
Diffstat (limited to 'arch/s390/kvm/kvm-s390.h')
-rw-r--r-- | arch/s390/kvm/kvm-s390.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h index b887fe7a7064..cc309cc37e96 100644 --- a/arch/s390/kvm/kvm-s390.h +++ b/arch/s390/kvm/kvm-s390.h @@ -217,6 +217,18 @@ static inline void kvm_s390_set_user_cpu_state_ctrl(struct kvm *kvm) kvm->arch.user_cpu_state_ctrl = 1; } +/* get the end gfn of the last (highest gfn) memslot */ +static inline unsigned long kvm_s390_get_gfn_end(struct kvm_memslots *slots) +{ + struct kvm_memory_slot *ms; + + if (WARN_ON(!slots->used_slots)) + return 0; + + ms = slots->memslots; + return ms->base_gfn + ms->npages; +} + /* implemented in pv.c */ int kvm_s390_pv_destroy_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc); int kvm_s390_pv_create_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc); |