Skip to contentSkip to conversation

Hexagon: doc updates

PATCH Superseded Brian Cain 2 participants 11 messages Nov 9

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Brian Cain

author
#0 lore raw

cover Hexagon: doc updates

Update the docs to describe the system emulation usage for common use cases like Hexagon SDK/QuRT programs, Standalone OS programs, booting VM guests, like Linux.

Brian Cain (5):
docs/system/hexagon: describe machine models and memory maps docs/system/hexagon: update the overview and emulation limits docs/system/hexagon: document boot interfaces docs/system/hexagon: document SDK semihosting workloads docs/system/hexagon: describe integrated firmware OS boot paths

 docs/system/hexagon/boot.rst              | 100 ++++++++++++++
 docs/system/hexagon/cdsp.rst              |  41 +++---
 docs/system/hexagon/emulation.rst         |  18 +++
 docs/system/hexagon/machines.rst          |  38 ++++++
 docs/system/hexagon/operating-systems.rst |  50 +++++++
 docs/system/hexagon/sdk-programs.rst      | 155 ++++++++++++++++++++++
 docs/system/target-hexagon.rst            |  58 +++++---
 7 files changed, 420 insertions(+), 40 deletions(-)
 create mode 100644 docs/system/hexagon/boot.rst
 create mode 100644 docs/system/hexagon/machines.rst
 create mode 100644 docs/system/hexagon/operating-systems.rst
 create mode 100644 docs/system/hexagon/sdk-programs.rst
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/5 docs/system/hexagon: describe machine models and memory maps

---
 docs/system/hexagon/cdsp.rst     | 41 +++++++++++++++-----------------
 docs/system/hexagon/machines.rst | 38 +++++++++++++++++++++++++++++
 docs/system/target-hexagon.rst   |  5 ++--
 3 files changed, 60 insertions(+), 24 deletions(-)
 create mode 100644 docs/system/hexagon/machines.rst
docs/system/hexagon/cdsp.rst +19 -22
index 8d3a1f611b0..3556d8a8aa0 100644
@@ -1,21 +1,12 @@
 .. SPDX-License-Identifier: GPL-2.0-or-later
 
-Compute DSP
-===========
+Board-specific boot firmware
+============================
 
-A Hexagon CDSP is designed as a computation offload device for an SoC.  The
-``V66G_1024`` machine contains:
-
-* L2VIC interrupt controller
-* QTimer timer device
-
-This machine will support any Hexagon CPU, but will default to ``v66``.
-
-H2 boot firmware
-----------------
-
-These machines can be started through the H2 hypervisor images shipped in
-``pc-bios``, selected with ``-bios``:
+The CDSP/NSP machines can use the host firmware shipped in ``pc-bios``,
+selected with ``-bios``. These images contain H2 and either the ``booter``
+or ``loadlinux`` loader. Use ``-L`` to specify QEMU's firmware directory
+when running an uninstalled build.
 
 .. list-table::
    :header-rows: 1
@@ -45,16 +36,22 @@ These machines can be started through the H2 hypervisor images shipped in
      - ``0xa0000000``
      - ``sa8797p_nsp0``
 
+``hexagon_loadlinux_<suffix>``
+  Boots a guest operating system written for the Hexagon VM interface.
+  Despite the name, it is not specific to Linux. H2 starts the guest from
+  an image that QEMU has placed at the ``-kernel`` address in the table
+  above.
+
 ``hexagon_booter_<suffix>``
-  H2 plus a loader that reads guest ELF files from the host through QEMU
-  semihosting::
+  Runs H2 user programs.  The booter creates a VM, loads a program
+  that it reads from the host through semihosting, and waits for the
+  program to exit::
 
     qemu-system-hexagon -M qcs6490-cdsp -serial stdio -display none \
         -bios hexagon_booter_qcs6490_cdsp \
