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

riscv: Support vendor extensions and xtheadvector #865

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3fd665f
cpuidle: riscv-sbi: Add cluster_pm_enter()/exit()
nick650823 Feb 26, 2024
30dae23
Merge patch series "riscv: fix patching with IPI"
palmer-dabbelt Apr 17, 2024
a4c0451
Merge patch series "riscv: Create and document PR_RISCV_SET_ICACHE_FL…
palmer-dabbelt Apr 17, 2024
3a0dc44
riscv: Remove redundant CONFIG_64BIT from pgtable_l{4,5}_enabled
Mar 20, 2024
7a04dd8
riscv: Annotate pgtable_l{4,5}_enabled with __ro_after_init
Mar 20, 2024
fc7a50e
riscv: mm: still create swiotlb buffer for kmalloc() bouncing if requ…
xhackerustc Mar 25, 2024
e445302
Merge patch series "riscv: enable lockless lockref implementation"
palmer-dabbelt Apr 24, 2024
0a16a17
riscv: select ARCH_HAS_FAST_MULTIPLIER
xhackerustc Mar 25, 2024
ff9921f
adding ci files
Apr 28, 2024
2e3f8bc
dt-bindings: riscv: Add xtheadvector ISA extension description
charlie-rivos May 3, 2024
2224c88
dt-bindings: riscv: cpus: add a vlen register length property
ConchuOD May 3, 2024
f3dadcb
riscv: vector: Use vlenb from DT
charlie-rivos May 3, 2024
a44e48c
riscv: dts: allwinner: Add xtheadvector to the D1/D1s devicetree
charlie-rivos May 3, 2024
57d7044
riscv: Extend cpufeature.c to detect vendor extensions
charlie-rivos May 3, 2024
015b2c0
riscv: Add vendor extensions to /proc/cpuinfo
charlie-rivos May 3, 2024
f13a2e0
riscv: Introduce vendor variants of extension helpers
charlie-rivos May 3, 2024
5f323cb
riscv: cpufeature: Extract common elements from extension checking
charlie-rivos May 3, 2024
96faf2e
riscv: Convert xandespmu to use the vendor extension framework
charlie-rivos May 3, 2024
cac64e3
RISC-V: define the elements of the VCSR vector CSR
mmind May 3, 2024
9ef0115
riscv: csr: Add CSR encodings for VCSR_VXRM/VCSR_VXSAT
charlie-rivos May 3, 2024
e549023
riscv: Add xtheadvector instruction definitions
charlie-rivos May 3, 2024
f972f9d
riscv: vector: Support xtheadvector save/restore
charlie-rivos May 3, 2024
dd79a18
riscv: hwprobe: Add thead vendor extension probing
charlie-rivos May 3, 2024
7c29145
riscv: hwprobe: Document thead vendor extensions and xtheadvector ext…
charlie-rivos May 3, 2024
3eb103e
selftests: riscv: Fix vector tests
charlie-rivos May 3, 2024
a5d53e5
selftests: riscv: Support xtheadvector in vector tests
charlie-rivos May 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/scripts/patches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2023 Rivos Inc.
#
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail

d=$(dirname "${BASH_SOURCE[0]}")

parallel_log=$(mktemp -p /build)
basesha=$(git log -1 --pretty=%H .github/scripts/patches.sh)
patches=( $(git rev-list --reverse ${basesha}..HEAD) )

echo "git-tip begin"
git log -1 $(git log -1 --pretty=%H .github/scripts/patches.sh)^
echo "git-tip end"

