From nobody Mon Feb 9 09:28:57 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1709056384120651.4733667115283; Tue, 27 Feb 2024 09:53:04 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id D67DA1C49; Tue, 27 Feb 2024 12:53:02 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B2BFC1EC8; Tue, 27 Feb 2024 11:43:07 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 456301DE6; Tue, 27 Feb 2024 11:42:55 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5CA6E1DB9 for ; Tue, 27 Feb 2024 11:36:55 -0500 (EST) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-551-7FwfTV7sP-i611dD5adhlQ-1; Tue, 27 Feb 2024 11:36:53 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 395FE3812009 for ; Tue, 27 Feb 2024 16:36:53 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.45.242.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id A74021C060B1 for ; Tue, 27 Feb 2024 16:36:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 7FwfTV7sP-i611dD5adhlQ-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 25/25] qemu: command: Remove fallback '-usb' handling Date: Tue, 27 Feb 2024 17:36:27 +0100 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: RLZLGQD3Q5LQ4CDH3Y4NORFEALC5ZSGQ X-Message-ID-Hash: RLZLGQD3Q5LQ4CDH3Y4NORFEALC5ZSGQ X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709056385006100001 Currently all machine types which do honour '-usb' are already covered by code which will either select a proper controller model or would select the same one which '-usb' would use. Thus all of the legacy -usb controller code can be removed. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 88 ++----------------- .../sparc-minimal.sparc-latest.args | 1 - 2 files changed, 8 insertions(+), 81 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2d6f930756..b163322191 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2919,62 +2919,6 @@ qemuBuildControllerDevProps(const virDomainDef *doma= inDef, } -static bool -qemuBuildDomainForbidLegacyUSBController(const virDomainDef *def) -{ - if (ARCH_IS_X86(def->os.arch) || - ARCH_IS_PPC(def->os.arch) || - ARCH_IS_ARM(def->os.arch) || - qemuDomainIsRISCVVirt(def)) - return true; - - return false; -} - - -static int -qemuBuildLegacyUSBControllerCommandLine(virCommand *cmd, - const virDomainDef *def) -{ - size_t i; - size_t nlegacy =3D 0; - size_t nusb =3D 0; - - for (i =3D 0; i < def->ncontrollers; i++) { - virDomainControllerDef *cont =3D def->controllers[i]; - - if (cont->type !=3D VIR_DOMAIN_CONTROLLER_TYPE_USB) - continue; - - /* If we have mode=3D'none', there are no other USB controllers */ - if (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) - return 0; - - if (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT) - nlegacy++; - else - nusb++; - } - - if (nlegacy > 1) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Multiple legacy USB controllers are not supporte= d")); - return -1; - } - - if (nusb =3D=3D 0 && - !qemuBuildDomainForbidLegacyUSBController(def) && - !ARCH_IS_S390(def->os.arch)) { - /* We haven't added any USB controller yet, but we haven't been as= ked - * not to add one either. Add a legacy USB controller, unless we're - * creating a kind of guest we want to keep legacy-free */ - virCommandAddArg(cmd, "-usb"); - } - - return 0; -} - - /** * qemuBuildSkipController: * @controller: Controller to check @@ -3055,29 +2999,16 @@ qemuBuildControllersByTypeCommandLine(virCommand *c= md, if (qemuBuildSkipController(cont, def)) continue; - /* skip USB controllers with type none.*/ - if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_USB && - cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) { - continue; - } + if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_USB) { - if (cont->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_USB && - cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT && - !qemuBuildDomainForbidLegacyUSBController(def)) { + /* skip USB controllers with type none*/ + if (cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) + continue; - /* An appropriate default USB controller model should already - * have been selected in qemuDomainDeviceDefPostParse(); if - * we still have no model by now, we have to fall back to the - * legacy USB controller. - * - * Note that we *don't* want to end up with the legacy USB - * controller for q35 and virt machines, so we go ahead and - * fail in qemuBuildControllerDevProps(); on the other hand, - * for s390 machines we want to ignore any USB controller - * (see 548ba43028 for the full story), so we skip - * qemuBuildControllerDevProps() but we don't ultimately end - * up adding the legacy USB controller */ - continue; + /* skip 'default' controllers on s390 for legacy reasons */ + if (ARCH_IS_S390(def->os.arch) && + cont->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_USB_DEFAULT) + continue; } if (qemuBuildControllerDevProps(def, cont, qemuCaps, &props) < 0) @@ -3135,9 +3066,6 @@ qemuBuildControllersCommandLine(virCommand *cmd, return -1; } - if (qemuBuildLegacyUSBControllerCommandLine(cmd, def) < 0) - return -1; - return 0; } diff --git a/tests/qemuxmlconfdata/sparc-minimal.sparc-latest.args b/tests/= qemuxmlconfdata/sparc-minimal.sparc-latest.args index 1cb520cf4a..b285efa615 100644 --- a/tests/qemuxmlconfdata/sparc-minimal.sparc-latest.args +++ b/tests/qemuxmlconfdata/sparc-minimal.sparc-latest.args @@ -24,7 +24,6 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-redhat6= 2sparc/.config \ -rtc base=3Dutc \ -no-shutdown \ -boot strict=3Don \ --usb \ -blockdev '{"driver":"file","filename":"/home/berrange/VirtualMachines/red= hat-6.2-sparc.img","node-name":"libvirt-2-storage","auto-read-only":true,"d= iscard":"unmap"}' \ -blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"qco= w2","file":"libvirt-2-storage"}' \ -device scsi-hd,bus=3Dscsi.0,scsi-id=3D0,device_id=3Ddrive-scsi0-0-0-0,dri= ve=3Dlibvirt-2-format,id=3Dscsi0-0-0-0,bootindex=3D1 \ --=20 2.43.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org