Skip to contentSkip to conversation

semihosting/next (SYS_HEAPINFO)

PATCH Superseded Alex Bennée 2 participants 11 messages Mar 12, 2021 RISC-V

lore
Share & tools
lore
#0 lore raw

v5 cover semihosting/next (SYS_HEAPINFO)

Hi,

Change from the last version include tweaking the test to be a little less asnprintf heavy and also don't rely on brk() to do it's job. It also threw up a linux-user failure for RiscV which didn't have the needed TaskState info set. The series now applies cleanly to master.

The following patches need review:

- tests/tcg: add HeapInfo checking to semihosting test
- linux-user/riscv: initialise the TaskState heap/stack info
- semihosting/arm-compat-semi: don't use SET_ARG to report SYS_HEAPINFO
- semihosting: move semihosting tests to multiarch

Alex Bennée (5):
semihosting: move semihosting tests to multiarch semihosting/arm-compat-semi: unify GET/SET_ARG helpers semihosting/arm-compat-semi: don't use SET_ARG to report SYS_HEAPINFO linux-user/riscv: initialise the TaskState heap/stack info tests/tcg: add HeapInfo checking to semihosting test

 tests/tcg/aarch64/semicall.h                  | 18 +++++
 tests/tcg/arm/semicall.h                      | 15 +---
 tests/tcg/riscv64/semicall.h                  | 22 ++++++
 linux-user/riscv/cpu_loop.c                   |  5 ++
 semihosting/arm-compat-semi.c                 | 62 +++++++---------
 tests/tcg/arm/semihosting.c                   | 26 -------
 .../arm-compat-semi}/semiconsole.c            |  2 +
 .../multiarch/arm-compat-semi/semihosting.c   | 71 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 tests/tcg/Makefile.target                     |  3 +
 tests/tcg/aarch64/Makefile.target             | 18 -----
 tests/tcg/arm/Makefile.target                 | 16 +----
 tests/tcg/multiarch/Makefile.target           | 31 ++++++++
 13 files changed, 180 insertions(+), 110 deletions(-)
 create mode 100644 tests/tcg/aarch64/semicall.h
 create mode 100644 tests/tcg/riscv64/semicall.h
 delete mode 100644 tests/tcg/arm/semihosting.c
 rename tests/tcg/{arm => multiarch/arm-compat-semi}/semiconsole.c (93%)
 create mode 100644 tests/tcg/multiarch/arm-compat-semi/semihosting.c
Signature · 1 line
2.20.1
#1 lore raw

PATCH v5 1/5 semihosting: move semihosting tests to multiarch

It may be arm-compat-semihosting but more than one architecture uses it so lets move the tests into the multiarch area. We gate it on the feature and split the semicall.h header between the arches.

Also clean-up a bit of the Makefile messing about to one common set of runners.

---
v5
- add to MAINTAINERS

---
 tests/tcg/aarch64/semicall.h                  | 18 +++++++++++
 tests/tcg/arm/semicall.h                      | 15 +--------
 tests/tcg/riscv64/semicall.h                  | 22 +++++++++++++
 .../arm-compat-semi}/semiconsole.c            |  2 ++
 .../arm-compat-semi}/semihosting.c            |  5 ++-
 MAINTAINERS                                   |  1 +
 tests/tcg/Makefile.target                     |  3 ++
 tests/tcg/aarch64/Makefile.target             | 18 -----------
 tests/tcg/arm/Makefile.target                 | 16 ++--------
 tests/tcg/multiarch/Makefile.target           | 31 +++++++++++++++++++
 10 files changed, 84 insertions(+), 47 deletions(-)
 create mode 100644 tests/tcg/aarch64/semicall.h
 create mode 100644 tests/tcg/riscv64/semicall.h
 rename tests/tcg/{arm => multiarch/arm-compat-semi}/semiconsole.c (93%)
 rename tests/tcg/{arm => multiarch/arm-compat-semi}/semihosting.c (85%)
