Skip to contentSkip to conversation

target-arm queue

GIT PULL Applied Peter Maydell 2 participants 11 messages Jul 26, 2022

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

A last lot of bug fixes before rc0...

thanks
-- PMM

The following changes since commit 0d0275c31f00b71b49eb80bbdca2cfe244cf80fb:

Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging (2022-07-26 10:31:02 +0100)

are available in the Git repository at:

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

for you to fetch changes up to 5865d99fe88d8c8fa437c18c6b63fb2a8165634f:

hw/display/bcm2835_fb: Fix framebuffer allocation address (2022-07-26 14:09:44 +0100)

----------------------------------------------------------------
target-arm queue:
* Update Coverity component definitions
* target/arm: Add MO_128 entry to pred_esz_masks[]
* configure: Fix portability issues
* hw/display/bcm2835_fb: Fix framebuffer allocation address

----------------------------------------------------------------
Alan Jian (1):
hw/display/bcm2835_fb: Fix framebuffer allocation address

Peter Maydell (8):
scripts/coverity-scan/COMPONENTS.md: Add loongarch component scripts/coverity-scan/COMPONENTS.md: Update slirp component info target/arm: Add MO_128 entry to pred_esz_masks[]
configure: Add missing POSIX-required space
configure: Add braces to clarify intent of $emu[[:space:]]
configure: Don't use bash-specific string-replacement syntax
configure: Drop dead code attempting to use -msmall-data on alpha hosts
configure: Avoid '==' bashism

 configure                           | 20 +++++++-------------
 target/arm/cpu.h                    |  2 +-
 hw/display/bcm2835_fb.c             |  3 +--
 target/arm/translate-sve.c          |  5 +++--
 scripts/coverity-scan/COMPONENTS.md |  7 +++++--
 5 files changed, 17 insertions(+), 20 deletions(-)
#1 lore raw

[PULL 1/9] scripts/coverity-scan/COMPONENTS.md: Add loongarch component

Add the component regex for the new loongarch target.

Message-id: [email protected]

---
 scripts/coverity-scan/COMPONENTS.md | 3 +++
 1 file changed, 3 insertions(+)
scripts/coverity-scan/COMPONENTS.md +3 -0
index de2eb962416..a61d011d9a4 100644
@@ -143,3 +143,6 @@ testlibs
 
 tests
   ~ (/qemu)?(/tests/.*)
+
+loongarch
+  ~ (/qemu)?((/include)?/hw/(loongarch/.*|.*/loongarch.*)|/target/loongarch/.*)
Signature · 1 line
2.25.1
#2 lore raw

[PULL 7/9] configure: Drop dead code attempting to use -msmall-data on alpha hosts

In reply to Peter Maydell

In commit 823eb013452e93d we moved the setting of ARCH from configure to meson.build, but we accidentally left behind one attempt to use $ARCH in configure, which was trying to add -msmall-data to the compiler flags on Alpha hosts. Since ARCH is now never set, the test always fails and we never add the flag.

There isn't actually any need to use this compiler flag on Alpha:
the original intent was that it would allow us to simplify our TCG codegen on that platform, but we never actually made the TCG changes that would rely on -msmall-data.

Drop the effectively-dead code from configure, as we don't need it.

This was spotted by shellcheck:

In ./configure line 2254:
case "$ARCH" in
^---^ SC2153: Possible misspelling: ARCH may not be assigned, but arch is.

Message-id: [email protected]

---
 configure | 7 -------
 1 file changed, 7 deletions(-)
configure +0 -7
index c05205b6085..d0e9a51462e 100755
@@ -2251,13 +2251,6 @@ if test "$fortify_source" = "yes" ; then
   QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
 fi
 
-case "$ARCH" in
-alpha)
-  # Ensure there's only a single GP
-  QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS"
-;;
-esac
-
 if test "$have_asan" = "yes"; then
   QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS"
   QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS"
Signature · 1 line
2.25.1
#3 lore raw

[PULL 3/9] target/arm: Add MO_128 entry to pred_esz_masks[]

In reply to Peter Maydell

In commit 7390e0e9ab8475, we added support for SME loads and stores. Unlike SVE loads and stores, these include handling of 128-bit elements. The SME load/store functions call down into the existing sve_cont_ldst_elements() function, which uses the element size MO_* value as an index into the pred_esz_masks[] array. Because this code path now has to handle MO_128, we need to add an extra element to the array.

This bug was spotted by Coverity because it meant we were reading off the end of the array.

Resolves: Coverity CID 1490539, 1490541, 1490543, 1490544, 1490545,
1490546, 1490548, 1490549, 1490550, 1490551, 1490555, 1490557, 1490558, 1490560, 1490561, 1490563

Fixes 7390e0e9ab8475 ("target/arm: Implement SME LD1, ST1")

Message-id: [email protected]

---
 target/arm/cpu.h           | 2 +-
 target/arm/translate-sve.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
