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

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