tests/tcg/aarch64/semicall.h new file +18 -0
new file mode 100644
index 0000000000..8a3fce35c5
@@ -0,0 +1,18 @@
+/*
+ * Semihosting Tests - AArch64 helper
+ *
+ * Copyright (c) 2019
+ * Written by Alex Bennée <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+uintptr_t __semi_call(uintptr_t type, uintptr_t arg0)
+{
+    register uintptr_t t asm("x0") = type;
+    register uintptr_t a0 asm("x1") = arg0;
+    asm("hlt 0xf000"
+        : "=r" (t)
+        : "r" (t), "r" (a0));
+    return t;
+}
tests/tcg/arm/semicall.h +1 -14
index d4f6818192..ad8ac51310 100644
@@ -1,5 +1,5 @@
 /*
- * Semihosting Tests
+ * Semihosting Tests - ARM Helper
  *
  * Copyright (c) 2019
  * Written by Alex Bennée <[email protected]>
@@ -7,13 +7,8 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
-#define SYS_WRITE0      0x04
-#define SYS_READC       0x07
-#define SYS_REPORTEXC   0x18
-
 uintptr_t __semi_call(uintptr_t type, uintptr_t arg0)
 {
-#if defined(__arm__)
     register uintptr_t t asm("r0") = type;
     register uintptr_t a0 asm("r1") = arg0;
 #ifdef __thumb__
@@ -23,13 +18,5 @@ uintptr_t __semi_call(uintptr_t type, uintptr_t arg0)
 #endif
     asm(SVC : "=r" (t)
         : "r" (t), "r" (a0));
-#else
-    register uintptr_t t asm("x0") = type;
-    register uintptr_t a0 asm("x1") = arg0;
-    asm("hlt 0xf000"
-        : "=r" (t)
-        : "r" (t), "r" (a0));
-#endif
-
     return t;
 }
tests/tcg/riscv64/semicall.h new file +22 -0
new file mode 100644
index 0000000000..f8c88f32dc
@@ -0,0 +1,22 @@
+/*
+ * Semihosting Tests - RiscV64 Helper
+ *
+ * Copyright (c) 2021
+ * Written by Alex Bennée <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+uintptr_t __semi_call(uintptr_t type, uintptr_t arg0)
+{
+    register uintptr_t t asm("a0") = type;
+    register uintptr_t a0 asm("a1") = arg0;
+    asm(".option norvc\n\t"
+        ".balign 16\n\t"
+        "slli zero, zero, 0x1f\n\t"
+        "ebreak\n\t"
+        "srai zero, zero, 0x7\n\t"
+        : "=r" (t)
+        : "r" (t), "r" (a0));
+    return t;
+}
tests/tcg/multiarch/arm-compat-semi/semiconsole.c renamed from tests/tcg/arm/semiconsole.c +2 -0
similarity index 93%
rename from tests/tcg/arm/semiconsole.c
rename to tests/tcg/multiarch/arm-compat-semi/semiconsole.c
index 6ef0bd2450..1d82efc589 100644
@@ -7,6 +7,8 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#define SYS_READC       0x07
+
 #include <stdio.h>
 #include <stdint.h>
 #include "semicall.h"
tests/tcg/multiarch/arm-compat-semi/semihosting.c renamed from tests/tcg/arm/semihosting.c +4 -1
similarity index 85%
rename from tests/tcg/arm/semihosting.c
rename to tests/tcg/multiarch/arm-compat-semi/semihosting.c
index 33faac9916..b3fd16cd12 100644
@@ -7,12 +7,15 @@
  * SPDX-License-Identifier: GPL-3.0-or-later
  */
 
