fbb94cc706
- kvm-virtio-iommu-Add-bypass-mode-support-to-assigned-dev.patch [bz#2100106] - kvm-virtio-iommu-Use-recursive-lock-to-avoid-deadlock.patch [bz#2100106] - kvm-virtio-iommu-Add-an-assert-check-in-translate-routin.patch [bz#2100106] - kvm-virtio-iommu-Fix-the-partial-copy-of-probe-request.patch [bz#2100106] - kvm-virtio-iommu-Fix-migration-regression.patch [bz#2100106] - kvm-pc-bios-s390-ccw-virtio-Introduce-a-macro-for-the-DA.patch [bz#2098077] - kvm-pc-bios-s390-ccw-bootmap-Improve-the-guessing-logic-.patch [bz#2098077] - kvm-pc-bios-s390-ccw-virtio-blkdev-Simplify-fix-virtio_i.patch [bz#2098077] - kvm-pc-bios-s390-ccw-virtio-blkdev-Remove-virtio_assume_.patch [bz#2098077] - kvm-pc-bios-s390-ccw-virtio-Set-missing-status-bits-whil.patch [bz#2098077] - kvm-pc-bios-s390-ccw-virtio-Read-device-config-after-fea.patch [bz#2098077] - kvm-pc-bios-s390-ccw-virtio-Beautify-the-code-for-readin.patch [bz#2098077] - kvm-pc-bios-s390-ccw-Split-virtio-scsi-code-from-virtio_.patch [bz#2098077] - kvm-pc-bios-s390-ccw-virtio-blkdev-Request-the-right-fea.patch [bz#2098077] - kvm-pc-bios-s390-ccw-netboot.mak-Ignore-Clang-s-warnings.patch [bz#2098077] - kvm-hw-block-fdc-Prevent-end-of-track-overrun-CVE-2021-3.patch [bz#1951522] - kvm-tests-qtest-fdc-test-Add-a-regression-test-for-CVE-2.patch [bz#1951522] - Resolves: bz#2100106 (Fix virtio-iommu/vfio bypass) - Resolves: bz#2098077 (virtio-blk: Can't boot fresh installation from used virtio-blk dasd disk under certain conditions) - Resolves: bz#1951522 (CVE-2021-3507 qemu-kvm: QEMU: fdc: heap buffer overflow in DMA read data transfers [rhel-9.0])
181 lines
5.8 KiB
Diff
181 lines
5.8 KiB
Diff
From 2e38b4ec5c53b2b98539a70105d3046e1c452ab8 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Huth <thuth@redhat.com>
|
|
Date: Fri, 8 Jul 2022 20:49:01 +0200
|
|
Subject: [PATCH 13/17] pc-bios/s390-ccw: Split virtio-scsi code from
|
|
virtio_blk_setup_device()
|
|
|
|
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
RH-MergeRequest: 106: pc-bios/s390-ccw: Fix boot from disks with 4k sectors that do not have the typical DASD geometry
|
|
RH-Commit: [8/10] f49c5fb77e05c9dc09ed9f037e37f6a461e4bba6 (thuth/qemu-kvm-cs9)
|
|
RH-Bugzilla: 2098077
|
|
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
|
Bugzilla: http://bugzilla.redhat.com/2098077
|
|
|
|
commit cf30b7c4a9b2c64518be8037c2e6670aacdb00b9
|
|
Author: Thomas Huth <thuth@redhat.com>
|
|
Date: Mon Jul 4 13:19:00 2022 +0200
|
|
|
|
pc-bios/s390-ccw: Split virtio-scsi code from virtio_blk_setup_device()
|
|
|
|
The next patch is going to add more virtio-block specific code to
|
|
virtio_blk_setup_device(), and if the virtio-scsi code is also in
|
|
there, this is more cumbersome. And the calling function virtio_setup()
|
|
in main.c looks at the device type already anyway, so it's more
|
|
logical to separate the virtio-scsi stuff into a new function in
|
|
virtio-scsi.c instead.
|
|
|
|
Message-Id: <20220704111903.62400-10-thuth@redhat.com>
|
|
Reviewed-by: Eric Farman <farman@linux.ibm.com>
|
|
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
|
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
---
|
|
pc-bios/s390-ccw/main.c | 24 +++++++++++++++++-------
|
|
pc-bios/s390-ccw/virtio-blkdev.c | 20 ++------------------
|
|
pc-bios/s390-ccw/virtio-scsi.c | 19 ++++++++++++++++++-
|
|
pc-bios/s390-ccw/virtio-scsi.h | 2 +-
|
|
4 files changed, 38 insertions(+), 27 deletions(-)
|
|
|
|
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
|
|
index 5d2b7ba94d..13e1d8fdf7 100644
|
|
--- a/pc-bios/s390-ccw/main.c
|
|
+++ b/pc-bios/s390-ccw/main.c
|
|
@@ -14,6 +14,7 @@
|
|
#include "s390-ccw.h"
|
|
#include "cio.h"
|
|
#include "virtio.h"
|
|
+#include "virtio-scsi.h"
|
|
#include "dasd-ipl.h"
|
|
|
|
char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
|
|
@@ -218,6 +219,7 @@ static int virtio_setup(void)
|
|
{
|
|
VDev *vdev = virtio_get_device();
|
|
QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS;
|
|
+ int ret;
|
|
|
|
memcpy(&qipl, early_qipl, sizeof(QemuIplParameters));
|
|
|
|
@@ -225,18 +227,26 @@ static int virtio_setup(void)
|
|
menu_setup();
|
|
}
|
|
|
|
- if (virtio_get_device_type() == VIRTIO_ID_NET) {
|
|
+ switch (vdev->senseid.cu_model) {
|
|
+ case VIRTIO_ID_NET:
|
|
sclp_print("Network boot device detected\n");
|
|
vdev->netboot_start_addr = qipl.netboot_start_addr;
|
|
- } else {
|
|
- int ret = virtio_blk_setup_device(blk_schid);
|
|
- if (ret) {
|
|
- return ret;
|
|
- }
|
|
+ return 0;
|
|
+ case VIRTIO_ID_BLOCK:
|
|
+ ret = virtio_blk_setup_device(blk_schid);
|
|
+ break;
|
|
+ case VIRTIO_ID_SCSI:
|
|
+ ret = virtio_scsi_setup_device(blk_schid);
|
|
+ break;
|
|
+ default:
|
|
+ panic("\n! No IPL device available !\n");
|
|
+ }
|
|
+
|
|
+ if (!ret) {
|
|
IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detected");
|
|
}
|
|
|
|
- return 0;
|
|
+ return ret;
|
|
}
|
|
|
|
static void ipl_boot_device(void)
|
|
diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c
|
|
index db1f7f44aa..c175b66a47 100644
|
|
--- a/pc-bios/s390-ccw/virtio-blkdev.c
|
|
+++ b/pc-bios/s390-ccw/virtio-blkdev.c
|
|
@@ -222,27 +222,11 @@ uint64_t virtio_get_blocks(void)
|
|
int virtio_blk_setup_device(SubChannelId schid)
|
|
{
|
|
VDev *vdev = virtio_get_device();
|
|
- int ret = 0;
|
|
|
|
vdev->schid = schid;
|
|
virtio_setup_ccw(vdev);
|
|
|
|
- switch (vdev->senseid.cu_model) {
|
|
- case VIRTIO_ID_BLOCK:
|
|
- sclp_print("Using virtio-blk.\n");
|
|
- break;
|
|
- case VIRTIO_ID_SCSI:
|
|
- IPL_assert(vdev->config.scsi.sense_size == VIRTIO_SCSI_SENSE_SIZE,
|
|
- "Config: sense size mismatch");
|
|
- IPL_assert(vdev->config.scsi.cdb_size == VIRTIO_SCSI_CDB_SIZE,
|
|
- "Config: CDB size mismatch");
|
|
+ sclp_print("Using virtio-blk.\n");
|
|
|
|
- sclp_print("Using virtio-scsi.\n");
|
|
- ret = virtio_scsi_setup(vdev);
|
|
- break;
|
|
- default:
|
|
- panic("\n! No IPL device available !\n");
|
|
- }
|
|
-
|
|
- return ret;
|
|
+ return 0;
|
|
}
|
|
diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c
|
|
index 2c8d0f3097..3b7069270c 100644
|
|
--- a/pc-bios/s390-ccw/virtio-scsi.c
|
|
+++ b/pc-bios/s390-ccw/virtio-scsi.c
|
|
@@ -329,7 +329,7 @@ static void scsi_parse_capacity_report(void *data,
|
|
}
|
|
}
|
|
|
|
-int virtio_scsi_setup(VDev *vdev)
|
|
+static int virtio_scsi_setup(VDev *vdev)
|
|
{
|
|
int retry_test_unit_ready = 3;
|
|
uint8_t data[256];
|
|
@@ -430,3 +430,20 @@ int virtio_scsi_setup(VDev *vdev)
|
|
|
|
return 0;
|
|
}
|
|
+
|
|
+int virtio_scsi_setup_device(SubChannelId schid)
|
|
+{
|
|
+ VDev *vdev = virtio_get_device();
|
|
+
|
|
+ vdev->schid = schid;
|
|
+ virtio_setup_ccw(vdev);
|
|
+
|
|
+ IPL_assert(vdev->config.scsi.sense_size == VIRTIO_SCSI_SENSE_SIZE,
|
|
+ "Config: sense size mismatch");
|
|
+ IPL_assert(vdev->config.scsi.cdb_size == VIRTIO_SCSI_CDB_SIZE,
|
|
+ "Config: CDB size mismatch");
|
|
+
|
|
+ sclp_print("Using virtio-scsi.\n");
|
|
+
|
|
+ return virtio_scsi_setup(vdev);
|
|
+}
|
|
diff --git a/pc-bios/s390-ccw/virtio-scsi.h b/pc-bios/s390-ccw/virtio-scsi.h
|
|
index 4b14c2c2f9..e6b6cd4815 100644
|
|
--- a/pc-bios/s390-ccw/virtio-scsi.h
|
|
+++ b/pc-bios/s390-ccw/virtio-scsi.h
|
|
@@ -67,8 +67,8 @@ static inline bool virtio_scsi_response_ok(const VirtioScsiCmdResp *r)
|
|
return r->response == VIRTIO_SCSI_S_OK && r->status == CDB_STATUS_GOOD;
|
|
}
|
|
|
|
-int virtio_scsi_setup(VDev *vdev);
|
|
int virtio_scsi_read_many(VDev *vdev,
|
|
ulong sector, void *load_addr, int sec_num);
|
|
+int virtio_scsi_setup_device(SubChannelId schid);
|
|
|
|
#endif /* VIRTIO_SCSI_H */
|
|
--
|
|
2.31.1
|
|
|