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

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