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