target/arm/cpu.h +1 -1
index e890ee074d3..5168e3d837e 100644
@@ -3387,7 +3387,7 @@ static inline uint64_t *aa64_vfp_qreg(CPUARMState *env, unsigned regno)
 }
 
 /* Shared between translate-sve.c and sve_helper.c.  */
-extern const uint64_t pred_esz_masks[4];
+extern const uint64_t pred_esz_masks[5];
 
 /* Helper for the macros below, validating the argument type. */
 static inline MemTxAttrs *typecheck_memtxattrs(MemTxAttrs *x)
target/arm/translate-sve.c +3 -2
index 41f8b12259e..621a2abb22f 100644
@@ -529,9 +529,10 @@ static void do_predtest(DisasContext *s, int dofs, int gofs, int words)
 }
 
 /* For each element size, the bits within a predicate word that are active.  */
-const uint64_t pred_esz_masks[4] = {
+const uint64_t pred_esz_masks[5] = {
     0xffffffffffffffffull, 0x5555555555555555ull,
-    0x1111111111111111ull, 0x0101010101010101ull
+    0x1111111111111111ull, 0x0101010101010101ull,
+    0x0001000100010001ull,
 };
 
 static bool trans_INVALID(DisasContext *s, arg_INVALID *a)
Signature · 1 line
2.25.1
#4 lore raw

[PULL 2/9] scripts/coverity-scan/COMPONENTS.md: Update slirp component info

In reply to Peter Maydell

Update the regex for the slirp component now that it lives solely inside /slirp/, and note that it should be ignored in Coverity analysis (because it's a separate upstream project now, and they run Coverity on it themselves).

Message-id: [email protected]

---
 scripts/coverity-scan/COMPONENTS.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/coverity-scan/COMPONENTS.md +2 -2
index a61d011d9a4..3aad9cdfaf4 100644
@@ -108,8 +108,8 @@ qemu-ga
 scsi
   ~ (/qemu)?(/scsi/.*|/hw/scsi/.*|/include/hw/scsi/.*)
 
-slirp
-  ~ (/qemu)?(/.*slirp.*)
+slirp (component should be ignored in analysis)
+  ~ (/qemu)?(/slirp/.*)
 
 tcg
   ~ (/qemu)?(/accel/tcg/.*|/replay/.*|/(.*/)?softmmu.*)
Signature · 1 line
2.25.1
#5 lore raw

[PULL 5/9] configure: Add braces to clarify intent of $emu[[:space:]]

In reply to Peter Maydell

In shell script syntax, $var[something] is not special for variable
expansion: $var is expanded. However, as it can look as if it were intended to be an array element access (the correct syntax for which is ${var[something]}), shellcheck recommends using explicit braces around ${var} to clarify the intended expansion.

This fixes the warning:

In ./configure line 2346:

        if "$target_ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
                                                              ^-- SC1087: Use braces when expanding arrays, e.g. ${array[idx]} (or ${var}[.. to quiet).

Message-id: [email protected]

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index dec6f030346..a56c3d921be 100755
@@ -2343,7 +2343,7 @@ if test -n "$target_cc" &&
     # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
     # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
     for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
-        if "$target_ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then
+        if "$target_ld" -verbose 2>&1 | grep -q "^[[:space:]]*${emu}[[:space:]]*$"; then
             ld_i386_emulation="$emu"
             break
         fi
Signature · 1 line
2.25.1
#6 lore raw

[PULL 9/9] hw/display/bcm2835_fb: Fix framebuffer allocation address

In reply to Peter Maydell

From: Alan Jian <[email protected]>

This patch fixes the dedicated framebuffer mailbox interface by removing an unneeded offset. This means that we pick the framebuffer address in the same way that we do if the guest code uses the buffer allocate mechanism of the bcm2835_property interface (case 0x00040001: /* Allocate buffer */ in bcm2835_property.c).

The documentation of this mailbox interface doesn't say anything about using parts of the request buffer address to affect the chosen framebuffer address:
https://github.com/raspberrypi/firmware/wiki/Mailbox-framebuffer-interface

Some baremetal applications like the Screen01/Screen02 examples from Baking Pi tutorial[1] didn't work before this patch.

[1] https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html

Message-id: [email protected]

[PMM: tweaked commit message]
---
 hw/display/bcm2835_fb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/display/bcm2835_fb.c +1 -2
index 088fc3d51c5..a05277674f2 100644
@@ -279,8 +279,7 @@ static void bcm2835_fb_mbox_push(BCM2835FBState *s, uint32_t value)
     newconf.xoffset = ldl_le_phys(&s->dma_as, value + 24);
     newconf.yoffset = ldl_le_phys(&s->dma_as, value + 28);
 
-    newconf.base = s->vcram_base | (value & 0xc0000000);
-    newconf.base += BCM2835_FB_OFFSET;
+    newconf.base = s->vcram_base + BCM2835_FB_OFFSET;
 
     /* Copy fields which we don't want to change from the existing config */
     newconf.pixo = s->config.pixo;
Signature · 1 line
2.25.1
#7 lore raw

[PULL 8/9] configure: Avoid '==' bashism

In reply to Peter Maydell

The '==' operator to test is a bashism; the standard way to copmare strings is '='. This causes dash to complain:

../../configure: 681: test: linux: unexpected operator

Message-id: [email protected]

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index d0e9a51462e..2c19329d58c 100755
@@ -678,7 +678,7 @@ werror=""
 
 meson_option_build_array() {
   printf '['
-  (if test "$targetos" == windows; then
+  (if test "$targetos" = windows; then
     IFS=\;
   else
     IFS=:
Signature · 1 line
2.25.1
#8 lore raw

[PULL 4/9] configure: Add missing POSIX-required space

In reply to Peter Maydell

In commit 7d7dbf9dc15be6e1 we added a line to the configure script which is not valid POSIX shell syntax, because it is missing a space after a '!' character. shellcheck diagnoses this:

if !(GIT="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
^-- SC1035: You are missing a required space after the !.

and the OpenBSD shell will not correctly handle this without the space.

Fixes 7d7dbf9dc15be6e1 ("configure: replace --enable/disable-git-update with --with-git-submodules")

Message-id: [email protected]

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index 35e0b281985..dec6f030346 100755
@@ -2425,7 +2425,7 @@ else
     cxx=
 fi
 
-if !(GIT="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
+if ! (GIT="$git" "$source_path/scripts/git-submodule.sh" "$git_submodules_action" "$git_submodules"); then
     exit 1
 fi
 
Signature · 1 line
2.25.1
#9 lore raw

[PULL 6/9] configure: Don't use bash-specific string-replacement syntax

In reply to Peter Maydell

The variable string-replacement syntax ${var/old/new} is a bashism (though it is also supported by some other shells), and for instance does not work with the NetBSD /bin/sh, which complains:
../src/configure: 687: Syntax error: Bad substitution

Replace it with a more portable sed-based approach, similar to what we already do in quote_sh().

Note that shellcheck also diagnoses this:

In ./configure line 687:
e=${e/'\'/'\\'}
^-----------^ SC2039: In POSIX sh, string replacement is undefined.
^-- SC1003: Want to escape a single quote? echo 'This is how it'\''s done'.
^-- SC1003: Want to escape a single quote? echo 'This is how it'\''s done'.

In ./configure line 688:

    e=${e/\"/'\"'}
      ^----------^ SC2039: In POSIX sh, string replacement is undefined.
Fixes 8154f5e64b0cf ("meson: Prefix each element of firmware path")

Message-id: [email protected]

---
 configure | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
configure +4 -3
index a56c3d921be..c05205b6085 100755
@@ -684,9 +684,10 @@ meson_option_build_array() {
     IFS=:
   fi
   for e in $1; do
-    e=${e/'\'/'\\'}
-    e=${e/\"/'\"'}
-    printf '"""%s""",' "$e"
+    printf '"""'
+    # backslash escape any '\' and '"' characters
+    printf "%s" "$e" | sed -e 's/\([\"]\)/\\\1/g'
+    printf '""",'
   done)
   printf ']\n'
 }
Signature · 1 line
2.25.1
#10 lore raw
In reply to Peter Maydell
Quoted 15 lines · Peter Maydell

A last lot of bug fixes before rc0...

thanks
-- PMM

The following changes since commit 0d0275c31f00b71b49eb80bbdca2cfe244cf80fb:

   Merge tag 'net-pull-request' of https://github.com/jasowang/qemu into staging (2022-07-26 10:31:02 +0100)

are available in the Git repository at:

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

for you to fetch changes up to 5865d99fe88d8c8fa437c18c6b63fb2a8165634f:

Quoted 8 lines
   hw/display/bcm2835_fb: Fix framebuffer allocation address (2022-07-26 14:09:44 +0100)

----------------------------------------------------------------
target-arm queue:
* Update Coverity component definitions
* target/arm: Add MO_128 entry to pred_esz_masks[]
* configure: Fix portability issues
* hw/display/bcm2835_fb: Fix framebuffer allocation address

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

r~

Quoted 22 lines

----------------------------------------------------------------
Alan Jian (1):
hw/display/bcm2835_fb: Fix framebuffer allocation address

Peter Maydell (8):
scripts/coverity-scan/COMPONENTS.md: Add loongarch component scripts/coverity-scan/COMPONENTS.md: Update slirp component info target/arm: Add MO_128 entry to pred_esz_masks[]
configure: Add missing POSIX-required space
configure: Add braces to clarify intent of $emu[[:space:]]
configure: Don't use bash-specific string-replacement syntax
configure: Drop dead code attempting to use -msmall-data on alpha hosts
configure: Avoid '==' bashism

  configure                           | 20 +++++++-------------
  target/arm/cpu.h                    |  2 +-
  hw/display/bcm2835_fb.c             |  3 +--
  target/arm/translate-sve.c          |  5 +++--
  scripts/coverity-scan/COMPONENTS.md |  7 +++++--
  5 files changed, 17 insertions(+), 20 deletions(-)