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

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