-        -semihosting-config enable=on,target=native,arg=booter,arg=guest.elf
+        -semihosting-config enable=on,target=native,arg=booter,arg=prog.elf
 
-  Guests are loaded at ``0xa2000000``.
+  Programs are loaded at ``0xa2000000`` by default; the booter's
+  ``--guest_base`` option changes this (``arg=--help`` lists its options).
 
-``hexagon_loadlinux_<suffix>``
-  H2 plus a loader that starts a kernel which QEMU has placed at the
-  ``-kernel`` address in the table above.
+  For more info, see <https://github.com/qualcomm/hexagon-hypervisor>.
docs/system/hexagon/machines.rst new file +38 -0
new file mode 100644
index 00000000000..a4760b7a5b1
@@ -0,0 +1,38 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Hexagon machines
+================
+
+Choose a machine that matches the runtime environment for the program and
+the Hexagon ISA it targets. Hexagon machines fall into two broad categories:
+simulator-compatible machines and board-specific DSP subsystem machines.
+
+Simulator-compatible machines
+-----------------------------
+
+Simulator-compatible machines support standalone SDK OS and QuRT programs
+intended for the Hexagon simulator environment. They provide the common
+Hexagon system facilities expected by those programs, including interrupt
+and timer services, local memory, semihosting, and a configuration table
+that describes the selected model's capabilities.
+
+Select the model that matches the program's target ISA and threading
+requirements. ``V66G_1024`` is the default when ``-M`` is omitted; ``sim``
+selects the most modern simulator-style machine.
+
+The virtual machine (``virt``)
+------------------------------
+
+``virt`` is a synthetic simulator-compatible board for operating systems and
+bare-metal programs. QEMU supplies a device tree that describes the virtual
+hardware available to the guest, including CPUs, interrupt controller,
+console, virtio devices, and accelerator capabilities. See :doc:`boot` for
+its boot protocol.
+
+Board-specific CDSP and NSP machines
+------------------------------------
+
+Board-specific CDSP and NSP machines model the DSP subsystem of a named
+SoC.
+
+Firmware choices are listed in :doc:`cdsp`.
docs/system/target-hexagon.rst +3 -2
index 5d48cf401ad..5a646fd0d04 100644
@@ -21,8 +21,8 @@ reset and the first instructions are fetched from DDR via the EVB/reset vector.
 In a real system, a TBU/SMMU would normally arbitrate AXI accesses but
 we don't have a need to model that for QEMU.
 
-Hexagon DSP cores use simultaneous multithreading (SMT) with as many as 8
-hardware threads.
+Hexagon DSP cores use simultaneous multithreading (SMT). The number of
+hardware threads depends on the machine.
 
 .. admonition:: Diagram
 
@@ -100,6 +100,7 @@ machines. This can be further configured through ``-semihosting-config``.
 Hexagon Features
 ================
 .. toctree::
+   hexagon/machines
    hexagon/emulation
    hexagon/cdsp
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] docs/system/hexagon: describe machine models and memory maps

Quoted 8 lines · Brian Cain
---
 docs/system/hexagon/cdsp.rst     | 41 +++++++++++++++-----------------
 docs/system/hexagon/machines.rst | 38 +++++++++++++++++++++++++++++
 docs/system/target-hexagon.rst   |  5 ++--
 3 files changed, 60 insertions(+), 24 deletions(-)
 create mode 100644 docs/system/hexagon/machines.rst
author
#3 lore raw

PATCH 2/5 docs/system/hexagon: update the overview and emulation limits

In reply to Brian Cain

Describe the devices that the machines instantiate, ELF boot path.

---
 docs/system/hexagon/emulation.rst | 18 +++++++++++++++
 docs/system/target-hexagon.rst    | 37 ++++++++++++++++++-------------
 2 files changed, 39 insertions(+), 16 deletions(-)
