From nobody Mon Feb 9 03:16:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1661439945; cv=none; d=zohomail.com; s=zohoarc; b=KzWyBxavbWgYfa46dUYXASP6TYoDTNr9cnjfUVWTM8p1Af1Qo+NW6a3I63hL8jR00nPe6Fa+yySw/1jmCOmc+KmkqwbYi1rani4bEzs9t1olJsmg3PEzUZ6cnRjk99klmEAVWujOik6xsgACRdJiL+Ay8zYIrjcswMSSDftEyyQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661439945; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SCIQbUIn/ZbrILGHvDcvkX0jww+BR9S2JoysSn4KFrc=; b=NN2/bFA1HmNZ5atNU4N1xiv/HBOwAkqjbuaLYIiU5/SuubXLK/k2OVBZJ0JhnsxST8BRbafybrFcuoJF6mLVf1aF7ri7UQ8wR8GW+h6/UAkPM+04FEs3EerXYBKP/0VMPumdVUqptYcJu8YRhCDyo9QE1dNIRdwXcTcILpeJnLE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1661439945487399.911920017788; Thu, 25 Aug 2022 08:05:45 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-460-VzEZf9KpN8iD5TpcGv2QTw-1; Thu, 25 Aug 2022 11:05:38 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8EAB8280EA3D; Thu, 25 Aug 2022 15:05:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71842492CA7; Thu, 25 Aug 2022 15:05:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2FA151946A72; Thu, 25 Aug 2022 15:05:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5FE611946A6C for ; Thu, 25 Aug 2022 15:05:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 40918945DF; Thu, 25 Aug 2022 15:05:27 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6B4C9458A for ; Thu, 25 Aug 2022 15:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661439944; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SCIQbUIn/ZbrILGHvDcvkX0jww+BR9S2JoysSn4KFrc=; b=ASXl8d3QCtWLlSLS8yTHD8f20nnah6N/at46u7GNPu9ltWcexKEfCtFDPeejbx4BjNLr6N cIVTO5uVxcucXtIwmTFOc3cuDAICDGezt+ywKf105MNo7H3WeO1N/i2BL9WNZXv9hqQ1sK G7aRYIj+Pu8RaS883G2Q7046eG4zQcc= X-MC-Unique: VzEZf9KpN8iD5TpcGv2QTw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/8] qemu: Remove extra logic around QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY Date: Thu, 25 Aug 2022 17:05:17 +0200 Message-Id: <2615016e73640907c5843701d3db120b5a48c874.1661439774.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1661439947156100005 Content-Type: text/plain; charset="utf-8" The virtio-*-(non-)-transitional device models which replace the use of 'disable-legacy'/'disable-modern' features were introduced in qemu-4.0. This means we can remove the specific parts of the code for formatting the old-style device options and replace all other code to solely depend on the QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL flag. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 6 ++---- src/qemu/qemu_command.c | 23 ++--------------------- src/qemu/qemu_domain_address.c | 3 +-- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c5338f6830..d7fe1d789d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -6157,8 +6157,7 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCaps *qemu= Caps, /* disk->model values */ VIR_DOMAIN_CAPS_ENUM_SET(disk->model, VIR_DOMAIN_DISK_MODEL_VIRTIO); - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY) || - virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL)) { VIR_DOMAIN_CAPS_ENUM_SET(disk->model, VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL= ); VIR_DOMAIN_CAPS_ENUM_SET(disk->model, @@ -6275,8 +6274,7 @@ virQEMUCapsFillDomainDeviceRNGCaps(virQEMUCaps *qemuC= aps, if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_RNG)) { VIR_DOMAIN_CAPS_ENUM_SET(rng->model, VIR_DOMAIN_RNG_MODEL_VIRTIO); - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL) || - virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY))= { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL)) { VIR_DOMAIN_CAPS_ENUM_SET(rng->model, VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIO= NAL, VIR_DOMAIN_RNG_MODEL_VIRTIO_NON_TRANS= ITIONAL); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a31b8ee438..089d0493d9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -952,9 +952,7 @@ static int qemuBuildVirtioDevGetConfig(const virDomainDeviceDef *device, virQEMUCaps *qemuCaps, char **devtype, - virDomainVirtioOptions **virtioOptions, - virTristateSwitch *disableLegacy, - virTristateSwitch *disableModern) + virDomainVirtioOptions **virtioOptions) { virDomainDeviceInfo *info =3D virDomainDeviceGetInfo(device); g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; @@ -964,9 +962,6 @@ qemuBuildVirtioDevGetConfig(const virDomainDeviceDef *d= evice, bool has_ntmodel =3D false; bool useBusSuffix =3D true; - *disableLegacy =3D VIR_TRISTATE_SWITCH_ABSENT; - *disableModern =3D VIR_TRISTATE_SWITCH_ABSENT; - qemuBuildVirtioDevGetConfigDev(device, qemuCaps, &baseName, virtioOptions, &has_tmodel, &has_ntmodel, &useBusSuffix); @@ -1026,9 +1021,6 @@ qemuBuildVirtioDevGetConfig(const virDomainDeviceDef = *device, if (has_tmodel) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL= )) { virBufferAddLit(&buf, "-transitional"); - } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISAB= LE_LEGACY)) { - *disableLegacy =3D VIR_TRISTATE_SWITCH_OFF; - *disableModern =3D VIR_TRISTATE_SWITCH_OFF; } /* No error if -transitional is not supported: our address * allocation will force the device into plain PCI bus, which @@ -1037,12 +1029,6 @@ qemuBuildVirtioDevGetConfig(const virDomainDeviceDef= *device, } else if (has_ntmodel) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL= )) { virBufferAddLit(&buf, "-non-transitional"); - } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISAB= LE_LEGACY)) { - /* Even if the QEMU binary doesn't support the non-transit= ional - * device, we can still make it work by manually disabling= legacy - * VirtIO and enabling modern VirtIO */ - *disableLegacy =3D VIR_TRISTATE_SWITCH_ON; - *disableModern =3D VIR_TRISTATE_SWITCH_OFF; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("virtio non-transitional model not suppor= ted for this qemu")); @@ -1073,8 +1059,6 @@ qemuBuildVirtioDevProps(virDomainDeviceType devtype, g_autoptr(virJSONValue) props =3D NULL; const virDomainDeviceDef device =3D { .type =3D devtype }; g_autofree char *model =3D NULL; - virTristateSwitch disableLegacy =3D VIR_TRISTATE_SWITCH_ABSENT; - virTristateSwitch disableModern =3D VIR_TRISTATE_SWITCH_ABSENT; virDomainVirtioOptions *virtioOptions =3D NULL; /* We temporarily cast the const away here, but that's safe to do @@ -1083,14 +1067,11 @@ qemuBuildVirtioDevProps(virDomainDeviceType devtype, * not touch its contents */ virDomainDeviceSetData((virDomainDeviceDef *) &device, (void *) devdat= a); - if (qemuBuildVirtioDevGetConfig(&device, qemuCaps, &model, &virtioOpti= ons, - &disableLegacy, &disableModern) < 0) + if (qemuBuildVirtioDevGetConfig(&device, qemuCaps, &model, &virtioOpti= ons) < 0) return NULL; if (virJSONValueObjectAdd(&props, "s:driver", model, - "S:disable-legacy", qemuOnOffAuto(disableLeg= acy), - "T:disable-modern", disableModern, NULL) < 0) return NULL; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index bd9a951899..228ac07cd5 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1098,8 +1098,7 @@ qemuDomainFillDevicePCIConnectFlagsIterInit(virDomain= Def *def, VIR_PCI_CONNECT_AUTOASSIGN); } - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY) || - virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL)) { data->virtioFlags =3D data->pcieFlags; } else { data->virtioFlags =3D (VIR_PCI_CONNECT_TYPE_PCI_DEVICE | --=20 2.37.1