Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Zve32[xf] and Zve64[xfd] Vector subextensions #988

Closed
wants to merge 9 commits into from

Conversation

bjoto
Copy link

@bjoto bjoto commented May 9, 2024

Pull request for series with
subject: Support Zve32[xf] and Zve64[xfd] Vector subextensions
version: 5
url: https://patchwork.kernel.org/project/linux-riscv/list/?series=851960

@bjoto
Copy link
Author

bjoto commented May 9, 2024

Upstream branch: 0a16a17
series: https://patchwork.kernel.org/project/linux-riscv/list/?series=851960
version: 5

@bjoto
Copy link
Author

bjoto commented May 14, 2024

Upstream branch: 92cce91
series: https://patchwork.kernel.org/project/linux-riscv/list/?series=851960
version: 5

@bjoto
Copy link
Author

bjoto commented May 22, 2024

Upstream branch: 018b9d9
series: https://patchwork.kernel.org/project/linux-riscv/list/?series=851960
version: 5

@bjoto
Copy link
Author

bjoto commented May 22, 2024

Upstream branch: 0bfbc91
series: https://patchwork.kernel.org/project/linux-riscv/list/?series=851960
version: 5

@bjoto
Copy link
Author

bjoto commented May 23, 2024

Upstream branch: c6c901b
series: https://patchwork.kernel.org/project/linux-riscv/list/?series=851960
version: 5

@bjoto bjoto closed this May 23, 2024
@bjoto bjoto reopened this May 23, 2024
@bjoto
Copy link
Author

bjoto commented May 23, 2024

Upstream branch: 46cad6c
series: https://patchwork.kernel.org/project/linux-riscv/list/?series=851960
version: 5

The function would fail when it detects the calling hart's vlen doesn't
match the first one's. The boot hart is the first hart calling this
function during riscv_fill_hwcap, so it is impossible to fail here. Add
a comment about this behavior.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Currently we only support Vector for SMP platforms, that is, all SMP
cores have the same vlenb. If we happen to detect a mismatching vlen, it
is better to just fail bootting it up to prevent further race/scheduling
issues.

Also, move .Lsecondary_park forward and chage `tail smp_callin` into a
regular call in the early assembly. So a core would be parked right
after a return from smp_callin. Note that a successful smp_callin
does not return.

Fixes: 7017858 ("riscv: Introduce riscv_v_vsize to record size of Vector context")
Reported-by: Conor Dooley <conor.dooley@microchip.com>
Closes: https://lore.kernel.org/linux-riscv/20240228-vicinity-cornstalk-4b8eb5fe5730@spud/
Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Yunhui Cui <cuiyunhui@bytedance.com>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Single-letter extensions may also imply multiple subextensions. For
example, Vector extension implies zve64d, and zve64d implies zve64f.

Extension parsing for "riscv,isa-extensions" has the ability to resolve
the dependency by calling match_isa_ext(). This patch makes deprecated
parser call the same function for single letter extensions.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Add description for Zve32x Zve32f Zve64x Zve64f Zve64d ISA extensions.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Multiple Vector subextensions are added. Also, the patch takes care of
the dependencies of Vector subextensions by macro expansions. So, if
some "embedded" platform only reports "zve64f" on the ISA string, the
parser is able to expand it to zve32x zve32f zve64x and zve64f.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
The following Vector subextensions for "embedded" platforms are added
into RISCV_HWPROBE_KEY_IMA_EXT_0:
 - ZVE32X
 - ZVE32F
 - ZVE64X
 - ZVE64F
 - ZVE64D

Extensions ending with an X indicates that the platform doesn't have a
vector FPU.
Extensions ending with F/D mean that whether single (F) or double (D)
precision vector operation is supported.
The number 32 or 64 follows from ZVE tells the maximum element length.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Reviewed-by: Clément Léger <cleger@rivosinc.com>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
Make has_vector() to check for ZVE32X. Every in-kernel usage of V that
requires a more complicate version of V must then call out explicitly.

Also, change riscv_v_first_use_handler(), and boot code that calls
riscv_v_setup_vsize() to accept ZVE32X.

Most kernel/user interfaces requires minimum of ZVE32X. Thus, programs
compiled and run with ZVE32X should be supported by the kernel on most
aspects. This includes context-switch, signal, ptrace, prctl, and
hwprobe.

One exception is that ELF_HWCAP returns 'V' only if full V is supported
on the platform. This means that the system without a full V must not
rely on ELF_HWCAP to tell whether it is allowable to execute Vector
without first invoking a prctl() check.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Acked-by: Joel Granados <j.granados@samsung.com>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
The minimal requirement for running Vector subextension on Linux is
ZVE32X. So change the test accordingly to run prctl as long as it find
it.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
@bjoto
Copy link
Author

bjoto commented May 23, 2024

Upstream branch: 6ca445d
series: https://patchwork.kernel.org/project/linux-riscv/list/?series=851960
version: 5

@bjoto bjoto force-pushed the for-next_base branch 2 times, most recently from 58015b6 to 958bb3b Compare May 23, 2024 19:15
@bjoto bjoto closed this May 27, 2024
@bjoto
Copy link
Author

bjoto commented May 27, 2024

Upstream branch: 6ca445d
series: https://patchwork.kernel.org/project/linux-riscv/list/?series=851960
version: 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants