cryptospore / 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

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