qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 05/22] hw/arm: Select VIRTIO_NET for virt machine


From: Paolo Bonzini
Subject: Re: [PATCH 05/22] hw/arm: Select VIRTIO_NET for virt machine
Date: Tue, 9 May 2023 13:59:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]