Commit c5d1f6b5 authored by Claudio Imbrenda's avatar Claudio Imbrenda Committed by Christian Borntraeger

KVM: s390: split kvm_s390_real_to_abs

A new function _kvm_s390_real_to_abs will apply prefixing to a real address
with a given prefix value.

The old kvm_s390_real_to_abs becomes now a wrapper around the new function.

This is needed to avoid code duplication in vSIE.
Signed-off-by: default avatarClaudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210322140559.500716-2-imbrenda@linux.ibm.comSigned-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent bdf7509b
...@@ -18,17 +18,14 @@ ...@@ -18,17 +18,14 @@
/** /**
* kvm_s390_real_to_abs - convert guest real address to guest absolute address * kvm_s390_real_to_abs - convert guest real address to guest absolute address
* @vcpu - guest virtual cpu * @prefix - guest prefix
* @gra - guest real address * @gra - guest real address
* *
* Returns the guest absolute address that corresponds to the passed guest real * Returns the guest absolute address that corresponds to the passed guest real
* address @gra of a virtual guest cpu by applying its prefix. * address @gra of by applying the given prefix.
*/ */
static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu, static inline unsigned long _kvm_s390_real_to_abs(u32 prefix, unsigned long gra)
unsigned long gra)
{ {
unsigned long prefix = kvm_s390_get_prefix(vcpu);
if (gra < 2 * PAGE_SIZE) if (gra < 2 * PAGE_SIZE)
gra += prefix; gra += prefix;
else if (gra >= prefix && gra < prefix + 2 * PAGE_SIZE) else if (gra >= prefix && gra < prefix + 2 * PAGE_SIZE)
...@@ -36,6 +33,20 @@ static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu, ...@@ -36,6 +33,20 @@ static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
return gra; return gra;
} }
/**
* kvm_s390_real_to_abs - convert guest real address to guest absolute address
* @vcpu - guest virtual cpu
* @gra - guest real address
*
* Returns the guest absolute address that corresponds to the passed guest real
* address @gra of a virtual guest cpu by applying its prefix.
*/
static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
unsigned long gra)
{
return _kvm_s390_real_to_abs(kvm_s390_get_prefix(vcpu), gra);
}
/** /**
* _kvm_s390_logical_to_effective - convert guest logical to effective address * _kvm_s390_logical_to_effective - convert guest logical to effective address
* @psw: psw of the guest * @psw: psw of the guest
......
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