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 259FFC48260 for ; Fri, 26 Jan 2024 13:46:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.672009.1045580 (Exim 4.92) (envelope-from ) id 1rTMX4-0004uK-4e; Fri, 26 Jan 2024 13:46:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 672009.1045580; Fri, 26 Jan 2024 13:46:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rTMX4-0004uD-1E; Fri, 26 Jan 2024 13:46:10 +0000 Received: by outflank-mailman (input) for mailman id 672009; Fri, 26 Jan 2024 13:46:08 +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 1rTMX2-0004u7-RQ for xen-devel@lists.xenproject.org; Fri, 26 Jan 2024 13:46:08 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3eceb771-bc51-11ee-98f5-efadbce2ee36; Fri, 26 Jan 2024 14:46:04 +0100 (CET) Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-685-UHJ6FfAoNoq31H08sGPzNA-1; Fri, 26 Jan 2024 08:46:01 -0500 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6800e52d47aso35662996d6.1 for ; Fri, 26 Jan 2024 05:46:01 -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) 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 Sender: "Xen-devel" X-Inumbo-ID: 3eceb771-bc51-11ee-98f5-efadbce2ee36 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= X-MC-Unique: UHJ6FfAoNoq31H08sGPzNA-1 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=Yvn6tXclspozjl4RdOY894o874qPKxDAdd5c1eju/jP81SMCcmY5ATDMndxZNfmskm plCcqvX6wgO9PdLj1aObANakzb4h36K4mLobvtlyIRZIsr0QDUBqDWWQgk0K876xIrFF fOqbI/Y4mLoHWyqFtQR+KN4e0d4XK9QM4lPv3KJma2P8ycegIAyqFxF91AmnlHDiiOiv HqOay3IsNnwPIt9/Iy9qsdfPmELH/LqsNtIwZqDecRw1ZlAqsc+mJ+3o5vEUyZCR1plq hlRSyg6zwSkrAFzEMKNo2tOt/76RUHlDKfYwaNJY9H2uBDE6fw9dC2IFlwGL/UlIORHP 92Ag== X-Gm-Message-State: AOJu0YwisA/GP4dYj2fpGQH0EUI4+CvwTaXCqJSLO2rG/k7GNdxJncgl LcdAv1ivCtEim11DaV7WWvreahPOacnRDvJo1UBNZQ79BSlOhDaALFvMOwTOwAKxAe4TWbRsccf IhShiYExRZ2ntfD8//cuFYt0hBntCt+1ySnT08Y5lWyU7cPX6YvLpaEBLv+vRzaGu X-Received: by 2002:a0c:da88:0:b0:681:929e:28cd with SMTP id z8-20020a0cda88000000b00681929e28cdmr1377299qvj.19.1706276760654; 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) 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 0lewVYfFfsmokfAVMKWzOl1Sr0KGI5T9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DxUjsk3UBHZx+IhFjs2siVZi5wnHIqM7eK9abr2cK2weInTBwXwqVWjsXZ4tq5+jQrwDK cvxIcwXdUTLGxc4/Z/VRH1PZSvfQxdxMGmNTGaXVNfdFZjm4fz0mz+OUi6AHC4CZpwnsliGV ODqwX8Y1zic9viSTbKS01ZNp175POyWViUk9qisPZB7ypfSIVSEULrL347qY/hm9ahhqmn17 Ng255syASv3ehvX7iwWDfzXbA0/TVaqwa1YIkec+/8miicV0zMP9siRcYQkyTqSzaTFBBmqD oiT+z+/E59qj/EKfyce3sbC9XLjXv3mHMrq1tKX4G7IJGnS989E/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 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