Commit 03de3e44 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'riscv-for-linus-6.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux

Pull RISC-V updates from Paul Walmsley:
 "Nothing exotic here; these are the cleanup and new ISA extension
  probing patches (not including CFI):

   - Add probing and userspace reporting support for the standard RISC-V
     ISA extensions Zilsd and Zclsd, which implement load/store dual
     instructions on RV32

   - Abstract the register saving code in setup_sigcontext() so it can
     be used for stateful RISC-V ISA extensions beyond the vector
     extension

   - Add the SBI extension ID and some initial data structure
     definitions for the RISC-V standard SBI debug trigger extension

   - Clean up some code slightly: change some page table functions to
     avoid atomic operations oinn !SMP and to avoid unnecessary casts to
     atomic_long_t; and use the existing RISCV_FULL_BARRIER macro in
     place of some open-coded 'fence rw,rw' instructions"

* tag 'riscv-for-linus-6.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: Add SBI debug trigger extension and function ids
  riscv/atomic.h: use RISCV_FULL_BARRIER in _arch_atomic* function.
  riscv: hwprobe: export Zilsd and Zclsd ISA extensions
  riscv: add ISA extension parsing for Zilsd and Zclsd
  dt-bindings: riscv: add Zilsd and Zclsd extension descriptions
  riscv: mm: use xchg() on non-atomic_long_t variables, not atomic_long_xchg()
  riscv: mm: ptep_get_and_clear(): avoid atomic ops when !CONFIG_SMP
  riscv: mm: pmdp_huge_get_and_clear(): avoid atomic ops when !CONFIG_SMP
  riscv: signal: abstract header saving for setup_sigcontext
