qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"Ed Maste" <emaste@freebsd.org>, "Thomas Huth" <thuth@redhat.com>,
	"Alexandre Iooss" <erdnaxe@crans.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Jagannathan Raman" <jag.raman@oracle.com>,
	"John G Johnson" <john.g.johnson@oracle.com>,
	"Mahmoud Mandour" <ma.mandourr@gmail.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Bandan Das" <bsd@redhat.com>,
	"Elena Ufimtseva" <elena.ufimtseva@oracle.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Beraldo Leal" <bleal@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Qiuhao Li" <Qiuhao.Li@outlook.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Alexander Bulekov" <alxndr@bu.edu>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"John Snow" <jsnow@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Darren Kenny" <darren.kenny@oracle.com>,
	qemu-arm@nongnu.org, "Yanan Wang" <wangyanan55@huawei.com>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Li-Wen Hsu" <lwhsu@freebsd.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Kashyap Chamarthy" <kchamart@redhat.com>
Subject: [PATCH v2 22/35] docs: add an introduction to the system docs
Date: Tue, 24 Jan 2023 18:01:14 +0000	[thread overview]
Message-ID: <20230124180127.1881110-23-alex.bennee@linaro.org> (raw)
In-Reply-To: <20230124180127.1881110-1-alex.bennee@linaro.org>

Drop the frankly misleading quickstart section for a more rounded
introduction section. This new section gives an overview of the
accelerators as well as a high level introduction to some of the key
features of the emulator. We also expand on a general form for a QEMU
command line with a hopefully not too scary worked example of what
this looks like.

Acked-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Kashyap Chamarthy <kchamart@redhat.com>

---
v2
  - integrated Kashyap's comments
  - used -blockdev for pflash
  - remove extra whitespace
  - some punctuation fixes from Peter
  - make it clearer TCG is the default accelerator
---
 docs/interop/live-block-operations.rst |   2 +
 docs/interop/qemu-qmp-ref.rst          |   2 +
 docs/system/index.rst                  |   2 +-
 docs/system/introduction.rst           | 220 +++++++++++++++++++++++++
 docs/system/multi-process.rst          |   2 +
 docs/system/quickstart.rst             |  21 ---
 qemu-options.hx                        |   3 +
 7 files changed, 230 insertions(+), 22 deletions(-)
 create mode 100644 docs/system/introduction.rst
 delete mode 100644 docs/system/quickstart.rst

diff --git a/docs/interop/live-block-operations.rst b/docs/interop/live-block-operations.rst
index 135784ab33..691429c7af 100644
--- a/docs/interop/live-block-operations.rst
+++ b/docs/interop/live-block-operations.rst
@@ -4,6 +4,8 @@
     This work is licensed under the terms of the GNU GPL, version 2 or
     later.  See the COPYING file in the top-level directory.
 
+.. _Live Block Operations:
+
 ============================
 Live Block Device Operations
 ============================
diff --git a/docs/interop/qemu-qmp-ref.rst b/docs/interop/qemu-qmp-ref.rst
index 357effd64f..f94614a0b2 100644
--- a/docs/interop/qemu-qmp-ref.rst
+++ b/docs/interop/qemu-qmp-ref.rst
@@ -1,3 +1,5 @@
+.. _QMP Ref:
+
 QEMU QMP Reference Manual
 =========================
 
diff --git a/docs/system/index.rst b/docs/system/index.rst
index 282b6ffb56..3605bbe1ce 100644
--- a/docs/system/index.rst
+++ b/docs/system/index.rst
@@ -12,7 +12,7 @@ or Hypervisor.Framework.
 .. toctree::
    :maxdepth: 3
 
-   quickstart
+   introduction
    invocation
    device-emulation
    keys
