0727d3
From 5b3548c50e35729d724403b83e26579d31621367 Mon Sep 17 00:00:00 2001
0727d3
From: Thomas Huth <thuth@redhat.com>
0727d3
Date: Fri, 8 Jul 2022 12:29:50 +0200
0727d3
Subject: [PATCH 32/37] pc-bios/s390-ccw/virtio-blkdev: Remove
0727d3
 virtio_assume_scsi()
0727d3
0727d3
RH-Author: Thomas Huth <thuth@redhat.com>
0727d3
RH-MergeRequest: 198: pc-bios/s390-ccw: Fix boot from disks with 4k sectors that do not have the typical DASD geometry
0727d3
RH-Commit: [4/9] 5256c4e6f4d5c5aedf1bad3fee30dd3ad230a3dd
0727d3
RH-Bugzilla: 2098076
0727d3
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
0727d3
RH-Acked-by: David Hildenbrand <david@redhat.com>
0727d3
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
0727d3
0727d3
Bugzilla: http://bugzilla.redhat.com/2098076
0727d3
0727d3
commit 5447de2619050a0a4dd480b97f88a9b58da360d1
0727d3
Author: Thomas Huth <thuth@redhat.com>
0727d3
Date:   Mon Jul 4 13:18:56 2022 +0200
0727d3
0727d3
    pc-bios/s390-ccw/virtio-blkdev: Remove virtio_assume_scsi()
0727d3
0727d3
    The virtio_assume_scsi() function is very questionable: First, it
0727d3
    is only called for virtio-blk, and not for virtio-scsi, so the naming
0727d3
    is already quite confusing. Second, it is called if we detected a
0727d3
    "invalid" IPL disk, trying to fix it by blindly setting a sector
0727d3
    size of 512. This of course won't work in most cases since disks
0727d3
    might have a different sector size for a reason.
0727d3
0727d3
    Thus let's remove this strange function now. The calling code can
0727d3
    also be removed completely, since there is another spot in main.c
0727d3
    that does "IPL_assert(virtio_ipl_disk_is_valid(), ...)" to make
0727d3
    sure that we do not try to IPL from an invalid device.
0727d3
0727d3
    Message-Id: <20220704111903.62400-6-thuth@redhat.com>
0727d3
    Reviewed-by: Eric Farman <farman@linux.ibm.com>
0727d3
    Signed-off-by: Thomas Huth <thuth@redhat.com>
0727d3
0727d3
Signed-off-by: Thomas Huth <thuth@redhat.com>
0727d3
---
0727d3
 pc-bios/s390-ccw/virtio-blkdev.c | 24 ------------------------
0727d3
 pc-bios/s390-ccw/virtio.h        |  1 -
0727d3
 2 files changed, 25 deletions(-)
0727d3
0727d3
diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c
0727d3
index 7e13155589..db1f7f44aa 100644
0727d3
--- a/pc-bios/s390-ccw/virtio-blkdev.c
0727d3
+++ b/pc-bios/s390-ccw/virtio-blkdev.c
0727d3
@@ -112,23 +112,6 @@ VirtioGDN virtio_guessed_disk_nature(void)
0727d3
     return virtio_get_device()->guessed_disk_nature;
0727d3
 }
0727d3
 
0727d3
-void virtio_assume_scsi(void)
0727d3
-{
0727d3
-    VDev *vdev = virtio_get_device();
0727d3
-
0727d3
-    switch (vdev->senseid.cu_model) {
0727d3
-    case VIRTIO_ID_BLOCK:
0727d3
-        vdev->guessed_disk_nature = VIRTIO_GDN_SCSI;
0727d3
-        vdev->config.blk.blk_size = VIRTIO_SCSI_BLOCK_SIZE;
0727d3
-        vdev->config.blk.physical_block_exp = 0;
0727d3
-        vdev->blk_factor = 1;
0727d3
-        break;
0727d3
-    case VIRTIO_ID_SCSI:
0727d3
-        vdev->scsi_block_size = VIRTIO_SCSI_BLOCK_SIZE;
0727d3
-        break;
0727d3
-    }
0727d3
-}
0727d3
-
0727d3
 void virtio_assume_iso9660(void)
0727d3
 {
0727d3
     VDev *vdev = virtio_get_device();
0727d3
@@ -247,13 +230,6 @@ int virtio_blk_setup_device(SubChannelId schid)
0727d3
     switch (vdev->senseid.cu_model) {
0727d3
     case VIRTIO_ID_BLOCK:
0727d3
         sclp_print("Using virtio-blk.\n");
0727d3
-        if (!virtio_ipl_disk_is_valid()) {
0727d3
-            /* make sure all getters but blocksize return 0 for
0727d3
-             * invalid IPL disk
0727d3
-             */
0727d3
-            memset(&vdev->config.blk, 0, sizeof(vdev->config.blk));
0727d3
-            virtio_assume_scsi();
0727d3
-        }
0727d3
         break;
0727d3
     case VIRTIO_ID_SCSI:
0727d3
         IPL_assert(vdev->config.scsi.sense_size == VIRTIO_SCSI_SENSE_SIZE,
0727d3
diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h
0727d3
index 241730effe..600ba5052b 100644
0727d3
--- a/pc-bios/s390-ccw/virtio.h
0727d3
+++ b/pc-bios/s390-ccw/virtio.h
0727d3
@@ -182,7 +182,6 @@ enum guessed_disk_nature_type {
0727d3
 typedef enum guessed_disk_nature_type VirtioGDN;
0727d3
 
0727d3
 VirtioGDN virtio_guessed_disk_nature(void);
0727d3
-void virtio_assume_scsi(void);
0727d3
 void virtio_assume_eckd(void);
0727d3
 void virtio_assume_iso9660(void);
0727d3
 
0727d3
-- 
0727d3
2.35.3
0727d3