From nobody Wed Oct 22 15:08:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151912346518946.11454347467736; Tue, 20 Feb 2018 02:44:25 -0800 (PST) Received: from localhost ([::1]:54546 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eo5PM-0008Ku-Ad for importer@patchew.org; Tue, 20 Feb 2018 05:44:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eo5O3-0007cC-2X for qemu-devel@nongnu.org; Tue, 20 Feb 2018 05:43:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eo5O1-0003FV-NH for qemu-devel@nongnu.org; Tue, 20 Feb 2018 05:43:03 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55468 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eo5Nv-0003Bm-EN; Tue, 20 Feb 2018 05:42:55 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8175C402290A; Tue, 20 Feb 2018 10:42:44 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-114.ams2.redhat.com [10.36.116.114]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7373A2024CA7; Tue, 20 Feb 2018 10:42:38 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Paolo Bonzini , Markus Armbruster Date: Tue, 20 Feb 2018 11:42:37 +0100 Message-Id: <1519123357-13225-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 20 Feb 2018 10:42:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 20 Feb 2018 10:42:44 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH] scsi: Remove automatic creation of SCSI controllers with -drive if=scsi X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marcel Apfelbaum , Fam Zheng , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Automatic creation of SCSI controllers for "-drive if=3Dscsi" for x86 machines was quite a bad idea (see description of commit f778a82f0c179 for details). This is marked as deprecated since QEMU v2.9.0, and as far as I know, nobody complained that this is still urgently required anymore. Time to remove this now. Suggested-by: Markus Armbruster Signed-off-by: Thomas Huth --- hw/i386/pc.c | 17 ----------------- hw/i386/pc_piix.c | 4 ---- hw/i386/pc_q35.c | 3 --- hw/scsi/lsi53c895a.c | 2 +- hw/scsi/scsi-bus.c | 49 +---------------------------------------------= --- hw/scsi/spapr_vscsi.c | 3 +-- include/hw/scsi/scsi.h | 2 +- qemu-doc.texi | 5 ----- vl.c | 9 --------- 9 files changed, 4 insertions(+), 90 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 55e69d6..2f7746c 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1636,23 +1636,6 @@ void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus) rom_reset_order_override(); } =20 -void pc_pci_device_init(PCIBus *pci_bus) -{ - int max_bus; - int bus; - - /* Note: if=3Dscsi is deprecated with PC machine types */ - max_bus =3D drive_get_max_bus(IF_SCSI); - for (bus =3D 0; bus <=3D max_bus; bus++) { - pci_create_simple(pci_bus, -1, "lsi53c895a"); - /* - * By not creating frontends here, we make - * scsi_legacy_handle_cmdline() create them, and warn that - * this usage is deprecated. - */ - } -} - void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) { DeviceState *dev; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 456dc9e..8658bcb 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -295,10 +295,6 @@ static void pc_init1(MachineState *machine, PC_MACHINE_ACPI_DEVICE_PROP, &error_abort= ); } =20 - if (pcmc->pci_enabled) { - pc_pci_device_init(pci_bus); - } - if (pcms->acpi_nvdimm_state.is_enabled) { nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io, pcms->fw_cfg, OBJECT(pcms)); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index aba7541..0c0bc48 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -273,9 +273,6 @@ static void pc_q35_init(MachineState *machine) /* the rest devices to which pci devfn is automatically assigned */ pc_vga_init(isa_bus, host_bus); pc_nic_init(isa_bus, host_bus); - if (pcmc->pci_enabled) { - pc_pci_device_init(host_bus); - } =20 if (pcms->acpi_nvdimm_state.is_enabled) { nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io, diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 191505d..f3d4c4d 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -2277,5 +2277,5 @@ void lsi53c895a_create(PCIBus *bus) { LSIState *s =3D LSI53C895A(pci_create_simple(bus, -1, "lsi53c895a")); =20 - scsi_bus_legacy_handle_cmdline(&s->bus, false); + scsi_bus_legacy_handle_cmdline(&s->bus); } diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index b7bafbe..1eaeffc 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -271,7 +271,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, Blo= ckBackend *blk, return SCSI_DEVICE(dev); } =20 -void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated) +void scsi_bus_legacy_handle_cmdline(SCSIBus *bus) { Location loc; DriveInfo *dinfo; @@ -284,59 +284,12 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, boo= l deprecated) continue; } qemu_opts_loc_restore(dinfo->opts); - if (deprecated) { - /* Handling -drive not claimed by machine initialization */ - if (blk_get_attached_dev(blk_by_legacy_dinfo(dinfo))) { - continue; /* claimed */ - } - if (!dinfo->is_default) { - warn_report("bus=3D%d,unit=3D%d is deprecated with this" - " machine type", - bus->busnr, unit); - } - } scsi_bus_legacy_add_drive(bus, blk_by_legacy_dinfo(dinfo), unit, false, -1, false, NULL, &error_fat= al); } loc_pop(&loc); } =20 -static bool is_scsi_hba_with_legacy_magic(Object *obj) -{ - static const char *magic[] =3D { - "am53c974", "dc390", "esp", "lsi53c810", "lsi53c895a", - "megasas", "megasas-gen2", "mptsas1068", "spapr-vscsi", - "virtio-scsi-device", - NULL - }; - const char *typename =3D object_get_typename(obj); - int i; - - for (i =3D 0; magic[i]; i++) - if (!strcmp(typename, magic[i])) { - return true; - } - - return false; -} - -static int scsi_legacy_handle_cmdline_cb(Object *obj, void *opaque) -{ - SCSIBus *bus =3D (SCSIBus *)object_dynamic_cast(obj, TYPE_SCSI_BUS); - - if (bus && is_scsi_hba_with_legacy_magic(OBJECT(bus->qbus.parent))) { - scsi_bus_legacy_handle_cmdline(bus, true); - } - - return 0; -} - -void scsi_legacy_handle_cmdline(void) -{ - object_child_foreach_recursive(object_get_root(), - scsi_legacy_handle_cmdline_cb, NULL); -} - static int32_t scsi_invalid_field(SCSIRequest *req, uint8_t *buf) { scsi_req_build_sense(req, SENSE_CODE(INVALID_FIELD)); diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c index 360db53..a9e49c7 100644 --- a/hw/scsi/spapr_vscsi.c +++ b/hw/scsi/spapr_vscsi.c @@ -1215,8 +1215,7 @@ void spapr_vscsi_create(VIOsPAPRBus *bus) dev =3D qdev_create(&bus->bus, "spapr-vscsi"); =20 qdev_init_nofail(dev); - scsi_bus_legacy_handle_cmdline(&VIO_SPAPR_VSCSI_DEVICE(dev)->bus, - false); + scsi_bus_legacy_handle_cmdline(&VIO_SPAPR_VSCSI_DEVICE(dev)->bus); } =20 static int spapr_vscsi_devnode(VIOsPAPRDevice *dev, void *fdt, int node_of= f) diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h index 802a647..7ecadda 100644 --- a/include/hw/scsi/scsi.h +++ b/include/hw/scsi/scsi.h @@ -153,7 +153,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, Blo= ckBackend *blk, int unit, bool removable, int bootin= dex, bool share_rw, const char *serial, Error **errp); -void scsi_bus_legacy_handle_cmdline(SCSIBus *bus, bool deprecated); +void scsi_bus_legacy_handle_cmdline(SCSIBus *bus); void scsi_legacy_handle_cmdline(void); =20 SCSIRequest *scsi_req_alloc(const SCSIReqOps *reqops, SCSIDevice *d, diff --git a/qemu-doc.texi b/qemu-doc.texi index 56388b5..2f19980 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2687,11 +2687,6 @@ The ``-net vlan=3DNN'' argument is partially replace= d with the new ``-netdev'' argument. The remaining use cases will no longer be directly supported in QEMU. =20 -@subsection -drive if=3Dscsi (since 2.9.0) - -The ``-drive if=3Dscsi'' argument is replaced by the the -``-device BUS-TYPE'' argument combined with ``-drive if=3Dnone''. - @subsection -drive cyls=3D...,heads=3D...,secs=3D...,trans=3D... (since 2.= 10.0) =20 The drive geometry arguments are replaced by the the geometry arguments diff --git a/vl.c b/vl.c index 81724f5..0feaca7 100644 --- a/vl.c +++ b/vl.c @@ -4638,15 +4638,6 @@ int main(int argc, char **argv, char **envp) =20 rom_reset_order_override(); =20 - /* - * Create frontends for -drive if=3Dscsi leftovers. - * Normally, frontends for -drive get created by machine - * initialization for onboard SCSI HBAs. However, we create a few - * more ever since SCSI qdevification, but this is pretty much an - * implementation accident, and deprecated. - */ - scsi_legacy_handle_cmdline(); - /* Did we create any drives that we failed to create a device for? */ drive_check_orphaned(); =20 --=20 1.8.3.1