thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-s390-sclp-get-machine-once-during-read-scp-cpu-info.patch

a19a21
From 44e8cdba29b932ee6fff7a2d00b09e6e78c3a0ef Mon Sep 17 00:00:00 2001
a19a21
From: Thomas Huth <thuth@redhat.com>
a19a21
Date: Wed, 11 Nov 2020 12:03:06 -0500
a19a21
Subject: [PATCH 06/18] s390/sclp: get machine once during read scp/cpu info
a19a21
a19a21
RH-Author: Thomas Huth <thuth@redhat.com>
a19a21
Message-id: <20201111120316.707489-3-thuth@redhat.com>
a19a21
Patchwork-id: 99499
a19a21
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH v2 02/12] s390/sclp: get machine once during read scp/cpu info
a19a21
Bugzilla: 1798506
a19a21
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
a19a21
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
a19a21
RH-Acked-by: David Hildenbrand <david@redhat.com>
a19a21
a19a21
From: Collin Walling <walling@linux.ibm.com>
a19a21
a19a21
Functions within read scp/cpu info will need access to the machine
a19a21
state. Let's make a call to retrieve the machine state once and
a19a21
pass the appropriate data to the respective functions.
a19a21
a19a21
Signed-off-by: Collin Walling <walling@linux.ibm.com>
a19a21
Reviewed-by: David Hildenbrand <david@redhat.com>
a19a21
Reviewed-by: Thomas Huth <thuth@redhat.com>
a19a21
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
a19a21
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
a19a21
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
a19a21
Message-Id: <20200915194416.107460-2-walling@linux.ibm.com>
a19a21
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
a19a21
(cherry picked from commit 912d70d2755cb9b3144eeed4014580ebc5485ce6)
a19a21
Signed-off-by: Thomas Huth <thuth@redhat.com>
a19a21
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
a19a21
---
a19a21
 hw/s390x/sclp.c | 8 ++++----
a19a21
 1 file changed, 4 insertions(+), 4 deletions(-)
a19a21
a19a21
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
a19a21
index d8ae207731f..fe7d0fece80 100644
a19a21
--- a/hw/s390x/sclp.c
a19a21
+++ b/hw/s390x/sclp.c
a19a21
@@ -49,9 +49,8 @@ static inline bool sclp_command_code_valid(uint32_t code)
a19a21
     return false;
a19a21
 }
a19a21
 
a19a21
-static void prepare_cpu_entries(SCLPDevice *sclp, CPUEntry *entry, int *count)
a19a21
+static void prepare_cpu_entries(MachineState *ms, CPUEntry *entry, int *count)
a19a21
 {
a19a21
-    MachineState *ms = MACHINE(qdev_get_machine());
a19a21
     uint8_t features[SCCB_CPU_FEATURE_LEN] = { 0 };
a19a21
     int i;
a19a21
 
a19a21
@@ -77,7 +76,7 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
a19a21
     IplParameterBlock *ipib = s390_ipl_get_iplb();
a19a21
 
a19a21
     /* CPU information */
a19a21
-    prepare_cpu_entries(sclp, read_info->entries, &cpu_count);
a19a21
+    prepare_cpu_entries(machine, read_info->entries, &cpu_count);
a19a21
     read_info->entries_cpu = cpu_to_be16(cpu_count);
a19a21
     read_info->offset_cpu = cpu_to_be16(offsetof(ReadInfo, entries));
a19a21
     read_info->highest_cpu = cpu_to_be16(machine->smp.max_cpus - 1);
a19a21
@@ -132,10 +131,11 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
a19a21
 /* Provide information about the CPU */
a19a21
 static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB *sccb)
a19a21
 {
a19a21
+    MachineState *machine = MACHINE(qdev_get_machine());
a19a21
     ReadCpuInfo *cpu_info = (ReadCpuInfo *) sccb;
a19a21
     int cpu_count;
a19a21
 
a19a21
-    prepare_cpu_entries(sclp, cpu_info->entries, &cpu_count);
a19a21
+    prepare_cpu_entries(machine, cpu_info->entries, &cpu_count);
a19a21
     cpu_info->nr_configured = cpu_to_be16(cpu_count);
a19a21
     cpu_info->offset_configured = cpu_to_be16(offsetof(ReadCpuInfo, entries));
a19a21
     cpu_info->nr_standby = cpu_to_be16(0);
a19a21
-- 
a19a21
2.27.0
a19a21