|
|
586cba |
From f07e4629a7c58407f903810a038660c88c6a6315 Mon Sep 17 00:00:00 2001
|
|
|
586cba |
From: Thomas Huth <thuth@redhat.com>
|
|
|
586cba |
Date: Fri, 8 Jul 2022 20:49:01 +0200
|
|
|
586cba |
Subject: [PATCH 08/17] pc-bios/s390-ccw/virtio-blkdev: Simplify/fix
|
|
|
586cba |
virtio_ipl_disk_is_valid()
|
|
|
586cba |
|
|
|
586cba |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
586cba |
RH-MergeRequest: 106: pc-bios/s390-ccw: Fix boot from disks with 4k sectors that do not have the typical DASD geometry
|
|
|
586cba |
RH-Commit: [3/10] fb06830a3e50d9da3d84913b50bb227865cc44b3 (thuth/qemu-kvm-cs9)
|
|
|
586cba |
RH-Bugzilla: 2098077
|
|
|
586cba |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
586cba |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
586cba |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
586cba |
|
|
|
586cba |
Bugzilla: http://bugzilla.redhat.com/2098077
|
|
|
586cba |
|
|
|
586cba |
commit bbf615f7b707f009ef8e757d170902ad33b90644
|
|
|
586cba |
Author: Thomas Huth <thuth@redhat.com>
|
|
|
586cba |
Date: Mon Jul 4 13:18:55 2022 +0200
|
|
|
586cba |
|
|
|
586cba |
pc-bios/s390-ccw/virtio-blkdev: Simplify/fix virtio_ipl_disk_is_valid()
|
|
|
586cba |
|
|
|
586cba |
The s390-ccw bios fails to boot if the boot disk is a virtio-blk
|
|
|
586cba |
disk with a sector size of 4096. For example:
|
|
|
586cba |
|
|
|
586cba |
dasdfmt -b 4096 -d cdl -y -p -M quick /dev/dasdX
|
|
|
586cba |
fdasd -a /dev/dasdX
|
|
|
586cba |
install a guest onto /dev/dasdX1 using virtio-blk
|
|
|
586cba |
qemu-system-s390x -nographic -hda /dev/dasdX1
|
|
|
586cba |
|
|
|
586cba |
The bios then bails out with:
|
|
|
586cba |
|
|
|
586cba |
! Cannot read block 0 !
|
|
|
586cba |
|
|
|
586cba |
Looking at virtio_ipl_disk_is_valid() and especially the function
|
|
|
586cba |
virtio_disk_is_scsi(), it does not really make sense that we expect
|
|
|
586cba |
only such a limited disk geometry (like a block size of 512) for
|
|
|
586cba |
our boot disks. Let's relax the check and allow everything that
|
|
|
586cba |
remotely looks like a sane disk.
|
|
|
586cba |
|
|
|
586cba |
Message-Id: <20220704111903.62400-5-thuth@redhat.com>
|
|
|
586cba |
Reviewed-by: Eric Farman <farman@linux.ibm.com>
|
|
|
586cba |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
586cba |
|
|
|
586cba |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
586cba |
---
|
|
|
586cba |
pc-bios/s390-ccw/virtio-blkdev.c | 41 ++++++--------------------------
|
|
|
586cba |
pc-bios/s390-ccw/virtio.h | 2 --
|
|
|
586cba |
2 files changed, 7 insertions(+), 36 deletions(-)
|
|
|
586cba |
|
|
|
586cba |
diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c
|
|
|
586cba |
index 6483307630..7e13155589 100644
|
|
|
586cba |
--- a/pc-bios/s390-ccw/virtio-blkdev.c
|
|
|
586cba |
+++ b/pc-bios/s390-ccw/virtio-blkdev.c
|
|
|
586cba |
@@ -166,46 +166,19 @@ void virtio_assume_eckd(void)
|
|
|
586cba |
virtio_eckd_sectors_for_block_size(vdev->config.blk.blk_size);
|
|
|
586cba |
}
|
|
|
586cba |
|
|
|
586cba |
-bool virtio_disk_is_scsi(void)
|
|
|
586cba |
-{
|
|
|
586cba |
- VDev *vdev = virtio_get_device();
|
|
|
586cba |
-
|
|
|
586cba |
- if (vdev->guessed_disk_nature == VIRTIO_GDN_SCSI) {
|
|
|
586cba |
- return true;
|
|
|
586cba |
- }
|
|
|
586cba |
- switch (vdev->senseid.cu_model) {
|
|
|
586cba |
- case VIRTIO_ID_BLOCK:
|
|
|
586cba |
- return (vdev->config.blk.geometry.heads == 255)
|
|
|
586cba |
- && (vdev->config.blk.geometry.sectors == 63)
|
|
|
586cba |
- && (virtio_get_block_size() == VIRTIO_SCSI_BLOCK_SIZE);
|
|
|
586cba |
- case VIRTIO_ID_SCSI:
|
|
|
586cba |
- return true;
|
|
|
586cba |
- }
|
|
|
586cba |
- return false;
|
|
|
586cba |
-}
|
|
|
586cba |
-
|
|
|
586cba |
-bool virtio_disk_is_eckd(void)
|
|
|
586cba |
+bool virtio_ipl_disk_is_valid(void)
|
|
|
586cba |
{
|
|
|
586cba |
+ int blksize = virtio_get_block_size();
|
|
|
586cba |
VDev *vdev = virtio_get_device();
|
|
|
586cba |
- const int block_size = virtio_get_block_size();
|
|
|
586cba |
|
|
|
586cba |
- if (vdev->guessed_disk_nature == VIRTIO_GDN_DASD) {
|
|
|
586cba |
+ if (vdev->guessed_disk_nature == VIRTIO_GDN_SCSI ||
|
|
|
586cba |
+ vdev->guessed_disk_nature == VIRTIO_GDN_DASD) {
|
|
|
586cba |
return true;
|
|
|
586cba |
}
|
|
|
586cba |
- switch (vdev->senseid.cu_model) {
|
|
|
586cba |
- case VIRTIO_ID_BLOCK:
|
|
|
586cba |
- return (vdev->config.blk.geometry.heads == 15)
|
|
|
586cba |
- && (vdev->config.blk.geometry.sectors ==
|
|
|
586cba |
- virtio_eckd_sectors_for_block_size(block_size));
|
|
|
586cba |
- case VIRTIO_ID_SCSI:
|
|
|
586cba |
- return false;
|
|
|
586cba |
- }
|
|
|
586cba |
- return false;
|
|
|
586cba |
-}
|
|
|
586cba |
|
|
|
586cba |
-bool virtio_ipl_disk_is_valid(void)
|
|
|
586cba |
-{
|
|
|
586cba |
- return virtio_disk_is_scsi() || virtio_disk_is_eckd();
|
|
|
586cba |
+ return (vdev->senseid.cu_model == VIRTIO_ID_BLOCK ||
|
|
|
586cba |
+ vdev->senseid.cu_model == VIRTIO_ID_SCSI) &&
|
|
|
586cba |
+ blksize >= 512 && blksize <= 4096;
|
|
|
586cba |
}
|
|
|
586cba |
|
|
|
586cba |
int virtio_get_block_size(void)
|
|
|
586cba |
diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h
|
|
|
586cba |
index 9e410bde6f..241730effe 100644
|
|
|
586cba |
--- a/pc-bios/s390-ccw/virtio.h
|
|
|
586cba |
+++ b/pc-bios/s390-ccw/virtio.h
|
|
|
586cba |
@@ -186,8 +186,6 @@ void virtio_assume_scsi(void);
|
|
|
586cba |
void virtio_assume_eckd(void);
|
|
|
586cba |
void virtio_assume_iso9660(void);
|
|
|
586cba |
|
|
|
586cba |
-extern bool virtio_disk_is_scsi(void);
|
|
|
586cba |
-extern bool virtio_disk_is_eckd(void);
|
|
|
586cba |
extern bool virtio_ipl_disk_is_valid(void);
|
|
|
586cba |
extern int virtio_get_block_size(void);
|
|
|
586cba |
extern uint8_t virtio_get_heads(void);
|
|
|
586cba |
--
|
|
|
586cba |
2.31.1
|
|
|
586cba |
|