docs/system/hexagon/emulation.rst +18 -0
index fb57c77ae90..41a9a8467f9 100644
@@ -11,7 +11,25 @@ It also has support for the following architecture extensions:
 
 - HVX (Hexagon Vector eXtensions)
 - `HVX floating point <https://docs.qualcomm.com/doc/80-N2040-61/topic/hvx-floating-point.html>`_.
+- HLX (see the `HLX reference manual
+  <https://docs.qualcomm.com/doc/80-N3040-23/topic/hlx.html>`_).
+
+User-DMA and HMX are not yet implemented.
+
+Machine configurations also select the available HVX contexts, VTCM,
+and HMX/HLX resources. See :doc:`machines` for the machine configurations.
 
 For information on the specifics of the HVX extension, please refer
 to the `Qualcomm Hexagon V79 HVX Programmer's Reference Manual
 <https://docs.qualcomm.com/doc/80-N2040-61/>`_.
+
+Emulation limits
+----------------
+
+The system models target functional execution.
+
+HVX uses 128-byte vectors; 64-byte mode is not implemented.
+
+See :doc:`../../devel/hexagon-sys` and
+:doc:`../../devel/hexagon-l2vic` for system-register, TLB, and interrupt
+details relevant to OS and firmware authors.
docs/system/target-hexagon.rst +21 -16
index 5a646fd0d04..7b7d0bc31bc 100644
@@ -8,15 +8,17 @@ Hexagon System emulator
 Use the ``qemu-system-hexagon`` executable to simulate a 32-bit Hexagon
 machine.
 
-Hexagon Machines
-================
+DSP subsystem
+=============
 
 Hexagon DSPs are suited to various functions and generally appear in a
 "DSP subsystem" of a larger system-on-chip (SoC).
 
 Hexagon DSPs are often included in a subsystem that looks like the diagram
 below.  Instructions are loaded into DDR before the DSP is brought out of
-reset and the first instructions are fetched from DDR via the EVB/reset vector.
+reset and the first instructions are fetched from DDR via the reset vector.
+QEMU's ELF boot path instead starts at the ELF entry point; the guest sets
+up its own ``EVB``.
 
 In a real system, a TBU/SMMU would normally arbitrate AXI accesses but
 we don't have a need to model that for QEMU.
@@ -60,32 +62,36 @@ hardware threads depends on the machine.
 
 Components
 ----------
-Other than l2vic and HVX, the components below are not implemented in QEMU.
+The devices instantiated depend on the machine. QEMU implements the
+interrupt controller, timer, configuration table, and accelerator contexts;
+local RAM regions are provided where the machine configuration calls for
+them.
 
 * L2VIC: the L2 vectored interrupt controller.  Supports 1024 input
   interrupts, edge- or level-triggered.  The core ISA has system registers
   ``VID``, ``VID1`` which read through to the L2VIC device.
-* QTimer: ARMSSE-based programmable timer device. Its interrupts are
+* QTimer: programmable timer device. Its interrupts are
   wired to the L2VIC.  System registers ``TIMER``, ``UTIMER`` read
   through to the QTimer device.
 * QDSP6SS: DSP subsystem features, accessible to the entire SoC, including
-  DSP NMI, watchdog, reset, etc.
-* CSR: Configuration/Status Registers.
+  DSP NMI, watchdog, reset, etc. Board models provide selected registers
+  for firmware initialization.
+* CSR: the QTimer control registers are mapped at the machine's CSR base
+  address; see :doc:`hexagon/machines`.
 * TCM: DSP-exclusive tightly-coupled memory.  This memory can be used for
   DSPs when isolated from DDR and in some bootstrapping modes.
 * VTCM: DSP-exclusive vector tightly-coupled memory.  This memory is accessed
   by some HVX instructions.
-* HVX: the vector coprocessor supports 64 and 128-byte vector registers.
-  64-byte mode is not implemented in QEMU.
+* HVX: the vector coprocessor. See :doc:`hexagon/emulation` for supported
+  modes and instruction sets.
 
 
 Bootstrapping
 -------------
