yeahuh / rpms / qemu-kvm

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