Commit b0bb1269 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'riscv-for-linus-5.2-mw2' of...

Merge tag 'riscv-for-linus-5.2-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux

Pull RISC-V updates from Palmer Dabbelt:
 "This contains an assortment of RISC-V related patches that I'd like to
  target for the 5.2 merge window. Most of the patches are cleanups, but
  there are a handful of user-visible changes:

   - The nosmp and nr_cpus command-line arguments are now supported,
     which work like normal.

   - The SBI console no longer installs itself as a preferred console,
     we rely on standard mechanisms (/chosen, command-line, hueristics)
     instead.

   - sfence_remove_sfence_vma{,_asid} now pass their arguments along to
     the SBI call.

   - Modules now support BUG().

   - A missing sfence.vma during boot has been added. This bug only
     manifests during boot.

   - The arch/riscv support for SiFive's L2 cache controller has been
     merged, which should un-block the EDAC framework work.

  I've only tested this on QEMU again, as I didn't have time to get
  things running on the Unleashed. The latest master from this morning
  merges in cleanly and passes the tests as well"

* tag 'riscv-for-linus-5.2-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux: (31 commits)
  riscv: fix locking violation in page fault handler
  RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs
  RISC-V: Add DT documentation for SiFive L2 Cache Controller
  RISC-V: Avoid using invalid intermediate translations
  riscv: Support BUG() in kernel module
  riscv: Add the support for c.ebreak check in is_valid_bugaddr()
  riscv: support trap-based WARN()
  riscv: fix sbi_remote_sfence_vma{,_asid}.
  riscv: move switch_mm to its own file
  riscv: move flush_icache_{all,mm} to cacheflush.c
  tty: Don't force RISCV SBI console as preferred console
  RISC-V: Access CSRs using CSR numbers
  RISC-V: Add interrupt related SCAUSE defines in asm/csr.h
  RISC-V: Use tabs to align macro values in asm/csr.h
  RISC-V: Fix minor checkpatch issues.
  RISC-V: Support nr_cpus command line option.
  RISC-V: Implement nosmp commandline option.
  RISC-V: Add RISC-V specific arch_match_cpu_phys_id
  riscv: vdso: drop unnecessary cc-ldoption
  riscv: call pm_power_off from machine_halt / machine_power_off
  ...
parents 72cf0b07 8fef9900
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
SiFive L2 Cache Controller
--------------------------
The SiFive Level 2 Cache Controller is used to provide access to fast copies
of memory for masters in a Core Complex. The Level 2 Cache Controller also
acts as directory-based coherency manager.
All the properties in ePAPR/DeviceTree specification applies for this platform

Required Properties:
--------------------
- compatible: Should be "sifive,fu540-c000-ccache" and "cache"

- cache-block-size: Specifies the block size in bytes of the cache.
  Should be 64

- cache-level: Should be set to 2 for a level 2 cache

- cache-sets: Specifies the number of associativity sets of the cache.
  Should be 1024

- cache-size: Specifies the size in bytes of the cache. Should be 2097152

- cache-unified: Specifies the cache is a unified cache

- interrupts: Must contain 3 entries (DirError, DataError and DataFail signals)

- reg: Physical base address and size of L2 cache controller registers map

Optional Properties:
--------------------
- next-level-cache: phandle to the next level cache if present.

- memory-region: reference to the reserved-memory for the L2 Loosely Integrated
  Memory region. The reserved memory node should be defined as per the bindings
  in reserved-memory.txt


Example:

	cache-controller@2010000 {
		compatible = "sifive,fu540-c000-ccache", "cache";
		cache-block-size = <64>;
		cache-level = <2>;
		cache-sets = <1024>;
		cache-size = <2097152>;
		cache-unified;
		interrupt-parent = <&plic0>;
		interrupts = <1 2 3>;
		reg = <0x0 0x2010000 0x0 0x1000>;
		next-level-cache = <&L25 &L40 &L36>;
		memory-region = <&l2_lim>;
	};
+1 −5
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ config RISCV
	select GENERIC_STRNCPY_FROM_USER
	select GENERIC_STRNLEN_USER
	select GENERIC_SMP_IDLE_THREAD
	select GENERIC_ATOMIC64 if !64BIT || !RISCV_ISA_A
	select GENERIC_ATOMIC64 if !64BIT
	select HAVE_ARCH_AUDITSYSCALL
	select HAVE_MEMBLOCK_NODE_MAP
	select HAVE_DMA_CONTIGUOUS
