From: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
To: Nathan Egge <negge@xiph.org>, Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Bin Meng <bin.meng@windriver.com>
Cc: Weiwei Li <liweiwei@iscas.ac.cn>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
qemu-riscv@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH] linux-user/elfload: Set V in ELF_HWCAP for RISC-V
Date: Thu, 3 Aug 2023 11:42:03 -0300 [thread overview]
Message-ID: <cfb8653b-ddc8-b4a9-9792-73ef84ee925e@ventanamicro.com> (raw)
In-Reply-To: <20230803131424.40744-1-negge@xiph.org>
On 8/3/23 10:14, Nathan Egge wrote:
> From: "Nathan Egge" <negge@xiph.org>
>
> Set V bit for hwcap if misa is set.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1793
> Signed-off-by: Nathan Egge <negge@xiph.org>
> ---
Tested with the example program described in the bug:
===========
#include <sys/auxv.h>
#include <stdio.h>
#define ISA_V_HWCAP (1 << ('v' - 'a'))
void main() {
unsigned long hw_cap = getauxval(AT_HWCAP);
printf("RVV %s\n", hw_cap & ISA_V_HWCAP ? "detected" : "not found");
}
===========
$ ./qemu-riscv64 -cpu rv64,vext_spec=v1.0,v=true,vlen=128 -B 0x100000 ./a.out
RVV detected
$ ./qemu-riscv64 -cpu rv64,vext_spec=v1.0,vlen=128 -B 0x100000 ./a.out
RVV not found
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Looks like 8.1 material to me. Thanks,
Daniel
> linux-user/elfload.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index 861ec07abc..a299ba7300 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -1710,7 +1710,8 @@ static uint32_t get_elf_hwcap(void)
> #define MISA_BIT(EXT) (1 << (EXT - 'A'))
> RISCVCPU *cpu = RISCV_CPU(thread_cpu);
> uint32_t mask = MISA_BIT('I') | MISA_BIT('M') | MISA_BIT('A')
> - | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C');
> + | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C')
> + | MISA_BIT('V');
>
> return cpu->env.misa_ext & mask;
> #undef MISA_BIT
next prev parent reply other threads:[~2023-08-03 14:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-03 13:14 [PATCH] linux-user/elfload: Set V in ELF_HWCAP for RISC-V Nathan Egge
2023-08-03 14:42 ` Daniel Henrique Barboza [this message]
2023-08-04 16:17 ` Richard Henderson
2023-08-08 6:36 ` Michael Tokarev
2023-08-10 17:09 ` Alistair Francis
-- strict thread matches above, loose matches on Subject: below --
2023-07-31 12:10 Nathan Egge
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=cfb8653b-ddc8-b4a9-9792-73ef84ee925e@ventanamicro.com \
--to=dbarboza@ventanamicro.com \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=liweiwei@iscas.ac.cn \
--cc=negge@xiph.org \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/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.