yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
a19a21
From adf66c037e60d66f864960b24c746b767efb10b9 Mon Sep 17 00:00:00 2001
a19a21
From: Thomas Huth <thuth@redhat.com>
a19a21
Date: Wed, 11 Nov 2020 12:03:10 -0500
a19a21
Subject: [PATCH 10/18] s390/sclp: use cpu offset to locate cpu entries
a19a21
a19a21
RH-Author: Thomas Huth <thuth@redhat.com>
a19a21
Message-id: <20201111120316.707489-7-thuth@redhat.com>
a19a21
Patchwork-id: 99503
a19a21
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH v2 06/12] s390/sclp: use cpu offset to locate cpu entries
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
The start of the CPU entry region in the Read SCP Info response data is
a19a21
denoted by the offset_cpu field. As such, QEMU needs to begin creating
a19a21
entries at this address.
a19a21
a19a21
This is in preparation for when Read SCP Info inevitably introduces new
a19a21
bytes that push the start of the CPUEntry field further away.
a19a21
a19a21
Read CPU Info is unlikely to ever change, so let's not bother
a19a21
accounting for the offset there.
a19a21
a19a21
Signed-off-by: Collin Walling <walling@linux.ibm.com>
a19a21
Reviewed-by: Thomas Huth <thuth@redhat.com>
a19a21
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
a19a21
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
a19a21
Message-Id: <20200915194416.107460-6-walling@linux.ibm.com>
a19a21
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
a19a21
(cherry picked from commit 1a7a568859473b1cda39a015493c5c82bb200281)
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 | 6 ++++--
a19a21
 1 file changed, 4 insertions(+), 2 deletions(-)
a19a21
a19a21
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
a19a21
index 2b4c6c5cfad..017989b3888 100644
a19a21
--- a/hw/s390x/sclp.c
a19a21
+++ b/hw/s390x/sclp.c
a19a21
@@ -89,6 +89,8 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
a19a21
     int rnsize, rnmax;
a19a21
     IplParameterBlock *ipib = s390_ipl_get_iplb();
a19a21
     int required_len = SCCB_REQ_LEN(ReadInfo, machine->possible_cpus->len);
a19a21
+    int offset_cpu = offsetof(ReadInfo, entries);
a19a21
+    CPUEntry *entries_start = (void *)sccb + offset_cpu;
a19a21
 
a19a21
     if (be16_to_cpu(sccb->h.length) < required_len) {
a19a21
         sccb->h.response_code = cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LENGTH);
a19a21
@@ -96,9 +98,9 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
a19a21
     }
a19a21
 
a19a21
     /* CPU information */
a19a21
-    prepare_cpu_entries(machine, read_info->entries, &cpu_count);
a19a21
+    prepare_cpu_entries(machine, entries_start, &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->offset_cpu = cpu_to_be16(offset_cpu);
a19a21
     read_info->highest_cpu = cpu_to_be16(machine->smp.max_cpus - 1);
a19a21
 
a19a21
     read_info->ibc_val = cpu_to_be32(s390_get_ibc_val());
a19a21
-- 
a19a21
2.27.0
a19a21