From: Conor Dooley <conor@kernel.org>
To: Palmer Dabbelt <palmer@rivosinc.com>
Cc: linux-riscv@lists.infradead.org
Subject: Re: [PATCH] RISC-V: Only provide the single-letter extensions in HWCAP
Date: Fri, 3 Feb 2023 07:11:06 +0000 [thread overview]
Message-ID: <Y9yzigjy+Nm7nsQz@dizzy> (raw)
In-Reply-To: <20230202233832.11036-1-palmer@rivosinc.com>
[-- Attachment #1.1: Type: text/plain, Size: 2894 bytes --]
On Thu, Feb 02, 2023 at 03:38:32PM -0800, Palmer Dabbelt wrote:
> The recent refactoring led to us leaking some HWCAP bits to userspace
> that didn't make much sense. With any luck we'll have a better scheme
> soon, but for now just mask off those bits to avoid polluting userspace.
>
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
> ---
> arch/riscv/include/asm/elf.h | 10 ++++++----
> arch/riscv/include/asm/hwcap.h | 8 --------
> 2 files changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/arch/riscv/include/asm/elf.h b/arch/riscv/include/asm/elf.h
> index e7acffdf21d2..30e7d2455960 100644
> --- a/arch/riscv/include/asm/elf.h
> +++ b/arch/riscv/include/asm/elf.h
> @@ -14,6 +14,7 @@
> #include <asm/auxvec.h>
> #include <asm/byteorder.h>
> #include <asm/cacheinfo.h>
> +#include <asm/hwcap.h>
>
> /*
> * These are used to set parameters in the core dumps.
> @@ -59,12 +60,13 @@ extern bool compat_elf_check_arch(Elf32_Ehdr *hdr);
> #define STACK_RND_MASK (0x3ffff >> (PAGE_SHIFT - 12))
> #endif
> #endif
> +
> /*
> - * This yields a mask that user programs can use to figure out what
> - * instruction set this CPU supports. This could be done in user space,
> - * but it's not easy, and we've already done it here.
> + * Provides information on the availiable set of ISA extensions to userspace,
> + * via a bitmap that coorespends to each single-letter ISA extension. This is
> + * essentially defunct, but will remain for compatibility with userspace.
> */
> -#define ELF_HWCAP (elf_hwcap)
> +#define ELF_HWCAP (elf_hwcap & ((1UL << RISCV_ISA_EXT_BASE) - 1))
Should that not be a GENMASK, or is there a reason not to use that here?
Away from a setup where I can poke at it though, so, since you say this
has only been exported in for-next, preventing us running out of hwcap
sounds like a great idea.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Thanks,
Conor.
> extern unsigned long elf_hwcap;
>
> /*
> diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h
> index ee9c80fe0062..831bebacb7fb 100644
> --- a/arch/riscv/include/asm/hwcap.h
> +++ b/arch/riscv/include/asm/hwcap.h
> @@ -52,18 +52,10 @@
>
> #include <linux/jump_label.h>
>
> -/*
> - * This yields a mask that user programs can use to figure out what
> - * instruction set this cpu supports.
> - */
> -#define ELF_HWCAP (elf_hwcap)
> -
> enum {
> CAP_HWCAP = 1,
> };
>
> -extern unsigned long elf_hwcap;
> -
> struct riscv_isa_ext_data {
> /* Name of the extension displayed to userspace via /proc/cpuinfo */
> char uprop[RISCV_ISA_EXT_NAME_LEN_MAX];
> --
> 2.39.0
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 161 bytes --]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2023-02-03 7:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 23:38 [PATCH] RISC-V: Only provide the single-letter extensions in HWCAP Palmer Dabbelt
2023-02-03 7:11 ` Conor Dooley [this message]
2023-02-22 15:00 ` patchwork-bot+linux-riscv
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=Y9yzigjy+Nm7nsQz@dizzy \
--to=conor@kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@rivosinc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox