Skip to content

Commit 2f9eb0c

Browse files
committed
Merge tag 'riscv-for-linus-7.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V fixes from Paul Walmsley: "The most notable change involves the rseq kselftest common Makefile (as it is not RISC-V-specific). The basic approach in the patch appears similar to one used in the KVM and S390 selftests (grep for LINUX_TOOL_ARCH_INCLUDE and SUBARCH), and the rseq kselftests pass a quick build test on x86 after this. - Avoid a null pointer deference in machine_kexec_prepare() that the IMA subsystem can trigger - Bypass libc in part of the ptrace_v_not_enabled kselftest to avoid noise from child atfork handlers that libc might run - Include Kconfig support for UltraRISC SoCs, already referenced by some device drivers; and enable it in our defconfig - Fix the build of the rseq kselftest for RISC-V by borrowing a technique from the KVM and S390 kselftests that includes arch-specific header files from tools/arch/<arch>/include - Fix some memory leaks in the RISC-V vector ptrace kselftests - Clean up some DT bindings and hwprobe documentation" * tag 'riscv-for-linus-7.2-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: selftests/riscv: ptrace: Fix memory leak of regset_data in vector tests selftests/rseq: Fix a building error for riscv arch riscv: defconfig: enable ARCH_ULTRARISC riscv: add UltraRISC SoC family Kconfig support riscv: hwprobe.rst: Document EXT_ZICFISS and EXT_ZICFILP riscv: hwprobe.rst: Make indentation consistent dt-bindings: riscv: sort multi-letter Z extensions alphanumerically selftests: riscv: Bypass libc in inactive vector ptrace test riscv: Prevent NULL pointer dereference in machine_kexec_prepare()
2 parents f4bf75d + 58a37e7 commit 2f9eb0c

7 files changed

Lines changed: 222 additions & 197 deletions

File tree

Documentation/arch/riscv/hwprobe.rst

Lines changed: 107 additions & 97 deletions
Large diffs are not rendered by default.

