Skip to contentSkip to conversation

testing, docs, semihosting move and guest-loader

GIT PULL Applied Alex Bennée 4 participants 20 messages Mar 10, 2021 – Mar 22, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 drops the hexagon docker patches.

The following changes since commit a557b00469bca61a058fc1db4855503cac1c3219:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2021-03-09 21:31:18 +0000)

are available in the Git repository at:

https://github.com/stsquad/qemu.git tags/pull-testing-docs-xen-updates-100321-2

for you to fetch changes up to 8df9f0c3d7f53c5a123ebb873d1c22daec003c22:

semihosting: Move hw/semihosting/ -> semihosting/ (2021-03-10 15:34:12 +0000)

----------------------------------------------------------------
Testing, guest-loader and other misc tweaks

- add warning text to quickstart example
- add CFI tests to CI
- use --arch-only for docker pre-requisites
- fix .editorconfig for emacs
- add guest-loader for Xen-like hypervisor testing
- move generic-loader docs into manual proper
- move semihosting out of hw/

----------------------------------------------------------------
Alex Bennée (10):
docs/system: add a gentle prompt for the complexity to come tests/docker: add a test-tcg for building then running check-tcg .editorconfig: update the automatic mode setting for Emacs hw/board: promote fdt from ARM VirtMachineState to MachineState hw/riscv: migrate fdt field to generic MachineState
device_tree: add qemu_fdt_setprop_string_array helper hw/core: implement a guest-loader to support static hypervisor guests
docs: move generic-loader documentation into the main manual
docs: add some documentation for the guest-loader tests/avocado: add boot_xen tests

Daniele Buono (2):
gitlab-ci.yml: Allow custom # of parallel linkers gitlab-ci.yml: Add jobs to test CFI flags

Philippe Mathieu-Daudé (3):

      tests/docker: Use --arch-only when building Debian cross image
      semihosting: Move include/hw/semihosting/ -> include/semihosting/
      semihosting: Move hw/semihosting/ -> semihosting/
 docs/generic-loader.txt                           |  92 ------
 docs/system/generic-loader.rst                    | 117 +++++++
 docs/system/guest-loader.rst                      |  54 ++++
 docs/system/index.rst                             |   2 +
 docs/system/quickstart.rst                        |   8 +
 docs/system/targets.rst                           |   2 +
 meson.build                                       |   1 +
 hw/core/guest-loader.h                            |  34 +++
 include/hw/arm/virt.h                             |   1 -
 include/hw/boards.h                               |   1 +
 include/hw/riscv/virt.h                           |   1 -
 include/{hw => }/semihosting/console.h            |   0
 include/{hw => }/semihosting/semihost.h           |   0
 include/sysemu/device_tree.h                      |  17 ++
 {hw/semihosting => semihosting}/common-semi.h     |   0
 gdbstub.c                                         |   2 +-
 hw/arm/virt.c                                     | 356 +++++++++++-----------
 hw/core/guest-loader.c                            | 145 +++++++++
 hw/mips/malta.c                                   |   2 +-
 hw/riscv/virt.c                                   |  20 +-
 linux-user/aarch64/cpu_loop.c                     |   2 +-
 linux-user/arm/cpu_loop.c                         |   2 +-
 linux-user/riscv/cpu_loop.c                       |   2 +-
 linux-user/semihost.c                             |   2 +-
 {hw/semihosting => semihosting}/arm-compat-semi.c |   6 +-
 {hw/semihosting => semihosting}/config.c          |   2 +-
 {hw/semihosting => semihosting}/console.c         |   4 +-
 softmmu/device_tree.c                             |  26 ++
 softmmu/vl.c                                      |   2 +-
 stubs/semihost.c                                  |   2 +-
 target/arm/helper.c                               |   4 +-
 target/arm/m_helper.c                             |   4 +-
 target/arm/translate-a64.c                        |   2 +-
 target/arm/translate.c                            |   2 +-
 target/lm32/helper.c                              |   2 +-
 target/m68k/op_helper.c                           |   2 +-
 target/mips/cpu.c                                 |   2 +-
 target/mips/mips-semi.c                           |   4 +-
 target/mips/translate.c                           |   2 +-
 target/nios2/helper.c                             |   2 +-
 target/riscv/cpu_helper.c                         |   2 +-
 target/unicore32/helper.c                         |   2 +-
 target/xtensa/translate.c                         |   2 +-
 target/xtensa/xtensa-semi.c                       |   2 +-
 .editorconfig                                     |  17 +-
 .gitlab-ci.yml                                    | 123 ++++++++
 Kconfig                                           |   1 +
 MAINTAINERS                                       |  13 +-
 hw/Kconfig                                        |   1 -
 hw/core/meson.build                               |   2 +
 hw/meson.build                                    |   1 -
 {hw/semihosting => semihosting}/Kconfig           |   0
 {hw/semihosting => semihosting}/meson.build       |   0
 tests/acceptance/boot_xen.py                      | 118 +++++++
 tests/docker/dockerfiles/debian10.docker          |   2 +-
 tests/docker/test-tcg                             |  22 ++
 56 files changed, 921 insertions(+), 318 deletions(-)
 delete mode 100644 docs/generic-loader.txt
 create mode 100644 docs/system/generic-loader.rst
 create mode 100644 docs/system/guest-loader.rst
 create mode 100644 hw/core/guest-loader.h
 rename include/{hw => }/semihosting/console.h (100%)
 rename include/{hw => }/semihosting/semihost.h (100%)
 rename {hw/semihosting => semihosting}/common-semi.h (100%)
 create mode 100644 hw/core/guest-loader.c
 rename {hw/semihosting => semihosting}/arm-compat-semi.c (99%)
 rename {hw/semihosting => semihosting}/config.c (99%)
 rename {hw/semihosting => semihosting}/console.c (98%)
 rename {hw/semihosting => semihosting}/Kconfig (100%)
 rename {hw/semihosting => semihosting}/meson.build (100%)
 create mode 100644 tests/acceptance/boot_xen.py
 create mode 100755 tests/docker/test-tcg
Signature · 1 line
2.20.1
#1 lore raw

[PULL v2 07/15] hw/board: promote fdt from ARM VirtMachineState to MachineState

The use of FDT's is quite common across our various platforms. To allow the guest loader to tweak it we need to make it available in the generic state. This creates the field and migrates the initial user to use the generic field. Other boards will be updated in later patches.

Message-Id: <[email protected]>

