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

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