-Hexagon systems do not generally have access to a block device.  So, for
-QEMU the typical use case involves loading a binary or ELF file into memory
-and executing from the indicated start address::
+Use ``-kernel`` to load an ELF file into memory and start execution at
+its entry point::
 
-    $ qemu-system-hexagon -kernel ./prog -append 'arg1 arg2'
+    $ qemu-system-hexagon -M V68N_1024 -kernel ./prog.elf -append 'arg1 arg2'
 
 Semihosting
 -----------
@@ -97,10 +103,9 @@ guest software can access the host console and filesystem. Read the
 for details. Semihosting is enabled by default on hexagon-sim-compatible
 machines. This can be further configured through ``-semihosting-config``.
 
-Hexagon Features
-================
 .. toctree::
+   :caption: Hexagon documentation
+
    hexagon/machines
    hexagon/emulation
    hexagon/cdsp
-
Signature · 1 line
2.34.1
Reviewed-by on v1 2/5
#4 lore raw

Re: [PATCH 2/5] docs/system/hexagon: update the overview and emulation limits

Quoted 9 lines · Brian Cain

Describe the devices that the machines instantiate, ELF boot path.

---
 docs/system/hexagon/emulation.rst | 18 +++++++++++++++
 docs/system/target-hexagon.rst    | 37 ++++++++++++++++++-------------
 2 files changed, 39 insertions(+), 16 deletions(-)
author
#5 lore raw

PATCH 3/5 docs/system/hexagon: document boot interfaces

In reply to Brian Cain

Describe ELF and raw-image loading, reset state, the DTB handoff to VM host firmware, and initial thread state. Explain UART and semihosting console routing.

---
 docs/system/hexagon/boot.rst   | 100 +++++++++++++++++++++++++++++++++
 docs/system/target-hexagon.rst |   1 +
 2 files changed, 101 insertions(+)
 create mode 100644 docs/system/hexagon/boot.rst