+#define SYS_WRITE0      0x04
+#define SYS_REPORTEXC   0x18
+
 #include <stdint.h>
 #include "semicall.h"
 
 int main(int argc, char *argv[argc])
 {
-#if defined(__arm__)
+#if UINTPTR_MAX == UINT32_MAX
     uintptr_t exit_code = 0x20026;
 #else
     uintptr_t exit_block[2] = {0x20026, 0};
MAINTAINERS +1 -0
index 8e9f0d591e..0af92aea8f 100644
@@ -3264,6 +3264,7 @@ M: Alex Bennée <[email protected]>
 S: Maintained
 F: semihosting/
 F: include/semihosting/
+F: tests/tcg/multiarch/arm-compat-semi/
 
 Multi-process QEMU
 M: Elena Ufimtseva <[email protected]>
tests/tcg/Makefile.target +3 -0
index 24d75a5801..cab8c6b3a2 100644
@@ -32,6 +32,9 @@
 all:
 -include ../../../config-host.mak
 -include ../config-$(TARGET).mak
+ifeq ($(CONFIG_USER_ONLY),y)
+-include $(SRC_PATH)/default-configs/targets/$(TARGET).mak
+endif
 
 # for including , in command strings
 COMMA := ,
tests/tcg/aarch64/Makefile.target +0 -18
index bf53ad0087..56e48f4b34 100644
@@ -41,24 +41,6 @@ AARCH64_TESTS += mte-1 mte-2 mte-3 mte-4
 mte-%: CFLAGS += -march=armv8.5-a+memtag
 endif
 
-# Semihosting smoke test for linux-user
-AARCH64_TESTS += semihosting
-run-semihosting: semihosting
-	$(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")
-
-run-plugin-semihosting-with-%:
-	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
-		-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
-		 $(call strip-plugin,$<) 2> $<.err, \
-		"$< on $(TARGET_NAME) with $*")
-
-AARCH64_TESTS += semiconsole
-run-semiconsole: semiconsole
-	$(call skip-test, $<, "MANUAL ONLY")
-
-run-plugin-semiconsole-with-%:
-	$(call skip-test, $<, "MANUAL ONLY")
-
 ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_SVE),)
 # System Registers Tests
 AARCH64_TESTS += sysregs
tests/tcg/arm/Makefile.target +2 -14
index ec95156562..1deda384df 100644
@@ -30,37 +30,25 @@ run-fcvt: fcvt
 	$(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref)
 
 # Semihosting smoke test for linux-user
-ARM_TESTS += semihosting
 semihosting: CFLAGS += -mthumb
-run-semihosting: semihosting
-	$(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")
 
 ARM_TESTS += semihosting-arm
 semihosting-arm: CFLAGS += -marm
-semihosting-arm: semihosting.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
 
 run-semihosting-arm: semihosting-arm
 	$(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")
 
-run-plugin-semihosting-with-%:
+run-plugin-semihosting-arm-with-%:
 	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
 		-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
 		 $(call strip-plugin,$<) 2> $<.err, \
 		"$< on $(TARGET_NAME) with $*")
 
-ARM_TESTS += semiconsole semiconsole-arm
+ARM_TESTS += semiconsole-arm
 
 semiconsole: CFLAGS += -mthumb
-run-semiconsole: semiconsole
-	$(call skip-test, $<, "MANUAL ONLY")
-
-run-plugin-semiconsole-with-%:
-	$(call skip-test, $<, "MANUAL ONLY")
 
 semiconsole-arm: CFLAGS += -marm
-semiconsole-arm: semiconsole.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
 
 run-semiconsole-arm: semiconsole-arm
 	$(call skip-test, $<, "MANUAL ONLY")
tests/tcg/multiarch/Makefile.target +31 -0
index abbdb2e126..a3a751723d 100644
@@ -69,6 +69,37 @@ run-gdbstub-%:
 endif
 EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read
 
+# ARM Compatible Semi Hosting Tests
+#
+# Despite having ARM in the name we actually have several
+# architectures that implement it. We gate the tests on the feature
+# appearing in config.
+#
+ifeq ($(CONFIG_ARM_COMPATIBLE_SEMIHOSTING),y)
+VPATH += $(MULTIARCH_SRC)/arm-compat-semi
+
+# Add -I path back to TARGET_NAME for semicall.h
+semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
+
+run-semihosting: semihosting
+	$(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")
+
+run-plugin-semihosting-with-%:
+	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
+		-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
+		 $(call strip-plugin,$<) 2> $<.err, \
+		"$< on $(TARGET_NAME) with $*")
+
+semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
+
+run-semiconsole: semiconsole
+	$(call skip-test, $<, "MANUAL ONLY")
+
+run-plugin-semiconsole-with-%:
+	$(call skip-test, $<, "MANUAL ONLY")
+
+TESTS += semihosting semiconsole
+endif
 
 # Update TESTS
 TESTS += $(MULTIARCH_TESTS)
Signature · 1 line
2.20.1
#2 lore raw

PATCH v5 2/5 semihosting/arm-compat-semi: unify GET/SET_ARG helpers

In reply to Alex Bennée

From the semihosting point of view what we want to know is the current mode of the processor. Unify this into a single helper and allow us to use the same GET/SET_ARG helpers for the rest of the code. Having the helper will also be useful later.

Note: we aren't currently testing riscv32 due to missing toolchain for check-tcg tests.

---
v3
- consistent #ifdeffery

---
 semihosting/arm-compat-semi.c | 56 ++++++++++++-----------------------
 1 file changed, 19 insertions(+), 37 deletions(-)
semihosting/arm-compat-semi.c +19 -37
index 94950b6c56..0f0e129a7c 100644
@@ -767,15 +767,28 @@ static const GuestFDFunctions guestfd_fns[] = {
     },
 };
 