patch_tot=${#patches[@]}
rc=0
cnt=1

(while true ; do sleep 30; echo .; done) &
progress=$!

parallel -j 4 --joblog ${parallel_log} --colsep=, bash ${d}/patches/patch_tester.sh \
{1} {2} {3} :::: <(
for i in "${patches[@]}"; do
echo ${i},${cnt},${patch_tot}
cnt=$(( cnt + 1 ))
done) || rc=1
kill $progress
cat ${parallel_log}

42 changes: 42 additions & 0 deletions .github/scripts/patches/patch_tester.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2023 Rivos Inc.
#
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail

d=$(dirname "${BASH_SOURCE[0]}")

sha1=$1
patch_num=$2
patch_tot=$3

worktree=$(mktemp -d -p /build)
git worktree add $worktree ${sha1} &>/dev/null
cd $worktree

rc=0
tests=( $(ls ${d}/tests/*.sh) )
tcnt=1
for j in "${tests[@]}"; do
git reset --hard ${sha1} &>/dev/null
msg="Patch ${patch_num}/${patch_tot}: Test ${tcnt}/${#tests[@]}: ${j}"
echo "::group::${msg}"
testrc=0
bash ${j} || testrc=$?
echo "::endgroup::"
if (( $testrc == 250 )); then
rc=1
echo "::warning::WARN ${msg}"
elif (( $testrc )); then
rc=1
echo "::error::FAIL ${msg}"
else
echo "::notice::OK ${msg}"
fi
tcnt=$(( tcnt + 1 ))
done

git worktree remove $worktree &>/dev/null || true

exit $rc
23 changes: 23 additions & 0 deletions .github/scripts/patches/tests/build_rv32_defconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2022 by Rivos Inc.

tmpdir=build
tmpfile=$(mktemp -p /build)
rc=0

tuxmake --wrapper ccache --target-arch riscv --directory . \
--environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \
--environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \
-o $tmpdir --toolchain llvm -z none -k rv32_defconfig \
CROSS_COMPILE=riscv64-linux- \
>$tmpfile 2>/dev/null || rc=1

if [ $rc -ne 0 ]; then
grep "\(warning\|error\):" $tmpfile
fi

rm -rf $tmpdir $tmpfile

exit $rc
108 changes: 108 additions & 0 deletions .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2019 Netronome Systems, Inc.

# Modified tests/patch/build_defconfig_warn.sh for RISC-V builds

tmpfile_e=$(mktemp -p /build)
tmpfile_o=$(mktemp -p /build)
tmpfile_n=$(mktemp -p /build)

tmpdir_b=build_llvm
tmpdir_o=output

rc=0

echo "Redirect to $tmpfile_o and $tmpfile_n"

HEAD=$(git rev-parse HEAD)

echo "Tree base:"
git log -1 --pretty='%h ("%s")' HEAD~

echo "Building the whole tree with the patch"

tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \
--environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \
--environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \
-o $tmpdir_o -b $tmpdir_b --toolchain llvm -z none --kconfig allmodconfig \
-K CONFIG_WERROR=n -K CONFIG_RANDSTRUCT_NONE=y -K CONFIG_SAMPLES=n W=1 \
CROSS_COMPILE=riscv64-linux- \
config default \
>$tmpfile_e 2>/dev/null || rc=1

if [ $rc -eq 1 ]; then
grep "\(error\):" $tmpfile_e
rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b $tmpfile_e
exit $rc
fi

current=$(grep -c "\(warning\|error\):" $tmpfile_n)

git checkout -q HEAD~

echo "Building the tree before the patch"

tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \
--environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \
--environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \
-o $tmpdir_o -b $tmpdir_b --toolchain llvm -z none --kconfig allmodconfig \
-K CONFIG_WERROR=n -K CONFIG_RANDSTRUCT_NONE=y W=1 \
CROSS_COMPILE=riscv64-linux- \
config default \
>$tmpfile_o 2>/dev/null

incumbent=$(grep -c "\(warning\|error\):" $tmpfile_o)

git checkout -q $HEAD

echo "Building the tree with the patch"

tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \
--environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \
--environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \
-o $tmpdir_o -b $tmpdir_b --toolchain llvm -z none --kconfig allmodconfig \
-K CONFIG_WERROR=n -K CONFIG_RANDSTRUCT_NONE=y W=1 \
CROSS_COMPILE=riscv64-linux- \
config default \
>$tmpfile_n 2>/dev/null || rc=1

if [ $rc -eq 1 ]; then
grep "\(warning\|error\):" $tmpfile_n
rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b
exit $rc
fi

current=$(grep -c "\(warning\|error\):" $tmpfile_n)

if [ $current -gt $incumbent ]; then
echo "New errors added:"

tmpfile_errors_before=$(mktemp -p /build)
tmpfile_errors_now=$(mktemp -p /build)
grep "\(warning\|error\):" $tmpfile_o | sort | uniq -c > $tmpfile_errors_before
grep "\(warning\|error\):" $tmpfile_n | sort | uniq -c > $tmpfile_errors_now

diff -U 0 $tmpfile_errors_before $tmpfile_errors_now

rm $tmpfile_errors_before $tmpfile_errors_now

echo "Per-file breakdown"
tmpfile_fo=$(mktemp -p /build)
tmpfile_fn=$(mktemp -p /build)

grep "\(warning\|error\):" $tmpfile_o | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \
> $tmpfile_fo
grep "\(warning\|error\):" $tmpfile_n | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \
> $tmpfile_fn

diff -U 0 $tmpfile_fo $tmpfile_fn
rm $tmpfile_fo $tmpfile_fn
echo "pre: $incumbent post: $current"
rc=1
fi

rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b $tmpfile_e

exit $rc
107 changes: 107 additions & 0 deletions .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2019 Netronome Systems, Inc.

# Modified tests/patch/build_defconfig_warn.sh for RISC-V builds

tmpfile_e=$(mktemp -p /build)
tmpfile_o=$(mktemp -p /build)
tmpfile_n=$(mktemp -p /build)

tmpdir_b=build_gcc
tmpdir_o=output

rc=0

echo "Redirect to $tmpfile_o and $tmpfile_n"

HEAD=$(git rev-parse HEAD)

echo "Tree base:"
git log -1 --pretty='%h ("%s")' HEAD~

echo "Building the whole tree with the patch"

tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \
--environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \
--environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \
-o $tmpdir_o -b $tmpdir_b --toolchain gcc -z none --kconfig allmodconfig \
-K CONFIG_WERROR=n -K CONFIG_GCC_PLUGINS=n W=1 \
CROSS_COMPILE=riscv64-linux- \
config default \
>$tmpfile_e 2>/dev/null || rc=1

if [ $rc -eq 1 ]; then
grep "\(error\):" $tmpfile_e
rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b $tmpfile_e
exit $rc
fi

git checkout -q HEAD~

echo "Building the tree before the patch"

tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \
--environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \
--environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \
-o $tmpdir_o -b $tmpdir_b --toolchain gcc -z none --kconfig allmodconfig \
-K CONFIG_WERROR=n -K CONFIG_GCC_PLUGINS=n W=1 \
CROSS_COMPILE=riscv64-linux- \
config default \
>$tmpfile_o 2>/dev/null

incumbent=$(grep -c "\(warning\|error\):" $tmpfile_o)

git checkout -q $HEAD

echo "Building the tree with the patch"

tuxmake --wrapper ccache --target-arch riscv -e PATH=$PATH --directory . \
--environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \
--environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \
-o $tmpdir_o -b $tmpdir_b --toolchain gcc -z none --kconfig allmodconfig \
-K CONFIG_WERROR=n -K CONFIG_GCC_PLUGINS=n W=1 \
CROSS_COMPILE=riscv64-linux- \
config default \
>$tmpfile_n 2>/dev/null || rc=1

if [ $rc -eq 1 ]; then
grep "\(warning\|error\):" $tmpfile_n
rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b
exit $rc
fi

current=$(grep -c "\(warning\|error\):" $tmpfile_n)

if [ $current -gt $incumbent ]; then
echo "New errors added:"

tmpfile_errors_before=$(mktemp -p /build)
tmpfile_errors_now=$(mktemp -p /build)
grep "\(warning\|error\):" $tmpfile_o | sort | uniq -c > $tmpfile_errors_before
grep "\(warning\|error\):" $tmpfile_n | sort | uniq -c > $tmpfile_errors_now

diff -U 0 $tmpfile_errors_before $tmpfile_errors_now

rm $tmpfile_errors_before $tmpfile_errors_now

echo "Per-file breakdown"
tmpfile_fo=$(mktemp -p /build)
tmpfile_fn=$(mktemp -p /build)

grep "\(warning\|error\):" $tmpfile_o | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \
> $tmpfile_fo
grep "\(warning\|error\):" $tmpfile_n | sed -n 's@\(^\.\./[/a-zA-Z0-9_.-]*.[ch]\):.*@\1@p' | sort | uniq -c \
> $tmpfile_fn

diff -U 0 $tmpfile_fo $tmpfile_fn
rm $tmpfile_fo $tmpfile_fn
echo "pre: $incumbent post: $current"

rc=1
fi

rm -rf $tmpdir_o $tmpfile_o $tmpfile_n $tmpdir_b $tmpfile_e

exit $rc
23 changes: 23 additions & 0 deletions .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2022 by Rivos Inc.

tmpdir=$(mktemp -d -p /build)
tmpfile=$(mktemp -p /build)
rc=0

tuxmake --wrapper ccache --target-arch riscv --directory . \
--environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \
--environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \
-o $tmpdir --toolchain gcc -z none -k nommu_k210_defconfig \
CROSS_COMPILE=riscv64-linux- \
>$tmpfile 2>/dev/null || rc=1

if [ $rc -ne 0 ]; then
grep "\(warning\|error\):" $tmpfile
fi

rm -rf $tmpdir $tmpfile

exit $rc
23 changes: 23 additions & 0 deletions .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2022 by Rivos Inc.

tmpdir=$(mktemp -d -p /build)
tmpfile=$(mktemp -p /build)
rc=0

tuxmake --wrapper ccache --target-arch riscv --directory . \
--environment=KBUILD_BUILD_TIMESTAMP=@1621270510 \
--environment=KBUILD_BUILD_USER=tuxmake --environment=KBUILD_BUILD_HOST=tuxmake \
-o $tmpdir --toolchain gcc -z none -k nommu_virt_defconfig \
CROSS_COMPILE=riscv64-linux- \
>$tmpfile 2>/dev/null || rc=1

if [ $rc -ne 0 ]; then
grep "\(warning\|error\):" $tmpfile
fi

rm -rf $tmpdir $tmpfile

exit $rc