parents cd80afff 5efaf92d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -281,6 +281,14 @@ The following keys are defined:
  * :c:macro:`RISCV_HWPROBE_EXT_ZICBOP`: The Zicbop extension is supported, as
       ratified in commit 3dd606f ("Create cmobase-v1.0.pdf") of riscv-CMOs.

  * :c:macro:`RISCV_HWPROBE_EXT_ZILSD`: The Zilsd extension is supported as
       defined in the RISC-V ISA manual starting from commit f88abf1 ("Integrating
       load/store pair for RV32 with the main manual") of the riscv-isa-manual.

  * :c:macro:`RISCV_HWPROBE_EXT_ZCLSD`: The Zclsd extension is supported as
       defined in the RISC-V ISA manual starting from commit f88abf1 ("Integrating
       load/store pair for RV32 with the main manual") of the riscv-isa-manual.

* :c:macro:`RISCV_HWPROBE_KEY_CPUPERF_0`: Deprecated.  Returns similar values to
     :c:macro:`RISCV_HWPROBE_KEY_MISALIGNED_SCALAR_PERF`, but the key was
     mistakenly classified as a bitmask rather than a value.
+36 −0
Original line number Diff line number Diff line
@@ -377,6 +377,20 @@ properties:
            guarantee on LR/SC sequences, as ratified in commit b1d806605f87
            ("Updated to ratified state.") of the riscv profiles specification.

        - const: zilsd
          description:
            The standard Zilsd extension which provides support for aligned
            register-pair load and store operations in 32-bit instruction
            encodings, as ratified in commit f88abf1 ("Integrating
            load/store pair for RV32 with the main manual") of riscv-isa-manual.

        - const: zclsd
          description:
            The Zclsd extension implements the compressed (16-bit) version of the
            Load/Store Pair for RV32. As with Zilsd, this extension was ratified
            in commit f88abf1 ("Integrating load/store pair for RV32 with the
            main manual") of riscv-isa-manual.

        - const: zk
          description:
            The standard Zk Standard Scalar cryptography extension as ratified
@@ -882,6 +896,16 @@ properties:
            anyOf:
              - const: v
              - const: zve32x
      # Zclsd depends on Zilsd and Zca
      - if:
          contains:
            anyOf:
              - const: zclsd
        then:
          contains:
            allOf:
              - const: zilsd
              - const: zca

allOf:
  # Zcf extension does not exist on rv64
@@ -899,6 +923,18 @@ allOf:
          not:
            contains:
              const: zcf
  # Zilsd extension does not exist on rv64
  - if:
      properties:
        riscv,isa-base:
          contains:
            const: rv64i
    then:
      properties:
        riscv,isa-extensions:
          not:
            contains:
              const: zilsd

additionalProperties: true
...
+4 −4
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ ATOMIC_OPS(xor, xor, i)
		"	add            %[rc], %[p], %[a]\n"		\
		"	sc." sfx ".rl  %[rc], %[rc], %[c]\n"		\
		"	bnez           %[rc], 0b\n"			\
		"	fence          rw, rw\n"			\
		RISCV_FULL_BARRIER					\
		"1:\n"							\
		: [p]"=&r" (_prev), [rc]"=&r" (_rc), [c]"+A" (counter)	\
		: [a]"r" (_a), [u]"r" (_u)				\
@@ -242,7 +242,7 @@ static __always_inline s64 arch_atomic64_fetch_add_unless(atomic64_t *v, s64 a,
		"	addi            %[rc], %[p], 1\n"		\
		"	sc." sfx ".rl   %[rc], %[rc], %[c]\n"		\
		"	bnez            %[rc], 0b\n"			\
		"	fence           rw, rw\n"			\
		RISCV_FULL_BARRIER					\
		"1:\n"							\
		: [p]"=&r" (_prev), [rc]"=&r" (_rc), [c]"+A" (counter)	\
		:							\
@@ -268,7 +268,7 @@ static __always_inline bool arch_atomic_inc_unless_negative(atomic_t *v)
		"	addi            %[rc], %[p], -1\n"		\
		"	sc." sfx ".rl   %[rc], %[rc], %[c]\n"		\
		"	bnez            %[rc], 0b\n"			\
		"	fence           rw, rw\n"			\
		RISCV_FULL_BARRIER					\
		"1:\n"							\
		: [p]"=&r" (_prev), [rc]"=&r" (_rc), [c]"+A" (counter)	\
		:							\
@@ -294,7 +294,7 @@ static __always_inline bool arch_atomic_dec_unless_positive(atomic_t *v)
		"	bltz           %[rc], 1f\n"			\
		"	sc." sfx ".rl  %[rc], %[rc], %[c]\n"		\
		"	bnez           %[rc], 0b\n"			\
		"	fence          rw, rw\n"			\
		RISCV_FULL_BARRIER					\
		"1:\n"							\
		: [p]"=&r" (_prev), [rc]"=&r" (_rc), [c]"+A" (counter)	\
		:							\
+2 −0
Original line number Diff line number Diff line
@@ -108,6 +108,8 @@
#define RISCV_ISA_EXT_ZICBOP		99
#define RISCV_ISA_EXT_SVRSW60T59B	100
#define RISCV_ISA_EXT_ZALASR		101
#define RISCV_ISA_EXT_ZILSD		102
#define RISCV_ISA_EXT_ZCLSD		103

#define RISCV_ISA_EXT_XLINUXENVCFG	127

+14 −2
Original line number Diff line number Diff line
@@ -660,7 +660,13 @@ extern int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long a
static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
				       unsigned long address, pte_t *ptep)
{
	pte_t pte = __pte(atomic_long_xchg((atomic_long_t *)ptep, 0));
#ifdef CONFIG_SMP
	pte_t pte = __pte(xchg(&ptep->pte, 0));
#else
	pte_t pte = *ptep;

	set_pte(ptep, __pte(0));
#endif

	page_table_check_pte_clear(mm, pte);

@@ -997,7 +1003,13 @@ static inline int pmdp_test_and_clear_young(struct vm_area_struct *vma,
static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
					unsigned long address, pmd_t *pmdp)
{
	pmd_t pmd = __pmd(atomic_long_xchg((atomic_long_t *)pmdp, 0));
#ifdef CONFIG_SMP
	pmd_t pmd = __pmd(xchg(&pmdp->pmd, 0));
#else
	pmd_t pmd = *pmdp;

	pmd_clear(pmdp);
#endif

	page_table_check_pmd_clear(mm, pmd);

Loading