Documentation/devicetree/bindings/riscv/extensions.yaml

Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,13 @@ properties:
457457
merged in the riscv-isa-manual by commit dbc79cf28a2 ("Initial seed
458458
of zc.adoc to src tree.").
459459
460+
- const: zclsd
461+
description:
462+
The Zclsd extension implements the compressed (16-bit) version of the
463+
Load/Store Pair for RV32. As with Zilsd, this extension was ratified
464+
in commit f88abf1 ("Integrating load/store pair for RV32 with the
465+
main manual") of riscv-isa-manual.
466+
460467
- const: zcmop
461468
description:
462469
The standard Zcmop extension version 1.0, as ratified in commit
@@ -487,6 +494,22 @@ properties:
487494
in commit 64074bc ("Update version numbers for Zfh/Zfinx") of
488495
riscv-isa-manual.
489496

497+
- const: zicbom
498+
description:
499+
The standard Zicbom extension for base cache management operations as
500+
ratified in commit 3dd606f ("Create cmobase-v1.0.pdf") of riscv-CMOs.
501+
502+
- const: zicbop
503+
description:
504+
The standard Zicbop extension for cache-block prefetch instructions
505+
as ratified in commit 3dd606f ("Create cmobase-v1.0.pdf") of
506+
riscv-CMOs.
507+
508+
- const: zicboz
509+
description:
510+
The standard Zicboz extension for cache-block zeroing as ratified
511+
in commit 3dd606f ("Create cmobase-v1.0.pdf") of riscv-CMOs.
512+
490513
- const: ziccamoa
491514
description:
492515
The standard Ziccamoa extension for main memory (cacheability and
@@ -514,19 +537,77 @@ properties:
514537
guarantee on LR/SC sequences, as ratified in commit b1d806605f87
515538
("Updated to ratified state.") of the riscv profiles specification.
516539

540+
- const: zicfilp
541+
description: |
542+
The standard Zicfilp extension for enforcing forward edge
543+
control-flow integrity as ratified in commit 3f8e450 ("merge
544+
pull request #227 from ved-rivos/0709") of riscv-cfi
545+
github repo.
546+
547+
- const: zicfiss
548+
description: |
549+
The standard Zicfiss extension for enforcing backward edge
550+
control-flow integrity as ratified in commit 3f8e450 ("merge
551+
pull request #227 from ved-rivos/0709") of riscv-cfi
552+
github repo.
553+
554+
- const: zicntr
555+
description:
556+
The standard Zicntr extension for base counters and timers, as
557+
ratified in the 20191213 version of the unprivileged ISA
558+
specification.
559+
560+
- const: zicond
561+
description:
562+
The standard Zicond extension for conditional arithmetic and
563+
conditional-select/move operations as ratified in commit 95cf1f9
564+
("Add changes requested by Ved during signoff") of riscv-zicond.
565+
566+
- const: zicsr
567+
description: |
568+
The standard Zicsr extension for control and status register
569+
instructions, as ratified in the 20191213 version of the
570+
unprivileged ISA specification.
571+
572+
This does not include Chapter 10, "Counters", which documents
573+
special case read-only CSRs, that were moved into the Zicntr and
574+
Zihpm extensions after the ratification of the 20191213 version of
575+
the unprivileged specification.
576+
577+
- const: zifencei
578+
description:
579+
The standard Zifencei extension for instruction-fetch fence, as
580+
ratified in the 20191213 version of the unprivileged ISA
581+
specification.
582+
583+
- const: zihintntl
584+
description:
585+
The standard Zihintntl extension for non-temporal locality hints, as
586+
ratified in commit 0dc91f5 ("Zihintntl is ratified") of the
587+
riscv-isa-manual.
588+
589+
- const: zihintpause
590+
description:
591+
The standard Zihintpause extension for pause hints, as ratified in
592+
commit d8ab5c7 ("Zihintpause is ratified") of the riscv-isa-manual.
593+
594+
- const: zihpm
595+
description:
596+
The standard Zihpm extension for hardware performance counters, as
597+
ratified in the 20191213 version of the unprivileged ISA
598+
specification.
599+
517600
- const: zilsd
518601
description:
519602
The standard Zilsd extension which provides support for aligned
520603
register-pair load and store operations in 32-bit instruction
521604
encodings, as ratified in commit f88abf1 ("Integrating
522605
load/store pair for RV32 with the main manual") of riscv-isa-manual.
523606

524-
- const: zclsd
607+
- const: zimop
525608
description:
526-
The Zclsd extension implements the compressed (16-bit) version of the
527-
Load/Store Pair for RV32. As with Zilsd, this extension was ratified
528-
in commit f88abf1 ("Integrating load/store pair for RV32 with the
529-
main manual") of riscv-isa-manual.
609+
The standard Zimop extension version 1.0, as ratified in commit
610+
58220614a5f ("Zimop is ratified/1.0") of the riscv-isa-manual.
530611

531612
- const: zk
532613
description:
@@ -590,87 +671,6 @@ properties:
590671
in version 1.0 of RISC-V Cryptography Extensions Volume I
591672
specification.
592673

593-
- const: zicbom
594-
description:
595-
The standard Zicbom extension for base cache management operations as
596-
ratified in commit 3dd606f ("Create cmobase-v1.0.pdf") of riscv-CMOs.
597-
598-
- const: zicbop
599-
description:
600-
The standard Zicbop extension for cache-block prefetch instructions
601-
as ratified in commit 3dd606f ("Create cmobase-v1.0.pdf") of
602-
riscv-CMOs.
603-
604-
- const: zicboz
605-
description:
606-
The standard Zicboz extension for cache-block zeroing as ratified
607-
in commit 3dd606f ("Create cmobase-v1.0.pdf") of riscv-CMOs.
608-
609-
- const: zicfilp
610-
description: |
611-
The standard Zicfilp extension for enforcing forward edge
612-
control-flow integrity as ratified in commit 3f8e450 ("merge
613-
pull request #227 from ved-rivos/0709") of riscv-cfi
614-
github repo.
615-
616-
- const: zicfiss
617-
description: |
618-
The standard Zicfiss extension for enforcing backward edge
619-
control-flow integrity as ratified in commit 3f8e450 ("merge
620-
pull request #227 from ved-rivos/0709") of riscv-cfi
621-
github repo.
622-
623-
- const: zicntr
624-
description:
625-
The standard Zicntr extension for base counters and timers, as
626-
ratified in the 20191213 version of the unprivileged ISA
627-
specification.
628-
629-
- const: zicond
630-
description:
631-
The standard Zicond extension for conditional arithmetic and
632-
conditional-select/move operations as ratified in commit 95cf1f9
633-
("Add changes requested by Ved during signoff") of riscv-zicond.
634-
635-
- const: zicsr
636-
description: |
637-
The standard Zicsr extension for control and status register
638-
instructions, as ratified in the 20191213 version of the
639-
unprivileged ISA specification.
640-
641-
This does not include Chapter 10, "Counters", which documents
642-
special case read-only CSRs, that were moved into the Zicntr and
643-
Zihpm extensions after the ratification of the 20191213 version of
644-
the unprivileged specification.
645-
646-
- const: zifencei
647-
description:
648-
The standard Zifencei extension for instruction-fetch fence, as
649-
ratified in the 20191213 version of the unprivileged ISA
650-
specification.
651-
652-
- const: zihintpause
653-
description:
654-
The standard Zihintpause extension for pause hints, as ratified in
655-
commit d8ab5c7 ("Zihintpause is ratified") of the riscv-isa-manual.
656-
657-
- const: zihintntl
658-
description:
659-
The standard Zihintntl extension for non-temporal locality hints, as
660-
ratified in commit 0dc91f5 ("Zihintntl is ratified") of the
661-
riscv-isa-manual.
662-
663-
- const: zihpm
664-
description:
665-
The standard Zihpm extension for hardware performance counters, as
666-
ratified in the 20191213 version of the unprivileged ISA
667-
specification.
668-
669-
- const: zimop
670-
description:
671-
The standard Zimop extension version 1.0, as ratified in commit
672-
58220614a5f ("Zimop is ratified/1.0") of the riscv-isa-manual.
673-
674674
- const: ztso
675675
description:
676676
The standard Ztso extension for total store ordering, as ratified
@@ -809,18 +809,18 @@ properties:
809809
instructions, as ratified in commit 56ed795 ("Update
810810
riscv-crypto-spec-vector.adoc") of riscv-crypto.
811811
812-
- const: zvksh
813-
description: |
814-
The standard Zvksh extension for ShangMi suite: SM3 secure hash
815-
instructions, as ratified in commit 56ed795 ("Update
816-
riscv-crypto-spec-vector.adoc") of riscv-crypto.
817-
818812
- const: zvksg
819813
description:
820814
The standard Zvksg extension for ShangMi algorithm suite with GCM
821815
instructions, as ratified in commit 56ed795 ("Update
822816
riscv-crypto-spec-vector.adoc") of riscv-crypto.
823817

818+
- const: zvksh
819+
description: |
820+
The standard Zvksh extension for ShangMi suite: SM3 secure hash
821+
instructions, as ratified in commit 56ed795 ("Update
822+
riscv-crypto-spec-vector.adoc") of riscv-crypto.
823+
824824
- const: zvkt
825825
description:
826826
The standard Zvkt extension for vector data-independent execution

arch/riscv/Kconfig.socs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ config ARCH_THEAD
8484
help
8585
This enables support for the RISC-V based T-HEAD SoCs.
8686

87+
config ARCH_ULTRARISC
88+
bool "UltraRISC RISC-V SoCs"
89+
help
90+
This enables support for UltraRISC SoC platform hardware,
91+
including boards based on the UR-DP1000.
92+
8793
config ARCH_VIRT
8894
bool "QEMU Virt Machine"
8995
select POWER_RESET

arch/riscv/configs/defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ CONFIG_SOC_STARFIVE=y
3333
CONFIG_ARCH_SUNXI=y
3434
CONFIG_ARCH_TENSTORRENT=y
3535
CONFIG_ARCH_THEAD=y
36+
CONFIG_ARCH_ULTRARISC=y
3637
CONFIG_ARCH_VIRT=y
3738
CONFIG_ARCH_CANAAN=y
3839
CONFIG_SMP=y

arch/riscv/kernel/machine_kexec.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ machine_kexec_prepare(struct kimage *image)
4141
if (image->segment[i].memsz <= sizeof(fdt))
4242
continue;
4343

44+
if (!image->segment[i].buf)
45+
continue;
46+
4447
if (image->file_mode)
4548
memcpy(&fdt, image->segment[i].buf, sizeof(fdt));
4649
else if (copy_from_user(&fdt, image->segment[i].buf, sizeof(fdt)))

tools/testing/selftests/riscv/vector/validate_v_ptrace.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
#include <sys/ptrace.h>
3+
#include <sys/syscall.h>
34
#include <sys/types.h>
45
#include <sys/wait.h>
56
#include <sys/uio.h>
@@ -25,9 +26,9 @@ TEST(ptrace_v_not_enabled)
2526
SKIP(return, "Vector not supported");
2627

2728
chld_lock = 1;
28-
pid = fork();
29+
pid = (pid_t)syscall(SYS_clone, SIGCHLD, 0, NULL, 0, NULL);
2930
ASSERT_LE(0, pid)
30-
TH_LOG("fork: %m");
31+
TH_LOG("clone: %m");
3132

3233
if (pid == 0) {
3334
while (chld_lock == 1)
@@ -74,7 +75,7 @@ TEST(ptrace_v_not_enabled)
7475
ASSERT_EQ(-1, ret);
7576

7677
/* cleanup */
77-
78+
free(regset_data);
7879
ASSERT_EQ(0, kill(pid, SIGKILL));
7980
}
8081
}
@@ -206,7 +207,7 @@ TEST(ptrace_v_early_debug)
206207
EXPECT_EQ(vl_csr, regset_data->vl);
207208

208209
/* cleanup */
209-
210+
free(regset_data);
210211
ASSERT_EQ(0, kill(pid, SIGKILL));
211212
}
212213
}
@@ -330,7 +331,7 @@ TEST(ptrace_v_syscall_clobbering)
330331
EXPECT_EQ(0UL, regset_data->vl);
331332

332333
/* cleanup */
333-
334+
free(regset_data);
334335
ASSERT_EQ(0, kill(pid, SIGKILL));
335336
}
336337
}
@@ -648,7 +649,7 @@ TEST_F(v_csr_invalid, ptrace_v_invalid_values)
648649
ASSERT_EQ(ret, -1);
649650

650651
/* cleanup */
651-
652+
free(regset_data);
652653
ASSERT_EQ(0, kill(pid, SIGKILL));
653654
}
654655
}
@@ -910,7 +911,7 @@ TEST_F(v_csr_valid, ptrace_v_valid_values)
910911
EXPECT_EQ(regset_data->vlenb, vlenb);
911912

912913
/* cleanup */
913-
914+
free(regset_data);
914915
ASSERT_EQ(0, kill(pid, SIGKILL));
915916
}
916917
}

tools/testing/selftests/rseq/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ CLANG_FLAGS += -no-integrated-as
55
endif
66

77
top_srcdir = ../../../..
8+
include $(top_srcdir)/scripts/subarch.include
9+
ARCH ?= $(SUBARCH)
10+
LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include
811

912
CFLAGS += -O2 -Wall -g -I./ $(KHDR_INCLUDES) -L$(OUTPUT) -Wl,-rpath=./ \
10-
$(CLANG_FLAGS) -I$(top_srcdir)/tools/include
13+
$(CLANG_FLAGS) -I$(top_srcdir)/tools/include \
14+
-I$(LINUX_TOOL_ARCH_INCLUDE)
1115
LDLIBS += -lpthread -ldl
1216

1317
# Own dependencies because we only want to build against 1st prerequisite, but

0 commit comments

Comments
 (0)