docs/system/hexagon/boot.rst new file +100 -0
new file mode 100644
index 00000000000..36c603c69e0
@@ -0,0 +1,100 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Hexagon boot interface
+======================
+
+``qemu-system-hexagon`` loads the initial image. Guest startup code
+initializes the stack, exception handling, and runtime state. When a
+Hexagon VM host is loaded, it establishes the guest OS's boot environment.
+
+Initial hardware state
+----------------------
+
+Only hardware thread zero starts executing. Other threads start powered
+off.
+
+Execution uses untranslated physical addresses in monitor mode. Guest software
+must populate TLB entries before enabling the MMU, and set up exception vectors
+and interrupt masks before enabling interrupts. See
+:doc:`../../devel/hexagon-sys` for the system architecture.
+
+QEMU sets thread zero's PC to the selected image entry address. ``EVB``
+initially contains zero; ELF startup code installs its own aligned event
+vector base.
+
+Simulator-compatible machines
+-----------------------------
+
+``-kernel file`` loads a little-endian Hexagon ELF, places its loadable
+segments according to their physical addresses, zero-fills the segments'
+remaining memory, and starts thread zero at the ELF entry point. Link
+startup code for untranslated execution, with the entry point accessible
+at its linked address.
+
+The virt machine
+----------------
+
+``-kernel file`` alone loads a Hexagon ELF into DDR, which starts at
+``0x80000000``, and starts at its ELF entry point.
+
+``-bios file`` alone loads a raw firmware image at the start of DDR and
+starts executing there.
+
+``-bios`` with ``-kernel`` boots the kernel through Hexagon VM host
+firmware, as described in :ref:`hexagon-vm-boot`. The kernel window starts
+at ``0xa0000000``.
+
+Otherwise, guest software reads the generated DTB at ``0x99800000``.
+``-append`` sets its ``/chosen/bootargs`` property.
+
+Board-specific machines
+------------------------------------
+
+Both ``-kernel`` and ``-bios`` accept Hexagon ELF images. The combinations
+have different meanings:
+
+.. list-table::
+   :header-rows: 1
+
+   * - Options
+     - Loading and entry
+   * - ``-kernel`` alone
+     - Load segments at ELF physical addresses and start at the ELF entry.
+   * - ``-bios`` alone
+     - Load firmware segments at ELF physical addresses and start at its entry.
+   * - ``-bios`` and ``-kernel``
+     - Load firmware normally, relocate the kernel segments into the board's
+       kernel window, and enter firmware through a QEMU boot stub.
+
+The combined case is described in :ref:`hexagon-vm-boot`, using the kernel
+base in :doc:`cdsp`.
+
+``-dtb file`` replaces the generated tree. A nonempty ``-append`` value
+sets its ``/chosen/bootargs``. A replacement tree must describe the
+selected hardware-thread count, actual RAM, and matching device drivers.
+
+.. _hexagon-vm-boot:
+
+Booting a kernel through Hexagon VM host firmware
+-------------------------------------------------
+
+On the ``virt`` and board-specific machines, ``-bios`` with ``-kernel``
+starts the kernel through Hexagon VM host firmware. QEMU loads the firmware
+ELF as linked and adds the machine's kernel base to the kernel ELF's
+physical load addresses, so the kernel's addresses are relative to the
+start of its window. The kernel must use the corresponding Hexagon VM
+guest layout. QEMU starts thread zero at a boot stub at ``0x99c00000``.
+The stub passes the DTB address with the low word in ``r0`` and the high
+word in ``r1``, then jumps to the firmware's ELF entry point. The Hexagon
+VM host defines the child VM's register and execution state.
+
+QEMU places the DTB after the loaded kernel.  QEMU copies it to guest RAM
+before entering the firmware. An optional ``-initrd`` is placed
+after the DTB base.  ``-initrd`` requires both ``-bios`` and ``-kernel``.
+
+Console and semihosting
+-----------------------
+
+SDK simulator programs use semihosting for console I/O. The ``virt`` and
+board-specific machines also provide a PL011 UART, whose host backend is
+selected with ``-serial``.
docs/system/target-hexagon.rst +1 -0
index 7b7d0bc31bc..e091b75c7a3 100644
@@ -107,5 +107,6 @@ machines. This can be further configured through ``-semihosting-config``.
    :caption: Hexagon documentation
 
    hexagon/machines
+   hexagon/boot
    hexagon/emulation
    hexagon/cdsp
Signature · 1 line
2.34.1
Reviewed-by on v1 3/5
#6 lore raw

Re: [PATCH 3/5] docs/system/hexagon: document boot interfaces

Quoted 11 lines · Brian Cain

Describe ELF and raw-image loading, reset state, the DTB handoff to VM host firmware, and initial thread state. Explain UART and semihosting console routing.

---
 docs/system/hexagon/boot.rst   | 100 +++++++++++++++++++++++++++++++++
 docs/system/target-hexagon.rst |   1 +
 2 files changed, 101 insertions(+)
 create mode 100644 docs/system/hexagon/boot.rst
author
#7 lore raw

PATCH 4/5 docs/system/hexagon: document SDK semihosting workloads

In reply to Brian Cain

Show how to run standalone SDK programs and the QuRT loader chain with an explicit v68 machine.

---
 docs/system/hexagon/sdk-programs.rst | 155 +++++++++++++++++++++++++++
 docs/system/target-hexagon.rst       |   3 +
 2 files changed, 158 insertions(+)
 create mode 100644 docs/system/hexagon/sdk-programs.rst
