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 33E07C77B7C for ; Tue, 9 May 2023 12:01:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM0s-0008A8-HZ; Tue, 09 May 2023 08:00:14 -0400 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 1pwM0l-00089d-OI for qemu-devel@nongnu.org; Tue, 09 May 2023 08:00:08 -0400 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 1pwM0j-0005Sq-L7 for qemu-devel@nongnu.org; Tue, 09 May 2023 08:00:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683633604; 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; bh=9eruX1xU0kSyUmT6Iz9QvGjV36rpRjfCr5CWvM8poI4=; b=T4/+4T0ZOyCUuvQsy1Bn65RMjaDuIT0utOZAQIlDSDZrMBjDrizfuc1eTGT477W4uocxXR gTia6eabjjaCAjCJejViU3AFj74UIG5MYCuvl3H9xDtAUGELlUoRDxNhQiD5py4xZ9As6L u+3WMBoaDpwkI8nG5/yS7E8LC+9F1zw= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-4I5lLG9wMgq1hiol8gWM3w-1; Tue, 09 May 2023 07:59:31 -0400 X-MC-Unique: 4I5lLG9wMgq1hiol8gWM3w-1 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-965cd056598so640246666b.0 for ; Tue, 09 May 2023 04:59:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683633570; x=1686225570; h=content-transfer-encoding:in-reply-to: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=9eruX1xU0kSyUmT6Iz9QvGjV36rpRjfCr5CWvM8poI4=; b=jmy3PyAmkTPeFnNL71BZO6tzzKDvYHml3Fwj74MtoAdGGq/UmVPpOgxVxCMAMn4BNo qGvm2jSQNhN1CspZ35JHY5qnPg2kyulGiyuc7OW+g9fDryMJQdv4UkhmdgcvjV2sKUfs 01055bg89qeUnF7TrolKaYO/8QgmKSgeXwGqmzIu99rtPqJYy1NrGJyT2B3pFyBQpm6/ NgYF8d6+nMEUXI3txfHExFci7gAtPrIJyKurELgjJeene7GtTCqF3fWrBzliuKqCBAKW dasqjpgVjuZREFpKNltqntL8Sb/M4X0PtdiyhSlhBqDxjgB9eKw1RCtXUPNHY6Mfvtei 6u2g== X-Gm-Message-State: AC+VfDy44uhkXWQJx7y7Zl5IXxIwrhUOSp7jtQEbpyMERqF8BVPfwgwE Imep2+MNedtuqoUUjsu1bdrsBddt+W9UxnZ9fff2YKbhVirOl0d2V8Qg+YH/1edYtLYuhwy7gbX BuqUVuFMpaVMsb1M= X-Received: by 2002:a17:907:96ac:b0:948:a1ae:b2c4 with SMTP id hd44-20020a17090796ac00b00948a1aeb2c4mr14233137ejc.6.1683633570032; Tue, 09 May 2023 04:59:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ544JYtH8LpCO9uuM42FYSV20eB2pwuXTIgsc0QbKXijndLrZGQZvwXLkOGnE34jXV3w6qs3Q== X-Received: by 2002:a17:907:96ac:b0:948:a1ae:b2c4 with SMTP id hd44-20020a17090796ac00b00948a1aeb2c4mr14233115ejc.6.1683633569647; Tue, 09 May 2023 04:59:29 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:9af8:e5f5:7516:fa89? ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.googlemail.com with ESMTPSA id ev21-20020a17090729d500b00965b416585bsm1259833ejc.118.2023.05.09.04.59.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 May 2023 04:59:29 -0700 (PDT) Message-ID: Date: Tue, 9 May 2023 13:59:27 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 05/22] hw/arm: Select VIRTIO_NET for virt machine Content-Language: en-US To: =?UTF-8?Q?Alex_Benn=c3=a9e?= Cc: Peter Maydell , Fabiano Rosas , qemu-devel , Laurent Vivier , Artyom Tarasenko , "Edgar E. Iglesias" , Wainer dos Santos Moschetta , Thomas Huth , Leif Lindholm , Gerd Hoffmann , Helge Deller , Xiaojuan Yang , Stefan Hajnoczi , Cleber Rosa , Eduardo Habkost , Juan Quintela , John Snow , Yoshinori Sato , =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , Ilya Leoshkevich , Pavel Dovgalyuk , Andrew Jeffery , qemu-s390x , Richard Henderson , qemu-arm , Bastian Koppelmann , Beraldo Leal , Max Filippov , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Mark Cave-Ayland , Jiaxun Yang , Radoslaw Biernacki , Aurelien Jarno , David Hildenbrand , Markus Armbruster , Song Gao , Joel Stanley , =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= References: <20230503091244.1450613-1-alex.bennee@linaro.org> <20230503091244.1450613-6-alex.bennee@linaro.org> <531a2eab-f0e6-46a5-c021-c82746c1ae38@redhat.com> <87y1m5s9yl.fsf@linaro.org> <5fb214d8-4a54-f896-f23f-fe9e646e4b2d@redhat.com> <878re4cl1u.fsf@suse.de> <70da6b28-d731-7e3b-b5a6-7d9983389d57@redhat.com> <878rdxbuoe.fsf@linaro.org> From: Paolo Bonzini In-Reply-To: <878rdxbuoe.fsf@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.421, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@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-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 5/9/23 13:37, Alex Bennée wrote: >> Then, an accurate description that uses "functional" in that sense >> could be as follows: >> >> The Kconfig system will include any devices and subsystems that are >> mandatory for a given machine type, and will flag any configuration >> conflicts. However, the person doing the configuration still needs to >> know which devices are needed (on top of the mandatory ones) to obtain >> a functional guest, and Kconfig will not provide any hints in this >> respect. > > So I thought that was the model I was following in adding devices but it > seems I don't understand the no-defaults behaviour. What is the > difference between a device that is added in the machine.c that makes it > required or expendable with -nodefaults? First of all let's look at softmmu/vl.c, which is what creates the backends of the default devices. These backends are basically automatic command line options of the "old" kind that directs both the creation of a backend and how it's associated to a device. For example, if you have neither a -serial option nor a "-device isa-serial" option, vl.c's qemu_create_default_devices() will create the machine as if you specified one of "-serial mon:stdio", "-serial stdio" or "-serial vc:80Cx24C"; if you have none of -netdev/nic/-net, it will literally add two "-net" command line options corresponding to "-net nic -net user"; and so on for many other devices unless the board opts out (CD-ROM, floppy, SD card, parallel). There's also a default monitor which is a bit out of topic here. In any case, the effect of these "old" command line options is to populate various arrays, for example serial_hds[] for serial ports and nd_table[] for NIC backends. There are then two ways that a board can process these arrays. It can either _always_ create the device and possibly leave it not connected to any backend, or it can create the device only if the backend exists. Looking at qemu-system-aarch64's "-M virt", pl011 is always created with create_uart(), i.e. even with "-nodefaults"; NICs instead are only created if the backend exists (search for "nd_table" in hw/arm/virt.c). In the former case, the device will have to be select-ed in Kconfig. In the latter case, instead, the device will have an "imply" directive, and will be left out by --without-default-devices. Paolo