From patchwork Mon Nov 6 19:49:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 13447408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 415B5C4332F for ; Mon, 6 Nov 2023 20:05:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.628356.979775 (Exim 4.92) (envelope-from ) id 1r05r6-0007Qp-EU; Mon, 06 Nov 2023 20:05:52 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 628356.979775; Mon, 06 Nov 2023 20:05:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r05r6-0007Qh-BK; Mon, 06 Nov 2023 20:05:52 +0000 Received: by outflank-mailman (input) for mailman id 628356; Mon, 06 Nov 2023 20:05:50 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r05hO-00024f-Oi for xen-devel@lists.xenproject.org; Mon, 06 Nov 2023 19:55:50 +0000 Received: from casper.infradead.org (casper.infradead.org [2001:8b0:10b:1236::1]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 77cf3edf-7cde-11ee-98da-6d05b1d4d9a1; Mon, 06 Nov 2023 20:55:43 +0100 (CET) Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1r05fc-007tah-BC; Mon, 06 Nov 2023 19:54:01 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.96.2 #2 (Red Hat Linux)) id 1r05fc-001GP5-1u; Mon, 06 Nov 2023 19:54:00 +0000 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: 77cf3edf-7cde-11ee-98da-6d05b1d4d9a1 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=L5VhMhMWWBNBbH2l848PbF3Scoxc1bNY0ufdNZIbk1U=; b=iGwdZ+aCxnLlfra+boD9l6BbR5 ZecLaYSnhd2Mj6VGcRr5cKFp3OHC4upiyzuowHAzrNm+l9PPjYHAkA4bsuk85Y4nKk52kzr3+zyEd WnS0EyMGlN6ZDfyfDTmHT/OpldPg+ZJbZZPEcHW5jilZh/O9C382WNiPYOg9DNJ13rHwCLDxJFCPm Y+L4+sh6q+geRp+KAezyv3Z+Nb5xjuNyuOBLWRC7q+PqKSiqxSUwzaBCQGXmBFP4ccIZe+YhY+YYX TdkNjwVq2/Gm1+kB1qfNHER9XVHZDiq28bZA9sEfSnKDxSIznvYI5NHm4VScCILsu+ZnzaauwqDEy 7knI7PNw==; 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_Le_Goater?= , Andrew Jeffery , Joel Stanley , Igor Mitsyanko , Jean-Christophe Dubois , Andrey Smirnov , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=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 , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Eduardo Habkost , Song Gao , Thomas Huth , Laurent Vivier , Huacai Chen , Jiaxun Yang , =?utf-8?q?Herv=C3=A9_Poussineau?= , 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 , David Hildenbrand , Ilya Leoshkevich , Halil Pasic , Christian Borntraeger , Eric Farman , 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 Subject: [PATCH for-8.3 v2 35/46] hw/mips/mipssim: use qemu_create_nic_device() Date: Mon, 6 Nov 2023 19:49:40 +0000 Message-ID: <20231106195352.301038-36-dwmw2@infradead.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231106195352.301038-1-dwmw2@infradead.org> References: <20231106195352.301038-1-dwmw2@infradead.org> MIME-Version: 1.0 Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html From: David Woodhouse The MIPS SIM platform instantiates its NIC only if a corresponding configuration exists for it. Use qemu_create_nic_device() function for that. Signed-off-by: David Woodhouse --- hw/mips/mipssim.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index 4f743f37eb..d930526fd6 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -110,13 +110,15 @@ static void main_cpu_reset(void *opaque) } } -static void mipsnet_init(int base, qemu_irq irq, NICInfo *nd) +static void mipsnet_init(int base, qemu_irq irq) { DeviceState *dev; SysBusDevice *s; - dev = qdev_new("mipsnet"); - qdev_set_nic_properties(dev, nd); + dev = qemu_create_nic_device("mipsnet", true, NULL); + if (!dev) { + return; + } s = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); @@ -217,9 +219,8 @@ mips_mipssim_init(MachineState *machine) sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0)); } - if (nd_table[0].used) - /* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */ - mipsnet_init(0x4200, env->irq[2], &nd_table[0]); + /* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */ + mipsnet_init(0x4200, env->irq[2]); } static void mips_mipssim_machine_init(MachineClass *mc)