-/* Read the input value from the argument block; fail the semihosting
- * call if the memory read fails.
+/*
+ * Read the input value from the argument block; fail the semihosting
+ * call if the memory read fails. Eventually we could use a generic
+ * CPUState helper function here.
  */
-#ifdef TARGET_ARM
+static inline bool is_64bit_semihosting(CPUArchState *env)
+{
+#if defined(TARGET_ARM)
+    return is_a64(env);
+#elif defined(TARGET_RISCV)
+    return !riscv_cpu_is_32bit(env);
+#else
+#error un-handled architecture
+#endif
+}
+
+
 #define GET_ARG(n) do {                                 \
-    if (is_a64(env)) {                                  \
+    if (is_64bit_semihosting(env)) {                    \
         if (get_user_u64(arg ## n, args + (n) * 8)) {   \
             errno = EFAULT;                             \
-            return set_swi_errno(cs, -1);              \
+            return set_swi_errno(cs, -1);               \
         }                                               \
     } else {                                            \
         if (get_user_u32(arg ## n, args + (n) * 4)) {   \
@@ -786,41 +799,10 @@ static const GuestFDFunctions guestfd_fns[] = {
 } while (0)
 
 #define SET_ARG(n, val)                                 \
-    (is_a64(env) ?                                      \
+    (is_64bit_semihosting(env) ?                        \
      put_user_u64(val, args + (n) * 8) :                \
      put_user_u32(val, args + (n) * 4))
-#endif
 
-#ifdef TARGET_RISCV
-
-/*
- * get_user_ual is defined as get_user_u32 in softmmu-semi.h,
- * we need a macro that fetches a target_ulong
- */
-#define get_user_utl(arg, p)                    \
-    ((sizeof(target_ulong) == 8) ?              \
-     get_user_u64(arg, p) :                     \
-     get_user_u32(arg, p))
-
-/*
- * put_user_ual is defined as put_user_u32 in softmmu-semi.h,
- * we need a macro that stores a target_ulong
- */
-#define put_user_utl(arg, p)                    \
-    ((sizeof(target_ulong) == 8) ?              \
-     put_user_u64(arg, p) :                     \
-     put_user_u32(arg, p))
-
-#define GET_ARG(n) do {                                                 \
-        if (get_user_utl(arg ## n, args + (n) * sizeof(target_ulong))) { \
-            errno = EFAULT;                                             \
-            return set_swi_errno(cs, -1);                              \
-        }                                                               \
-    } while (0)
-
-#define SET_ARG(n, val)                                 \
-    put_user_utl(val, args + (n) * sizeof(target_ulong))
-#endif
 
 /*
  * Do a semihosting call.
Signature · 1 line
2.20.1
#3 lore raw

PATCH v5 3/5 semihosting/arm-compat-semi: don't use SET_ARG to report SYS_HEAPINFO

In reply to Alex Bennée

As per the spec:

the PARAMETER REGISTER contains the address of a pointer to a four-field data block.

So we need to follow arg0 and place the results of SYS_HEAPINFO there.

Fixes 3c37cfe0b1 ("semihosting: Change internal common-semi interfaces to use CPUState *")
Cc Bug 1915925 <[email protected]>
Cc Keith Packard <[email protected]>

---
v3
- just revert the old behaviour

---
 semihosting/arm-compat-semi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
semihosting/arm-compat-semi.c +5 -1
index 0f0e129a7c..fe079ca93a 100644
@@ -1214,7 +1214,11 @@ target_ulong do_common_semihosting(CPUState *cs)
             for (i = 0; i < ARRAY_SIZE(retvals); i++) {
                 bool fail;
 
-                fail = SET_ARG(i, retvals[i]);
+                if (is_64bit_semihosting(env)) {
+                    fail = put_user_u64(retvals[i], arg0 + i * 8);
+                } else {
+                    fail = put_user_u32(retvals[i], arg0 + i * 4);
+                }
 
                 if (fail) {
                     /* Couldn't write back to argument block */
Signature · 1 line
2.20.1
Reviewed-by on v5 3/5
#4 lore raw

Re: [PATCH v5 3/5] semihosting/arm-compat-semi: don't use SET_ARG to report SYS_HEAPINFO

Quoted 14 lines · Alex Bennée

As per the spec:

the PARAMETER REGISTER contains the address of a pointer to a four-field data block.

So we need to follow arg0 and place the results of SYS_HEAPINFO there.

Fixes 3c37cfe0b1 ("semihosting: Change internal common-semi interfaces to use CPUState *")
Cc Bug 1915925 <[email protected]>
Cc Keith Packard <[email protected]>
Quoted 3 lines

---
v3
- just revert the old behaviour

thanks
-- PMM

#5 lore raw

PATCH v5 4/5 linux-user/riscv: initialise the TaskState heap/stack info

In reply to Alex Bennée

Arguably the target_cpu_copy_regs function for each architecture is misnamed as a number of the architectures also take the opportunity to fill out the TaskState structure. This could arguably be factored out into common code but that would require a wider audit of the architectures. For now just replicate for riscv so we can correctly report semihosting information for SYS_HEAPINFO.

---
 linux-user/riscv/cpu_loop.c | 5 +++++
 1 file changed, 5 insertions(+)
linux-user/riscv/cpu_loop.c +5 -0
index 6767f941e8..74a9628dc9 100644
@@ -135,4 +135,9 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs)
         error_report("Incompatible ELF: RVE cpu requires RVE ABI binary");
         exit(EXIT_FAILURE);
     }
+
+    ts->stack_base = info->start_stack;
+    ts->heap_base = info->brk;
+    /* This will be filled in on the first SYS_HEAPINFO call.  */
+    ts->heap_limit = 0;
 }
Signature · 1 line
2.20.1
#6 lore raw

PATCH v5 5/5 tests/tcg: add HeapInfo checking to semihosting test

In reply to Alex Bennée

Query the SYS_HEAPINFO semicall and do some basic verification of the information via libc calls.

---
v5
- drop asnprintf, just mix printf output
- don't use brk() but do sanity check

---
 .../multiarch/arm-compat-semi/semihosting.c   | 44 ++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)
tests/tcg/multiarch/arm-compat-semi/semihosting.c +43 -1
index b3fd16cd12..8e9cfb578c 100644
@@ -8,9 +8,13 @@
  */
 
 #define SYS_WRITE0      0x04
+#define SYS_HEAPINFO    0x16
 #define SYS_REPORTEXC   0x18
 
 #include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
 #include "semicall.h"
 
 int main(int argc, char *argv[argc])
@@ -21,8 +25,46 @@ int main(int argc, char *argv[argc])
     uintptr_t exit_block[2] = {0x20026, 0};
     uintptr_t exit_code = (uintptr_t) &exit_block;
 #endif
+    struct {
+        void *heap_base;
+        void *heap_limit;
+        void *stack_base;
+        void *stack_limit;
+    } info;
+    void *ptr_to_info = (void *) &info;
 
-    __semi_call(SYS_WRITE0, (uintptr_t) "Hello World");
+    __semi_call(SYS_WRITE0, (uintptr_t) "Checking HeapInfo\n");
+
+    memset(&info, 0, sizeof(info));
+    __semi_call(SYS_HEAPINFO, (uintptr_t) &ptr_to_info);
+
+    if (info.heap_base == NULL || info.heap_limit == NULL) {
+        printf("null heap: %p -> %p\n", info.heap_base, info.heap_limit);
+        exit(1);
+    } else if (info.heap_base != NULL && info.heap_limit != NULL) {
+        /* Error if heap base is above limit */
+        if ((uintptr_t) info.heap_base >= (uintptr_t) info.heap_limit) {
+            printf("heap base %p >= heap_limit %p\n",
+                   info.heap_base, info.heap_limit);
+            exit(2);
+        }
+    }
+
+    if (info.stack_base == NULL) {
+        printf("null stack: %p -> %p\n", info.stack_base, info.stack_limit);
+        exit(3);
+    } else if (info.stack_base != NULL && info.stack_limit != NULL) {
+        /* Error if stack base is below limit */
+        if ((uintptr_t) info.stack_base < (uintptr_t) info.stack_limit) {
+            printf("stack base %p < stack_limit %p\n",
+                   info.stack_base, info.stack_limit);
+            exit(4);
+        }
+    }
+    printf("heap: %p -> %p\n", info.heap_base, info.heap_limit);
+    printf("stack: %p -> %p\n", info.stack_base, info.stack_limit);
+
+    __semi_call(SYS_WRITE0, (uintptr_t) "Passed HeapInfo checks");
     __semi_call(SYS_REPORTEXC, exit_code);
     /* if we get here we failed */
     return -1;
Signature · 1 line
2.20.1
#7 lore raw

Re: [PATCH v5 5/5] tests/tcg: add HeapInfo checking to semihosting test

Quoted 3 lines · Alex Bennée

Query the SYS_HEAPINFO semicall and do some basic verification of the information via libc calls.

Are we both testing system emulation and linux-user, or just one of the two? (Not that I want to hold this up if we're only testing one, but coverage of both, including M-profile, seems like it would be useful; cf also
https://bugs.launchpad.net/qemu/+bug/1918302 which is M-profile system-emulation SYS_HEAPINFO being broken in 5.2.)

thanks
-- PMM

#8 lore raw

Re: [PATCH v5 5/5] tests/tcg: add HeapInfo checking to semihosting test

Quoted 8 lines · Peter Maydell

On Fri, 12 Mar 2021 at 10:31, Alex Benn=C3=A9e <[email protected]> wro= te:

Quoted 3 lines

Query the SYS_HEAPINFO semicall and do some basic verification of the information via libc calls.

Are we both testing system emulation and linux-user, or just one of the two= ?

Currently just linux-user. There is no inherent reason we couldn't add a system emulation test but I felt that was already reasonably exercised by your semihosting tests.

Quoted 8 lines

(Not that I want to hold this up if we're only testing one, but coverage of both, including M-profile, seems like it would be useful; cf also
https://bugs.launchpad.net/qemu/+bug/1918302 which is M-profile system-emul= ation
SYS_HEAPINFO being broken in 5.2.)

thanks
-- PMM

Signature · 1 line
Alex Bennée
#9 lore raw

Re: [PATCH v5 5/5] tests/tcg: add HeapInfo checking to semihosting test

Quoted 10 lines · Alex Bennée
Quoted 6 lines · Peter Maydell

On Fri, 12 Mar 2021 at 10:31, Alex Benn=C3=A9e <[email protected]> wro= te:

Quoted 3 lines

Query the SYS_HEAPINFO semicall and do some basic verification of the information via libc calls.

Quoted 6 lines
Quoted 2 lines

Are we both testing system emulation and linux-user, or just one of the two= ?

Currently just linux-user. There is no inherent reason we couldn't add a system emulation test but I felt that was already reasonably exercised by your semihosting tests.

Do we run those automatically anywhere ? I agree that probably the best thing is to get those into the CI loop somehow (and then put a SYS_HEAPINFO test there.)

-- PMM

#10 lore raw

Re: [PATCH v5 5/5] tests/tcg: add HeapInfo checking to semihosting test

Quoted 17 lines · Peter Maydell

On Fri, 12 Mar 2021 at 11:24, Alex Benn=C3=A9e <[email protected]> wro= te:

Quoted 5 lines
Quoted 1 line · Peter Maydell

On Fri, 12 Mar 2021 at 10:31, Alex Benn=3DC3=3DA9e <alex.bennee@linaro.=

org> wro=3D

Quoted 6 lines
Quoted 6 lines

te:

Quoted 3 lines

Query the SYS_HEAPINFO semicall and do some basic verification of the information via libc calls.

Are we both testing system emulation and linux-user, or just one of the=

two=3D

Quoted 2 lines
Quoted 1 line

?

Quoted 7 lines
Quoted 3 lines

Currently just linux-user. There is no inherent reason we couldn't add a system emulation test but I felt that was already reasonably exercised by your semihosting tests.

Do we run those automatically anywhere ? I agree that probably the best thing is to get those into the CI loop somehow (and then put a SYS_HEAPINFO test there.)

Not currently. I have toyed with series that make integrate the building of external test suites into the source tree. There are a number that it would be useful to have a short "make" away including:

kvm-unit-tests
LTP
diy7 (memory model testing)
sbsa-ref tools

and I guess the semihosting testd would be another good example.

Signature · 1 line
Alex Bennée