Blame SOURCES/0032-scsi-Disable-deprecated-implicit-SCSI-HBA-creation-m.patch

9bac43
From 4c43abf1394c3711f93a4e0175ff5c10769f6480 Mon Sep 17 00:00:00 2001
9bac43
From: Markus Armbruster <armbru@redhat.com>
9bac43
Date: Fri, 28 Apr 2017 12:22:27 +0200
9bac43
Subject: scsi: Disable deprecated implicit SCSI HBA creation more cleanly
9bac43
9bac43
RH-Author: Markus Armbruster <armbru@redhat.com>
9bac43
Message-id: <1493382147-23057-2-git-send-email-armbru@redhat.com>
9bac43
Patchwork-id: 74946
9bac43
O-Subject: [RHV-7.4 qemu-kvm-rhev PATCH] scsi: Disable deprecated implicit SCSI HBA creation more cleanly
9bac43
Bugzilla: 971799
9bac43
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9bac43
RH-Acked-by: John Snow <jsnow@redhat.com>
9bac43
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9bac43
9bac43
The PC machines (pc-q35-* pc-i440fx-* pc-* isapc xenfv) automatically
9bac43
create lsi53c895a SCSI HBAs and SCSI devices to honor -drive if=scsi.
9bac43
Deprecated upstream since commit f778a82, v2.9.0, not supported at all
9bac43
in RHEL.  The way it fails is rather ugly, though:
9bac43
9bac43
    $ qemu-kvm -nodefaults -S -drive if=scsi,media=cdrom
9bac43
    qemu-kvm: Unknown device 'lsi53c895a' for bus 'PCI'
9bac43
    Aborted (core dumped)
9bac43
9bac43
Recent upstream work permit us to make this fail cleanly by commenting
9bac43
out the code that tries to create lsi53c895a SCSI HBAs in
9bac43
pc_pci_device_init():
9bac43
9bac43
    qemu-kvm: -drive if=scsi,media=cdrom: machine type does not support if=scsi,bus=0,unit=0
9bac43
9bac43
However, by itself this would make another deprecated feature
9bac43
available in RHEL: drives defined with if=scsi get picked up by SCSI
9bac43
HBAs added with -device, unlike other interface types.  Deprecated
9bac43
upstream since commit a64aa57, v2.9.0.  Comment out that code, too.
9bac43
Bonus: that code can be rather slow with a large number of drives, so
9bac43
good riddance.
9bac43
9bac43
Signed-off-by: Markus Armbruster <armbru@redhat.com>
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
(cherry picked from commit 7977e603169c92da4b0ecd656c3346500a93897b)
9bac43
---
9bac43
 hw/i386/pc.c       | 2 ++
9bac43
 hw/scsi/scsi-bus.c | 7 +++++++
9bac43
 vl.c               | 2 ++
9bac43
 3 files changed, 11 insertions(+)
9bac43
9bac43
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
9bac43
index ae23fc4..ccaa832 100644
9bac43
--- a/hw/i386/pc.c
9bac43
+++ b/hw/i386/pc.c
9bac43
@@ -1645,6 +1645,7 @@ void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
9bac43
 
9bac43
 void pc_pci_device_init(PCIBus *pci_bus)
9bac43
 {
9bac43
+#if 0 /* Disabled for Red Hat Enterprise Linux */
9bac43
     int max_bus;
9bac43
     int bus;
9bac43
 
9bac43
@@ -1658,6 +1659,7 @@ void pc_pci_device_init(PCIBus *pci_bus)
9bac43
          * this usage is deprecated.
9bac43
          */
9bac43
     }
9bac43
+#endif
9bac43
 }
9bac43
 
9bac43
 void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name)
9bac43
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
9bac43
index e364410..309daaa 100644
9bac43
--- a/hw/scsi/scsi-bus.c
9bac43
+++ b/hw/scsi/scsi-bus.c
9bac43
@@ -265,6 +265,8 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
9bac43
 
9bac43
 void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated)
9bac43
 {
9bac43
+#if 0 /* Disabled for Red Hat Enterprise Linux */
9bac43
+
9bac43
     Location loc;
9bac43
     DriveInfo *dinfo;
9bac43
     int unit;
9bac43
@@ -291,8 +293,11 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated)
9bac43
                                   unit, false, -1, NULL, &error_fatal);
9bac43
     }
9bac43
     loc_pop(&loc;;
9bac43
+#endif
9bac43
 }
9bac43
 
9bac43
+#if 0 /* Disabled for Red Hat Enterprise Linux */
9bac43
+
9bac43
 static bool is_scsi_hba_with_legacy_magic(Object *obj)
9bac43
 {
9bac43
     static const char *magic[] = {
9bac43
@@ -329,6 +334,8 @@ void scsi_legacy_handle_cmdline(void)
9bac43
                                    scsi_legacy_handle_cmdline_cb, NULL);
9bac43
 }
9bac43
 
9bac43
+#endif
9bac43
+
9bac43
 static int32_t scsi_invalid_field(SCSIRequest *req, uint8_t *buf)
9bac43
 {
9bac43
     scsi_req_build_sense(req, SENSE_CODE(INVALID_FIELD));
9bac43
diff --git a/vl.c b/vl.c
9bac43
index 59f515c..183b7f7 100644
9bac43
--- a/vl.c
9bac43
+++ b/vl.c
9bac43
@@ -4676,6 +4676,7 @@ int main(int argc, char **argv, char **envp)
9bac43
 
9bac43
     rom_reset_order_override();
9bac43
 
9bac43
+#if 0 /* Disabled for Red Hat Enterprise Linux */
9bac43
     /*
9bac43
      * Create frontends for -drive if=scsi leftovers.
9bac43
      * Normally, frontends for -drive get created by machine
9bac43
@@ -4684,6 +4685,7 @@ int main(int argc, char **argv, char **envp)
9bac43
      * implementation accident, and deprecated.
9bac43
      */
9bac43
     scsi_legacy_handle_cmdline();
9bac43
+#endif
9bac43
 
9bac43
     /* Did we create any drives that we failed to create a device for? */
9bac43
     drive_check_orphaned();
9bac43
-- 
9bac43
1.8.3.1
9bac43