diff --git a/docs/system/introduction.rst b/docs/system/introduction.rst
new file mode 100644
index 0000000000..a4a6130b02
--- /dev/null
+++ b/docs/system/introduction.rst
@@ -0,0 +1,220 @@
+Introduction
+============
+
+Virtualisation Accelerators
+---------------------------
+
+QEMU's system emulation provides a virtual model of a machine (CPU,
+memory and emulated devices) to run a guest OS. It supports a number
+of hypervisors (known as accelerators) as well as a JIT known as the
+Tiny Code Generator (TCG) capable of emulating many CPUs.
+
+.. list-table:: Supported Accelerators
+  :header-rows: 1
+
+  * - Accelerator
+    - Host OS
+    - Host Architectures
+  * - KVM
+    - Linux
+    - Arm (64 bit only), MIPS, PPC, RISC-V, s390x, x86
+  * - Xen
+    - Linux (as dom0)
+    - Arm, x86
+  * - Intel HAXM (hax)
+    - Linux, Windows
+    - x86
+  * - Hypervisor Framework (hvf)
+    - MacOS
+    - x86 (64 bit only), Arm (64 bit only)
+  * - Windows Hypervisor Platform (wphx)
+    - Windows
+    - x86
+  * - NetBSD Virtual Machine Monitor (nvmm)
+    - NetBSD
+    - x86
+  * - Tiny Code Generator (tcg)
+    - Linux, other POSIX, Windows, MacOS
+    - Arm, x86, Loongarch64, MIPS, PPC, s390x, Sparc64
+
+Feature Overview
+----------------
+
+System emulation provides a wide range of device models to emulate
+various hardware components you may want to add to your machine. This
+includes a wide number of VirtIO devices which are specifically tuned
+for efficient operation under virtualisation. Some of the device
+emulation can be offloaded from the main QEMU process using either
+vhost-user (for VirtIO) or :ref:`Multi-process QEMU`. If the platform
+supports it QEMU also supports directly passing devices through to
+guest VMs to eliminate the device emulation overhead. See
+:ref:`device-emulation` for more details.
+
+There is a full :ref:`featured block layer<Live Block Operations>`
+which allows for construction of complex storage topology which can be
+stacked across multiple layers supporting redirection, networking,
+snapshots and migration support.
+
+The flexible ``chardev`` system allows for handling IO from character
+like devices using stdio, files, unix sockets and TCP networking.
+
+QEMU provides a number of management interfaces including a line based
+:ref:`Human Monitor Protocol (HMP)<QEMU monitor>` that allows you to
+dynamically add and remove devices as well as introspect the system
+state. The :ref:`QEMU Monitor Protocol<QMP Ref>` (QMP) is a well
+defined, versioned, machine usable API that presents a rich interface
+to other tools to create, control and manage Virtual Machines. This is
+the interface used by higher level tools interfaces such as `Virt
+Manager <https://virt-manager.org/>`_ using the `libvirt framework
+<https://libvirt.org>`_.
+
+For the common accelerators QEMU, supported debugging with its
+:ref:`gdbstub<GDB usage>` which allows users to connect GDB and debug
+system software images.
+
+Running
+-------
+
+QEMU provides a rich and complex API which can be overwhelming to
+understand. While some architectures can boot something with just a
+disk image, those examples elide a lot of details with defaults that
+may not be optimal for modern systems.
+
+For a non-x86 system where we emulate a broad range of machine types,
+the command lines are generally more explicit in defining the machine
+and boot behaviour. You will find often find example command lines in
+the :ref:`system-targets-ref` section of the manual.
+
+While the project doesn't want to discourage users from using the
+command line to launch VMs, we do want to highlight that there are a
+number of projects dedicated to providing a more user friendly
+experience. Those built around the ``libvirt`` framework can make use
+of feature probing to build modern VM images tailored to run on the
+hardware you have.
+
+That said, the general form of a QEMU command line can be expressed
+as:
+
+.. parsed-literal::
+
+  $ |qemu_system| [machine opts] \\
+                  [cpu opts] \\
+                  [accelerator opts] \\
+                  [device opts] \\
+                  [backend opts] \\
+                  [interface opts] \\
+                  [boot opts] 
+
+Most options will generate some help information. So for example:
+
+.. parsed-literal::
+
+   $ |qemu_system| -M help
+
+will list the machine types supported by that QEMU binary. ``help``
+can also be passed as an argument to another option. For example:
+
+.. parsed-literal::
+
+  $ |qemu_system| -device scsi-hd,help
+
+will list the arguments and their default values of additional options
+that can control the behaviour of the ``scsi-hd`` device.
+
+.. list-table:: Options Overview
+  :header-rows: 1
+  :widths: 10, 90
+
+  * - Options
+    -
+  * - Machine
+    - Define the :ref:`machine type<Machine Options>`, amount of memory etc
+  * - CPU
+    - Type and number/topology of vCPUs. Most accelerators offer
+      a ``host`` cpu option which simply passes through your host CPU
+      configuration without filtering out any features.
+  * - Accelerator
+    - This will depend on the hypervisor you run. Note that the
+      default is TCG, which is purely emulated, so you must specify an
+      accelerator type to take advantage of hardware virtualization.
+  * - Devices
+    - Additional devices that are not defined by default with the
+      machine type.
+  * - Backends
+    - Backends are how QEMU deals with the guest's data, for example
+      how a block device is stored, how network devices see the
+      network or how a serial device is directed to the outside world.
+  * - Interfaces
+    - How the system is displayed, how it is managed and controlled or
+      debugged.
+  * - Boot
+    - How the system boots, via firmware or direct kernel boot.
+
+In the following example we first define a ``virt`` machine which is a
+general purpose platform for running Aarch64 guests. We enable
+virtualisation so we can use KVM inside the emulated guest. As the
+``virt`` machine comes with some built in pflash devices we give them
+names so we can override the defaults later.
+
+.. code::
+
+ $ qemu-system-aarch64 \
+    -machine type=virt,virtualization=on,pflash0=rom,pflash1=efivars \
+    -m 4096 \
+
+We then define the 4 vCPUs using the ``max`` option which gives us all
+the Arm features QEMU is capable of emulating. We enable a more
+emulation friendly implementation of Arm's pointer authentication
+algorithm. We explicitly specify TCG acceleration even though QEMU
+would default to it anyway.
+
+.. code::
+
+ -cpu max,pauth-impdef=on \
+ -smp 4 \
+ -accel tcg \
+
+As the ``virt`` platform doesn't have any default network or storage
+devices we need to define them. We give them ids so we can link them
+with the backend later on.
+
+.. code::
+
+ -device virtio-net-pci,netdev=unet \
+ -device virtio-scsi-pci \
+ -device scsi-hd,drive=hd \
+
+We connect the user-mode networking to our network device. As
+user-mode networking isn't directly accessible from the outside world
+we forward localhost port 2222 to the ssh port on the guest.
+
+.. code::
+
+ -netdev user,id=unet,hostfwd=tcp::2222-:22 \
+
+We connect the guest visible block device to an LVM partition we have
+set aside for our guest.
+
+.. code::
+
+ -blockdev driver=raw,node-name=hd,file.driver=host_device,file.filename=/dev/lvm-disk/debian-bullseye-arm64 \
+
+We then tell QEMU to multiplex the :ref:`QEMU monitor` with the serial
+port output (we can switch between the two using :ref:`keys in the
+character backend multiplexer`). As there is no default graphical
+device we disable the display as we can work entirely in the terminal.
+
+.. code::
+
+ -serial mon:stdio \
+ -display none \
+
+Finally we override the default firmware to ensure we have some
+storage for EFI to persist its configuration. That firmware is
+responsible for finding the disk, booting grub and eventually running
+our system.
+
+.. code::
+
+ -blockdev node-name=rom,driver=file,filename=(pwd)/pc-bios/edk2-aarch64-code.fd,read-only=true \
+ -blockdev node-name=efivars,driver=file,filename=$HOME/images/qemu-arm64-efivars
diff --git a/docs/system/multi-process.rst b/docs/system/multi-process.rst
index 210531ee17..16f0352416 100644
--- a/docs/system/multi-process.rst
+++ b/docs/system/multi-process.rst
@@ -1,3 +1,5 @@
+.. _Multi-process QEMU:
+
 Multi-process QEMU
 ==================
 
