yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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