[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH v3 5/5] tests/tcg/aarch64: userspace system regist
From: |
Alex Bennée |
Subject: |
Re: [Qemu-arm] [PATCH v3 5/5] tests/tcg/aarch64: userspace system register test |
Date: |
Mon, 25 Jun 2018 21:51:27 +0100 |
User-agent: |
mu4e 1.1.0; emacs 26.1.50 |
Alex Bennée <address@hidden> writes:
> This tests a bunch of registers that the kernel allows userspace to
> read including the CPUID registers.
>
> Signed-off-by: Alex Bennée <address@hidden>
> ---
> tests/tcg/aarch64/Makefile.target | 2 +-
> tests/tcg/aarch64/sysregs.c | 99 +++++++++++++++++++++++++++++++
> 2 files changed, 100 insertions(+), 1 deletion(-)
> create mode 100644 tests/tcg/aarch64/sysregs.c
>
> diff --git a/tests/tcg/aarch64/Makefile.target
> b/tests/tcg/aarch64/Makefile.target
> index 08c45b8470..cc1a7eb486 100644
> --- a/tests/tcg/aarch64/Makefile.target
> +++ b/tests/tcg/aarch64/Makefile.target
> @@ -7,7 +7,7 @@ VPATH += $(AARCH64_SRC)
>
> # we don't build any of the ARM tests
> AARCH64_TESTS=$(filter-out $(ARM_TESTS), $(TESTS))
> -AARCH64_TESTS+=fcvt
> +AARCH64_TESTS+=fcvt sysregs
> TESTS:=$(AARCH64_TESTS)
>
> fcvt: LDFLAGS+=-lm
> diff --git a/tests/tcg/aarch64/sysregs.c b/tests/tcg/aarch64/sysregs.c
> new file mode 100644
> index 0000000000..177d1fe33b
> --- /dev/null
> +++ b/tests/tcg/aarch64/sysregs.c
> @@ -0,0 +1,99 @@
> +/*
> + * Check emulated system register access for linux-user mode.
> + *
> + * See:
> https://www.kernel.org/doc/Documentation/arm64/cpu-feature-registers.txt
> + */
> +
> +#include <asm/hwcap.h>
> +#include <stdio.h>
> +#include <sys/auxv.h>
> +#include <signal.h>
> +#include <string.h>
> +#include <stdbool.h>
> +
<snip>
> +
> + /* when (getauxval(AT_HWCAP) & HWCAP_CPUID), since 4.11*/
> + if (!(getauxval(AT_HWCAP) & HWCAP_CPUID)) {
> + printf("CPUID registers unavailable\n");
> + return 1;
> + } else {
> + printf("Checking CPUID registers\n");
> + }
Annoyingly this fails on qemu:debian-arm64-cross as it uses an older set
of headers than my desktop cross environment:
aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.3.0-16ubuntu3) 7.3.0
with the libc:
Source: cross-toolchain-base (25ubuntu6)
Version: 2.27-3ubuntu1cross1
Provides: libc6-arm64-dcv1
So I'm thinking an #ifndef HWCAP_CPUID and define it would be acceptable
for a test case.
--
Alex Bennée
- [Qemu-arm] [PATCH v3 0/5] support reading some CPUID/CNT registers from user-space, Alex Bennée, 2018/06/25
- [Qemu-arm] [PATCH v3 1/5] target/arm: support reading of CNT[VCT|FRQ]_EL0 from user-space, Alex Bennée, 2018/06/25
- [Qemu-arm] [PATCH v3 4/5] linux-user/elfload: enable HWCAP_CPUID for AArch64, Alex Bennée, 2018/06/25
- [Qemu-arm] [PATCH v3 3/5] target/arm: expose CPUID registers to userspace, Alex Bennée, 2018/06/25
- [Qemu-arm] [PATCH v3 5/5] tests/tcg/aarch64: userspace system register test, Alex Bennée, 2018/06/25
- [Qemu-arm] [PATCH v3 2/5] target/arm: relax permission checks for HWCAP_CPUID registers, Alex Bennée, 2018/06/25
- Re: [Qemu-arm] [PATCH v3 0/5] support reading some CPUID/CNT registers from user-space, Peter Maydell, 2018/06/28