From: "Alex Bennée" <alex.bennee@linaro.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-devel@nongnu.org, "Eduardo Habkost" <ehabkost@redhat.com>
Subject: Re: [PATCH v2 02/21] docs: collect the disparate device emulation docs into one section
Date: Mon, 19 Jul 2021 09:34:36 +0100 [thread overview]
Message-ID: <878s22r8e3.fsf@linaro.org> (raw)
In-Reply-To: <8735sgds41.fsf@dusky.pond.sub.org>
Markus Armbruster <armbru@redhat.com> writes:
> Cc: QOM maintainers for additional eyes.
>
> Alex Bennée <alex.bennee@linaro.org> writes:
>
>> While we are at it add a brief preamble that explains some of the
>> common concepts in QEMU's device emulation which will hopefully lead
>> to less confusing about our dizzying command line options.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Message-Id: <20210714093638.21077-3-alex.bennee@linaro.org>
>> ---
>> docs/system/device-emulation.rst | 78 +++++++++++++++++++++++
>> docs/system/{ => devices}/ivshmem.rst | 0
>> docs/system/{ => devices}/net.rst | 0
>> docs/system/{ => devices}/nvme.rst | 0
>> docs/system/{ => devices}/usb.rst | 0
>> docs/system/{ => devices}/virtio-pmem.rst | 0
>> docs/system/index.rst | 6 +-
>> 7 files changed, 79 insertions(+), 5 deletions(-)
>> create mode 100644 docs/system/device-emulation.rst
>> rename docs/system/{ => devices}/ivshmem.rst (100%)
>> rename docs/system/{ => devices}/net.rst (100%)
>> rename docs/system/{ => devices}/nvme.rst (100%)
>> rename docs/system/{ => devices}/usb.rst (100%)
>> rename docs/system/{ => devices}/virtio-pmem.rst (100%)
>>
>> diff --git a/docs/system/device-emulation.rst b/docs/system/device-emulation.rst
>> new file mode 100644
>> index 0000000000..3156eeac2d
>> --- /dev/null
>> +++ b/docs/system/device-emulation.rst
>> @@ -0,0 +1,78 @@
>> +.. _device-emulation:
>> +
>> +Device Emulation
>> +----------------
>> +
>> +QEMU supports the emulation of a large number of devices from
>> +peripherals such network cards and USB devices to integrated systems
>> +on a chip (SoCs). Configuration of these is often a source of
>> +confusion so it helps to have an understanding of some of the terms
>> +used to describes devices within QEMU.
>> +
>> +Common Terms
>> +~~~~~~~~~~~~
>> +
>> +Device Front End
>> +================
>> +
>> +A device front end is how a device is presented to the guest. The type
>> +of device presented should match the hardware that the guest operating
>> +system is expecting to see. All devices can be specified with the
>> +``--device`` command line option. Running QEMU with the command line
>> +options ``--device help`` will list all devices it is aware of. Using
>> +the command line ``--device foo,help`` will list the additional
>> +configuration options available for that device.
>> +
>> +A front end is often paired with a back end, which describes how the
>> +host's resources are used in the emulation.
>> +
>> +Device Buses
>> +============
>> +
>> +All devices exist on a BUS. Depending on the machine model you choose
>
> This isn't true anymore; there are bus-less devices. To show the
> user-pluggable ones, try
>
> $ qemu-system-FOO -device help | grep -v '", bus'
Are they user-pluggable though? Aside from strange cases like loaders
most of them look like SoC specific adornments which I suspect would
make no sense to attach to another machine type. x86_64 seems to be a
special case has all the various CPU types show up as non-bus devices.
>
>> +(``-M foo``) a number of buses will have been automatically created.
>> +In most cases the BUS a device is attached to can be inferred, for
>> +example PCI devices are generally automatically allocated to the next
>> +free slot of the PCI bus. However in complicated configurations you
>
> "The PCI bus" tacitly assumes there's just one.
>
> We actually pick the first bus (in qtree pre-order) that can take
> another device. Best not to rely on the search order; if you care which
> bus to plug into, specify it with bus=ID.
>
> "Next free slot" is about the device address on the bus. Should we
> explain the concept "device address on a bus"?
>
>> +can explicitly specify what bus a device is attached to and its
>> +address. Some devices, for example a PCI SCSI host controller, will
>> +add an additional bus to the system that other devices can be attached
>
> A device can add more than one bus.
So how about:
Most devices will exist on a BUS of some sort. Depending on the
machine model you choose (``-M foo``) a number of buses will have been
automatically created. In most cases the BUS a device is attached to
can be inferred, for example PCI devices are generally automatically
allocated to the next free address of first PCI bus found. However in
complicated configurations you can explicitly specify what bus
(``bus=ID``) a device is attached to along with its address
(``addr=N``). Some devices, for example a PCI SCSI host controller,
will add an additional buses to the system that other devices can be
attached to. A hypothetical chain of devices might look like:
--device foo,bus=pci.0,addr=0,id=foo.0
--device bar,bus=foo.0,addr=1,id=baz
which would be a bar device (with the ID of baz) which is attached to
the foo bus foo.0 which itself is attached to the first slot of a PCI
bus pci.0
Maybe we should add a section about device IDs?
--
Alex Bennée
next prev parent reply other threads:[~2021-07-19 8:55 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 18:20 [PATCH v2 00/21] documentation and metadata updates Alex Bennée
2021-07-14 18:20 ` [PATCH v2 01/21] gitignore: Update with some filetypes Alex Bennée
2021-07-14 18:20 ` [PATCH v2 02/21] docs: collect the disparate device emulation docs into one section Alex Bennée
2021-07-15 6:10 ` Markus Armbruster
2021-07-19 8:34 ` Alex Bennée [this message]
2021-07-20 13:09 ` Markus Armbruster
2021-07-14 18:20 ` [PATCH v2 03/21] docs: add a section on the generalities of vhost-user Alex Bennée
2021-07-15 10:06 ` Stefan Hajnoczi
2021-07-14 18:20 ` [PATCH v2 04/21] configure: remove needless if leg Alex Bennée
2021-07-16 16:08 ` Richard Henderson
2021-07-14 18:20 ` [PATCH v2 05/21] contrib/gitdm: add some new aliases to fix up commits Alex Bennée
2021-07-16 16:09 ` Richard Henderson
2021-07-14 18:20 ` [PATCH v2 06/21] .mailmap: fix up some broken commit authors Alex Bennée
2021-07-14 18:20 ` [PATCH v2 07/21] contrib/gitdm: add domain-map for MontaVista Alex Bennée
2021-07-14 18:20 ` [PATCH v2 08/21] contrib/gitdm: add a group mapping for robot scanners Alex Bennée
2021-07-14 18:20 ` [PATCH v2 09/21] gitdm.config: sort the corporate GroupMap entries Alex Bennée
2021-07-14 18:20 ` [PATCH v2 10/21] contrib/gitdm: add domain-map/group-map mappings for Samsung Alex Bennée
2021-07-15 5:49 ` Klaus Jensen
2021-07-15 9:06 ` Alex Bennée
2021-07-14 18:20 ` [PATCH v2 11/21] contrib/gitdm: add domain-map for Eldorado Alex Bennée
2021-07-14 18:20 ` [PATCH v2 12/21] contrib/gitdm: add domain-map/group-map for Wind River Alex Bennée
2021-07-14 18:20 ` [PATCH v2 13/21] contrib/gitdm: un-ironically add a mapping for LWN Alex Bennée
2021-07-14 18:20 ` [PATCH v2 14/21] contrib/gitdm: add domain-map for Crudebyte Alex Bennée
2021-07-14 18:20 ` [PATCH v2 15/21] contrib/gitdm: add domain-map for ZTE Alex Bennée
2021-07-14 18:20 ` [PATCH v2 16/21] contrib/gitdm: add domain-map for Syrmia Alex Bennée
2021-07-14 18:20 ` [PATCH v2 17/21] contrib/gitdm: add domain-map for NVIDIA Alex Bennée
2021-07-15 15:01 ` Kirti Wankhede
2021-07-14 18:20 ` [PATCH v2 18/21] contrib/gitdm: add group-map for Netflix Alex Bennée
2021-07-14 18:20 ` [PATCH v2 19/21] contrib/gitdm: add an explicit academic entry for BU Alex Bennée
2021-07-14 18:39 ` Alexander Bulekov
2021-07-14 18:20 ` [PATCH v2 20/21] contrib/gitdm: add a new interns group-map for GSoC/Outreachy work Alex Bennée
2021-07-15 14:31 ` Mahmoud Mandour
2021-07-14 18:20 ` [PATCH v2 21/21] contrib/gitdm: add more individual contributor entries Alex Bennée
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878s22r8e3.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).