77c23f
From 999cf62d870ff9aa8e9609fcbbcefef9ae1aceb6 Mon Sep 17 00:00:00 2001
77c23f
From: Thomas Huth <thuth@redhat.com>
77c23f
Date: Fri, 29 May 2020 05:53:50 -0400
77c23f
Subject: [PATCH 08/42] s390x: kvm: Make kvm_sclp_service_call void
77c23f
MIME-Version: 1.0
77c23f
Content-Type: text/plain; charset=UTF-8
77c23f
Content-Transfer-Encoding: 8bit
77c23f
77c23f
RH-Author: Thomas Huth <thuth@redhat.com>
77c23f
Message-id: <20200529055420.16855-9-thuth@redhat.com>
77c23f
Patchwork-id: 97030
77c23f
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 08/38] s390x: kvm: Make kvm_sclp_service_call void
77c23f
Bugzilla: 1828317
77c23f
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
77c23f
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
77c23f
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
77c23f
RH-Acked-by: David Hildenbrand <david@redhat.com>
77c23f
77c23f
From: Janosch Frank <frankja@linux.ibm.com>
77c23f
77c23f
It defaults to returning 0 anyway and that return value is not
77c23f
necessary, as 0 is also the default rc that the caller would return.
77c23f
77c23f
While doing that we can simplify the logic a bit and return early if
77c23f
we inject a PGM exception.
77c23f
77c23f
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
77c23f
Reviewed-by: Thomas Huth <thuth@redhat.com>
77c23f
Message-Id: <20191129091713.4582-1-frankja@linux.ibm.com>
77c23f
Reviewed-by: David Hildenbrand <david@redhat.com>
77c23f
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
77c23f
(cherry picked from commit 15b6c0370c3e2774fd9ffda5c10c6e36952e8eb6)
77c23f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
77c23f
---
77c23f
 target/s390x/kvm.c | 12 +++++-------
77c23f
 1 file changed, 5 insertions(+), 7 deletions(-)
77c23f
77c23f
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
77c23f
index a02d569537..1c5bc7a2f9 100644
77c23f
--- a/target/s390x/kvm.c
77c23f
+++ b/target/s390x/kvm.c
77c23f
@@ -1159,13 +1159,13 @@ void kvm_s390_access_exception(S390CPU *cpu, uint16_t code, uint64_t te_code)
77c23f
     kvm_s390_vcpu_interrupt(cpu, &irq);
77c23f
 }
77c23f
 
77c23f
-static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run,
77c23f
+static void kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run,
77c23f
                                  uint16_t ipbh0)
77c23f
 {
77c23f
     CPUS390XState *env = &cpu->env;
77c23f
     uint64_t sccb;
77c23f
     uint32_t code;
77c23f
-    int r = 0;
77c23f
+    int r;
77c23f
 
77c23f
     sccb = env->regs[ipbh0 & 0xf];
77c23f
     code = env->regs[(ipbh0 & 0xf0) >> 4];
77c23f
@@ -1173,11 +1173,9 @@ static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run,
77c23f
     r = sclp_service_call(env, sccb, code);
77c23f
     if (r < 0) {
77c23f
         kvm_s390_program_interrupt(cpu, -r);
77c23f
-    } else {
77c23f
-        setcc(cpu, r);
77c23f
+        return;
77c23f
     }
77c23f
-
77c23f
-    return 0;
77c23f
+    setcc(cpu, r);
77c23f
 }
77c23f
 
77c23f
 static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
77c23f
@@ -1240,7 +1238,7 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1)
77c23f
         setcc(cpu, 3);
77c23f
         break;
77c23f
     case PRIV_B2_SCLP_CALL:
77c23f
-        rc = kvm_sclp_service_call(cpu, run, ipbh0);
77c23f
+        kvm_sclp_service_call(cpu, run, ipbh0);
77c23f
         break;
77c23f
     default:
77c23f
         rc = -1;
77c23f
-- 
77c23f
2.27.0
77c23f