From: "Alex Bennée" <alex.bennee@linaro.org>
To: peter.maydell@linaro.org
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH v3 5/5] tests/tcg/aarch64: userspace system register test
Date: Mon, 25 Jun 2018 21:51:27 +0100 [thread overview]
Message-ID: <87tvpqwpww.fsf@linaro.org> (raw)
In-Reply-To: <20180625160009.17437-6-alex.bennee@linaro.org>
Alex Bennée <alex.bennee@linaro.org> writes:
> This tests a bunch of registers that the kernel allows userspace to
> read including the CPUID registers.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> 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
WARNING: multiple messages have this Message-ID (diff)
From: "Alex Bennée" <alex.bennee@linaro.org>
To: peter.maydell@linaro.org
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 5/5] tests/tcg/aarch64: userspace system register test
Date: Mon, 25 Jun 2018 21:51:27 +0100 [thread overview]
Message-ID: <87tvpqwpww.fsf@linaro.org> (raw)
In-Reply-To: <20180625160009.17437-6-alex.bennee@linaro.org>
Alex Bennée <alex.bennee@linaro.org> writes:
> This tests a bunch of registers that the kernel allows userspace to
> read including the CPUID registers.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> 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
next prev parent reply other threads:[~2018-06-25 20:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 16:00 [PATCH v3 0/5] support reading some CPUID/CNT registers from user-space Alex Bennée
2018-06-25 16:00 ` [Qemu-devel] " Alex Bennée
2018-06-25 16:00 ` [PATCH v3 1/5] target/arm: support reading of CNT[VCT|FRQ]_EL0 " Alex Bennée
2018-06-25 16:00 ` [Qemu-devel] " Alex Bennée
2018-06-27 4:52 ` Richard Henderson
2018-06-27 16:57 ` Emilio G. Cota
2018-06-25 16:00 ` [PATCH v3 2/5] target/arm: relax permission checks for HWCAP_CPUID registers Alex Bennée
2018-06-25 16:00 ` [Qemu-devel] " Alex Bennée
2018-06-27 5:25 ` Richard Henderson
2018-06-28 14:25 ` Peter Maydell
2018-06-28 14:25 ` [Qemu-devel] " Peter Maydell
2018-06-28 14:39 ` Alex Bennée
2018-06-28 14:39 ` [Qemu-devel] " Alex Bennée
2018-06-25 16:00 ` [PATCH v3 3/5] target/arm: expose CPUID registers to userspace Alex Bennée
2018-06-25 16:00 ` [Qemu-devel] " Alex Bennée
2018-06-28 14:23 ` Peter Maydell
2018-06-28 14:23 ` [Qemu-devel] " Peter Maydell
2018-06-25 16:00 ` [PATCH v3 4/5] linux-user/elfload: enable HWCAP_CPUID for AArch64 Alex Bennée
2018-06-25 16:00 ` [Qemu-devel] " Alex Bennée
2018-06-27 5:27 ` Richard Henderson
2018-06-25 16:00 ` [PATCH v3 5/5] tests/tcg/aarch64: userspace system register test Alex Bennée
2018-06-25 16:00 ` [Qemu-devel] " Alex Bennée
2018-06-25 20:51 ` Alex Bennée [this message]
2018-06-25 20:51 ` Alex Bennée
2018-06-27 5:38 ` Richard Henderson
2018-06-28 15:06 ` [PATCH v3 0/5] support reading some CPUID/CNT registers from user-space Peter Maydell
2018-06-28 15:06 ` [Qemu-devel] " Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tvpqwpww.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.