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

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