From nobody Tue Nov 26 17:15:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1706290404; cv=none; d=zohomail.com; s=zohoarc; b=hdNQIj0AXXTJ+VRsdfShcir7qJEeZF1uglKMR66yIIzcQaZhQcFlkVbca8TqGD8z+rd8lVl+Vp1hsz5RGjDqv1fD3ok6gR8HbLU5qpW5TIokLMOGvYijgWB9pDReCn/cEFlrgUPXBtGERVrwg70LNK0xAqh1meUsGZcPC2y7mHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706290404; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IsEBwT+a/9aBHnvV7Yr1FI82jfvo4oBFxfzxJeL3Zis=; b=UE33+NLHEbl5L+fRUfekZmpZGMzLuRO7aPnK/bmOj/dXiPRvBdRuvqA/aAeZleHi6daBgF0hgOl55GO2Tp3Qb+m5ty6xHV63UPmlkdY+lbxgWZ0lLHYDBIZzTdLf7wn9eZmg38qHDniVGtcq71ED5xC+bC8Q94Zd0aE8exSn9uE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1706290404066686.598531644813; Fri, 26 Jan 2024 09:33:24 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.672255.1046062 (Exim 4.92) (envelope-from ) id 1rTQ4i-000570-9l; Fri, 26 Jan 2024 17:33:08 +0000 Received: by outflank-mailman (output) from mailman id 672255.1046062; Fri, 26 Jan 2024 17:33:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rTQ4i-000565-4N; Fri, 26 Jan 2024 17:33:08 +0000 Received: by outflank-mailman (input) for mailman id 672255; Fri, 26 Jan 2024 17:33:06 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rTQ4g-0004m7-Gj for xen-devel@lists.xenproject.org; Fri, 26 Jan 2024 17:33:06 +0000 Received: from casper.infradead.org (casper.infradead.org [2001:8b0:10b:1236::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f54dc813-bc70-11ee-98f5-efadbce2ee36; Fri, 26 Jan 2024 18:33:03 +0100 (CET) Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTQ48-0000000EKUK-0jkb; Fri, 26 Jan 2024 17:32:33 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTQ48-00000001elz-1dme; Fri, 26 Jan 2024 17:32:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: f54dc813-bc70-11ee-98f5-efadbce2ee36 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=IsEBwT+a/9aBHnvV7Yr1FI82jfvo4oBFxfzxJeL3Zis=; b=o5uphZnnzk66xr9FQuoGoHaWIH PD2KSJ0bQgU+wewzGTv6tW1nP7TEDC+E82NfYVZOc0ivOVbXRaWBji21VgdgmcaPk9xvQHH3sxJlL W5wBmOCo9yGT9zGskThjhwDeXxPVaZOGfgFkJr/Un2HV5HrdgIyvjt5d2luhddn04WvUuGUPVHH1F vgrOcbchZYTSfxytYsLDI2IRBdKtuEUB6IWNVLStJPL2SNKo11VF4z5PXceDtjJZXfL1Zrp+dIdtT 0ff5H/8bgPl8RpeD4OefovH/Vdckf2q7lj3BcNiyq79D5dH9O/Ey/uC4NhTumGesDLoMCQmZb15rV EMIIlqZQ==; From: David Woodhouse To: qemu-devel@nongnu.org Cc: Richard Henderson , Beniamino Galvani , Peter Maydell , Strahinja Jankovic , Niek Linnenbank , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Andrew Jeffery , Joel Stanley , Igor Mitsyanko , Jean-Christophe Dubois , Andrey Smirnov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Rob Herring , Subbaraya Sundeep , Jan Kiszka , Tyrone Ting , Hao Wu , Radoslaw Biernacki , Leif Lindholm , Marcin Juszkiewicz , "Edgar E. Iglesias" , Alistair Francis , Helge Deller , Paolo Bonzini , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Song Gao , Thomas Huth , Laurent Vivier , Huacai Chen , Jiaxun Yang , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Aleksandar Rikalo , Aurelien Jarno , Jason Wang , Jia Liu , Stafford Horne , Mark Cave-Ayland , Nicholas Piggin , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Bin Meng , Palmer Dabbelt , Weiwei Li , Liu Zhiwei , Halil Pasic , Christian Borntraeger , Eric Farman , David Hildenbrand , Ilya Leoshkevich , Yoshinori Sato , Magnus Damm , Artyom Tarasenko , Stefano Stabellini , Anthony Perard , Paul Durrant , Max Filippov , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-s390x@nongnu.org, xen-devel@lists.xenproject.org, David Woodhouse , Thomas Huth Subject: [PATCH v4 16/47] hw/ppc/spapr: use qemu_get_nic_info() and pci_init_nic_devices() Date: Fri, 26 Jan 2024 17:24:53 +0000 Message-ID: <20240126173228.394202-17-dwmw2@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240126173228.394202-1-dwmw2@infradead.org> References: <20240126173228.394202-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) X-ZM-MESSAGEID: 1706290404500100001 Content-Type: text/plain; charset="utf-8" From: David Woodhouse Avoid directly referencing nd_table[] by first instantiating any spapr-vlan devices using a qemu_get_nic_info() loop, then calling pci_init_nic_devices() to do the rest. No functional change intended. Signed-off-by: David Woodhouse Reviewed-by: Thomas Huth --- hw/ppc/spapr.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index e8dabc8614..0d72d286d8 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2796,6 +2796,7 @@ static void spapr_machine_init(MachineState *machine) MemoryRegion *sysmem =3D get_system_memory(); long load_limit, fw_size; Error *resize_hpt_err =3D NULL; + NICInfo *nd; =20 if (!filename) { error_report("Could not find LPAR firmware '%s'", bios_name); @@ -2996,21 +2997,12 @@ static void spapr_machine_init(MachineState *machin= e) =20 phb =3D spapr_create_default_phb(); =20 - for (i =3D 0; i < nb_nics; i++) { - NICInfo *nd =3D &nd_table[i]; - - if (!nd->model) { - nd->model =3D g_strdup("spapr-vlan"); - } - - if (g_str_equal(nd->model, "spapr-vlan") || - g_str_equal(nd->model, "ibmveth")) { - spapr_vlan_create(spapr->vio_bus, nd); - } else { - pci_nic_init_nofail(&nd_table[i], phb->bus, nd->model, NULL); - } + while ((nd =3D qemu_find_nic_info("spapr-vlan", true, "ibmveth"))) { + spapr_vlan_create(spapr->vio_bus, nd); } =20 + pci_init_nic_devices(phb->bus, NULL); + for (i =3D 0; i <=3D drive_get_max_bus(IF_SCSI); i++) { spapr_vscsi_create(spapr->vio_bus); } --=20 2.43.0