Skip to contentSkip to conversation

target-arm queue

GIT PULL Applied Peter Maydell 2 participants 7 messages Aug 12, 2022

lore
Share & tools
lore
#0 lore raw

This pullreq has:
* two arm bug fixes which fix some "Linux fails to boot" bugs
* a docs typo-fixing patch
* a couple of compile failure/warning issues

I think they're all pretty safe and worth having in rc3.

thanks
-- PMM

The following changes since commit a6b1c53e79d08a99a28cc3e67a3e1a7c34102d6b:

Merge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging (2022-08-10 10:26:57 -0700)

are available in the Git repository at:

https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220812

for you to fetch changes up to 4311682ea8293f720730f260e8a7601117d79e65:

cutils: Add missing dyld(3) include on macOS (2022-08-12 11:33:52 +0100)

----------------------------------------------------------------
target-arm queue:
* Don't report Statistical Profiling Extension in ID registers
* virt ACPI tables: Present the GICR structure properly for GICv4
* Fix some typos in documentation
* tests/unit: fix a -Wformat-truncation warning
* cutils: Add missing dyld(3) include on macOS

----------------------------------------------------------------
Marc-André Lureau (1):
tests/unit: fix a -Wformat-truncation warning

Peter Maydell (1):
target/arm: Don't report Statistical Profiling Extension in ID registers

Philippe Mathieu-Daudé (1):
cutils: Add missing dyld(3) include on macOS

Stefan Weil (1):
Fix some typos in documentation (most of them found by codespell)

Zenghui Yu (1):
hw/arm/virt-acpi-build: Present the GICR structure properly for GICv4

 docs/about/deprecated.rst               |  2 +-
 docs/specs/acpi_erst.rst                |  4 ++--
 docs/system/devices/canokey.rst         |  8 ++++----
 docs/system/devices/cxl.rst             | 12 ++++++------
 hw/arm/virt-acpi-build.c                |  4 ++--
 target/arm/cpu.c                        | 11 +++++++++++
 tests/unit/test-qobject-input-visitor.c |  3 +--
 util/cutils.c                           |  4 ++++
 util/oslib-posix.c                      |  4 ----
 9 files changed, 31 insertions(+), 21 deletions(-)
#1 lore raw

[PULL 4/5] hw/arm/virt-acpi-build: Present the GICR structure properly for GICv4

From: Zenghui Yu <[email protected]>

With the introduction of the new TCG GICv4, build_madt() is badly broken as we do not present any GIC Redistributor structure in MADT for GICv4 guests, so that they have no idea about where the Redistributor register frames are. This fixes a Linux guest crash at boot time with ACPI enabled and '-machine gic-version=4'.

While at it, let's convert the remaining hard coded gic_version into enumeration VIRT_GIC_VERSION_2 for consistency.

Message-id: [email protected]

---
 hw/arm/virt-acpi-build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/arm/virt-acpi-build.c +2 -2
index 449fab00805..9b3aee01bf8 100644
@@ -732,7 +732,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
         uint32_t pmu_interrupt = arm_feature(&armcpu->env, ARM_FEATURE_PMU) ?
                                              PPI(VIRTUAL_PMU_IRQ) : 0;
 
