yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-pc-bios-s390x-Ensure-Read-IPL-memory-is-clean.patch

8fced6
From 6b19062226ecebf63d2d0b0ff05b5bcfa7a05818 Mon Sep 17 00:00:00 2001
8fced6
From: Thomas Huth <thuth@redhat.com>
8fced6
Date: Thu, 10 Dec 2020 08:32:40 -0500
8fced6
Subject: [PATCH 4/5] pc-bios: s390x: Ensure Read IPL memory is clean
8fced6
8fced6
RH-Author: Thomas Huth <thuth@redhat.com>
8fced6
Message-id: <20201210083241.173509-4-thuth@redhat.com>
8fced6
Patchwork-id: 100372
8fced6
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 3/4] pc-bios: s390x: Ensure Read IPL memory is clean
8fced6
Bugzilla: 1903135
8fced6
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
8fced6
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
8fced6
RH-Acked-by: David Hildenbrand <david@redhat.com>
8fced6
8fced6
From: Eric Farman <farman@linux.ibm.com>
8fced6
8fced6
If, for example, we boot off a virtio device and chreipl to a vfio-ccw
8fced6
device, the space at lowcore will be non-zero. We build a Read IPL CCW
8fced6
at address zero, but it will have leftover PSW data that will conflict
8fced6
with the Format-0 CCW being generated:
8fced6
8fced6
0x0: 00080000 80010000
8fced6
       ------ Ccw0.cda
8fced6
              -- Ccw0.chainData
8fced6
                -- Reserved bits
8fced6
8fced6
The data address will be overwritten with the correct value (0x0), but
8fced6
the apparent data chain bit will cause subsequent memory to be used as
8fced6
the target of the data store, which may not be where we expect (0x0).
8fced6
8fced6
Clear out this space when we boot from DASD, so that we know it exists
8fced6
exactly as we expect.
8fced6
8fced6
Signed-off-by: Eric Farman <farman@linux.ibm.com>
8fced6
Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
8fced6
Reviewed-by: Janosch Frank <frankja@de.ibm.com>
8fced6
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
8fced6
Acked-by: Cornelia Huck <cohuck@redhat.com>
8fced6
Message-Id: <20201120160117.59366-2-farman@linux.ibm.com>
8fced6
Signed-off-by: Thomas Huth <thuth@redhat.com>
8fced6
(cherry picked from commit d8e5bbdd0d6fa8d9b5ac15de62c87105d92ff558)
8fced6
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
8fced6
---
8fced6
 pc-bios/s390-ccw/dasd-ipl.c | 3 +++
8fced6
 1 file changed, 3 insertions(+)
8fced6
8fced6
diff --git a/pc-bios/s390-ccw/dasd-ipl.c b/pc-bios/s390-ccw/dasd-ipl.c
8fced6
index 0fc879bb8e8..71cbae2f16e 100644
8fced6
--- a/pc-bios/s390-ccw/dasd-ipl.c
8fced6
+++ b/pc-bios/s390-ccw/dasd-ipl.c
8fced6
@@ -100,6 +100,9 @@ static void make_readipl(void)
8fced6
 {
8fced6
     Ccw0 *ccwIplRead = (Ccw0 *)0x00;
8fced6
 
8fced6
+    /* Clear out any existing data */
8fced6
+    memset(ccwIplRead, 0, sizeof(Ccw0));
8fced6
+
8fced6
     /* Create Read IPL ccw at address 0 */
8fced6
     ccwIplRead->cmd_code = CCW_CMD_READ_IPL;
8fced6
     ccwIplRead->cda = 0x00; /* Read into address 0x00 in main memory */
8fced6
-- 
8fced6
2.27.0
8fced6