From nobody Wed Jan 15 13:40:36 2025 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 1705487113082521.3141700785714; Wed, 17 Jan 2024 02:25:13 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id EAE30449; Wed, 17 Jan 2024 05:25:11 -0500 (EST) Received: from lists.libvirt.org.85.43.8.in-addr.arpa (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E27671E99; Wed, 17 Jan 2024 04:56:46 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 9587E1D6F; Wed, 17 Jan 2024 04:55:08 -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 6702A1D6B for ; Wed, 17 Jan 2024 04:55:06 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-631-21mUXUMFNCW7a17RwBEd9w-1; Wed, 17 Jan 2024 04:55:04 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 09BA085A58B for ; Wed, 17 Jan 2024 09:55:04 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.224.208]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9456B40C6EB9 for ; Wed, 17 Jan 2024 09:55:03 +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_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: 21mUXUMFNCW7a17RwBEd9w-1 From: Andrea Bolognani To: devel@lists.libvirt.org Subject: [PATCH 15/18] qemu: Improve qemuDomainDefaultNetModel() Date: Wed, 17 Jan 2024 10:54:48 +0100 Message-ID: <20240117095451.788816-16-abologna@redhat.com> In-Reply-To: <20240117095451.788816-1-abologna@redhat.com> References: <20240117095451.788816-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: Z6BE3JA3GAA4LCCJNUW5LFV2Y6BTX53P X-Message-ID-Hash: Z6BE3JA3GAA4LCCJNUW5LFV2Y6BTX53P X-MailFrom: abologna@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"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1705487114682100001 Outside of x86, where we need to try pretty hard to pick hardware that obsolete operating systems might be able to use, and Arm, where some of the less virtualization-friendly machine types have their own specific default, the sensible choice is virtio-net. This is even more true for any architecture that's going to be introduced in the future, as recent experience has shown that they will be developed with virtualization in mind and use virtio as extensively as possible. Note that the default for ppc64 is changed as part of this. That's technically a breaking change, but it should be safe to apply since * it doesn't affect existing guests; * virt-manager already prefers virtio-net anyway. rtl8139 was a pretty bad default for the architecture in the first place, which was only applied accidentally due to its existing status as default for x86. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 12 ++++-------- .../ppc64-default-net.ppc64-latest.args | 2 +- .../ppc64-default-net.ppc64-latest.xml | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index de36641137..fac83e8bb7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5392,12 +5392,7 @@ static int qemuDomainDefaultNetModel(const virDomainDef *def, virQEMUCaps *qemuCaps) { - if (ARCH_IS_S390(def->os.arch)) - return VIR_DOMAIN_NET_MODEL_VIRTIO; - - if (def->os.arch =3D=3D VIR_ARCH_ARMV6L || - def->os.arch =3D=3D VIR_ARCH_ARMV7L || - def->os.arch =3D=3D VIR_ARCH_AARCH64) { + if (ARCH_IS_ARM(def->os.arch)) { if (STREQ(def->os.machine, "versatilepb")) return VIR_DOMAIN_NET_MODEL_SMC91C111; =20 @@ -5409,8 +5404,9 @@ qemuDomainDefaultNetModel(const virDomainDef *def, return VIR_DOMAIN_NET_MODEL_LAN9118; } =20 - /* virtio is a sensible default for RISC-V virt guests */ - if (qemuDomainIsRISCVVirt(def)) + /* For all remaining non-x86 architectures, virtio-net is a good + * default */ + if (!ARCH_IS_X86(def->os.arch)) return VIR_DOMAIN_NET_MODEL_VIRTIO; =20 /* In all other cases the model depends on the capabilities. If they w= ere diff --git a/tests/qemuxml2argvdata/ppc64-default-net.ppc64-latest.args b/t= ests/qemuxml2argvdata/ppc64-default-net.ppc64-latest.args index 4180c247d4..d1716817fb 100644 --- a/tests/qemuxml2argvdata/ppc64-default-net.ppc64-latest.args +++ b/tests/qemuxml2argvdata/ppc64-default-net.ppc64-latest.args @@ -27,7 +27,7 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-guest/.= config \ -no-shutdown \ -boot strict=3Don \ -netdev user,id=3Dhostnet0 \ --device '{"driver":"rtl8139","netdev":"hostnet0","id":"net0","mac":"52:54:= 00:09:a4:37","bus":"pci.0","addr":"0x1"}' \ +-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":= "52:54:00:09:a4:37","bus":"pci.0","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don diff --git a/tests/qemuxml2xmloutdata/ppc64-default-net.ppc64-latest.xml b/= tests/qemuxml2xmloutdata/ppc64-default-net.ppc64-latest.xml index fa83b6e290..8b59dcaafd 100644 --- a/tests/qemuxml2xmloutdata/ppc64-default-net.ppc64-latest.xml +++ b/tests/qemuxml2xmloutdata/ppc64-default-net.ppc64-latest.xml @@ -24,7 +24,7 @@ - +