docs/system/hexagon/sdk-programs.rst new file +155 -0
new file mode 100644
index 00000000000..2edfe28ad66
@@ -0,0 +1,155 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Running SDK programs
+====================
+
+``qemu-system-hexagon`` can run SDK programs that normally run under
+``hexagon-sim``. The boot image depends on the runtime the program expects:
+
+.. list-table::
+   :header-rows: 1
+
+   * - Use case
+     - Initial image
+     - Subsequent stages
+   * - SDK standalone OS
+     - ``-kernel prog.elf``
+     - Startup code calls the program's ``main()``
+   * - SDK QuRT dynamic program
+     - ``-kernel runelf.pbn``
+     - QuRT loads ``run_main_on_hexagon_sim``, which loads ``userprog.so``
+
+SDK programs and semihosting
+----------------------------
+
+The simulator-compatible machines, such as ``V66G_1024`` and
+``V68N_1024``, provide semihosting by default. The SDK runtime uses
+``trap0`` calls for services such as console I/O, host file access, and
+program termination.
+
+See :ref:`hexagon-semihosting` for more info.
+
+The examples below use v68 SDK artifacts with ``-M V68N_1024``.
+
+Standalone OS programs
+~~~~~~~~~~~~~~~~~~~~~~
+
+By default, ``hexagon-clang`` links a bare-metal executable with the SDK's
+standalone OS startup code and C runtime. This small runtime initializes
+the machine, calls ``main()``, and implements hosted services through
+semihosting.
+
+For example, save the following as ``prog.c``:
+
+.. code-block:: c
+
+    #include <stdio.h>
+
+    int main(int argc, char **argv)
+    {
+        for (int i = 0; i < argc; i++) {
+            printf("argv[%d] = %s\n", i, argv[i]);
+        }
+        return 0;
+    }
+
+With the SDK tools on ``PATH``, build and run it with:
+
+.. code-block:: sh
+
+    hexagon-clang -mv68 prog.c -o prog.elf
+    qemu-system-hexagon -M V68N_1024 -display none \
+        -kernel ./prog.elf -append "foo bar"
+
+The program prints:
+
+.. code-block:: text
+
+    argv[0] = ./prog.elf
+    argv[1] = foo
+    argv[2] = bar
+
+Guest command-line arguments
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The example above passes the arguments with ``-append``. QEMU uses the
+``-kernel`` filename as the first semihosting argument and splits
+``-append`` on spaces to supply the remaining arguments. The host shell
+quotes keep ``foo bar`` together as the value of the QEMU option; the
+guest runtime subsequently parses the semihosting command line.
+
+You can instead specify the semihosting command line with ``arg=`` options:
+
+.. code-block:: sh
+
+    qemu-system-hexagon -M V68N_1024 -display none -kernel ./prog.elf \
+        -semihosting-config 'enable=on,target=native,arg=./prog.elf,arg=foo,arg=bar'
+
+Include the program name as the first ``arg=`` value.
+
+``target=native`` selects QEMU's implementation of semihosting even when
+a debugger is connected. To connect the semihosting console explicitly to
+the terminal, add a character device and select it with ``chardev=``:
+
+.. code-block:: sh
+
+    qemu-system-hexagon -M V68N_1024 -display none \
+        -chardev stdio,id=semi \
+        -semihosting-config enable=on,target=native,chardev=semi \
+        -kernel ./prog.elf -append "foo bar"
+
+QuRT programs and the SDK loader chain
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+An SDK QuRT dynamic test consists of three guest images:
+
+1. ``runelf.pbn`` boots QuRT and loads a user process from a host file.
+2. ``run_main_on_hexagon_sim`` is that process. It initializes the dynamic
+   loader and loads the application's shared object.
+3. ``userprog.so`` exports ``main(int argc, char **argv)``, which the
+   runner invokes.
+
+QEMU initially loads only ``runelf.pbn``. The subsequent stages read the
+other images through semihosting. Use matching SDK architecture variants
+for the boot image, runner, and application. For example, with Hexagon
+SDK 6.4 and its toolv19 v68 artifacts:
+
+.. code-block:: sh
+
+    runelf="$HEXAGON_SDK_ROOT/rtos/qurt/computev68/sdksim_bin/runelf.pbn"
+    runner="$HEXAGON_SDK_ROOT/libs/run_main_on_hexagon/ship/hexagon_toolv19_v68/run_main_on_hexagon_sim"
+    qemu-system-hexagon -M V68N_1024 -display none \
+        -kernel "$runelf" -append "$runner -- ./userprog.so foo bar"
+
+Build ``userprog.so`` with the SDK's QuRT shared-library build rules,
+including any libraries needed by the application, and place its shared
+dependencies where the SDK dynamic loader can find them.
+
+The command line exposed through semihosting is:
+
+.. code-block:: text
+
+    <runelf.pbn path> <runner path> -- ./userprog.so foo bar
+
+The fields have the following roles:
+
+.. csv-table::
+   :header: "Field", "Consumer", "Meaning"
+
+   <runelf.pbn path>, SDK startup, Boot image name
+   <runner path>, runelf.pbn, Process ELF to load
+   --, run_main_on_hexagon_sim, End of runner options
+   ./userprog.so, Dynamic loader, Shared object exporting main()
+   foo bar, Application, argv[1] and argv[2]
+
+The application's ``argv[0]`` is ``./userprog.so``. When translating an
+SDK simulator command ``runelf.pbn -- runner -- userprog.so``, omit the
+separator immediately after ``runelf.pbn`` from QEMU's ``-append`` value.
+The separator after the runner remains part of the guest command line.
+
+The equivalent explicit semihosting configuration is:
+
+.. code-block:: sh
+
+    qemu-system-hexagon -M V68N_1024 -display none -kernel "$runelf" \
+        -semihosting-config "enable=on,target=native,arg=$runelf,arg=$runner,arg=--,arg=./userprog.so,arg=foo,arg=bar"
docs/system/target-hexagon.rst +3 -0
index e091b75c7a3..dac8b9b3483 100644
@@ -93,6 +93,8 @@ its entry point::
 
     $ qemu-system-hexagon -M V68N_1024 -kernel ./prog.elf -append 'arg1 arg2'
 