-        if (vms->gic_version == 2) {
+        if (vms->gic_version == VIRT_GIC_VERSION_2) {
             physical_base_address = memmap[VIRT_GIC_CPU].base;
             gicv = memmap[VIRT_GIC_VCPU].base;
             gich = memmap[VIRT_GIC_HYP].base;
@@ -762,7 +762,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
         build_append_int_noprefix(table_data, armcpu->mp_affinity, 8);
     }
 
-    if (vms->gic_version == 3) {
+    if (vms->gic_version != VIRT_GIC_VERSION_2) {
         build_append_gicr(table_data, memmap[VIRT_GIC_REDIST].base,
                                       memmap[VIRT_GIC_REDIST].size);
         if (virt_gicv3_redist_region_count(vms) == 2) {
Signature · 1 line
2.25.1
#2 lore raw

[PULL 2/5] Fix some typos in documentation (most of them found by codespell)

In reply to Peter Maydell

From: Stefan Weil <[email protected]>

Message-id: [email protected]

---
 docs/about/deprecated.rst       |  2 +-
 docs/specs/acpi_erst.rst        |  4 ++--
 docs/system/devices/canokey.rst |  8 ++++----
 docs/system/devices/cxl.rst     | 12 ++++++------
 4 files changed, 13 insertions(+), 13 deletions(-)
docs/about/deprecated.rst +1 -1
index 7ee26626d5c..91b03115ee2 100644
@@ -297,7 +297,7 @@ by using ``-machine graphics=off``.
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 In QEMU versions 6.1, 6.2 and 7.0, the ``nvme-ns`` generates an EUI-64
-identifer that is not globally unique. If an EUI-64 identifer is required, the
+identifier that is not globally unique. If an EUI-64 identifier is required, the
 user must set it explicitly using the ``nvme-ns`` device parameter ``eui64``.
 
 ``-device nvme,use-intel-id=on|off`` (since 7.1)
docs/specs/acpi_erst.rst +2 -2
index a8a9d22d254..2339b60ad74 100644
@@ -108,7 +108,7 @@ Slot 0 contains a backend storage header that identifies the contents
 as ERST and also facilitates efficient access to the records.
 Depending upon the size of the backend storage, additional slots will
 be designated to be a part of the slot 0 header. For example, at 8KiB,
-the slot 0 header can accomodate 1021 records. Thus a storage size
+the slot 0 header can accommodate 1021 records. Thus a storage size
 of 8MiB (8KiB * 1024) requires an additional slot for use by the
 header. In this scenario, slot 0 and slot 1 form the backend storage
 header, and records can be stored starting at slot 2.
@@ -196,5 +196,5 @@ References
 [2] "Unified Extensible Firmware Interface Specification",
     version 2.1, October 2008.
 
-[3] "Windows Hardware Error Architecture", specfically
+[3] "Windows Hardware Error Architecture", specifically
     "Error Record Persistence Mechanism".
docs/system/devices/canokey.rst +4 -4
index c2c58ae3e7c..cfa6186e483 100644
@@ -28,9 +28,9 @@ With the same software configuration as a hardware key,
 the guest OS can use all the functionalities of a secure key as if
 there was actually an hardware key plugged in.
 
-CanoKey QEMU provides much convenience for debuging:
+CanoKey QEMU provides much convenience for debugging:
 
-* libcanokey-qemu supports debuging output thus developers can
+* libcanokey-qemu supports debugging output thus developers can
   inspect what happens inside a secure key
 * CanoKey QEMU supports trace event thus event
 * QEMU USB stack supports pcap thus USB packet between the guest
@@ -102,8 +102,8 @@ and find CanoKey QEMU there:
 
 You may setup the key as guided in [6]_. The console for the key is at [7]_.
 
-Debuging
-========
+Debugging
+=========
 
 CanoKey QEMU consists of two parts, ``libcanokey-qemu.so`` and ``canokey.c``,
 the latter of which resides in QEMU. The former provides core functionality
docs/system/devices/cxl.rst +6 -6
index 36031325cca..f25783a4ecf 100644
@@ -83,7 +83,7 @@ CXL Fixed Memory Windows (CFMW)
 A CFMW consists of a particular range of Host Physical Address space
 which is routed to particular CXL Host Bridges.  At time of generic
 software initialization it will have a particularly interleaving
-configuration and associated Quality of Serice Throtling Group (QTG).
+configuration and associated Quality of Service Throttling Group (QTG).
 This information is available to system software, when making
 decisions about how to configure interleave across available CXL
 memory devices.  It is provide as CFMW Structures (CFMWS) in
@@ -98,7 +98,7 @@ specification defined register interface called CXL Host Bridge
 Component Registers (CHBCR). The location of this CHBCR MMIO
 space is described to system software via a CXL Host Bridge
 Structure (CHBS) in the CEDT ACPI table.  The actual interfaces
-are identical to those used for other parts of the CXL heirarchy
+are identical to those used for other parts of the CXL hierarchy
 as CXL Component Registers in PCI BARs.
 
 Interfaces provided include:
@@ -143,7 +143,7 @@ CXL Memory Devices - Type 3
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 CXL type 3 devices use a PCI class code and are intended to be supported
 by a generic operating system driver. They have HDM decoders
-though in these EP devices, the decoder is reponsible not for
+though in these EP devices, the decoder is responsible not for
 routing but for translation of the incoming host physical address (HPA)
 into a Device Physical Address (DPA).
 
@@ -209,7 +209,7 @@ Notes:
     ranges of the system physical address map.  Each CFMW has
     particular interleave setup across the CXL Host Bridges (HB)
     CFMW0 provides uninterleaved access to HB0, CFW2 provides
-    uninterleaved acess to HB1. CFW1 provides interleaved memory access
+    uninterleaved access to HB1. CFW1 provides interleaved memory access
     across HB0 and HB1.
 
 (2) **Two CXL Host Bridges**. Each of these has 2 CXL Root Ports and
@@ -282,7 +282,7 @@ Example topology involving a switch::
             ---------------------------------------------------
            |    Switch 0  USP as PCI 0d:00.0                   |
            |    USP has HDM decoder which direct traffic to    |
-           |    appropiate downstream port                     |
+           |    appropriate downstream port                    |
            |    Switch BUS appears as 0e                       |
            |x__________________________________________________|
             |                  |               |              |
@@ -366,7 +366,7 @@ An example of 4 devices below a switch suitable for 1, 2 or 4 way interleave::
 Kernel Configuration Options
 ----------------------------
 
-In Linux 5.18 the followings options are necessary to make use of
+In Linux 5.18 the following options are necessary to make use of
 OS management of CXL memory devices as described here.
 
 * CONFIG_CXL_BUS
Signature · 1 line
2.25.1
#3 lore raw

[PULL 1/5] target/arm: Don't report Statistical Profiling Extension in ID registers

In reply to Peter Maydell

The newly added neoverse-n1 CPU has ID register values which indicate the presence of the Statistical Profiling Extension, because the real hardware has this feature. QEMU's TCG emulation does not yet implement SPE, though (not even as a minimal stub implementation), so guests will crash if they try to use it because the SPE system registers don't exist.

Force ID_AA64DFR0_EL1.PMSVer to 0 in CPU realize for TCG, so that we don't advertise to the guest a feature that doesn't exist.

(We could alternatively do this by editing the value that aarch64_neoverse_n1_initfn() sets for this ID register, but suppressing the field in realize means we won't re-introduce this bug when we add other CPUs that have SPE in hardware, such as the Neoverse-V1.)

An example of a non-booting guest is current mainline Linux (5.19), when booting in EL2 on the virt board (ie with -machine virtualization=on).

Message-id: [email protected]

---
 target/arm/cpu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
target/arm/cpu.c +11 -0
index 1b7b3d76bb3..7ec3281da9a 100644
@@ -1933,6 +1933,17 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
     }
 #endif
 
+    if (tcg_enabled()) {
+        /*
+         * Don't report the Statistical Profiling Extension in the ID
+         * registers, because TCG doesn't implement it yet (not even a
+         * minimal stub version) and guests will fall over when they
+         * try to access the non-existent system registers for it.
+         */
+        cpu->isar.id_aa64dfr0 =
+            FIELD_DP64(cpu->isar.id_aa64dfr0, ID_AA64DFR0, PMSVER, 0);
+    }
+
     /* MPU can be configured out of a PMSA CPU either by setting has-mpu
      * to false or by setting pmsav7-dregion to 0.
      */
Signature · 1 line
2.25.1
#4 lore raw

[PULL 5/5] cutils: Add missing dyld(3) include on macOS

In reply to Peter Maydell

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

Commit 06680b15b4 moved qemu_*_exec_dir() to cutils but forgot to move the macOS dyld(3) include, resulting in the following error (when building with Homebrew GCC on macOS Monterey 12.4):

[313/1197] Compiling C object libqemuutil.a.p/util_cutils.c.o
FAILED: libqemuutil.a.p/util_cutils.c.o
../../util/cutils.c:1039:13: error: implicit declaration of function '_NSGetExecutablePath' [-Werror=implicit-function-declaration]

   1039 |         if (_NSGetExecutablePath(fpath, &len) == 0) {
        |             ^~~~~~~~~~~~~~~~~~~~

../../util/cutils.c:1039:13: error: nested extern declaration of '_NSGetExecutablePath' [-Werror=nested-externs]

Fix by moving the include line to cutils.

Fixes 06680b15b4 ("include: move qemu_*_exec_dir() to cutils")

Message-id: [email protected]

---
 util/cutils.c      | 4 ++++
 util/oslib-posix.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)
util/cutils.c +4 -0
index cb43dda213c..def9c746ced 100644
@@ -39,6 +39,10 @@
 #include <kernel/image.h>
 #endif
 
+#ifdef __APPLE__
+#include <mach-o/dyld.h>
+#endif
+
 #ifdef G_OS_WIN32
 #include <pathcch.h>
 #include <wchar.h>
util/oslib-posix.c +0 -4
index bffec18869e..d55af69c112 100644
@@ -58,10 +58,6 @@
 #include <lwp.h>
 #endif
 
-#ifdef __APPLE__
-#include <mach-o/dyld.h>
-#endif
-
 #include "qemu/mmap-alloc.h"
 
 #ifdef CONFIG_DEBUG_STACK_USAGE
Signature · 1 line
2.25.1
#5 lore raw

[PULL 3/5] tests/unit: fix a -Wformat-truncation warning

In reply to Peter Maydell

From: Marc-André Lureau <[email protected]>

../tests/test-qobject-input-visitor.c: In function ‘test_visitor_in_list’:
../tests/test-qobject-input-visitor.c:454:49: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
454 | snprintf(string, sizeof(string), "string%d", i);
| ^~
../tests/test-qobject-input-visitor.c:454:42: note: directive argument in the range [0, 2147483606]
454 | snprintf(string, sizeof(string), "string%d", i);
| ^~~~~~~~~~
../tests/test-qobject-input-visitor.c:454:9: note: ‘snprintf’ output between 8 and 17 bytes into a destination of size 12

  454 |         snprintf(string, sizeof(string), "string%d", i);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Rather than trying to be clever, since this is called 3 times during tests, let's simply use g_strdup_printf().

Message-id: [email protected]

[PMM: fixed commit message typos]
---
 tests/unit/test-qobject-input-visitor.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tests/unit/test-qobject-input-visitor.c +1 -2
index 14329dabcfe..5f614afdbf1 100644
@@ -447,9 +447,8 @@ static void test_visitor_in_list(TestInputVisitorData *data,
     g_assert(head != NULL);
 
     for (i = 0, item = head; item; item = item->next, i++) {
-        char string[12];
+        g_autofree char *string = g_strdup_printf("string%d", i);
 
-        snprintf(string, sizeof(string), "string%d", i);
         g_assert_cmpstr(item->value->string, ==, string);
         g_assert_cmpint(item->value->integer, ==, 42 + i);
     }
Signature · 1 line
2.25.1
#6 lore raw
In reply to Peter Maydell
Quoted 22 lines · Peter Maydell

This pullreq has:
* two arm bug fixes which fix some "Linux fails to boot" bugs
* a docs typo-fixing patch
* a couple of compile failure/warning issues

I think they're all pretty safe and worth having in rc3.

thanks
-- PMM

The following changes since commit a6b1c53e79d08a99a28cc3e67a3e1a7c34102d6b:

   Merge tag 'linux-user-for-7.1-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging (2022-08-10 10:26:57 -0700)

are available in the Git repository at:

   https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220812

for you to fetch changes up to 4311682ea8293f720730f260e8a7601117d79e65:

cutils: Add missing dyld(3) include on macOS (2022-08-12 11:33:52 +0100)

Quoted 7 lines

----------------------------------------------------------------
target-arm queue:
* Don't report Statistical Profiling Extension in ID registers
* virt ACPI tables: Present the GICR structure properly for GICv4
* Fix some typos in documentation
* tests/unit: fix a -Wformat-truncation warning
* cutils: Add missing dyld(3) include on macOS

Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.

r~

Quoted 28 lines

----------------------------------------------------------------
Marc-André Lureau (1):
tests/unit: fix a -Wformat-truncation warning

Peter Maydell (1):
target/arm: Don't report Statistical Profiling Extension in ID registers

Philippe Mathieu-Daudé (1):
cutils: Add missing dyld(3) include on macOS

Stefan Weil (1):
Fix some typos in documentation (most of them found by codespell)

Zenghui Yu (1):
hw/arm/virt-acpi-build: Present the GICR structure properly for GICv4

  docs/about/deprecated.rst               |  2 +-
  docs/specs/acpi_erst.rst                |  4 ++--
  docs/system/devices/canokey.rst         |  8 ++++----
  docs/system/devices/cxl.rst             | 12 ++++++------
  hw/arm/virt-acpi-build.c                |  4 ++--
  target/arm/cpu.c                        | 11 +++++++++++
  tests/unit/test-qobject-input-visitor.c |  3 +--
  util/cutils.c                           |  4 ++++
  util/oslib-posix.c                      |  4 ----
  9 files changed, 31 insertions(+), 21 deletions(-)