include/hw/arm/virt.h +0 -1
index ee9a93101e..921416f918 100644
@@ -153,7 +153,6 @@ struct VirtMachineState {
     MemMapEntry *memmap;
     char *pciehb_nodename;
     const int *irqmap;
-    void *fdt;
     int fdt_size;
     uint32_t clock_phandle;
     uint32_t gic_phandle;
include/hw/boards.h +1 -0
index a46dfe5d1a..5fda5fd128 100644
@@ -258,6 +258,7 @@ struct MachineState {
 
     /*< public >*/
 
+    void *fdt;
     char *dtb;
     char *dumpdtb;
     int phandle_start;
hw/arm/virt.c +185 -171

776 lines not on this page · raw message

Signature · 1 line
2.20.1
#2 lore raw

[PULL v2 14/15] semihosting: Move include/hw/semihosting/ -> include/semihosting/

In reply to Alex Bennée

From: Philippe Mathieu-Daudé <[email protected]>

We want to move the semihosting code out of hw/ in the next patch.

This patch contains the mechanical steps, created using:

  $ git mv include/hw/semihosting/ include/
  $ sed -i s,hw/semihosting,semihosting, $(git grep -l hw/semihosting)

Message-Id: <[email protected]>
Message-Id: <[email protected]>

include/semihosting/console.h renamed from include/hw/semihosting/console.h +0 -0
similarity index 100%
rename from include/hw/semihosting/console.h
rename to include/semihosting/console.h
include/semihosting/semihost.h renamed from include/hw/semihosting/semihost.h +0 -0
similarity index 100%
rename from include/hw/semihosting/semihost.h
rename to include/semihosting/semihost.h
gdbstub.c +1 -1
index 16d7c8f534..7a4cc07584 100644
@@ -49,7 +49,7 @@
 #include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "sysemu/runstate.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/exec-all.h"
 #include "sysemu/replay.h"
 
hw/mips/malta.c +1 -1
index 9afc0b427b..26e7b1bd9f 100644
@@ -58,7 +58,7 @@
 #include "qemu/error-report.h"
 #include "hw/misc/empty_slot.h"
 #include "sysemu/kvm.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "hw/mips/cps.h"
 #include "hw/qdev-clock.h"
 
hw/semihosting/arm-compat-semi.c +3 -3
index 23c6e3edcb..94950b6c56 100644
@@ -34,9 +34,9 @@
 #include "qemu/osdep.h"
 
 #include "cpu.h"
-#include "hw/semihosting/semihost.h"
-#include "hw/semihosting/console.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/semihost.h"
+#include "semihosting/console.h"
+#include "semihosting/common-semi.h"
 #include "qemu/log.h"
 #include "qemu/timer.h"
 #ifdef CONFIG_USER_ONLY
hw/semihosting/config.c +1 -1
index 9807f10cb0..3548e0f627 100644
@@ -22,7 +22,7 @@
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "chardev/char.h"
 #include "sysemu/sysemu.h"
 
hw/semihosting/console.c +2 -2
index 9b4fee9260..c9ebd6fdd0 100644
@@ -17,8 +17,8 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/semihosting/semihost.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/semihost.h"
+#include "semihosting/console.h"
 #include "exec/gdbstub.h"
 #include "exec/exec-all.h"
 #include "qemu/log.h"
linux-user/aarch64/cpu_loop.c +1 -1
index 7c42f65706..ee72a1c20f 100644
@@ -22,7 +22,7 @@
 #include "qemu.h"
 #include "cpu_loop-common.h"
 #include "qemu/guest-random.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 #include "target/arm/syndrome.h"
 
 #define get_user_code_u32(x, gaddr, env)                \
linux-user/arm/cpu_loop.c +1 -1
index cadfb7fa43..989d03cd89 100644
@@ -22,7 +22,7 @@
 #include "qemu.h"
 #include "elf.h"
 #include "cpu_loop-common.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 
 #define get_user_code_u32(x, gaddr, env)                \
     ({ abi_long __r = get_user_u32((x), (gaddr));       \
linux-user/riscv/cpu_loop.c +1 -1
index 9665dabb09..6767f941e8 100644
@@ -23,7 +23,7 @@
 #include "qemu.h"
 #include "cpu_loop-common.h"
 #include "elf.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 
 void cpu_loop(CPURISCVState *env)
 {
linux-user/semihost.c +1 -1
index c0015ee7f6..82013b8b48 100644
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/console.h"
 #include "qemu.h"
 #include <termios.h>
 
softmmu/vl.c +1 -1
index ff488ea3e7..b7673b9613 100644
@@ -108,7 +108,7 @@
 #include "qapi/opts-visitor.h"
 #include "qapi/clone-visitor.h"
 #include "qom/object_interfaces.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "crypto/init.h"
 #include "sysemu/replay.h"
 #include "qapi/qapi-events-run-state.h"
stubs/semihost.c +1 -1
index 1d8b37f7b2..1b30f38b03 100644
@@ -11,7 +11,7 @@
 #include "qemu/osdep.h"
 #include "qemu/option.h"
 #include "qemu/error-report.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "sysemu/sysemu.h"
 
 /* Empty config */
target/arm/helper.c +2 -2
index 904b0927cd..d9220be7c5 100644
@@ -22,7 +22,7 @@
 #include "exec/exec-all.h"
 #include <zlib.h> /* For crc32 */
 #include "hw/irq.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "sysemu/cpus.h"
 #include "sysemu/cpu-timers.h"
 #include "sysemu/kvm.h"
@@ -34,7 +34,7 @@
 #ifdef CONFIG_TCG
 #include "arm_ldst.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 #endif
 
 #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
target/arm/m_helper.c +2 -2
index 731c435c00..d63ae465e1 100644
@@ -21,7 +21,7 @@
 #include "qemu/qemu-print.h"
 #include "exec/exec-all.h"
 #include <zlib.h> /* For crc32 */
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "sysemu/cpus.h"
 #include "sysemu/kvm.h"
 #include "qemu/range.h"
@@ -31,7 +31,7 @@
 #ifdef CONFIG_TCG
 #include "arm_ldst.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 #endif
 
 static void v7m_msr_xpsr(CPUARMState *env, uint32_t mask,
target/arm/translate-a64.c +1 -1
index b591f096df..0b42e53500 100644
@@ -28,7 +28,7 @@
 #include "internals.h"
 #include "qemu/host-utils.h"
 
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/gen-icount.h"
 
 #include "exec/helper-proto.h"
target/arm/translate.c +1 -1
index 1653cca1aa..62b1c2081b 100644
@@ -29,7 +29,7 @@
 #include "qemu/log.h"
 #include "qemu/bitops.h"
 #include "arm_ldst.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
target/lm32/helper.c +1 -1
index 7c52ae76d6..01cc3c53a5 100644
@@ -21,7 +21,7 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "qemu/host-utils.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/log.h"
 
 bool lm32_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
target/m68k/op_helper.c +1 -1
index 202498deb5..730cdf7744 100644
@@ -21,7 +21,7 @@
 #include "exec/helper-proto.h"
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #if defined(CONFIG_USER_ONLY)
 
target/mips/cpu.c +1 -1
index bf70c77295..bd4dca571f 100644
@@ -31,7 +31,7 @@
 #include "exec/exec-all.h"
 #include "hw/qdev-properties.h"
 #include "hw/qdev-clock.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "qapi/qapi-commands-machine-target.h"
 #include "fpu_helper.h"
 
target/mips/mips-semi.c +2 -2
index 898251aa02..6de60fa6dd 100644
@@ -22,8 +22,8 @@
 #include "qemu/log.h"
 #include "exec/helper-proto.h"
 #include "exec/softmmu-semi.h"
-#include "hw/semihosting/semihost.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/semihost.h"
+#include "semihosting/console.h"
 
 typedef enum UHIOp {
     UHI_exit = 1,
target/mips/translate.c +1 -1
index 70891c37cd..0b6d82d228 100644
@@ -29,7 +29,7 @@
 #include "exec/translator.h"
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #include "target/mips/trace.h"
 #include "trace-tcg.h"
target/nios2/helper.c +1 -1
index 57c97bde3c..53be8398e9 100644
@@ -26,7 +26,7 @@
 #include "exec/cpu_ldst.h"
 #include "exec/log.h"
 #include "exec/helper-proto.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #if defined(CONFIG_USER_ONLY)
 
target/riscv/cpu_helper.c +1 -1
index 2f43939fb6..83a6bcfad0 100644
@@ -24,7 +24,7 @@
 #include "exec/exec-all.h"
 #include "tcg/tcg-op.h"
 #include "trace.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 
 int riscv_cpu_mmu_index(CPURISCVState *env, bool ifetch)
 {
target/unicore32/helper.c +1 -1
index 54c26871fe..704393c27f 100644
@@ -14,7 +14,7 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/console.h"
 
 #undef DEBUG_UC32
 
target/xtensa/translate.c +1 -1
index 944a157747..0ae4efc48a 100644
@@ -37,7 +37,7 @@
 #include "qemu/log.h"
 #include "qemu/qemu-print.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/translator.h"
 
 #include "exec/helper-proto.h"
target/xtensa/xtensa-semi.c +1 -1
index 25f57a6500..79f2b043f2 100644
@@ -29,7 +29,7 @@
 #include "cpu.h"
 #include "chardev/char-fe.h"
 #include "exec/helper-proto.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "qapi/error.h"
 #include "qemu/log.h"
 
MAINTAINERS +1 -1
index ea200aae1d..c5ff881892 100644
@@ -3250,7 +3250,7 @@ Semihosting
 M: Alex Bennée <[email protected]>
 S: Maintained
 F: hw/semihosting/
-F: include/hw/semihosting/
+F: include/semihosting/
 
 Multi-process QEMU
 M: Elena Ufimtseva <[email protected]>
Signature · 1 line
2.20.1
#3 lore raw

[PULL v2 08/15] hw/riscv: migrate fdt field to generic MachineState

In reply to Alex Bennée

This is a mechanical change to make the fdt available through MachineState.

Message-Id: <[email protected]>

include/hw/riscv/virt.h +0 -1
index 84b7a3848f..632da52018 100644
@@ -41,7 +41,6 @@ struct RISCVVirtState {
     DeviceState *plic[VIRT_SOCKETS_MAX];
     PFlashCFI01 *flash[2];
 
-    void *fdt;
     int fdt_size;
 };
 
hw/riscv/virt.c +10 -10
index 4f0c2fbca0..0b39101a5e 100644
@@ -195,14 +195,14 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap,
     hwaddr flashbase = virt_memmap[VIRT_FLASH].base;
 
     if (mc->dtb) {
-        fdt = s->fdt = load_device_tree(mc->dtb, &s->fdt_size);
+        fdt = mc->fdt = load_device_tree(mc->dtb, &s->fdt_size);
         if (!fdt) {
             error_report("load_device_tree() failed");
             exit(1);
         }
         goto update_bootargs;
     } else {
-        fdt = s->fdt = create_device_tree(&s->fdt_size);
+        fdt = mc->fdt = create_device_tree(&s->fdt_size);
         if (!fdt) {
             error_report("create_device_tree() failed");
             exit(1);
@@ -444,12 +444,12 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap,
     g_free(name);
 
     name = g_strdup_printf("/soc/flash@%" PRIx64, flashbase);
-    qemu_fdt_add_subnode(s->fdt, name);
-    qemu_fdt_setprop_string(s->fdt, name, "compatible", "cfi-flash");
-    qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
+    qemu_fdt_add_subnode(mc->fdt, name);
+    qemu_fdt_setprop_string(mc->fdt, name, "compatible", "cfi-flash");
+    qemu_fdt_setprop_sized_cells(mc->fdt, name, "reg",
                                  2, flashbase, 2, flashsize,
                                  2, flashbase + flashsize, 2, flashsize);
-    qemu_fdt_setprop_cell(s->fdt, name, "bank-width", 4);
+    qemu_fdt_setprop_cell(mc->fdt, name, "bank-width", 4);
     g_free(name);
 
 update_bootargs:
@@ -667,9 +667,9 @@ static void virt_machine_init(MachineState *machine)
             hwaddr end = riscv_load_initrd(machine->initrd_filename,
                                            machine->ram_size, kernel_entry,
                                            &start);
-            qemu_fdt_setprop_cell(s->fdt, "/chosen",
+            qemu_fdt_setprop_cell(machine->fdt, "/chosen",
                                   "linux,initrd-start", start);
-            qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end",
+            qemu_fdt_setprop_cell(machine->fdt, "/chosen", "linux,initrd-end",
                                   end);
         }
     } else {
@@ -690,12 +690,12 @@ static void virt_machine_init(MachineState *machine)
 
     /* Compute the fdt load address in dram */
     fdt_load_addr = riscv_load_fdt(memmap[VIRT_DRAM].base,
-                                   machine->ram_size, s->fdt);
+                                   machine->ram_size, machine->fdt);
     /* load the reset vector */
     riscv_setup_rom_reset_vec(machine, &s->soc[0], start_addr,
                               virt_memmap[VIRT_MROM].base,
                               virt_memmap[VIRT_MROM].size, kernel_entry,
-                              fdt_load_addr, s->fdt);
+                              fdt_load_addr, machine->fdt);
 
     /* SiFive Test MMIO device */
     sifive_test_create(memmap[VIRT_TEST].base);
Signature · 1 line
2.20.1
#4 lore raw

[PULL v2 02/15] tests/docker: add a test-tcg for building then running check-tcg

In reply to Alex Bennée

This is mostly useful for verifying containers will work on the CI setup.

Message-Id: <[email protected]>

tests/docker/test-tcg new file +22 -0
new file mode 100755
index 0000000000..00993b73ba
@@ -0,0 +1,22 @@
+#!/bin/bash -e
+#
+# Build and run the TCG tests
+#
+# Copyright (c) 2021 Linaro Ltd.
+#
+# Authors:
+#  Alex Bennée <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+. common.rc
+
+cd "$BUILD_DIR"
+
+# although we are not building QEMU itself we still need a configured
+# build for the unit tests to be built and run
+TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
+build_qemu
+check_qemu check-tcg
Signature · 1 line
2.20.1
#5 lore raw

[PULL v2 12/15] docs: add some documentation for the guest-loader

In reply to Alex Bennée

Message-Id: <[email protected]>

docs/system/guest-loader.rst new file +54 -0
new file mode 100644
index 0000000000..37d03cbd89
@@ -0,0 +1,54 @@
+..
+   Copyright (c) 2020, Linaro
+
+Guest Loader
+------------
+
+The guest loader is similar to the `generic-loader` although it is
+aimed at a particular use case of loading hypervisor guests. This is
+useful for debugging hypervisors without having to jump through the
+hoops of firmware and boot-loaders.
+
+The guest loader does two things:
+
+  - load blobs (kernels and initial ram disks) into memory
+  - sets platform FDT data so hypervisors can find and boot them
+
+This is what is typically done by a boot-loader like grub using it's
+multi-boot capability. A typical example would look like:
+
+.. parsed-literal::
+
+  |qemu_system| -kernel ~/xen.git/xen/xen \
+    -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
+    -device guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro console=hvc0 earlyprintk=xen" \
+    -device guest-loader,addr=0x47000000,initrd=rootfs.cpio
+
+In the above example the Xen hypervisor is loaded by the -kernel
+parameter and passed it's boot arguments via -append. The Dom0 guest
+is loaded into the areas of memory. Each blob will get
+`/chosen/module@<addr>` entry in the FDT to indicate it's location and
+size. Additional information can be passed with by using additional
+arguments.
+
+Currently the only supported machines which use FDT data to boot are
+the ARM and RiscV `virt` machines.
+
+Arguments
+^^^^^^^^^
+
+The full syntax of the guest-loader is::
+
+  -device guest-loader,addr=<addr>[,kernel=<file>,[bootargs=<args>]][,initrd=<file>]
+
+``addr=<addr>``
+  This is mandatory and indicates the start address of the blob.
+
+``kernel|initrd=<file>``
+  Indicates the filename of the kernel or initrd blob. Both blobs will
+  have the "multiboot,module" compatibility string as well as
+  "multiboot,kernel" or "multiboot,ramdisk" as appropriate.
+
+``bootargs=<args>``
+  This is an optional field for kernel blobs which will pass command
+  like via the `/chosen/module@<addr>/bootargs` node.
docs/system/index.rst +1 -0
index cee1c83540..6ad9c93806 100644
@@ -26,6 +26,7 @@ Contents:
    ivshmem
    linuxboot
    generic-loader
+   guest-loader
    vnc-security
    tls
    gdb
MAINTAINERS +1 -0
index a1170bad5a..2ad004fed5 100644
@@ -2026,6 +2026,7 @@ Guest Loader
 M: Alex Bennée <[email protected]>
 S: Maintained
 F: hw/core/guest-loader.c
+F: docs/system/guest-loader.rst
 
 Intel Hexadecimal Object File Loader
 M: Su Hang <[email protected]>
Signature · 1 line
2.20.1
#6 lore raw

[PULL v2 05/15] tests/docker: Use --arch-only when building Debian cross image

In reply to Alex Bennée

From: Philippe Mathieu-Daudé <[email protected]>

When building a Docker image based on debian10.docker on a non-x86 host, we get:

[2/4] RUN apt update && DEBIAN_FRONTEND=noninteractive eatmydata apt build-dep -yy qemu
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
builddeps:qemu : Depends: gcc-s390x-linux-gnu but it is not installable
Depends: gcc-alpha-linux-gnu but it is not installable
E: Unable to correct problems, you have held broken packages.

Fix by using the --arch-only option suggested here:
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1866032/comments/1

Message-Id: <[email protected]>
Message-Id: <[email protected]>

tests/docker/dockerfiles/debian10.docker +1 -1
index 9d42b5a4b8..d034acbd25 100644
@@ -32,6 +32,6 @@ RUN apt update && \
         psmisc \
         python3 \
         python3-sphinx \
-        $(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\  -f2)
+        $(apt-get -s build-dep --arch-only qemu | egrep ^Inst | fgrep '[all]' | cut -d\  -f2)
 
 ENV FEATURES docs
Signature · 1 line
2.20.1
#7 lore raw

[PULL v2 13/15] tests/avocado: add boot_xen tests

In reply to Alex Bennée

These tests make sure we can boot the Xen hypervisor with a Dom0 kernel using the guest-loader. We currently have to use a kernel I built myself because there are issues using the Debian kernel images.

Message-Id: <[email protected]>

MAINTAINERS +1 -0
index 2ad004fed5..ea200aae1d 100644
@@ -2027,6 +2027,7 @@ M: Alex Bennée <[email protected]>
 S: Maintained
 F: hw/core/guest-loader.c
 F: docs/system/guest-loader.rst
+F: tests/acceptance/boot_xen.py
 
 Intel Hexadecimal Object File Loader
 M: Su Hang <[email protected]>
tests/acceptance/boot_xen.py new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
2.20.1
#8 lore raw

[PULL v2 01/15] docs/system: add a gentle prompt for the complexity to come

In reply to Alex Bennée

We all know the QEMU command line can become a fiendishly complex beast. Lets gently prepare our user for the horrors to come by referencing where other example command lines can be found in the manual.

Message-Id: <[email protected]>

docs/system/quickstart.rst +8 -0
index 3a3acab5e7..681678c86e 100644
@@ -11,3 +11,11 @@ Download and uncompress a PC hard disk image with Linux installed (e.g.
    |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.
docs/system/targets.rst +2 -0
index 75ed1087fd..9dcd95dd84 100644
@@ -1,3 +1,5 @@
+.. _system-targets-ref:
+
 QEMU System Emulator Targets
 ============================
 
Signature · 1 line
2.20.1
#9 lore raw

[PULL v2 10/15] hw/core: implement a guest-loader to support static hypervisor guests

In reply to Alex Bennée

Hypervisors, especially type-1 ones, need the firmware/bootcode to put their initial guest somewhere in memory and pass the information to it via platform data. The guest-loader is modelled after the generic loader for exactly this sort of purpose:

  $QEMU $ARGS  -kernel ~/xen.git/xen/xen \
    -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
    -device guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro console=hvc0 earlyprintk=xen" \
    -device guest-loader,addr=0x47000000,initrd=rootfs.cpio

Message-Id: <[email protected]>

hw/core/guest-loader.h new file +34 -0
new file mode 100644
index 0000000000..07f4b4884b
@@ -0,0 +1,34 @@
+/*
+ * Guest Loader
+ *
+ * Copyright (C) 2020 Linaro
+ * Written by Alex Bennée <[email protected]>
+ * (based on the generic-loader by Li Guang <[email protected]>)
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef GUEST_LOADER_H
+#define GUEST_LOADER_H
+
+#include "hw/qdev-core.h"
+#include "qom/object.h"
+
+struct GuestLoaderState {
+    /* <private> */
+    DeviceState parent_obj;
+
+    /* <public> */
+    uint64_t addr;
+    char *kernel;
+    char *args;
+    char *initrd;
+};
+
+#define TYPE_GUEST_LOADER "guest-loader"
+OBJECT_DECLARE_SIMPLE_TYPE(GuestLoaderState, GUEST_LOADER)
+
+#endif
hw/core/guest-loader.c new file +145 -0

145 lines not on this page · raw message

MAINTAINERS +5 -0
index 738786146d..38644691dc 100644
@@ -2022,6 +2022,11 @@ F: hw/core/generic-loader.c
 F: include/hw/core/generic-loader.h
 F: docs/generic-loader.txt
 
+Guest Loader
+M: Alex Bennée <[email protected]>
+S: Maintained
+F: hw/core/guest-loader.c
+
 Intel Hexadecimal Object File Loader
 M: Su Hang <[email protected]>
 S: Maintained
hw/core/meson.build +2 -0
index 032576f571..9cd72edf51 100644
@@ -37,6 +37,8 @@ softmmu_ss.add(files(
   'clock-vmstate.c',
 ))
 
+softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('guest-loader.c'))
+
 specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files(
   'machine-qmp-cmds.c',
   'numa.c',
Signature · 1 line
2.20.1
#10 lore raw

[PULL v2 04/15] gitlab-ci.yml: Add jobs to test CFI flags

In reply to Alex Bennée

From: Daniele Buono <[email protected]>

QEMU has had options to enable control-flow integrity features for a few months now. Add two sets of build/check/acceptance jobs to ensure the binary produced is working fine.

The three sets allow testing of x86_64 binaries for x86_64, s390x, ppc64 and aarch64 targets

[AJB: tweak job names to avoid brands]

Message-Id: <[email protected]>
Message-Id: <[email protected]>

.gitlab-ci.yml +119 -0
index 814f51873f..b23364bf3a 100644
@@ -483,6 +483,125 @@ clang-user:
       --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
     MAKE_CHECK_ARGS: check-unit check-tcg
 
+# Set LD_JOBS=1 because this requires LTO and ld consumes a large amount of memory.
+# On gitlab runners, default value sometimes end up calling 2 lds concurrently and
+# triggers an Out-Of-Memory error
+#
+# Since slirp callbacks are used in QEMU Timers, slirp needs to be compiled together
+# with QEMU and linked as a static library to avoid false positives in CFI checks.
+# This can be accomplished by using -enable-slirp=git, which avoids the use of
+# a system-wide version of the library
+#
+# Split in three sets of build/check/acceptance to limit the execution time of each
+# job
+build-cfi-aarch64:
+  <<: *native_build_job_definition
+  needs:
+  - job: amd64-fedora-container
+  variables:
+    LD_JOBS: 1
+    AR: llvm-ar
+    IMAGE: fedora
+    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
+      --enable-safe-stack --enable-slirp=git
+    TARGETS: aarch64-softmmu
+    MAKE_CHECK_ARGS: check-build
+  artifacts:
+    expire_in: 2 days
+    paths:
+      - build
+
+check-cfi-aarch64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-aarch64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check
+
+acceptance-cfi-aarch64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-aarch64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check-acceptance
+  <<: *acceptance_definition
+
+build-cfi-ppc64-s390x:
+  <<: *native_build_job_definition
+  needs:
+  - job: amd64-fedora-container
+  variables:
+    LD_JOBS: 1
+    AR: llvm-ar
+    IMAGE: fedora
+    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
+      --enable-safe-stack --enable-slirp=git
+    TARGETS: ppc64-softmmu s390x-softmmu
+    MAKE_CHECK_ARGS: check-build
+  artifacts:
+    expire_in: 2 days
+    paths:
+      - build
+
+check-cfi-ppc64-s390x:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-ppc64-s390x
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check
+
+acceptance-cfi-ppc64-s390x:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-ppc64-s390x
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check-acceptance
+  <<: *acceptance_definition
+
+build-cfi-x86_64:
+  <<: *native_build_job_definition
+  needs:
+  - job: amd64-fedora-container
+  variables:
+    LD_JOBS: 1
+    AR: llvm-ar
+    IMAGE: fedora
+    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
+      --enable-safe-stack --enable-slirp=git
+    TARGETS: x86_64-softmmu
+    MAKE_CHECK_ARGS: check-build
+  artifacts:
+    expire_in: 2 days
+    paths:
+      - build
+
+check-cfi-x86_64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-x86_64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check
+
+acceptance-cfi-x86_64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-x86_64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check-acceptance
+  <<: *acceptance_definition
+
 tsan-build:
   <<: *native_build_job_definition
   variables:
Signature · 1 line
2.20.1
#11 lore raw

Re: [PULL v2 04/15] gitlab-ci.yml: Add jobs to test CFI flags

Quoted 23 lines · Alex Bennée

From: Daniele Buono <[email protected]>

QEMU has had options to enable control-flow integrity features for a few months now. Add two sets of build/check/acceptance jobs to ensure the binary produced is working fine.

The three sets allow testing of x86_64 binaries for x86_64, s390x, ppc64 and aarch64 targets

[AJB: tweak job names to avoid brands]

Message-Id: <[email protected]>
Message-Id: <[email protected]>

.gitlab-ci.yml +6 -0
+build-cfi-x86_64:
+  <<: *native_build_job_definition
+  needs:
+  - job: amd64-fedora-container
+  variables:
+    LD_JOBS: 1

.gitlab-ci.yml clang-user: · line 584

Quoted 10 lines
.gitlab-ci.yml +10 -0
+    AR: llvm-ar
+    IMAGE: fedora
+    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
+      --enable-safe-stack --enable-slirp=git
+    TARGETS: x86_64-softmmu
+    MAKE_CHECK_ARGS: check-build
+  artifacts:
+    expire_in: 2 days
+    paths:
+      - build

FYI this job is timeouting:

ERROR: Job failed: execution took longer than 1h0m0s seconds

https://gitlab.com/qemu-project/qemu/-/jobs/1112829128

Quoted 24 lines
.gitlab-ci.yml +20 -0
+
+check-cfi-x86_64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-x86_64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check
+
+acceptance-cfi-x86_64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-x86_64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check-acceptance
+  <<: *acceptance_definition
+
 tsan-build:
   <<: *native_build_job_definition
   variables:
#12 lore raw

Re: [PULL v2 04/15] gitlab-ci.yml: Add jobs to test CFI flags

Hi Philippe,

I'm looking at the public QEMU pipelines and it seems that that job usually takes between 50 and 55 minutes, but there are higher spikes at 56, 57 and one where it failed at 1h.

We could perhaps set the timeout a bit higher, like 1h 10m, to not terminate the outliers immediately?
The job you linked was almost over, there were just about 20-ish tests to be linked, so it was probably next to completion.

Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 6 lines
.gitlab-ci.yml +6 -0
+build-cfi-x86_64:
+  <<: *native_build_job_definition
+  needs:
+  - job: amd64-fedora-container
+  variables:
+    LD_JOBS: 1

.gitlab-ci.yml clang-user: · line 584

Quoted 10 lines
.gitlab-ci.yml +10 -0
+    AR: llvm-ar
+    IMAGE: fedora
+    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
+      --enable-safe-stack --enable-slirp=git
+    TARGETS: x86_64-softmmu
+    MAKE_CHECK_ARGS: check-build
+  artifacts:
+    expire_in: 2 days
+    paths:
+      - build

FYI this job is timeouting:

ERROR: Job failed: execution took longer than 1h0m0s seconds

https://gitlab.com/qemu-project/qemu/-/jobs/1112829128

#13 lore raw

Re: [PULL v2 04/15] gitlab-ci.yml: Add jobs to test CFI flags

In reply to Philippe Mathieu-Daudé
Quoted 35 lines · Philippe Mathieu-Daudé
Quoted 23 lines · Alex Bennée

From: Daniele Buono <[email protected]>

QEMU has had options to enable control-flow integrity features for a few months now. Add two sets of build/check/acceptance jobs to ensure the binary produced is working fine.

The three sets allow testing of x86_64 binaries for x86_64, s390x, ppc64 and aarch64 targets

[AJB: tweak job names to avoid brands]

Message-Id: <[email protected]>
Message-Id: <[email protected]>

.gitlab-ci.yml +6 -0
+build-cfi-x86_64:
+  <<: *native_build_job_definition
+  needs:
+  - job: amd64-fedora-container
+  variables:
+    LD_JOBS: 1

.gitlab-ci.yml clang-user: · line 584

Quoted 10 lines
.gitlab-ci.yml +10 -0
+    AR: llvm-ar
+    IMAGE: fedora
+    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
+      --enable-safe-stack --enable-slirp=git
+    TARGETS: x86_64-softmmu
+    MAKE_CHECK_ARGS: check-build
+  artifacts:
+    expire_in: 2 days
+    paths:
+      - build
Quoted 6 lines

FYI this job is timeouting:

ERROR: Job failed: execution took longer than 1h0m0s seconds

https://gitlab.com/qemu-project/qemu/-/jobs/1112829128

I didn't see it fail in my tests (although visibility is somewhat masked by the current failing iotest). However I notice the builds are fairly close to the limit (56-58 mins). As they are already pared down maybe just increasing "timeout" is enough?

Quoted 24 lines
Quoted 24 lines
.gitlab-ci.yml +20 -0
+
+check-cfi-x86_64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-x86_64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check
+
+acceptance-cfi-x86_64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-x86_64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check-acceptance
+  <<: *acceptance_definition
+
 tsan-build:
   <<: *native_build_job_definition
   variables:
Signature · 1 line
Alex Bennée
#14 lore raw

[PULL v2 11/15] docs: move generic-loader documentation into the main manual

In reply to Alex Bennée

We might as well surface this useful information in the manual so users can find it easily. It is a fairly simple conversion to rst with the only textual fixes being QemuOps to QemuOpts.

Message-Id: <[email protected]>

docs/generic-loader.txt deleted +0 -92
deleted file mode 100644
index a9603a2af7..0000000000
@@ -1,92 +0,0 @@
-Copyright (c) 2016 Xilinx Inc.
-
-This work is licensed under the terms of the GNU GPL, version 2 or later.  See
-the COPYING file in the top-level directory.
-
-
-The 'loader' device allows the user to load multiple images or values into
-QEMU at startup.
-
-Loading Data into Memory Values
--------------------------------
-The loader device allows memory values to be set from the command line. This
-can be done by following the syntax below:
-
-     -device loader,addr=<addr>,data=<data>,data-len=<data-len>
-                   [,data-be=<data-be>][,cpu-num=<cpu-num>]
-
-    <addr>      - The address to store the data in.
-    <data>      - The value to be written to the address. The maximum size of
-                  the data is 8 bytes.
-    <data-len>  - The length of the data in bytes. This argument must be
-                  included if the data argument is.
-    <data-be>   - Set to true if the data to be stored on the guest should be
-                  written as big endian data. The default is to write little
-                  endian data.
-    <cpu-num>   - The number of the CPU's address space where the data should
-                  be loaded. If not specified the address space of the first
-                  CPU is used.
-
-All values are parsed using the standard QemuOps parsing. This allows the user
-to specify any values in any format supported. By default the values
-will be parsed as decimal. To use hex values the user should prefix the number
-with a '0x'.
-
-An example of loading value 0x8000000e to address 0xfd1a0104 is:
-    -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4
-
-Setting a CPU's Program Counter
--------------------------------
-The loader device allows the CPU's PC to be set from the command line. This
-can be done by following the syntax below:
-
-     -device loader,addr=<addr>,cpu-num=<cpu-num>
-
-    <addr>      - The value to use as the CPU's PC.
-    <cpu-num>   - The number of the CPU whose PC should be set to the
-                  specified value.
-
-All values are parsed using the standard QemuOps parsing. This allows the user
-to specify any values in any format supported. By default the values
-will be parsed as decimal. To use hex values the user should prefix the number
-with a '0x'.
-
-An example of setting CPU 0's PC to 0x8000 is:
-    -device loader,addr=0x8000,cpu-num=0
-
-Loading Files
--------------
-The loader device also allows files to be loaded into memory. It can load ELF,
-U-Boot, and Intel HEX executable formats as well as raw images.  The syntax is
-shown below:
-
-    -device loader,file=<file>[,addr=<addr>][,cpu-num=<cpu-num>][,force-raw=<raw>]
-
-    <file>      - A file to be loaded into memory
-    <addr>      - The memory address where the file should be loaded. This is
-                  required for raw images and ignored for non-raw files.
-    <cpu-num>   - This specifies the CPU that should be used. This is an
-                  optional argument and will cause the CPU's PC to be set to
-                  the memory address where the raw file is loaded or the entry
-                  point specified in the executable format header. This option
-                  should only be used for the boot image.
-                  This will also cause the image to be written to the specified
-                  CPU's address space. If not specified, the default is CPU 0.
-    <force-raw> - Setting force-raw=on forces the file to be treated as a raw
-                  image.  This can be used to load supported executable formats
-                  as if they were raw.
-
-All values are parsed using the standard QemuOps parsing. This allows the user
-to specify any values in any format supported. By default the values
-will be parsed as decimal. To use hex values the user should prefix the number
-with a '0x'.
-
-An example of loading an ELF file which CPU0 will boot is shown below:
-    -device loader,file=./images/boot.elf,cpu-num=0
-
-Restrictions and ToDos
-----------------------
- - At the moment it is just assumed that if you specify a cpu-num then you
-   want to set the PC as well. This might not always be the case. In future
-   the internal state 'set_pc' (which exists in the generic loader now) should
-   be exposed to the user so that they can choose if the PC is set or not.
docs/system/generic-loader.rst new file +117 -0

117 lines not on this page · raw message

docs/system/index.rst +1 -0
index 625b494372..cee1c83540 100644
@@ -25,6 +25,7 @@ Contents:
    usb
    ivshmem
    linuxboot
+   generic-loader
    vnc-security
    tls
    gdb
MAINTAINERS +1 -1
index 38644691dc..a1170bad5a 100644
@@ -2020,7 +2020,7 @@ M: Alistair Francis <[email protected]>
 S: Maintained
 F: hw/core/generic-loader.c
 F: include/hw/core/generic-loader.h
-F: docs/generic-loader.txt
+F: docs/system/generic-loader.rst
 
 Guest Loader
 M: Alex Bennée <[email protected]>
Signature · 1 line
2.20.1
#15 lore raw

[PULL v2 06/15] .editorconfig: update the automatic mode setting for Emacs

In reply to Alex Bennée

It seems the editor specific keywords have been deprecated in the main editorconfig plugin:

https://github.com/editorconfig/editorconfig-emacs#file-type-file_type_ext-file_type_emacs

Update the keywords to the suggested one and point users at the extension.

Message-Id: <[email protected]>

.editorconfig +11 -6
index 22681d91c6..7303759ed7 100644
@@ -4,6 +4,11 @@
 # plugin.
 #
 # Check https://editorconfig.org for details.
+#
+# Emacs: you need https://github.com/10sr/editorconfig-custom-majormode-el
+# to automatically enable the appropriate major-mode for your files
+# that aren't already caught by your existing config.
+#
 
 root = true
 
@@ -15,17 +20,17 @@ charset = utf-8
 [*.mak]
 indent_style = tab
 indent_size = 8
-file_type_emacs = makefile
+emacs_mode = makefile
 
 [Makefile*]
 indent_style = tab
 indent_size = 8
-file_type_emacs = makefile
+emacs_mode = makefile
 
 [*.{c,h,c.inc,h.inc}]
 indent_style = space
 indent_size = 4
-file_type_emacs = c
+emacs_mode = c
 
 [*.sh]
 indent_style = space
@@ -34,11 +39,11 @@ indent_size = 4
 [*.{s,S}]
 indent_style = tab
 indent_size = 8
-file_type_emacs = asm
+emacs_mode = asm
 
 [*.{vert,frag}]
-file_type_emacs = glsl
+emacs_mode = glsl
 
 [*.json]
 indent_style = space
-file_type_emacs = python
+emacs_mode = python
Signature · 1 line
2.20.1
#16 lore raw

[PULL v2 03/15] gitlab-ci.yml: Allow custom # of parallel linkers

In reply to Alex Bennée

From: Daniele Buono <[email protected]>

Define a new variable LD_JOBS, that can be used to select the maximum number of linking jobs to be executed in parallel. If the variable is not defined, maintain the default given by make -j

Currently, make parallelism at build time is based on the number of cpus available.

This doesn't work well with LTO at linking, because with LTO the linker has to load in memory all the intermediate object files for optimization.
The end result is that, if the gitlab runner happens to run two linking processes at the same time, the job will fail with an out-of-memory error,

This patch leverages the ability to maintain high parallelism at compile time, but limit the number of linkers executed in parallel.

Message-Id: <[email protected]>
Message-Id: <[email protected]>

.gitlab-ci.yml +4 -0
index 8b6d495288..814f51873f 100644
@@ -27,6 +27,10 @@ include:
       else
         ../configure --enable-werror $CONFIGURE_ARGS ;
       fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
+    - if test -n "$LD_JOBS";
+      then
+        meson configure . -Dbackend_max_links="$LD_JOBS" ;
+      fi || exit 1;
     - make -j"$JOBS"
     - if test -n "$MAKE_CHECK_ARGS";
       then
Signature · 1 line
2.20.1
#17 lore raw

[PULL v2 09/15] device_tree: add qemu_fdt_setprop_string_array helper

In reply to Alex Bennée

A string array in device tree is simply a series of \0 terminated strings next to each other. As libfdt doesn't support that directly we need to build it ourselves.

Message-Id: <[email protected]>

include/sysemu/device_tree.h +17 -0
index 982c89345f..8a2fe55622 100644
@@ -70,6 +70,23 @@ int qemu_fdt_setprop_u64(void *fdt, const char *node_path,
                          const char *property, uint64_t val);
 int qemu_fdt_setprop_string(void *fdt, const char *node_path,
                             const char *property, const char *string);
+
+/**
+ * qemu_fdt_setprop_string_array: set a string array property
+ *
+ * @fdt: pointer to the dt blob
+ * @name: node name
+ * @prop: property array
+ * @array: pointer to an array of string pointers
+ * @len: length of array
+ *
+ * assigns a string array to a property. This function converts and
+ * array of strings to a sequential string with \0 separators before
+ * setting the property.
+ */
+int qemu_fdt_setprop_string_array(void *fdt, const char *node_path,
+                                  const char *prop, char **array, int len);
+
 int qemu_fdt_setprop_phandle(void *fdt, const char *node_path,
                              const char *property,
                              const char *target_node_path);
softmmu/device_tree.c +26 -0
index b9a3ddc518..2691c58cf6 100644
@@ -21,6 +21,7 @@
 #include "qemu/error-report.h"
 #include "qemu/option.h"
 #include "qemu/bswap.h"
+#include "qemu/cutils.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
 #include "hw/loader.h"
@@ -397,6 +398,31 @@ int qemu_fdt_setprop_string(void *fdt, const char *node_path,
     return r;
 }
 
+/*
+ * libfdt doesn't allow us to add string arrays directly but they are
+ * test a series of null terminated strings with a length. We build
+ * the string up here so we can calculate the final length.
+ */
+int qemu_fdt_setprop_string_array(void *fdt, const char *node_path,
+                                  const char *prop, char **array, int len)
+{
+    int ret, i, total_len = 0;
+    char *str, *p;
+    for (i = 0; i < len; i++) {
+        total_len += strlen(array[i]) + 1;
+    }
+    p = str = g_malloc0(total_len);
+    for (i = 0; i < len; i++) {
+        int len = strlen(array[i]) + 1;
+        pstrcpy(p, len, array[i]);
+        p += len;
+    }
+
+    ret = qemu_fdt_setprop(fdt, node_path, prop, str, total_len);
+    g_free(str);
+    return ret;
+}
+
 const void *qemu_fdt_getprop(void *fdt, const char *node_path,
                              const char *property, int *lenp, Error **errp)
 {
Signature · 1 line
2.20.1
#18 lore raw

[PULL v2 15/15] semihosting: Move hw/semihosting/ -> semihosting/

In reply to Alex Bennée

From: Philippe Mathieu-Daudé <[email protected]>

With the exception of hw/core/, the hw/ directory only contains device models used in system emulation. Semihosting is also used by user emulation. As a generic feature, move it out of hw/ directory.

Message-Id: <[email protected]>
Message-Id: <[email protected]>

meson.build +1 -0
index adeec153d9..a7d2dd429d 100644
@@ -1951,6 +1951,7 @@ subdir('migration')
 subdir('monitor')
 subdir('net')
 subdir('replay')
+subdir('semihosting')
 subdir('hw')
 subdir('accel')
 subdir('plugins')
semihosting/common-semi.h renamed from hw/semihosting/common-semi.h +0 -0
similarity index 100%
rename from hw/semihosting/common-semi.h
rename to semihosting/common-semi.h
semihosting/arm-compat-semi.c renamed from hw/semihosting/arm-compat-semi.c +0 -0
similarity index 100%
rename from hw/semihosting/arm-compat-semi.c
rename to semihosting/arm-compat-semi.c
semihosting/config.c renamed from hw/semihosting/config.c +0 -0
similarity index 100%
rename from hw/semihosting/config.c
rename to semihosting/config.c
semihosting/console.c renamed from hw/semihosting/console.c +0 -0
similarity index 100%
rename from hw/semihosting/console.c
rename to semihosting/console.c
Kconfig +1 -0
index bf694c42af..d52ebd839b 100644
@@ -2,3 +2,4 @@ source Kconfig.host
 source backends/Kconfig
 source accel/Kconfig
 source hw/Kconfig
+source semihosting/Kconfig
MAINTAINERS +1 -1
index c5ff881892..3456993062 100644
@@ -3249,7 +3249,7 @@ F: qapi/rdma.json
 Semihosting
 M: Alex Bennée <[email protected]>
 S: Maintained
-F: hw/semihosting/
+F: semihosting/
 F: include/semihosting/
 
 Multi-process QEMU
hw/Kconfig +0 -1
index 8ea26479c4..ff40bd3f7b 100644
@@ -31,7 +31,6 @@ source remote/Kconfig
 source rtc/Kconfig
 source scsi/Kconfig
 source sd/Kconfig
-source semihosting/Kconfig
 source smbios/Kconfig
 source ssi/Kconfig
 source timer/Kconfig
hw/meson.build +0 -1
index e615d72d4d..8ba79b1a52 100644
@@ -30,7 +30,6 @@ subdir('rdma')
 subdir('rtc')
 subdir('scsi')
 subdir('sd')
-subdir('semihosting')
 subdir('smbios')
 subdir('ssi')
 subdir('timer')
semihosting/Kconfig renamed from hw/semihosting/Kconfig +0 -0
similarity index 100%
rename from hw/semihosting/Kconfig
rename to semihosting/Kconfig
semihosting/meson.build renamed from hw/semihosting/meson.build +0 -0
similarity index 100%
rename from hw/semihosting/meson.build
rename to semihosting/meson.build
Signature · 1 line
2.20.1
#19 lore raw
In reply to Alex Bennée
Quoted 18 lines · Alex Bennée

v2 drops the hexagon docker patches.

The following changes since commit a557b00469bca61a058fc1db4855503cac1c3219:

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2021-03-09 21:31:18 +0000)

are available in the Git repository at:

https://github.com/stsquad/qemu.git tags/pull-testing-docs-xen-updates-100321-2

for you to fetch changes up to 8df9f0c3d7f53c5a123ebb873d1c22daec003c22:

semihosting: Move hw/semihosting/ -> semihosting/ (2021-03-10 15:34:12 +0000)

----------------------------------------------------------------
Testing, guest-loader and other misc tweaks

Quoted 8 lines

- add warning text to quickstart example
- add CFI tests to CI
- use --arch-only for docker pre-requisites
- fix .editorconfig for emacs
- add guest-loader for Xen-like hypervisor testing
- move generic-loader docs into manual proper
- move semihosting out of hw/

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.0
for any user-visible changes.

-- PMM