Blame SOURCES/kvm-s390x-kvm-pass-values-instead-of-pointers-to-kvm_s39.patch

28c80a
From d8ea4acd4f566899da1ba6def05c5dca4217fd52 Mon Sep 17 00:00:00 2001
28c80a
From: David Hildenbrand <david@redhat.com>
28c80a
Date: Fri, 21 Dec 2018 15:39:47 +0100
28c80a
Subject: [PATCH 03/14] s390x/kvm: pass values instead of pointers to
28c80a
 kvm_s390_set_clock_*()
28c80a
28c80a
RH-Author: David Hildenbrand <david@redhat.com>
28c80a
Message-id: <20181221153957.28183-3-david@redhat.com>
28c80a
Patchwork-id: 83759
28c80a
O-Subject: [RHEL-7.6.z qemu-kvm-ma PATCH 02/12] s390x/kvm: pass values instead of pointers to kvm_s390_set_clock_*()
28c80a
Bugzilla: 1672920
28c80a
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
28c80a
RH-Acked-by: Thomas Huth <thuth@redhat.com>
28c80a
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
28c80a
28c80a
We are going to factor out the TOD into a separate device and use const
28c80a
pointers for device class functions where possible. We are passing right
28c80a
now ordinary pointers that should never be touched when setting the TOD.
28c80a
Let's just pass the values directly.
28c80a
28c80a
Note that s390_set_clock() will be removed in a follow-on patch and
28c80a
therefore its calling convention is not changed.
28c80a
28c80a
Signed-off-by: David Hildenbrand <david@redhat.com>
28c80a
Message-Id: <20180627134410.4901-3-david@redhat.com>
28c80a
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
28c80a
(cherry picked from commit 4ab6a1feac0a142045d3b7bdbb8182a99c0b8980)
28c80a
Signed-off-by: David Hildenbrand <david@redhat.com>
28c80a
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
28c80a
---
28c80a
 target/s390x/cpu.c       |  4 ++--
28c80a
 target/s390x/kvm-stub.c  |  4 ++--
28c80a
 target/s390x/kvm.c       | 12 ++++++------
28c80a
 target/s390x/kvm_s390x.h |  4 ++--
28c80a
 4 files changed, 12 insertions(+), 12 deletions(-)
28c80a
28c80a
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
28c80a
index c2b775f..1f590d1 100644
28c80a
--- a/target/s390x/cpu.c
28c80a
+++ b/target/s390x/cpu.c
28c80a
@@ -414,9 +414,9 @@ int s390_set_clock(uint8_t *tod_high, uint64_t *tod_low)
28c80a
     int r = 0;
28c80a
 
28c80a
     if (kvm_enabled()) {
28c80a
-        r = kvm_s390_set_clock_ext(tod_high, tod_low);
28c80a
+        r = kvm_s390_set_clock_ext(*tod_high, *tod_low);
28c80a
         if (r == -ENXIO) {
28c80a
-            return kvm_s390_set_clock(tod_high, tod_low);
28c80a
+            return kvm_s390_set_clock(*tod_high, *tod_low);
28c80a
         }
28c80a
     }
28c80a
     /* Fixme TCG */
28c80a
diff --git a/target/s390x/kvm-stub.c b/target/s390x/kvm-stub.c
28c80a
index 29b1054..bf7795e 100644
28c80a
--- a/target/s390x/kvm-stub.c
28c80a
+++ b/target/s390x/kvm-stub.c
28c80a
@@ -60,12 +60,12 @@ int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_low)
28c80a
     return -ENOSYS;
28c80a
 }
28c80a
 
28c80a
-int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low)
28c80a
+int kvm_s390_set_clock(uint8_t tod_high, uint64_t tod_low)
28c80a
 {
28c80a
     return -ENOSYS;
28c80a
 }
28c80a
 
28c80a
-int kvm_s390_set_clock_ext(uint8_t *tod_high, uint64_t *tod_low)
28c80a
+int kvm_s390_set_clock_ext(uint8_t tod_high, uint64_t tod_low)
28c80a
 {
28c80a
     return -ENOSYS;
28c80a
 }
28c80a
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
28c80a
index c27e628..009902e 100644
28c80a
--- a/target/s390x/kvm.c
28c80a
+++ b/target/s390x/kvm.c
28c80a
@@ -696,13 +696,13 @@ int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_low)
28c80a
     return r;
28c80a
 }
28c80a
 
28c80a
-int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low)
28c80a
+int kvm_s390_set_clock(uint8_t tod_high, uint64_t tod_low)
28c80a
 {
28c80a
     int r;
28c80a
     struct kvm_device_attr attr = {
28c80a
         .group = KVM_S390_VM_TOD,
28c80a
         .attr = KVM_S390_VM_TOD_LOW,
28c80a
-        .addr = (uint64_t)tod_low,
28c80a
+        .addr = (uint64_t)&tod_low,
28c80a
     };
28c80a
 
28c80a
     r = kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);
28c80a
@@ -711,15 +711,15 @@ int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_low)
28c80a
     }
28c80a
 
28c80a
     attr.attr = KVM_S390_VM_TOD_HIGH;
28c80a
-    attr.addr = (uint64_t)tod_high;
28c80a
+    attr.addr = (uint64_t)&tod_high;
28c80a
     return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);
28c80a
 }
28c80a
 
28c80a
-int kvm_s390_set_clock_ext(uint8_t *tod_high, uint64_t *tod_low)
28c80a
+int kvm_s390_set_clock_ext(uint8_t tod_high, uint64_t tod_low)
28c80a
 {
28c80a
     struct kvm_s390_vm_tod_clock gtod = {
28c80a
-        .epoch_idx = *tod_high,
28c80a
-        .tod  = *tod_low,
28c80a
+        .epoch_idx = tod_high,
28c80a
+        .tod  = tod_low,
28c80a
     };
28c80a
     struct kvm_device_attr attr = {
28c80a
         .group = KVM_S390_VM_TOD,
28c80a
diff --git a/target/s390x/kvm_s390x.h b/target/s390x/kvm_s390x.h
28c80a
index c383bf4..36eb34b 100644
28c80a
--- a/target/s390x/kvm_s390x.h
28c80a
+++ b/target/s390x/kvm_s390x.h
28c80a
@@ -25,8 +25,8 @@ int kvm_s390_get_ri(void);
28c80a
 int kvm_s390_get_gs(void);
28c80a
 int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_clock);
28c80a
 int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_clock);
28c80a
-int kvm_s390_set_clock(uint8_t *tod_high, uint64_t *tod_clock);
28c80a
-int kvm_s390_set_clock_ext(uint8_t *tod_high, uint64_t *tod_clock);
28c80a
+int kvm_s390_set_clock(uint8_t tod_high, uint64_t tod_clock);
28c80a
+int kvm_s390_set_clock_ext(uint8_t tod_high, uint64_t tod_clock);
28c80a
 void kvm_s390_enable_css_support(S390CPU *cpu);
28c80a
 int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch,
28c80a
                                     int vq, bool assign);
28c80a
-- 
28c80a
1.8.3.1
28c80a