@@ -35,7 +35,6 @@ config RISCV
	select HAVE_PERF_EVENTS
	select HAVE_SYSCALL_TRACEPOINTS
	select IRQ_DOMAIN
	select RISCV_ISA_A if SMP
	select SPARSE_IRQ
	select SYSCTL_EXCEPTION_TRACE
	select HAVE_ARCH_TRACEHOOK
@@ -195,9 +194,6 @@ config RISCV_ISA_C

	   If you don't know what to do here, say Y.

config RISCV_ISA_A
	def_bool y

menu "supported PMU type"
	depends on PERF_EVENTS

+2 −3
Original line number Diff line number Diff line
@@ -39,9 +39,8 @@ endif
KBUILD_CFLAGS += -Wall

# ISA string setting
riscv-march-$(CONFIG_ARCH_RV32I)	:= rv32im
riscv-march-$(CONFIG_ARCH_RV64I)	:= rv64im
riscv-march-$(CONFIG_RISCV_ISA_A)	:= $(riscv-march-y)a
riscv-march-$(CONFIG_ARCH_RV32I)	:= rv32ima
riscv-march-$(CONFIG_ARCH_RV64I)	:= rv64ima
riscv-march-$(CONFIG_FPU)		:= $(riscv-march-y)fd
riscv-march-$(CONFIG_RISCV_ISA_C)	:= $(riscv-march-y)c
KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y))
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ generic-y += compat.h
generic-y += cputime.h
generic-y += device.h
generic-y += div64.h
generic-y += extable.h
generic-y += dma.h
generic-y += dma-contiguous.h
generic-y += dma-mapping.h
+24 −11
Original line number Diff line number Diff line
@@ -21,7 +21,12 @@
#include <asm/asm.h>

#ifdef CONFIG_GENERIC_BUG
#define __BUG_INSN	_AC(0x00100073, UL) /* ebreak */
#define __INSN_LENGTH_MASK  _UL(0x3)
#define __INSN_LENGTH_32    _UL(0x3)
#define __COMPRESSED_INSN_MASK	_UL(0xffff)

#define __BUG_INSN_32	_UL(0x00100073) /* ebreak */
#define __BUG_INSN_16	_UL(0x9002) /* c.ebreak */

#ifndef __ASSEMBLY__
typedef u32 bug_insn_t;
@@ -38,38 +43,46 @@ typedef u32 bug_insn_t;
#define __BUG_ENTRY			\
	__BUG_ENTRY_ADDR "\n\t"		\
	__BUG_ENTRY_FILE "\n\t"		\
	RISCV_SHORT " %1"
	RISCV_SHORT " %1\n\t"		\
	RISCV_SHORT " %2"
#else
#define __BUG_ENTRY			\
	__BUG_ENTRY_ADDR
	__BUG_ENTRY_ADDR "\n\t"		\
	RISCV_SHORT " %2"
#endif

#define BUG()							\
#define __BUG_FLAGS(flags)					\
do {								\
	__asm__ __volatile__ (					\
		"1:\n\t"					\
			"ebreak\n"				\
			".pushsection __bug_table,\"a\"\n\t"	\
			".pushsection __bug_table,\"aw\"\n\t"	\
		"2:\n\t"					\
			__BUG_ENTRY "\n\t"			\
			".org 2b + %2\n\t"			\
			".org 2b + %3\n\t"                      \
			".popsection"				\
		:						\
		: "i" (__FILE__), "i" (__LINE__),		\
		  "i" (flags),					\
		  "i" (sizeof(struct bug_entry)));              \
	unreachable();						\
} while (0)

#endif /* !__ASSEMBLY__ */
#else /* CONFIG_GENERIC_BUG */
#ifndef __ASSEMBLY__
#define BUG()							\
do {								\
#define __BUG_FLAGS(flags) do {					\
	__asm__ __volatile__ ("ebreak\n");			\
	unreachable();						\
} while (0)
#endif /* !__ASSEMBLY__ */
#endif /* CONFIG_GENERIC_BUG */

#define BUG() do {						\
	__BUG_FLAGS(0);						\
	unreachable();						\
} while (0)

#define __WARN_FLAGS(flags) __BUG_FLAGS(BUGFLAG_WARNING|(flags))

#define HAVE_ARCH_BUG

#include <asm-generic/bug.h>
Loading