From mboxrd@z Thu Jan 1 00:00:00 1970 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.gnu.org (lists.gnu.org [209.51.188.17]) (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 63278C47DDF for ; Fri, 26 Jan 2024 13:46:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTMX2-0006z6-1j; Fri, 26 Jan 2024 08:46:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTMX0-0006yV-PV for qemu-riscv@nongnu.org; Fri, 26 Jan 2024 08:46:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rTMWx-0003ZA-B4 for qemu-riscv@nongnu.org; Fri, 26 Jan 2024 08:46:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706276762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=gGKgT2BouFnH5blaH26ztR8G6CnT324T0Q33w49jIj8=; b=Djk4kW1fPMc+f3PUhrnc/IehAS2BTPyDKEESGcXghwAA/1wEvygdFVGzTZ5iRNJrXwUfK0 YyY4GZpkfXBl7BFxwjM62DjrilWcCA3Lf4rs4qhBR+dS35frX4+bWrFaQ+Om2S4bI7TgBe 5uqasL1oMMu75SZBDYqeX5iMZPyDCys= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-691-jONtwDyTM7S2g6v3jwwkow-1; Fri, 26 Jan 2024 08:46:01 -0500 X-MC-Unique: jONtwDyTM7S2g6v3jwwkow-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6800e52d47aso35663166d6.1 for ; Fri, 26 Jan 2024 05:46:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706276760; x=1706881560; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gGKgT2BouFnH5blaH26ztR8G6CnT324T0Q33w49jIj8=; b=vB+O+LHJsdSEMX21a1ngyWIfr4w3a4Yv4vBbeii8YKrhJ7zpvtBLNQ5L2kVVtkPVEH VJwxK3MWvAnpcBESppasMdG64is2HgsSRNNXqdC7vqfFQvAWGcSPC5A2ZxAJp/6BgQ7y CaDR91RPrMmQ5bKkswlZPPOy0n6jIxHJsa2/JyaNyLFrlECcdegAcNK+5BYL2JKd8kzU mKTpYZKHaSmIIZTSTYsWCGODuqiq2Nvr2nDUFqhhX/fY+C5o/i6VnLClAYA5/GRlV9UK g6M/3GYDSQzofEZtl7v0/zJcwqr2YFF3YFBXBo8JfshjVHhukv3Zn97IXeWKNgUMZ2Jo dhxA== X-Gm-Message-State: AOJu0YwJK+j7SsWkUSKhvEuqqAWfNL/zMGSV6wyIE7CV7LilHAbntah9 D60mnYc+KilZUasWaNwHbtkgCJOsobZZouz3m2iwfS8d5ai1MMsWFo9COjCzCR/fbUC6kE+IoGb SEYP83VtmFOtzyNjNb6/WZ1LkO9DuBQIifW4TsyXgB9xPVbnGELSN X-Received: by 2002:a0c:da88:0:b0:681:929e:28cd with SMTP id z8-20020a0cda88000000b00681929e28cdmr1377272qvj.19.1706276760614; Fri, 26 Jan 2024 05:46:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXKYlPOQk0ygMtmSNAnT+cgcujEGgjsco4aR9b7xYzMbYrF8XJ08TBjdWESprAFCfhBHUXeA== X-Received: by 2002:a0c:da88:0:b0:681:929e:28cd with SMTP id z8-20020a0cda88000000b00681929e28cdmr1377232qvj.19.1706276760344; Fri, 26 Jan 2024 05:46:00 -0800 (PST) Received: from [192.168.0.9] (ip-109-43-176-119.web.vodafone.de. [109.43.176.119]) by smtp.gmail.com with ESMTPSA id qo12-20020a056214590c00b0068181b61183sm528291qvb.31.2024.01.26.05.45.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Jan 2024 05:45:59 -0800 (PST) Message-ID: <4ee5a881-4a23-4410-b6fd-b1124bce3dc5@redhat.com> Date: Fri, 26 Jan 2024 14:45:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 05/46] hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices() To: David Woodhouse , 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=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_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 , 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 References: <20240108204909.564514-1-dwmw2@infradead.org> <20240108204909.564514-6-dwmw2@infradead.org> <983ce258a214a0cbe6aeaabab01daed47a2e1066.camel@infradead.org> From: Thomas Huth Autocrypt: addr=thuth@redhat.com; keydata= xsFNBFH7eUwBEACzyOXKU+5Pcs6wNpKzrlJwzRl3VGZt95VCdb+FgoU9g11m7FWcOafrVRwU yYkTm9+7zBUc0sW5AuPGR/dp3pSLX/yFWsA/UB4nJsHqgDvDU7BImSeiTrnpMOTXb7Arw2a2 4CflIyFqjCpfDM4MuTmzTjXq4Uov1giGE9X6viNo1pxyEpd7PanlKNnf4PqEQp06X4IgUacW tSGj6Gcns1bCuHV8OPWLkf4hkRnu8hdL6i60Yxz4E6TqlrpxsfYwLXgEeswPHOA6Mn4Cso9O 0lewVYfFfsmokfAVMKWzOl1Sr0KGI5T9CpmRfAiSHpthhHWnECcJFwl72NTi6kUcUzG4se81 O6n9d/kTj7pzTmBdfwuOZ0YUSqcqs0W+l1NcASSYZQaDoD3/SLk+nqVeCBB4OnYOGhgmIHNW 0CwMRO/GK+20alxzk//V9GmIM2ACElbfF8+Uug3pqiHkVnKqM7W9/S1NH2qmxB6zMiJUHlTH gnVeZX0dgH27mzstcF786uPcdEqS0KJuxh2kk5IvUSL3Qn3ZgmgdxBMyCPciD/1cb7/Ahazr 3ThHQXSHXkH/aDXdfLsKVuwDzHLVSkdSnZdt5HHh75/NFHxwaTlydgfHmFFwodK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JGnS989E/fg6crv6NHae9Ckm7+lSs IQu4bBP2GxiRQ+NV3iV/KU3ebMRzqIC//DCOxzQNFNJAKldPe/bKZMCxEqtVoRkuJtNdp/5a yXFZ6TfE1hGKrDBYAm4vrnZ4CXFSBDllL59cFFOJCkn4Xboj/aVxxJxF30bn In-Reply-To: <983ce258a214a0cbe6aeaabab01daed47a2e1066.camel@infradead.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.313, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Sender: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org On 26/01/2024 12.25, David Woodhouse wrote: > On Fri, 2024-01-26 at 12:20 +0100, Thomas Huth wrote: >> On 26/01/2024 12.13, David Woodhouse wrote: >>> On Fri, 2024-01-26 at 11:43 +0100, Thomas Huth wrote: >>>> On 08/01/2024 21.26, David Woodhouse wrote: >>>>> From: David Woodhouse >>>>> >>>>> Eliminate direct access to nd_table[] and nb_nics by processing the the >>>>> Xen and ISA NICs first and then calling pci_init_nic_devices() for the >>>>> rest. >>>>> >>>>> Signed-off-by: David Woodhouse >>>>> Reviewed-by: Paul Durrant >>>>> --- >>>>>    hw/i386/pc.c                | 26 ++++++++++++++++---------- >>>>>    include/hw/net/ne2000-isa.h |  2 -- >>>>>    2 files changed, 16 insertions(+), 12 deletions(-) >>>>> >>>>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c >>>>> index 496498df3a..d80c536d88 100644 >>>>> --- a/hw/i386/pc.c >>>>> +++ b/hw/i386/pc.c >>>>> @@ -658,8 +658,11 @@ static void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd) >>>>>    { >>>>>        static int nb_ne2k = 0; >>>>> >>>>> -    if (nb_ne2k == NE2000_NB_MAX) >>>>> +    if (nb_ne2k == NE2000_NB_MAX) { >>>>> +        error_setg(&error_fatal, >>>>> +                   "maximum number of ISA NE2000 devices exceeded"); >>>>>            return; >>>>> +    } >>>> >>>> error_setg(&error_fatal, ...) quits QEMU, so the "return;" does not make >>>> much sense anymore. >>>> Now, according to include/qapi/error.h : >>>> >>>>    * Please don't error_setg(&error_fatal, ...), use error_report() and >>>>    * exit(), because that's more obvious. >>>> >>>> So I'd suggest to do that instead. >>> >>> It's going slightly in the opposite direction to what's requested in >>> https://lore.kernel.org/qemu-devel/34e2c0c6-4e04-486a-8e1f-4afdc461a5d4@linaro.org/ >>> >>> I was thinking that a future patch would let the &error_fatal be an >>> Error** passed in by the caller, and not actually hard-coded to be >>> fatal at all. >>> >>> But sure, unless Philippe objects I'm happy to do it as you show above. >> >> Now that you mention it, I'd also prefer having an Error** parameter to the >> function instead, that's certainly cleaner. So if you don't mind, please >> follow Philippe's suggestion instead! > > Right. There's a whole bunch of functions to untangle, that take an > Error** but don't return success/failure independently as they should. > Or don't even take the Error**. > > Rather than trying to fix that as part of this series, this was my > compromise — making it easy to switch that explicit &error_fatal out > for a function parameter, but not trying to shave that part of the yak > myself just yet. I think the nicest compromise is to add the "Error **errp" to the pc_init_ne2k_isa() and change the caller to pass in &error_fatal there ... further clean-up (passing the error even up further in the stack) is out of scope of this series, indeed. Thomas