[v2,2/2] KVM: s390: vsie: simplify < 8k address checks
diff mbox

Message ID 20180509141218.5629-3-david@redhat.com
State New
Headers show

Commit Message

David Hildenbrand May 9, 2018, 2:12 p.m. UTC
This makes it certainly more readable.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 arch/s390/kvm/vsie.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Janosch Frank May 16, 2018, 8:05 a.m. UTC | #1
On 09.05.2018 16:12, David Hildenbrand wrote:
> This makes it certainly more readable.

Yes, it does.
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>

> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  arch/s390/kvm/vsie.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index 969882b54266..84c89cb9636f 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -557,7 +557,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>  	if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_64BSCAO))
>  		gpa |= (u64) READ_ONCE(scb_o->scaoh) << 32;
>  	if (gpa) {
> -		if (!(gpa & ~0x1fffUL))
> +		if (gpa < 2 * PAGE_SIZE)
>  			rc = set_validity_icpt(scb_s, 0x0038U);
>  		else if ((gpa & ~0x1fffUL) == kvm_s390_get_prefix(vcpu))
>  			rc = set_validity_icpt(scb_s, 0x0011U);
> @@ -578,7 +578,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>  
>  	gpa = READ_ONCE(scb_o->itdba) & ~0xffUL;
>  	if (gpa && (scb_s->ecb & ECB_TE)) {
> -		if (!(gpa & ~0x1fffUL)) {
> +		if (gpa < 2 * PAGE_SIZE) {
>  			rc = set_validity_icpt(scb_s, 0x0080U);
>  			goto unpin;
>  		}
> @@ -594,7 +594,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>  
>  	gpa = READ_ONCE(scb_o->gvrd) & ~0x1ffUL;
>  	if (gpa && (scb_s->eca & ECA_VX) && !(scb_s->ecd & ECD_HOSTREGMGMT)) {
> -		if (!(gpa & ~0x1fffUL)) {
> +		if (gpa < 2 * PAGE_SIZE) {
>  			rc = set_validity_icpt(scb_s, 0x1310U);
>  			goto unpin;
>  		}
> @@ -613,7 +613,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>  
>  	gpa = READ_ONCE(scb_o->riccbd) & ~0x3fUL;
>  	if (gpa && (scb_s->ecb3 & ECB3_RI)) {
> -		if (!(gpa & ~0x1fffUL)) {
> +		if (gpa < 2 * PAGE_SIZE) {
>  			rc = set_validity_icpt(scb_s, 0x0043U);
>  			goto unpin;
>  		}
> @@ -632,7 +632,7 @@ static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>  
>  		gpa = READ_ONCE(scb_o->sdnxo) & ~0xfUL;
>  		sdnxc = READ_ONCE(scb_o->sdnxo) & 0xfUL;
> -		if (!gpa || !(gpa & ~0x1fffUL)) {
> +		if (!gpa || gpa < 2 * PAGE_SIZE) {
>  			rc = set_validity_icpt(scb_s, 0x10b0U);
>  			goto unpin;
>  		}
>
Cornelia Huck May 16, 2018, 11:40 a.m. UTC | #2
On Wed,  9 May 2018 16:12:18 +0200
David Hildenbrand <david@redhat.com> wrote:

> This makes it certainly more readable.
> 
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  arch/s390/kvm/vsie.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

Patch
diff mbox

diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index 969882b54266..84c89cb9636f 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -557,7 +557,7 @@  static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 	if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_64BSCAO))
 		gpa |= (u64) READ_ONCE(scb_o->scaoh) << 32;
 	if (gpa) {
-		if (!(gpa & ~0x1fffUL))
+		if (gpa < 2 * PAGE_SIZE)
 			rc = set_validity_icpt(scb_s, 0x0038U);
 		else if ((gpa & ~0x1fffUL) == kvm_s390_get_prefix(vcpu))
 			rc = set_validity_icpt(scb_s, 0x0011U);
@@ -578,7 +578,7 @@  static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 
 	gpa = READ_ONCE(scb_o->itdba) & ~0xffUL;
 	if (gpa && (scb_s->ecb & ECB_TE)) {
-		if (!(gpa & ~0x1fffUL)) {
+		if (gpa < 2 * PAGE_SIZE) {
 			rc = set_validity_icpt(scb_s, 0x0080U);
 			goto unpin;
 		}
@@ -594,7 +594,7 @@  static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 
 	gpa = READ_ONCE(scb_o->gvrd) & ~0x1ffUL;
 	if (gpa && (scb_s->eca & ECA_VX) && !(scb_s->ecd & ECD_HOSTREGMGMT)) {
-		if (!(gpa & ~0x1fffUL)) {
+		if (gpa < 2 * PAGE_SIZE) {
 			rc = set_validity_icpt(scb_s, 0x1310U);
 			goto unpin;
 		}
@@ -613,7 +613,7 @@  static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 
 	gpa = READ_ONCE(scb_o->riccbd) & ~0x3fUL;
 	if (gpa && (scb_s->ecb3 & ECB3_RI)) {
-		if (!(gpa & ~0x1fffUL)) {
+		if (gpa < 2 * PAGE_SIZE) {
 			rc = set_validity_icpt(scb_s, 0x0043U);
 			goto unpin;
 		}
@@ -632,7 +632,7 @@  static int pin_blocks(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 
 		gpa = READ_ONCE(scb_o->sdnxo) & ~0xfUL;
 		sdnxc = READ_ONCE(scb_o->sdnxo) & 0xfUL;
-		if (!gpa || !(gpa & ~0x1fffUL)) {
+		if (!gpa || gpa < 2 * PAGE_SIZE) {
 			rc = set_validity_icpt(scb_s, 0x10b0U);
 			goto unpin;
 		}