mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
Merge tag 'riscv-for-linus-6.5-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull more RISC-V updates from Palmer Dabbelt: - A bunch of fixes/cleanups from the first part of the merge window, mostly related to ACPI and vector as those were large - Some documentation improvements, mostly related to the new code - The "riscv,isa" DT key is deprecated - Support for link-time dead code elimination - Support for minor fault registration in userfaultd - A handful of cleanups around CMO alternatives * tag 'riscv-for-linus-6.5-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (23 commits) riscv: mm: mark noncoherent_supported as __ro_after_init riscv: mm: mark CBO relate initialization funcs as __init riscv: errata: thead: only set cbom size & noncoherent during boot riscv: Select HAVE_ARCH_USERFAULTFD_MINOR RISC-V: Document the ISA string parsing rules for ACPI risc-v: Fix order of IPI enablement vs RCU startup mm: riscv: fix an unsafe pte read in huge_pte_alloc() dt-bindings: riscv: deprecate riscv,isa RISC-V: drop error print from riscv_hartid_to_cpuid() riscv: Discard vector state on syscalls riscv: move memblock_allow_resize() after linear mapping is ready riscv: Enable ARCH_SUSPEND_POSSIBLE for s2idle riscv: vdso: include vdso/vsyscall.h for vdso_data selftests: Test RISC-V Vector's first-use handler riscv: vector: clear V-reg in the first-use trap riscv: vector: only enable interrupts in the first-use trap RISC-V: Fix up some vector state related build failures RISC-V: Document that V registers are clobbered on syscalls riscv: disable HAVE_LD_DEAD_CODE_DATA_ELIMINATION for LLD riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION ...
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
vstate_exec_nolibc
|
||||
vstate_prctl
|
||||
v_initval_nolibc
|
||||
|
@@ -2,7 +2,7 @@
|
||||
# Copyright (C) 2021 ARM Limited
|
||||
# Originally tools/testing/arm64/abi/Makefile
|
||||
|
||||
TEST_GEN_PROGS := vstate_prctl
|
||||
TEST_GEN_PROGS := vstate_prctl v_initval_nolibc
|
||||
TEST_GEN_PROGS_EXTENDED := vstate_exec_nolibc
|
||||
|
||||
include ../../lib.mk
|
||||
@@ -13,3 +13,7 @@ $(OUTPUT)/vstate_prctl: vstate_prctl.c ../hwprobe/sys_hwprobe.S
|
||||
$(OUTPUT)/vstate_exec_nolibc: vstate_exec_nolibc.c
|
||||
$(CC) -nostdlib -static -include ../../../../include/nolibc/nolibc.h \
|
||||
-Wall $(CFLAGS) $(LDFLAGS) $^ -o $@ -lgcc
|
||||
|
||||
$(OUTPUT)/v_initval_nolibc: v_initval_nolibc.c
|
||||
$(CC) -nostdlib -static -include ../../../../include/nolibc/nolibc.h \
|
||||
-Wall $(CFLAGS) $(LDFLAGS) $^ -o $@ -lgcc
|
||||
|
68
tools/testing/selftests/riscv/vector/v_initval_nolibc.c
Normal file
68
tools/testing/selftests/riscv/vector/v_initval_nolibc.c
Normal file
@@ -0,0 +1,68 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include "../../kselftest.h"
|
||||
#define MAX_VSIZE (8192 * 32)
|
||||
|
||||
void dump(char *ptr, int size)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
if (i != 0) {
|
||||
if (i % 16 == 0)
|
||||
printf("\n");
|
||||
else if (i % 8 == 0)
|
||||
printf(" ");
|
||||
}
|
||||
printf("%02x ", ptr[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
unsigned long vl;
|
||||
char *datap, *tmp;
|
||||
|
||||
datap = malloc(MAX_VSIZE);
|
||||
if (!datap) {
|
||||
ksft_test_result_fail("fail to allocate memory for size = %lu\n", MAX_VSIZE);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
tmp = datap;
|
||||
asm volatile (
|
||||
".option push\n\t"
|
||||
".option arch, +v\n\t"
|
||||
"vsetvli %0, x0, e8, m8, ta, ma\n\t"
|
||||
"vse8.v v0, (%2)\n\t"
|
||||
"add %1, %2, %0\n\t"
|
||||
"vse8.v v8, (%1)\n\t"
|
||||
"add %1, %1, %0\n\t"
|
||||
"vse8.v v16, (%1)\n\t"
|
||||
"add %1, %1, %0\n\t"
|
||||
"vse8.v v24, (%1)\n\t"
|
||||
".option pop\n\t"
|
||||
: "=&r" (vl), "=r" (tmp) : "r" (datap) : "memory");
|
||||
|
||||
ksft_print_msg("vl = %lu\n", vl);
|
||||
|
||||
if (datap[0] != 0x00 && datap[0] != 0xff) {
|
||||
ksft_test_result_fail("v-regesters are not properly initialized\n");
|
||||
dump(datap, vl * 4);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
for (i = 1; i < vl * 4; i++) {
|
||||
if (datap[i] != datap[0]) {
|
||||
ksft_test_result_fail("detect stale values on v-regesters\n");
|
||||
dump(datap, vl * 4);
|
||||
exit(-2);
|
||||
}
|
||||
}
|
||||
|
||||
free(datap);
|
||||
ksft_exit_pass();
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user