* [PATCH] riscv: fix multi-letter extension compare
@ 2022-10-06 7:02 Nikita Shubin
2022-10-06 16:10 ` Jessica Clarke
2022-10-07 6:08 ` Nikita Shubin
0 siblings, 2 replies; 3+ messages in thread
From: Nikita Shubin @ 2022-10-06 7:02 UTC (permalink / raw)
To: Atish Patra
Cc: Nikita Shubin, linux, Nikita Shubin, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Anup Patel, Heiko Stuebner, Guo Ren,
Tsukasa OI, Jisheng Zhang, Sunil V L, Yury Norov, linux-riscv,
linux-kernel
From: Nikita Shubin <n.shubin@yadro.com>
Increment ext pointer to match letters after 'z' character, so it points
to actual extension name.
Fixes: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support")
Signed-off-by: Nikita Shubin <n.shubin@yadro.com>
---
Hello Atish,
Sorry to blame you, but i double checked this and i don't see a way
how extensions from device tree could be successfully matched with
encoded ones without incrementing the ext pointer or prepending
the encoded extensions with 'z' letter.
I have no idea how this could slip through review - am i missing something ?
---
arch/riscv/kernel/cpufeature.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
index 3b5583db9d80..031546052dc0 100644
--- a/arch/riscv/kernel/cpufeature.c
+++ b/arch/riscv/kernel/cpufeature.c
@@ -199,6 +199,7 @@ void __init riscv_fill_hwcap(void)
this_hwcap |= isa2hwcap[(unsigned char)(*ext)];
set_bit(*ext - 'a', this_isa);
} else {
+ ext++;
SET_ISA_EXT_MAP("sscofpmf", RISCV_ISA_EXT_SSCOFPMF);
SET_ISA_EXT_MAP("svpbmt", RISCV_ISA_EXT_SVPBMT);
SET_ISA_EXT_MAP("zicbom", RISCV_ISA_EXT_ZICBOM);
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] riscv: fix multi-letter extension compare
2022-10-06 7:02 [PATCH] riscv: fix multi-letter extension compare Nikita Shubin
@ 2022-10-06 16:10 ` Jessica Clarke
2022-10-07 6:08 ` Nikita Shubin
1 sibling, 0 replies; 3+ messages in thread
From: Jessica Clarke @ 2022-10-06 16:10 UTC (permalink / raw)
To: Nikita Shubin
Cc: Atish Patra, Albert Ou, Yury Norov, Nikita Shubin, Anup Patel,
Linux Kernel Mailing List, linux, Tsukasa OI, Sunil V L,
Palmer Dabbelt, Jisheng Zhang, Paul Walmsley, Guo Ren,
linux-riscv, Heiko Stuebner
On 6 Oct 2022, at 08:02, Nikita Shubin <nikita.shubin@maquefel.me> wrote:
>
> From: Nikita Shubin <n.shubin@yadro.com>
>
> Increment ext pointer to match letters after 'z' character, so it points
> to actual extension name.
>
> Fixes: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support")
> Signed-off-by: Nikita Shubin <n.shubin@yadro.com>
> ---
> Hello Atish,
>
> Sorry to blame you, but i double checked this and i don't see a way
> how extensions from device tree could be successfully matched with
> encoded ones without incrementing the ext pointer or prepending
> the encoded extensions with 'z' letter.
>
> I have no idea how this could slip through review - am i missing something ?
> ---
> arch/riscv/kernel/cpufeature.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
> index 3b5583db9d80..031546052dc0 100644
> --- a/arch/riscv/kernel/cpufeature.c
> +++ b/arch/riscv/kernel/cpufeature.c
> @@ -199,6 +199,7 @@ void __init riscv_fill_hwcap(void)
> this_hwcap |= isa2hwcap[(unsigned char)(*ext)];
> set_bit(*ext - 'a', this_isa);
> } else {
> + ext++;
> SET_ISA_EXT_MAP("sscofpmf", RISCV_ISA_EXT_SSCOFPMF);
> SET_ISA_EXT_MAP("svpbmt", RISCV_ISA_EXT_SVPBMT);
> SET_ISA_EXT_MAP("zicbom", RISCV_ISA_EXT_ZICBOM);
This makes no sense. The single-letter prefix that’s part of the actual
extension name is already in the string there, whether s or z. Your
code means (a) you’d have to double up the prefix in the device tree
(which is obviously wrong) (b) you could use s or z interchangeably as
the first character (e.g. you’d make zzicbom and szicbom parsed as
zicbom).
Are you actually seeing a bug? Did you test this at all? This looks
like you misunderstood code and wrote an untested patch for a bug you
thought you saw.
Jess
> --
> 2.35.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] riscv: fix multi-letter extension compare
2022-10-06 7:02 [PATCH] riscv: fix multi-letter extension compare Nikita Shubin
2022-10-06 16:10 ` Jessica Clarke
@ 2022-10-07 6:08 ` Nikita Shubin
1 sibling, 0 replies; 3+ messages in thread
From: Nikita Shubin @ 2022-10-07 6:08 UTC (permalink / raw)
To: Atish Patra
Cc: linux, Nikita Shubin, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Anup Patel, Heiko Stuebner, Guo Ren, Tsukasa OI, Jisheng Zhang,
Sunil V L, Yury Norov, linux-riscv, linux-kernel
Hello Atish,
My bad, i somehow decided that 'sscofpmf' should
be 'zsscofpmf' in device tree, but it's 'Sscofpmf' actually.
Sorry for noise please ignore this patch.
On Thu, 6 Oct 2022 10:02:56 +0300
Nikita Shubin <nikita.shubin@maquefel.me> wrote:
> From: Nikita Shubin <n.shubin@yadro.com>
>
> Increment ext pointer to match letters after 'z' character, so it
> points to actual extension name.
>
> Fixes: 4905ec2fb7e6 ("RISC-V: Add sscofpmf extension support")
> Signed-off-by: Nikita Shubin <n.shubin@yadro.com>
> ---
> Hello Atish,
>
> Sorry to blame you, but i double checked this and i don't see a way
> how extensions from device tree could be successfully matched with
> encoded ones without incrementing the ext pointer or prepending
> the encoded extensions with 'z' letter.
>
> I have no idea how this could slip through review - am i missing
> something ? ---
> arch/riscv/kernel/cpufeature.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/riscv/kernel/cpufeature.c
> b/arch/riscv/kernel/cpufeature.c index 3b5583db9d80..031546052dc0
> 100644 --- a/arch/riscv/kernel/cpufeature.c
> +++ b/arch/riscv/kernel/cpufeature.c
> @@ -199,6 +199,7 @@ void __init riscv_fill_hwcap(void)
> this_hwcap |= isa2hwcap[(unsigned
> char)(*ext)]; set_bit(*ext - 'a', this_isa);
> } else {
> + ext++;
> SET_ISA_EXT_MAP("sscofpmf",
> RISCV_ISA_EXT_SSCOFPMF); SET_ISA_EXT_MAP("svpbmt",
> RISCV_ISA_EXT_SVPBMT); SET_ISA_EXT_MAP("zicbom",
> RISCV_ISA_EXT_ZICBOM);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-07 6:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06 7:02 [PATCH] riscv: fix multi-letter extension compare Nikita Shubin
2022-10-06 16:10 ` Jessica Clarke
2022-10-07 6:08 ` Nikita Shubin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).