+.. _hexagon-semihosting:
+
 Semihosting
 -----------
 Hexagon supports a semihosting interface similar to other architectures'.
@@ -107,6 +109,7 @@ machines. This can be further configured through ``-semihosting-config``.
    :caption: Hexagon documentation
 
    hexagon/machines
+   hexagon/sdk-programs
    hexagon/boot
    hexagon/emulation
    hexagon/cdsp
Signature · 1 line
2.34.1
Reviewed-by on v1 4/5
#8 lore raw

Re: [PATCH 4/5] docs/system/hexagon: document SDK semihosting workloads

Quoted 10 lines · Brian Cain

Show how to run standalone SDK programs and the QuRT loader chain with an explicit v68 machine.

---
 docs/system/hexagon/sdk-programs.rst | 155 +++++++++++++++++++++++++++
 docs/system/target-hexagon.rst       |   3 +
 2 files changed, 158 insertions(+)
 create mode 100644 docs/system/hexagon/sdk-programs.rst
author
#9 lore raw

PATCH 5/5 docs/system/hexagon: describe integrated firmware OS boot paths

In reply to Brian Cain

Show how to boot a Linux guest with the hexagon_loadlinux firmware, and hexagon_booter for running h2 user programs.

---
 docs/system/hexagon/operating-systems.rst | 50 +++++++++++++++++++++++
 docs/system/target-hexagon.rst            | 12 ++++++
 2 files changed, 62 insertions(+)
 create mode 100644 docs/system/hexagon/operating-systems.rst
docs/system/hexagon/operating-systems.rst new file +50 -0
new file mode 100644
index 00000000000..f367fc6387f
@@ -0,0 +1,50 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Booting guest operating systems
+===============================
+
+Hexagon VM guests require a Hexagon VM host. QEMU ships board-specific
+host firmware in ``pc-bios``. Guest operating systems boot with the
+``hexagon_loadlinux_*`` images; the ``hexagon_booter_*`` images run H2
+user programs instead (see :doc:`cdsp`). Select a matching machine,
+firmware, and guest memory layout from :doc:`cdsp`.
+
+Linux
+-----
+
+The kernel must be built for the Hexagon VM interface and include the
+PL011 console and required virtio-mmio device drivers.
+
+For a preloaded kernel and separate initramfs:
+
+.. code-block:: sh
+
+    qemu-system-hexagon -M qcs6490-cdsp -display none -serial stdio \
+        -bios hexagon_loadlinux_qcs6490_cdsp \
+        -kernel ./vmlinux -initrd ./initramfs.cpio.gz \
+        -append "console=ttyAMA0 rdinit=/init"
+
+``ttyAMA0`` selects the PL011 console. ``-append`` sets the boot arguments
+in QEMU's DTB; the guest and its VM host determine how those arguments
+are consumed. Add any platform-specific memory or delay-calibration
+parameters required by the kernel image.
+
+Guest operating systems on virt
+-------------------------------
+
+The ``virt`` machine boots a guest operating system through the same
+firmware, using a ``hexagon_loadlinux_*`` image whose kernel address in
+:doc:`cdsp` is ``0xa0000000``:
+
+.. code-block:: sh
+
+    qemu-system-hexagon -M virt -display none -serial stdio \
+        -bios hexagon_loadlinux_sa8775p_cdsp \
+        -kernel ./guest.elf -append "console=ttyAMA0"
+
+The guest ELF's physical load addresses are relative to the start of the
+kernel window at ``0xa0000000``, so a guest linked at physical address zero
+is loaded there. QEMU enters the firmware with the DTB address in
+``r1:r0`` (see :ref:`hexagon-vm-boot`). The guest must use the Hexagon VM
+interface for interrupts and timers, the PL011 at ``0x10000000``, and the
+virtio-mmio transports listed in :doc:`machines`.
docs/system/target-hexagon.rst +12 -0
index dac8b9b3483..3b63a94eb56 100644
@@ -105,11 +105,23 @@ guest software can access the host console and filesystem. Read the
 for details. Semihosting is enabled by default on hexagon-sim-compatible
 machines. This can be further configured through ``-semihosting-config``.
 
+Hexagon VM host
+---------------
+
+Guest operating systems can run under a Hexagon VM host, which provides
+virtual processor, memory management, interrupt, and timer services.
+The `Hexagon Virtual Machine Specification
+<https://docs.qualcomm.com/doc/80-NB419-3/80-NB419-3_REV_A_Hexagin_Virtual_Machine_Specification.pdf>`__
+describes the guest interface. The OS boot examples in
+:doc:`hexagon/operating-systems` use H2 as the Hexagon VM host; QEMU
+emulates the underlying DSP hardware.
+
 .. toctree::
    :caption: Hexagon documentation
 
    hexagon/machines
    hexagon/sdk-programs
    hexagon/boot
+   hexagon/operating-systems
    hexagon/emulation
    hexagon/cdsp
Signature · 1 line
2.34.1
Reviewed-by on v1 5/5
#10 lore raw

Re: [PATCH 5/5] docs/system/hexagon: describe integrated firmware OS boot paths

Quoted 10 lines · Brian Cain

Show how to boot a Linux guest with the hexagon_loadlinux firmware, and hexagon_booter for running h2 user programs.

---
 docs/system/hexagon/operating-systems.rst | 50 +++++++++++++++++++++++
 docs/system/target-hexagon.rst            | 12 ++++++
 2 files changed, 62 insertions(+)
 create mode 100644 docs/system/hexagon/operating-systems.rst