* [PATCH v1 1/2] RISC-V: add non-alternative fallback for riscv_has_extension_[un]likely()
2023-03-24 10:05 [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency Conor Dooley
@ 2023-03-24 10:05 ` Conor Dooley
2023-03-24 10:05 ` [PATCH v1 2/2] RISC-V: always select RISCV_ALTERNATIVE for non-xip kernels Conor Dooley
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Conor Dooley @ 2023-03-24 10:05 UTC (permalink / raw)
To: palmer
Cc: conor, conor.dooley, Paul Walmsley, Heiko Stuebner, Andrew Jones,
Anup Patel, Jisheng Zhang, Jason A . Donenfeld, linux-riscv,
linux-kernel
The has_fpu() check, which in turn calls riscv_has_extension_likely(),
relies on alternatives to figure out whether the system has an FPU.
As a result, it will malfunction on XIP kernels, as they do not support
the alternatives mechanism.
When alternatives support is not present, fall back to using
__riscv_isa_extension_available() in riscv_has_extension_[un]likely()
instead stead, which handily takes the same argument, so that kernels
that do not support alternatives can accurately report the presence of
FPU support.
Fixes: 702e64550b12 ("riscv: fpu: switch has_fpu() to riscv_has_extension_likely()")
Link: https://lore.kernel.org/all/ad445951-3d13-4644-94d9-e0989cda39c3@spud/
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
arch/riscv/include/asm/hwcap.h | 50 ++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 20 deletions(-)
diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h
index e3021b2590de..6263a0de1c6a 100644
--- a/arch/riscv/include/asm/hwcap.h
+++ b/arch/riscv/include/asm/hwcap.h
@@ -57,18 +57,31 @@ struct riscv_isa_ext_data {
unsigned int isa_ext_id;
};
+unsigned long riscv_isa_extension_base(const unsigned long *isa_bitmap);
+
+#define riscv_isa_extension_mask(ext) BIT_MASK(RISCV_ISA_EXT_##ext)
+
+bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, int bit);
+#define riscv_isa_extension_available(isa_bitmap, ext) \
+ __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_##ext)
+
static __always_inline bool
riscv_has_extension_likely(const unsigned long ext)
{
compiletime_assert(ext < RISCV_ISA_EXT_MAX,
"ext must be < RISCV_ISA_EXT_MAX");
- asm_volatile_goto(
- ALTERNATIVE("j %l[l_no]", "nop", 0, %[ext], 1)
- :
- : [ext] "i" (ext)
- :
- : l_no);
+ if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) {
+ asm_volatile_goto(
+ ALTERNATIVE("j %l[l_no]", "nop", 0, %[ext], 1)
+ :
+ : [ext] "i" (ext)
+ :
+ : l_no);
+ } else {
+ if (!__riscv_isa_extension_available(NULL, ext))
+ goto l_no;
+ }
return true;
l_no:
@@ -81,26 +94,23 @@ riscv_has_extension_unlikely(const unsigned long ext)
compiletime_assert(ext < RISCV_ISA_EXT_MAX,
"ext must be < RISCV_ISA_EXT_MAX");
- asm_volatile_goto(
- ALTERNATIVE("nop", "j %l[l_yes]", 0, %[ext], 1)
- :
- : [ext] "i" (ext)
- :
- : l_yes);
+ if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) {
+ asm_volatile_goto(
+ ALTERNATIVE("nop", "j %l[l_yes]", 0, %[ext], 1)
+ :
+ : [ext] "i" (ext)
+ :
+ : l_yes);
+ } else {
+ if (__riscv_isa_extension_available(NULL, ext))
+ goto l_yes;
+ }
return false;
l_yes:
return true;
}
-unsigned long riscv_isa_extension_base(const unsigned long *isa_bitmap);
-
-#define riscv_isa_extension_mask(ext) BIT_MASK(RISCV_ISA_EXT_##ext)
-
-bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, int bit);
-#define riscv_isa_extension_available(isa_bitmap, ext) \
- __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_##ext)
-
#endif
#endif /* _ASM_RISCV_HWCAP_H */
--
2.39.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v1 2/2] RISC-V: always select RISCV_ALTERNATIVE for non-xip kernels
2023-03-24 10:05 [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency Conor Dooley
2023-03-24 10:05 ` [PATCH v1 1/2] RISC-V: add non-alternative fallback for riscv_has_extension_[un]likely() Conor Dooley
@ 2023-03-24 10:05 ` Conor Dooley
2023-03-24 11:31 ` [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency Andrew Jones
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Conor Dooley @ 2023-03-24 10:05 UTC (permalink / raw)
To: palmer
Cc: conor, conor.dooley, Paul Walmsley, Heiko Stuebner, Andrew Jones,
Anup Patel, Jisheng Zhang, Jason A . Donenfeld, linux-riscv,
linux-kernel
When moving switch_to's has_fpu() over to using
riscv_has_extension_likely() rather than static branches, the FPU code
gained a dependency on the alternatives framework.
That dependency has now been removed, as riscv_has_extension_ikely() now
contains a fallback path, using __riscv_isa_extension_available(), but
if CONFIG_RISCV_ALTERNATIVE isn't selected when CONFIG_FPU is, has_fpu()
checks will not benefit from the "fast path" that the alternatives
framework provides.
We want to ensure that alternatives are available whenever
riscv_has_extension_[un]likely() is used, rather than silently falling
back to the slow path, but rather than rely on selecting
RISCV_ALTERNATIVE in the myriad of locations that may use
riscv_has_extension_[un]likely(), select it (almost) always instead by
adding it to the main RISCV config entry.
xip kernels cannot make use of the alternatives framework, so it is not
enabled for those configurations, although this is the status quo.
All current sites that select RISCV_ALTERNATIVE are converted to
dependencies on the option instead. The explicit dependencies on
!XIP_KERNEL can be dropped, as RISCV_ALTERNATIVE is not user selectable.
Fixes: 702e64550b12 ("riscv: fpu: switch has_fpu() to riscv_has_extension_likely()")
Link: https://lore.kernel.org/all/ZBruFRwt3rUVngPu@zx2c4.com/
Reported-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
---
arch/riscv/Kconfig | 12 ++++++------
arch/riscv/Kconfig.erratas | 6 ++----
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index c5e42cc37604..2f6976418d0a 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -126,6 +126,7 @@ config RISCV
select OF_IRQ
select PCI_DOMAINS_GENERIC if PCI
select PCI_MSI if PCI
+ select RISCV_ALTERNATIVE if !XIP_KERNEL
select RISCV_INTC
select RISCV_TIMER if RISCV_SBI
select SIFIVE_PLIC
@@ -401,9 +402,8 @@ config RISCV_ISA_C
config RISCV_ISA_SVPBMT
bool "SVPBMT extension support"
depends on 64BIT && MMU
- depends on !XIP_KERNEL
+ depends on RISCV_ALTERNATIVE
default y
- select RISCV_ALTERNATIVE
help
Adds support to dynamically detect the presence of the SVPBMT
ISA-extension (Supervisor-mode: page-based memory types) and
@@ -428,8 +428,8 @@ config TOOLCHAIN_HAS_ZBB
config RISCV_ISA_ZBB
bool "Zbb extension support for bit manipulation instructions"
depends on TOOLCHAIN_HAS_ZBB
- depends on !XIP_KERNEL && MMU
- select RISCV_ALTERNATIVE
+ depends on MMU
+ depends on RISCV_ALTERNATIVE
default y
help
Adds support to dynamically detect the presence of the ZBB
@@ -443,9 +443,9 @@ config RISCV_ISA_ZBB
config RISCV_ISA_ZICBOM
bool "Zicbom extension support for non-coherent DMA operation"
- depends on !XIP_KERNEL && MMU
+ depends on MMU
+ depends on RISCV_ALTERNATIVE
default y
- select RISCV_ALTERNATIVE
select RISCV_DMA_NONCOHERENT
help
Adds support to dynamically detect the presence of the ZICBOM
diff --git a/arch/riscv/Kconfig.erratas b/arch/riscv/Kconfig.erratas
index 69621ae6d647..0c8f4652cd82 100644
--- a/arch/riscv/Kconfig.erratas
+++ b/arch/riscv/Kconfig.erratas
@@ -2,8 +2,7 @@ menu "CPU errata selection"
config ERRATA_SIFIVE
bool "SiFive errata"
- depends on !XIP_KERNEL
- select RISCV_ALTERNATIVE
+ depends on RISCV_ALTERNATIVE
help
All SiFive errata Kconfig depend on this Kconfig. Disabling
this Kconfig will disable all SiFive errata. Please say "Y"
@@ -35,8 +34,7 @@ config ERRATA_SIFIVE_CIP_1200
config ERRATA_THEAD
bool "T-HEAD errata"
- depends on !XIP_KERNEL
- select RISCV_ALTERNATIVE
+ depends on RISCV_ALTERNATIVE
help
All T-HEAD errata Kconfig depend on this Kconfig. Disabling
this Kconfig will disable all T-HEAD errata. Please say "Y"
--
2.39.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency
2023-03-24 10:05 [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency Conor Dooley
2023-03-24 10:05 ` [PATCH v1 1/2] RISC-V: add non-alternative fallback for riscv_has_extension_[un]likely() Conor Dooley
2023-03-24 10:05 ` [PATCH v1 2/2] RISC-V: always select RISCV_ALTERNATIVE for non-xip kernels Conor Dooley
@ 2023-03-24 11:31 ` Andrew Jones
2023-03-24 11:37 ` Conor Dooley
2023-03-24 13:20 ` Jason A. Donenfeld
` (2 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Andrew Jones @ 2023-03-24 11:31 UTC (permalink / raw)
To: Conor Dooley
Cc: palmer, conor, Paul Walmsley, Heiko Stuebner, Anup Patel,
Jisheng Zhang, Jason A . Donenfeld, linux-riscv, linux-kernel
On Fri, Mar 24, 2023 at 10:05:37AM +0000, Conor Dooley wrote:
> Here's my attempt at fixing both the use of an FPU on XIP kernels and
> the issue that Jason ran into where CONFIG_FPU, which needs the
> alternatives frame work for has_fpu() checks, could be enabled without
> the alternatives actually being present.
>
> For the former, a "slow" fallback that does not use alternatives is
> added to riscv_has_extension_[un]likely() that can be used with XIP.
> Obviously, we want to make use of Jisheng's alternatives based approach
> where possible, so any users of riscv_has_extension_[un]likely() will
> want to make sure that they select RISCV_ALTERNATIVE.
> If they don't however, they'll hit the fallback path which (should,
> sparing a silly mistake from me!) behave in the same way, thus
> succeeding silently. Sounds like a
>
> To prevent "depends on !XIP_KERNEL; select RISCV_ALTERNATIVE" spreading
> like the plague through the various places that want to check for the
> presence of extensions, and sidestep the potential silent "success"
> mentioned above, all users RISCV_ALTERNATIVE are converted from selects
> to dependencies, with the option being selected for all !XIP_KERNEL
> builds.
>
> I know that the VDSO was a key place that Jisheng wanted to use the new
> helper rather than static branches, and I think the fallback path
> should not cause issues there.
>
> See the thread at [1] for the prior discussion.
>
> Cheers,
> Conor.
>
> 1 - https://lore.kernel.org/linux-riscv/20230128172856.3814-1-jszhang@kernel.org/T/#m21390d570997145d31dd8bb95002fd61f99c6573
>
> CC: Paul Walmsley <paul.walmsley@sifive.com>
> CC: Palmer Dabbelt <palmer@dabbelt.com>
> CC: Conor Dooley <conor.dooley@microchip.com>
> CC: Heiko Stuebner <heiko.stuebner@vrull.eu>
> CC: Andrew Jones <ajones@ventanamicro.com>
> CC: Anup Patel <apatel@ventanamicro.com>
> CC: Jisheng Zhang <jszhang@kernel.org>
> CC: Andrew Jones <ajones@ventanamicro.com>
> CC: Jason A. Donenfeld <Jason@zx2c4.com>
> CC: linux-riscv@lists.infradead.org
> CC: linux-kernel@vger.kernel.org
>
> Conor Dooley (2):
> RISC-V: add non-alternative fallback for
> riscv_has_extension_[un]likely()
> RISC-V: always select RISCV_ALTERNATIVE for non-xip kernels
>
> arch/riscv/Kconfig | 12 ++++----
> arch/riscv/Kconfig.erratas | 6 ++--
> arch/riscv/include/asm/hwcap.h | 50 ++++++++++++++++++++--------------
> 3 files changed, 38 insertions(+), 30 deletions(-)
>
> --
> 2.39.2
>
LGTM, but if it was based on for-next then it could also immediately be
applied to zicboz. For the series,
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Thanks,
drew
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency
2023-03-24 11:31 ` [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency Andrew Jones
@ 2023-03-24 11:37 ` Conor Dooley
2023-03-24 11:43 ` Andrew Jones
0 siblings, 1 reply; 9+ messages in thread
From: Conor Dooley @ 2023-03-24 11:37 UTC (permalink / raw)
To: Andrew Jones
Cc: palmer, conor, Paul Walmsley, Heiko Stuebner, Anup Patel,
Jisheng Zhang, Jason A . Donenfeld, linux-riscv, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 3058 bytes --]
On Fri, Mar 24, 2023 at 12:31:07PM +0100, Andrew Jones wrote:
> On Fri, Mar 24, 2023 at 10:05:37AM +0000, Conor Dooley wrote:
> > Here's my attempt at fixing both the use of an FPU on XIP kernels and
> > the issue that Jason ran into where CONFIG_FPU, which needs the
> > alternatives frame work for has_fpu() checks, could be enabled without
> > the alternatives actually being present.
> >
> > For the former, a "slow" fallback that does not use alternatives is
> > added to riscv_has_extension_[un]likely() that can be used with XIP.
> > Obviously, we want to make use of Jisheng's alternatives based approach
> > where possible, so any users of riscv_has_extension_[un]likely() will
> > want to make sure that they select RISCV_ALTERNATIVE.
> > If they don't however, they'll hit the fallback path which (should,
> > sparing a silly mistake from me!) behave in the same way, thus
> > succeeding silently. Sounds like a
> >
> > To prevent "depends on !XIP_KERNEL; select RISCV_ALTERNATIVE" spreading
> > like the plague through the various places that want to check for the
> > presence of extensions, and sidestep the potential silent "success"
> > mentioned above, all users RISCV_ALTERNATIVE are converted from selects
> > to dependencies, with the option being selected for all !XIP_KERNEL
> > builds.
> >
> > I know that the VDSO was a key place that Jisheng wanted to use the new
> > helper rather than static branches, and I think the fallback path
> > should not cause issues there.
> >
> > See the thread at [1] for the prior discussion.
> >
> > Cheers,
> > Conor.
> >
> > 1 - https://lore.kernel.org/linux-riscv/20230128172856.3814-1-jszhang@kernel.org/T/#m21390d570997145d31dd8bb95002fd61f99c6573
> >
> > CC: Paul Walmsley <paul.walmsley@sifive.com>
> > CC: Palmer Dabbelt <palmer@dabbelt.com>
> > CC: Conor Dooley <conor.dooley@microchip.com>
> > CC: Heiko Stuebner <heiko.stuebner@vrull.eu>
> > CC: Andrew Jones <ajones@ventanamicro.com>
> > CC: Anup Patel <apatel@ventanamicro.com>
> > CC: Jisheng Zhang <jszhang@kernel.org>
> > CC: Andrew Jones <ajones@ventanamicro.com>
> > CC: Jason A. Donenfeld <Jason@zx2c4.com>
> > CC: linux-riscv@lists.infradead.org
> > CC: linux-kernel@vger.kernel.org
> >
> > Conor Dooley (2):
> > RISC-V: add non-alternative fallback for
> > riscv_has_extension_[un]likely()
> > RISC-V: always select RISCV_ALTERNATIVE for non-xip kernels
> >
> > arch/riscv/Kconfig | 12 ++++----
> > arch/riscv/Kconfig.erratas | 6 ++--
> > arch/riscv/include/asm/hwcap.h | 50 ++++++++++++++++++++--------------
> > 3 files changed, 38 insertions(+), 30 deletions(-)
> >
> > --
> > 2.39.2
> >
>
> LGTM, but if it was based on for-next then it could also immediately be
> applied to zicboz. For the series,
Hmm, I did it on top of fixes since this needs to go into v6.3.
Perhaps I can create a standalone patch for Zicboz and Palmer could merge
these two into both fixes & for-next, with the standalone applied on
top?
[-- 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency
2023-03-24 11:37 ` Conor Dooley
@ 2023-03-24 11:43 ` Andrew Jones
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Jones @ 2023-03-24 11:43 UTC (permalink / raw)
To: Conor Dooley
Cc: palmer, conor, Paul Walmsley, Heiko Stuebner, Anup Patel,
Jisheng Zhang, Jason A . Donenfeld, linux-riscv, linux-kernel
On Fri, Mar 24, 2023 at 11:37:05AM +0000, Conor Dooley wrote:
> On Fri, Mar 24, 2023 at 12:31:07PM +0100, Andrew Jones wrote:
> > On Fri, Mar 24, 2023 at 10:05:37AM +0000, Conor Dooley wrote:
> > > Here's my attempt at fixing both the use of an FPU on XIP kernels and
> > > the issue that Jason ran into where CONFIG_FPU, which needs the
> > > alternatives frame work for has_fpu() checks, could be enabled without
> > > the alternatives actually being present.
> > >
> > > For the former, a "slow" fallback that does not use alternatives is
> > > added to riscv_has_extension_[un]likely() that can be used with XIP.
> > > Obviously, we want to make use of Jisheng's alternatives based approach
> > > where possible, so any users of riscv_has_extension_[un]likely() will
> > > want to make sure that they select RISCV_ALTERNATIVE.
> > > If they don't however, they'll hit the fallback path which (should,
> > > sparing a silly mistake from me!) behave in the same way, thus
> > > succeeding silently. Sounds like a
> > >
> > > To prevent "depends on !XIP_KERNEL; select RISCV_ALTERNATIVE" spreading
> > > like the plague through the various places that want to check for the
> > > presence of extensions, and sidestep the potential silent "success"
> > > mentioned above, all users RISCV_ALTERNATIVE are converted from selects
> > > to dependencies, with the option being selected for all !XIP_KERNEL
> > > builds.
> > >
> > > I know that the VDSO was a key place that Jisheng wanted to use the new
> > > helper rather than static branches, and I think the fallback path
> > > should not cause issues there.
> > >
> > > See the thread at [1] for the prior discussion.
> > >
> > > Cheers,
> > > Conor.
> > >
> > > 1 - https://lore.kernel.org/linux-riscv/20230128172856.3814-1-jszhang@kernel.org/T/#m21390d570997145d31dd8bb95002fd61f99c6573
> > >
> > > CC: Paul Walmsley <paul.walmsley@sifive.com>
> > > CC: Palmer Dabbelt <palmer@dabbelt.com>
> > > CC: Conor Dooley <conor.dooley@microchip.com>
> > > CC: Heiko Stuebner <heiko.stuebner@vrull.eu>
> > > CC: Andrew Jones <ajones@ventanamicro.com>
> > > CC: Anup Patel <apatel@ventanamicro.com>
> > > CC: Jisheng Zhang <jszhang@kernel.org>
> > > CC: Andrew Jones <ajones@ventanamicro.com>
> > > CC: Jason A. Donenfeld <Jason@zx2c4.com>
> > > CC: linux-riscv@lists.infradead.org
> > > CC: linux-kernel@vger.kernel.org
> > >
> > > Conor Dooley (2):
> > > RISC-V: add non-alternative fallback for
> > > riscv_has_extension_[un]likely()
> > > RISC-V: always select RISCV_ALTERNATIVE for non-xip kernels
> > >
> > > arch/riscv/Kconfig | 12 ++++----
> > > arch/riscv/Kconfig.erratas | 6 ++--
> > > arch/riscv/include/asm/hwcap.h | 50 ++++++++++++++++++++--------------
> > > 3 files changed, 38 insertions(+), 30 deletions(-)
> > >
> > > --
> > > 2.39.2
> > >
> >
> > LGTM, but if it was based on for-next then it could also immediately be
> > applied to zicboz. For the series,
>
> Hmm, I did it on top of fixes since this needs to go into v6.3.
Ah, sure.
> Perhaps I can create a standalone patch for Zicboz and Palmer could merge
> these two into both fixes & for-next, with the standalone applied on
> top?
Sounds good.
Thanks,
drew
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency
2023-03-24 10:05 [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency Conor Dooley
` (2 preceding siblings ...)
2023-03-24 11:31 ` [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency Andrew Jones
@ 2023-03-24 13:20 ` Jason A. Donenfeld
2023-03-30 21:02 ` Palmer Dabbelt
2023-03-30 21:10 ` patchwork-bot+linux-riscv
5 siblings, 0 replies; 9+ messages in thread
From: Jason A. Donenfeld @ 2023-03-24 13:20 UTC (permalink / raw)
To: Conor Dooley
Cc: palmer, conor, Paul Walmsley, Heiko Stuebner, Andrew Jones,
Anup Patel, Jisheng Zhang, linux-riscv, linux-kernel
Seems like a good approach to me. I'm not a RISC-V maintainer or
reviewer, but in case it helps,
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency
2023-03-24 10:05 [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency Conor Dooley
` (3 preceding siblings ...)
2023-03-24 13:20 ` Jason A. Donenfeld
@ 2023-03-30 21:02 ` Palmer Dabbelt
2023-03-30 21:10 ` patchwork-bot+linux-riscv
5 siblings, 0 replies; 9+ messages in thread
From: Palmer Dabbelt @ 2023-03-30 21:02 UTC (permalink / raw)
To: Palmer Dabbelt, Conor Dooley
Cc: Conor Dooley, Paul Walmsley, Heiko Stuebner, Andrew Jones,
Anup Patel, Jisheng Zhang, Jason A . Donenfeld, linux-riscv,
linux-kernel
On Fri, 24 Mar 2023 10:05:37 +0000, Conor Dooley wrote:
> Here's my attempt at fixing both the use of an FPU on XIP kernels and
> the issue that Jason ran into where CONFIG_FPU, which needs the
> alternatives frame work for has_fpu() checks, could be enabled without
> the alternatives actually being present.
>
> For the former, a "slow" fallback that does not use alternatives is
> added to riscv_has_extension_[un]likely() that can be used with XIP.
> Obviously, we want to make use of Jisheng's alternatives based approach
> where possible, so any users of riscv_has_extension_[un]likely() will
> want to make sure that they select RISCV_ALTERNATIVE.
> If they don't however, they'll hit the fallback path which (should,
> sparing a silly mistake from me!) behave in the same way, thus
> succeeding silently. Sounds like a
>
> [...]
Applied, thanks!
[1/2] RISC-V: add non-alternative fallback for riscv_has_extension_[un]likely()
https://git.kernel.org/palmer/c/1aa866931b80
[2/2] RISC-V: always select RISCV_ALTERNATIVE for non-xip kernels
https://git.kernel.org/palmer/c/1ee7fc3f4d0a
Best regards,
--
Palmer Dabbelt <palmer@rivosinc.com>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency
2023-03-24 10:05 [PATCH v1 0/2] RISC-V: Fixes for riscv_has_extension[un]likely()'s alternative dependency Conor Dooley
` (4 preceding siblings ...)
2023-03-30 21:02 ` Palmer Dabbelt
@ 2023-03-30 21:10 ` patchwork-bot+linux-riscv
5 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-03-30 21:10 UTC (permalink / raw)
To: Conor Dooley
Cc: linux-riscv, palmer, conor, paul.walmsley, heiko.stuebner, ajones,
apatel, jszhang, Jason, linux-kernel
Hello:
This series was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Fri, 24 Mar 2023 10:05:37 +0000 you wrote:
> Here's my attempt at fixing both the use of an FPU on XIP kernels and
> the issue that Jason ran into where CONFIG_FPU, which needs the
> alternatives frame work for has_fpu() checks, could be enabled without
> the alternatives actually being present.
>
> For the former, a "slow" fallback that does not use alternatives is
> added to riscv_has_extension_[un]likely() that can be used with XIP.
> Obviously, we want to make use of Jisheng's alternatives based approach
> where possible, so any users of riscv_has_extension_[un]likely() will
> want to make sure that they select RISCV_ALTERNATIVE.
> If they don't however, they'll hit the fallback path which (should,
> sparing a silly mistake from me!) behave in the same way, thus
> succeeding silently. Sounds like a
>
> [...]
Here is the summary with links:
- [v1,1/2] RISC-V: add non-alternative fallback for riscv_has_extension_[un]likely()
https://git.kernel.org/riscv/c/1aa866931b80
- [v1,2/2] RISC-V: always select RISCV_ALTERNATIVE for non-xip kernels
https://git.kernel.org/riscv/c/1ee7fc3f4d0a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 9+ messages in thread