diff --git a/docs/system/quickstart.rst b/docs/system/quickstart.rst
deleted file mode 100644
index 681678c86e..0000000000
--- a/docs/system/quickstart.rst
+++ /dev/null
@@ -1,21 +0,0 @@
-.. _pcsys_005fquickstart:
-
-Quick Start
------------
-
-Download and uncompress a PC hard disk image with Linux installed (e.g.
-``linux.img``) and type:
-
-.. parsed-literal::
-
-   |qemu_system| linux.img
-
-Linux should boot and give you a prompt.
-
-Users should be aware the above example elides a lot of the complexity
-of setting up a VM with x86_64 specific defaults and assumes the
-first non switch argument is a PC compatible disk image with a boot
-sector. For a non-x86 system where we emulate a broad range of machine
-types, the command lines are generally more explicit in defining the
-machine and boot behaviour. You will find more example command lines
-in the :ref:`system-targets-ref` section of the manual.
diff --git a/qemu-options.hx b/qemu-options.hx
index 4508a00c59..fd5347657a 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -20,6 +20,9 @@ DEF("version", 0, QEMU_OPTION_version,
 SRST
 ``-version``
     Display version information and exit
+
+    .. _Machine Options:
+
 ERST
 
 DEF("machine", HAS_ARG, QEMU_OPTION_machine, \
-- 
2.34.1



  parent reply	other threads:[~2023-01-24 18:04 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 18:00 [PATCH v2 00/35] maintainer tree pre-PR (testing/docs/semihosting/plugins) Alex Bennée
2023-01-24 18:00 ` [PATCH v2 01/35] scripts/ci: update gitlab-runner playbook to use latest runner Alex Bennée
2023-01-24 19:49   ` Richard Henderson
2023-01-24 18:00 ` [PATCH v2 02/35] gitlab: add FF_SCRIPT_SECTIONS for timings Alex Bennée
2023-01-25 12:09   ` Philippe Mathieu-Daudé
2023-01-25 12:15   ` Daniel P. Berrangé
2023-01-24 18:00 ` [PATCH v2 03/35] gitlab: just use plain --cc=clang for custom runner build Alex Bennée
2023-01-24 18:00 ` [PATCH v2 04/35] tests/unit: drop hacky race avoidance in test-io-channel-command Alex Bennée
2023-01-24 18:00 ` [PATCH v2 05/35] build-sys: fix crlf-ending C code Alex Bennée
2023-01-24 18:00 ` [PATCH v2 06/35] .gitlab-ci.d/windows: do not disable opengl Alex Bennée
2023-01-24 18:00 ` [PATCH v2 07/35] meson: replace Perl usage with Python Alex Bennée
2023-01-24 18:01 ` [PATCH v2 08/35] docs: drop texinfo options Alex Bennée
2023-01-24 18:01 ` [PATCH v2 09/35] gitlab: add lsan suppression file to workaround tcmalloc issues Alex Bennée
2023-01-25  7:44   ` Thomas Huth
2023-01-25 12:13   ` Philippe Mathieu-Daudé
2023-01-24 18:01 ` [PATCH v2 10/35] Update lcitool and fedora to 37 Alex Bennée
2023-01-24 18:01 ` [PATCH v2 11/35] lcitool: drop perl from QEMU project/dependencies Alex Bennée
2023-01-24 18:01 ` [PATCH v2 12/35] lcitool: drop texinfo " Alex Bennée
2023-01-24 18:01 ` [PATCH v2 13/35] tests/docker: Install flex in debian-tricore-cross Alex Bennée
2023-01-24 18:01 ` [PATCH v2 14/35] tests/docker: drop debian-tricore-cross's partial status Alex Bennée
2023-01-24 18:01 ` [PATCH v2 15/35] tests/tcg: skip the vma-pthread test on CI Alex Bennée
2023-01-24 18:01 ` [PATCH v2 16/35] tests/tcg: Use SIGKILL for timeout Alex Bennée
2023-01-25 12:14   ` Philippe Mathieu-Daudé
2023-01-24 18:01 ` [PATCH v2 17/35] gitlab: wrap up test results for custom runners Alex Bennée
2023-01-24 18:01 ` [PATCH v2 18/35] MAINTAINERS: Fix the entry for tests/tcg/nios2 Alex Bennée
2023-01-24 18:01 ` [PATCH v2 19/35] docs: add hotlinks to about preface text Alex Bennée
2023-01-25 12:16   ` Philippe Mathieu-Daudé
2023-01-24 18:01 ` [PATCH v2 20/35] docs: add a new section to outline emulation support Alex Bennée
2023-01-25  7:58   ` Thomas Huth
2023-01-25 12:18     ` Philippe Mathieu-Daudé
2023-01-24 18:01 ` [PATCH v2 21/35] semihosting: add semihosting section to the docs Alex Bennée
2023-01-24 18:01 ` Alex Bennée [this message]
2023-01-25  7:53   ` [PATCH v2 22/35] docs: add an introduction to the system docs Thomas Huth
2023-01-24 18:01 ` [PATCH v2 23/35] semihosting: Write back semihosting data before completion callback Alex Bennée
2023-01-25 23:21   ` Philippe Mathieu-Daudé
2023-01-24 18:01 ` [PATCH v2 24/35] semihosting: add O_BINARY flag in host_open for NT compatibility Alex Bennée
2023-01-24 18:01 ` [PATCH v2 25/35] tests/tcg: add memory-sve test for aarch64 Alex Bennée
2023-01-24 18:01 ` [PATCH v2 26/35] cpu: free cpu->tb_jmp_cache with RCU Alex Bennée
2023-01-24 18:01 ` [PATCH v2 27/35] util/qht: add missing atomic_set(hashes[i]) Alex Bennée
2023-01-24 18:01 ` [PATCH v2 28/35] thread: de-const qemu_spin_destroy Alex Bennée
2023-01-24 18:01 ` [PATCH v2 29/35] util/qht: use striped locks under TSAN Alex Bennée
2023-01-24 18:01 ` [PATCH v2 30/35] plugins: make qemu_plugin_user_exit's locking order consistent with fork_start's Alex Bennée
2023-01-24 18:01 ` [PATCH v2 31/35] plugins: fix optimization in plugin_gen_disable_mem_helpers Alex Bennée
2023-01-24 18:01 ` [PATCH v2 32/35] translator: always pair plugin_gen_insn_{start, end} calls Alex Bennée
2023-01-24 18:01 ` [PATCH v2 33/35] tcg: exclude non-memory effecting helpers from instrumentation Alex Bennée
2023-01-24 19:44   ` Richard Henderson
2023-01-24 18:01 ` [PATCH v2 34/35] cpu-exec: assert that plugin_mem_cbs is NULL after execution Alex Bennée
2023-01-24 19:46   ` Richard Henderson
2023-01-25 23:27   ` Philippe Mathieu-Daudé
2023-01-24 18:01 ` [PATCH v2 35/35] plugins: Iterate on cb_lists in qemu_plugin_user_exit Alex Bennée
2023-01-25 23:26   ` Philippe Mathieu-Daudé

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=20230124180127.1881110-23-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=Qiuhao.Li@outlook.com \
    --cc=alxndr@bu.edu \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=bleal@redhat.com \
    --cc=bsd@redhat.com \
    --cc=crosa@redhat.com \
    --cc=darren.kenny@oracle.com \
    --cc=eduardo@habkost.net \
    --cc=elena.ufimtseva@oracle.com \
    --cc=emaste@freebsd.org \
    --cc=erdnaxe@crans.org \
    --cc=jag.raman@oracle.com \
    --cc=john.g.johnson@oracle.com \
    --cc=jsnow@redhat.com \
    --cc=kchamart@redhat.com \
    --cc=lwhsu@freebsd.org \
    --cc=ma.mandourr@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=michael.roth@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    --cc=wangyanan55@huawei.com \
    /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).