yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-s390-sclp-use-cpu-offset-to-locate-cpu-entries.patch

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