projects/linux·commit 56d428ae

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

56d428ae · Linus Torvalds <[email protected]> · 2023-11-10 09:23:17 -08:00

Pull more RISC-V updates from Palmer Dabbelt:

 - Support for handling misaligned accesses in S-mode

 - Probing for misaligned access support is now properly cached and
   handled in parallel

 - PTDUMP now reflects the SW reserved bits, as well as the PBMT and
   NAPOT extensions

 - Performance improvements for TLB flushing

 - Support for many new relocations in the module loader

 - Various bug fixes and cleanups

* tag 'riscv-for-linus-6.7-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (51 commits)
  riscv: Optimize bitops with Zbb extension
  riscv: Rearrange hwcap.h and cpufeature.h
  drivers: perf: Do not broadcast to other cpus when starting a counter
  drivers: perf: Check find_first_bit() return value
  of: property: Add fw_devlink support for msi-parent
  RISC-V: Don't fail in riscv_of_parent_hartid() for disabled HARTs
  riscv: Fix set_memory_XX() and set_direct_map_XX() by splitting huge linear mappings
  riscv: Don't use PGD entries for the linear mapping
  RISC-V: Probe misaligned access speed in parallel
  RISC-V: Remove __init on unaligned_emulation_finish()
  RISC-V: Show accurate per-hart isa in /proc/cpuinfo
  RISC-V: Don't rely on positional structure initialization
  riscv: Add tests for riscv module loading
  riscv: Add remaining module relocations
  riscv: Avoid unaligned access when relocating modules
  riscv: split cache ops out of dma-noncoherent.c
  riscv: Improve flush_tlb_kernel_range()
  riscv: Make __flush_tlb_range() loop over pte instead of flushing the whole tlb
  riscv: Improve flush_tlb_range() for hugetlb pages
  riscv: Improve tlb_flush()
  ...
Commit
56d428ae1c4e27fbe02cb554b2192cd66e4df05a
Parents
656d88c3 · 457926b2

Merge commit. Changes below are compared with the first parent: 656d88c3.

Changes

86 files changed · +2541 −690

FileStatusAddDelContent
Documentation/arch/riscv/uabi.rstmodified+20−0View file
arch/riscv/Kconfigmodified+12−0View file
arch/riscv/Kconfig.debugmodified+1−0View file
arch/riscv/boot/Makefilemodified+1−0View file
arch/riscv/configs/defconfigmodified+2−0View file
arch/riscv/include/asm/bitops.hmodified+251−3View file
arch/riscv/include/asm/cpufeature.hmodified+101−1View file
arch/riscv/include/asm/elf.hmodified+1−1View file
arch/riscv/include/asm/entry-common.hmodified+14−0View file
arch/riscv/include/asm/errata_list.hmodified+3−3View file
arch/riscv/include/asm/hwcap.hmodified+0−91View file
arch/riscv/include/asm/insn-def.hmodified+4−4View file
arch/riscv/include/asm/pgtable-64.hmodified+9−5View file
arch/riscv/include/asm/pgtable-bits.hmodified+2−2View file
arch/riscv/include/asm/pgtable.hmodified+1−0View file
arch/riscv/include/asm/processor.hmodified+9−0View file
arch/riscv/include/asm/sbi.hmodified+0−3View file
arch/riscv/include/asm/switch_to.hmodified+1−1View file
arch/riscv/include/asm/tlb.hmodified+7−1View file
arch/riscv/include/asm/tlbflush.hmodified+11−4View file
arch/riscv/include/asm/vector.hmodified+1−1View file
arch/riscv/include/uapi/asm/elf.hmodified+4−1View file
arch/riscv/kernel/Makefilemodified+2−1View file
arch/riscv/kernel/copy-unaligned.Smodified+4−4View file
arch/riscv/kernel/cpu.cmodified+24−9View file
arch/riscv/kernel/cpufeature.cmodified+79−13View file
arch/riscv/kernel/entry.Smodified+7−8View file
arch/riscv/kernel/fpu.Smodified+125−4View file
arch/riscv/kernel/head.Smodified+15−15View file
arch/riscv/kernel/hibernate-asm.Smodified+6−6View file
arch/riscv/kernel/mcount-dyn.Smodified+8−12View file
arch/riscv/kernel/mcount.Smodified+9−9View file
arch/riscv/kernel/module.cmodified+504−104View file
arch/riscv/kernel/probes/rethook_trampoline.Smodified+2−2View file
arch/riscv/kernel/probes/simulate-insn.cmodified+1−1View file
arch/riscv/kernel/probes/uprobes.cmodified+6−0View file
arch/riscv/kernel/process.cmodified+18−0View file
arch/riscv/kernel/sbi.cmodified+10−22View file
arch/riscv/kernel/signal.cmodified+46−39View file
arch/riscv/kernel/smpboot.cmodified+0−1View file
arch/riscv/kernel/suspend_entry.Smodified+2−2View file
arch/riscv/kernel/tests/Kconfig.debugadded+35−0View file
arch/riscv/kernel/tests/Makefileadded+1−0View file
arch/riscv/kernel/tests/module_test/Makefileadded+15−0View file
arch/riscv/kernel/tests/module_test/test_module_linking_main.cadded+88−0View file
arch/riscv/kernel/tests/module_test/test_set16.Sadded+23−0View file
arch/riscv/kernel/tests/module_test/test_set32.Sadded+20−0View file
arch/riscv/kernel/tests/module_test/test_set6.Sadded+23−0View file
arch/riscv/kernel/tests/module_test/test_set8.Sadded+23−0View file
arch/riscv/kernel/tests/module_test/test_sub16.Sadded+20−0View file
arch/riscv/kernel/tests/module_test/test_sub32.Sadded+20−0View file
arch/riscv/kernel/tests/module_test/test_sub6.Sadded+20−0View file
arch/riscv/kernel/tests/module_test/test_sub64.Sadded+25−0View file
arch/riscv/kernel/tests/module_test/test_sub8.Sadded+20−0View file
arch/riscv/kernel/tests/module_test/test_uleb128.Sadded+31−0View file
arch/riscv/kernel/traps.cmodified+18−12View file
arch/riscv/kernel/traps_misaligned.cmodified+328−47View file
arch/riscv/kernel/vdso/flush_icache.Smodified+2−2View file
arch/riscv/kernel/vdso/getcpu.Smodified+2−2View file
arch/riscv/kernel/vdso/rt_sigreturn.Smodified+2−2View file
arch/riscv/kernel/vdso/sys_hwprobe.Smodified+2−2View file
arch/riscv/kernel/vdso/vdso.lds.Smodified+13−17View file
arch/riscv/kvm/aia.cmodified+1−1View file
arch/riscv/kvm/main.cmodified+1−1View file
arch/riscv/kvm/tlb.cmodified+1−1View file
arch/riscv/kvm/vcpu_fp.cmodified+1−1View file
arch/riscv/kvm/vcpu_onereg.cmodified+1−1View file
arch/riscv/kvm/vcpu_vector.cmodified+1−1View file
arch/riscv/lib/clear_page.Smodified+16−16View file
arch/riscv/lib/memcpy.Smodified+3−3View file
arch/riscv/lib/memmove.Smodified+28−29View file
arch/riscv/lib/memset.Smodified+3−3View file
arch/riscv/lib/uaccess.Smodified+5−6View file
arch/riscv/mm/Makefilemodified+1−0View file
arch/riscv/mm/cache-ops.cadded+17−0View file
arch/riscv/mm/dma-noncoherent.cmodified+4−19View file
arch/riscv/mm/init.cmodified+6−6View file
arch/riscv/mm/pageattr.cmodified+230−40View file
arch/riscv/mm/pmem.cmodified+2−2View file
arch/riscv/mm/ptdump.cmodified+34−19View file
arch/riscv/mm/tlbflush.cmodified+116−65View file
arch/riscv/purgatory/entry.Smodified+4−12View file
drivers/clocksource/timer-riscv.cmodified+1−1View file
drivers/firmware/efi/libstub/Makefilemodified+1−1View file
drivers/of/property.cmodified+2−0View file
drivers/perf/riscv_pmu_sbi.cmodified+8−5View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/arch/riscv/uabi.rst

View file
diff --git a/Documentation/arch/riscv/uabi.rst b/Documentation/arch/riscv/uabi.rst
index 8960fac..54d199d 100644
--- a/Documentation/arch/riscv/uabi.rst
+++ b/Documentation/arch/riscv/uabi.rst
@@ -42,6 +42,26 @@ An example string following the order is::
rv64imadc_zifoo_zigoo_zafoo_sbar_scar_zxmbaz_xqux_xrux
+"isa" and "hart isa" lines in /proc/cpuinfo
+-------------------------------------------
+
+The "isa" line in /proc/cpuinfo describes the lowest common denominator of
+RISC-V ISA extensions recognized by the kernel and implemented on all harts. The
+"hart isa" line, in contrast, describes the set of extensions recognized by the
+kernel on the particular hart being described, even if those extensions may not
+be present on all harts in the system.
+
+In both lines, the presence of an extension guarantees only that the hardware
+has the described capability. Additional kernel support or policy changes may be
+required before an extension's capability is fully usable by userspace programs.
+Similarly, for S-mode extensions, presence in one of these lines does not
+guarantee that the kernel is taking advantage of the extension, or that the
+feature will be visible in guest VMs managed by this kernel.
+
+Inversely, the absence of an extension in these lines does not necessarily mean
+the hardware does not support that feature. The running kernel may not recognize
+the extension, or may have deliberately removed it from the listing.
+
Misaligned accesses
-------------------

arch/riscv/Kconfig

View file
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 18b03ad..95a2a06 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -642,6 +642,15 @@ config THREAD_SIZE_ORDER
Specify the Pages of thread stack size (from 4KB to 64KB), which also
affects irq stack size, which is equal to thread stack size.
+config RISCV_MISALIGNED
+ bool "Support misaligned load/store traps for kernel and userspace"
+ select SYSCTL_ARCH_UNALIGN_ALLOW
+ default y
+ help
+ Say Y here if you want the kernel to embed support for misaligned
+ load/store for both kernel and userspace. When disable, misaligned
+ accesses will generate SIGBUS in userspace and panic in kernel.
+
endmenu # "Platform type"
menu "Kernel features"
@@ -909,6 +918,9 @@ config PORTABLE
select MMU
select OF
+config ARCH_PROC_KCORE_TEXT
+ def_bool y
+
menu "Power management options"
source "kernel/power/Kconfig"

arch/riscv/Kconfig.debug

View file
diff --git a/arch/riscv/Kconfig.debug b/arch/riscv/Kconfig.debug
index e69de29..eafe17e 100644
--- a/arch/riscv/Kconfig.debug
+++ b/arch/riscv/Kconfig.debug
@@ -0,0 +1 @@
+source "arch/riscv/kernel/tests/Kconfig.debug"

arch/riscv/boot/Makefile

View file
diff --git a/arch/riscv/boot/Makefile b/arch/riscv/boot/Makefile
index 22b1394..8e7fc0e 100644
--- a/arch/riscv/boot/Makefile
+++ b/arch/riscv/boot/Makefile
@@ -17,6 +17,7 @@
KCOV_INSTRUMENT := n
OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
+OBJCOPYFLAGS_loader.bin :=-O binary
OBJCOPYFLAGS_xipImage :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
targets := Image Image.* loader loader.o loader.lds loader.bin

arch/riscv/configs/defconfig

View file
diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index 938fa07..9058812 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -215,6 +215,8 @@ CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_PLTFM=y
CONFIG_MMC_SDHCI_CADENCE=y
CONFIG_MMC_SPI=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_STARFIVE=y
CONFIG_MMC_SDHI=y
CONFIG_MMC_SUNXI=y
CONFIG_RTC_CLASS=y

arch/riscv/include/asm/bitops.h

View file
diff --git a/arch/riscv/include/asm/bitops.h b/arch/riscv/include/asm/bitops.h
index 65f6eee..224b4dc 100644
--- a/arch/riscv/include/asm/bitops.h
+++ b/arch/riscv/include/asm/bitops.h
@@ -15,13 +15,261 @@
#include <asm/barrier.h>
#include <asm/bitsperlong.h>
+#if !defined(CONFIG_RISCV_ISA_ZBB) || defined(NO_ALTERNATIVE)
#include <asm-generic/bitops/__ffs.h>
-#include <asm-generic/bitops/ffz.h>
-#include <asm-generic/bitops/fls.h>
#include <asm-generic/bitops/__fls.h>
+#include <asm-generic/bitops/ffs.h>
+#include <asm-generic/bitops/fls.h>
+
+#else
+#include <asm/alternative-macros.h>
+#include <asm/hwcap.h>
+
+#if (BITS_PER_LONG == 64)
+#define CTZW "ctzw "
+#define CLZW "clzw "
+#elif (BITS_PER_LONG == 32)
+#define CTZW "ctz "
+#define CLZW "clz "
+#else
+#error "Unexpected BITS_PER_LONG"
+#endif
+
+static __always_inline unsigned long variable__ffs(unsigned long word)
+{
+ int num;
+
+ asm_volatile_goto(ALTERNATIVE("j %l[legacy]", "nop", 0,
+ RISCV_ISA_EXT_ZBB, 1)
+ : : : : legacy);
+
+ asm volatile (".option push\n"
+ ".option arch,+zbb\n"
+ "ctz %0, %1\n"
+ ".option pop\n"
+ : "=r" (word) : "r" (word) :);
+
+ return word;
+
+legacy:
+ num = 0;
+#if BITS_PER_LONG == 64
+ if ((word & 0xffffffff) == 0) {
+ num += 32;
+ word >>= 32;
+ }
+#endif
+ if ((word & 0xffff) == 0) {
+ num += 16;
+ word >>= 16;
+ }
+ if ((word & 0xff) == 0) {
+ num += 8;
+ word >>= 8;
+ }
+ if ((word & 0xf) == 0) {
+ num += 4;
+ word >>= 4;
+ }
+ if ((word & 0x3) == 0) {
+ num += 2;
+ word >>= 2;
+ }
+ if ((word & 0x1) == 0)
+ num += 1;
+ return num;
+}
+
+/**
+ * __ffs - find first set bit in a long word
+ * @word: The word to search
+ *
+ * Undefined if no set bit exists, so code should check against 0 first.
+ */
+#define __ffs(word) \
+ (__builtin_constant_p(word) ? \
+ (unsigned long)__builtin_ctzl(word) : \
+ variable__ffs(word))
+
+static __always_inline unsigned long variable__fls(unsigned long word)
+{
+ int num;
+
+ asm_volatile_goto(ALTERNATIVE("j %l[legacy]", "nop", 0,
+ RISCV_ISA_EXT_ZBB, 1)
+ : : : : legacy);
+
+ asm volatile (".option push\n"
+ ".option arch,+zbb\n"
+ "clz %0, %1\n"
+ ".option pop\n"
+ : "=r" (word) : "r" (word) :);
+
+ return BITS_PER_LONG - 1 - word;
+
+legacy:
+ num = BITS_PER_LONG - 1;
+#if BITS_PER_LONG == 64
+ if (!(word & (~0ul << 32))) {
+ num -= 32;
+ word <<= 32;
+ }
+#endif
+ if (!(word & (~0ul << (BITS_PER_LONG - 16)))) {
+ num -= 16;
+ word <<= 16;
+ }
+ if (!(word & (~0ul << (BITS_PER_LONG - 8)))) {
+ num -= 8;
+ word <<= 8;
+ }
+ if (!(word & (~0ul << (BITS_PER_LONG - 4)))) {
+ num -= 4;
+ word <<= 4;
+ }
+ if (!(word & (~0ul << (BITS_PER_LONG - 2)))) {
+ num -= 2;
+ word <<= 2;
+ }
+ if (!(word & (~0ul << (BITS_PER_LONG - 1))))
+ num -= 1;
+ return num;
+}
+
+/**
+ * __fls - find last set bit in a long word
+ * @word: the word to search
+ *
+ * Undefined if no set bit exists, so code should check against 0 first.
+ */
+#define __fls(word) \
+ (__builtin_constant_p(word) ? \
+ (unsigned long)(BITS_PER_LONG - 1 - __builtin_clzl(word)) : \
+ variable__fls(word))
+
+static __always_inline int variable_ffs(int x)
+{
+ int r;
+
+ if (!x)
+ return 0;
+
+ asm_volatile_goto(ALTERNATIVE("j %l[legacy]", "nop", 0,
+ RISCV_ISA_EXT_ZBB, 1)
+ : : : : legacy);
+
+ asm volatile (".option push\n"
+ ".option arch,+zbb\n"
+ CTZW "%0, %1\n"
+ ".option pop\n"
+ : "=r" (r) : "r" (x) :);
+
+ return r + 1;
+
+legacy:
+ r = 1;
+ if (!(x & 0xffff)) {
+ x >>= 16;
+ r += 16;
+ }
+ if (!(x & 0xff)) {
+ x >>= 8;
+ r += 8;
+ }
+ if (!(x & 0xf)) {
+ x >>= 4;
+ r += 4;
+ }
+ if (!(x & 3)) {
+ x >>= 2;
+ r += 2;
+ }
+ if (!(x & 1)) {
+ x >>= 1;
+ r += 1;
+ }
+ return r;
+}
+
+/**
+ * ffs - find first set bit in a word
+ * @x: the word to search
+ *
+ * This is defined the same way as the libc and compiler builtin ffs routines.
+ *
+ * ffs(value) returns 0 if value is 0 or the position of the first set bit if
+ * value is nonzero. The first (least significant) bit is at position 1.
+ */
+#define ffs(x) (__builtin_constant_p(x) ? __builtin_ffs(x) : variable_ffs(x))
+
+static __always_inline int variable_fls(unsigned int x)
+{
+ int r;
+
+ if (!x)
+ return 0;
+
+ asm_volatile_goto(ALTERNATIVE("j %l[legacy]", "nop", 0,
+ RISCV_ISA_EXT_ZBB, 1)
+ : : : : legacy);
+
+ asm volatile (".option push\n"
+ ".option arch,+zbb\n"
+ CLZW "%0, %1\n"
+ ".option pop\n"
+ : "=r" (r) : "r" (x) :);
+
+ return 32 - r;
+
+legacy:
+ r = 32;
+ if (!(x & 0xffff0000u)) {
+ x <<= 16;
+ r -= 16;
+ }
+ if (!(x & 0xff000000u)) {
+ x <<= 8;
+ r -= 8;
+ }
+ if (!(x & 0xf0000000u)) {
+ x <<= 4;
+ r -= 4;
+ }
+ if (!(x & 0xc0000000u)) {
+ x <<= 2;
+ r -= 2;
+ }
+ if (!(x & 0x80000000u)) {
+ x <<= 1;
+ r -= 1;
+ }
+ return r;
+}
+
+/**
+ * fls - find last set bit in a word
+ * @x: the word to search
+ *
+ * This is defined in a similar way as ffs, but returns the position of the most
+ * significant set bit.
+ *
+ * fls(value) returns 0 if value is 0 or the position of the last set bit if
+ * value is nonzero. The last (most significant) bit is at position 32.
+ */
+#define fls(x) \
+({ \
+ typeof(x) x_ = (x); \
+ __builtin_constant_p(x_) ? \
+ (int)((x_ != 0) ? (32 - __builtin_clz(x_)) : 0) \
+ : \
+ variable_fls(x_); \
+})
+
+#endif /* !defined(CONFIG_RISCV_ISA_ZBB) || defined(NO_ALTERNATIVE) */
+
+#include <asm-generic/bitops/ffz.h>
#include <asm-generic/bitops/fls64.h>
#include <asm-generic/bitops/sched.h>
-#include <asm-generic/bitops/ffs.h>
#include <asm-generic/bitops/hweight.h>

arch/riscv/include/asm/cpufeature.h

View file
diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h
index 13b7d35..a418c31 100644
--- a/arch/riscv/include/asm/cpufeature.h
+++ b/arch/riscv/include/asm/cpufeature.h
@@ -7,7 +7,10 @@
#define _ASM_CPUFEATURE_H
#include <linux/bitmap.h>
+#include <linux/jump_label.h>
#include <asm/hwcap.h>
+#include <asm/alternative-macros.h>
+#include <asm/errno.h>
/*
* These are probed via a device_initcall(), via either the SBI or directly
@@ -30,7 +33,104 @@ DECLARE_PER_CPU(long, misaligned_access_speed);
/* Per-cpu ISA extensions. */
extern struct riscv_isainfo hart_isa[NR_CPUS];
-void check_unaligned_access(int cpu);
void riscv_user_isa_enable(void);
+#ifdef CONFIG_RISCV_MISALIGNED
+bool unaligned_ctl_available(void);
+bool check_unaligned_access_emulated(int cpu);
+void unaligned_emulation_finish(void);
+#else
+static inline bool unaligned_ctl_available(void)
+{
+ return false;
+}
+
+static inline bool check_unaligned_access_emulated(int cpu)
+{
+ return false;
+}
+
+static inline void unaligned_emulation_finish(void) {}
+#endif
+
+unsigned long riscv_get_elf_hwcap(void);
+
+struct riscv_isa_ext_data {
+ const unsigned int id;
+ const char *name;
+ const char *property;
+};
+
+extern const struct riscv_isa_ext_data riscv_isa_ext[];
+extern const size_t riscv_isa_ext_count;
+extern bool riscv_isa_fallback;
+
+unsigned long riscv_isa_extension_base(const unsigned long *isa_bitmap);
+
+bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, int bit);
+#define riscv_isa_extension_available(isa_bitmap, ext) \
+ __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_##ext)
+
+static __always_inline bool
+riscv_has_extension_likely(const unsigned long ext)
+{
+ compiletime_assert(ext < RISCV_ISA_EXT_MAX,
+ "ext must be < RISCV_ISA_EXT_MAX");
+
+ if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) {
+ asm_volatile_goto(
+ ALTERNATIVE("j %l[l_no]", "nop", 0, %[ext], 1)
+ :
+ : [ext] "i" (ext)
+ :
+ : l_no);
+ } else {
+ if (!__riscv_isa_extension_available(NULL, ext))
+ goto l_no;
+ }
+
+ return true;
+l_no:
+ return false;
+}
+
+static __always_inline bool
+riscv_has_extension_unlikely(const unsigned long ext)
+{
+ compiletime_assert(ext < RISCV_ISA_EXT_MAX,
+ "ext must be < RISCV_ISA_EXT_MAX");
+
+ if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) {
+ asm_volatile_goto(
+ ALTERNATIVE("nop", "j %l[l_yes]", 0, %[ext], 1)
+ :
+ : [ext] "i" (ext)
+ :
+ : l_yes);
+ } else {
+ if (__riscv_isa_extension_available(NULL, ext))
+ goto l_yes;
+ }
+
+ return false;
+l_yes:
+ return true;
+}
+
+static __always_inline bool riscv_cpu_has_extension_likely(int cpu, const unsigned long ext)
+{
+ if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE) && riscv_has_extension_likely(ext))
+ return true;
+
+ return __riscv_isa_extension_available(hart_isa[cpu].isa, ext);
+}
+
+static __always_inline bool riscv_cpu_has_extension_unlikely(int cpu, const unsigned long ext)
+{
+ if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE) && riscv_has_extension_unlikely(ext))
+ return true;
+
+ return __riscv_isa_extension_available(hart_isa[cpu].isa, ext);
+}
+
#endif

arch/riscv/include/asm/elf.h

View file
diff --git a/arch/riscv/include/asm/elf.h b/arch/riscv/include/asm/elf.h
index b3b2dfb..06c236b 100644
--- a/arch/riscv/include/asm/elf.h
+++ b/arch/riscv/include/asm/elf.h
@@ -14,7 +14,7 @@
#include <asm/auxvec.h>
#include <asm/byteorder.h>
#include <asm/cacheinfo.h>
-#include <asm/hwcap.h>
+#include <asm/cpufeature.h>
/*
* These are used to set parameters in the core dumps.

arch/riscv/include/asm/entry-common.h

View file
diff --git a/arch/riscv/include/asm/entry-common.h b/arch/riscv/include/asm/entry-common.h
index 6e4dee4..7ab5e34 100644
--- a/arch/riscv/include/asm/entry-common.h
+++ b/arch/riscv/include/asm/entry-common.h
@@ -8,4 +8,18 @@
void handle_page_fault(struct pt_regs *regs);
void handle_break(struct pt_regs *regs);
+#ifdef CONFIG_RISCV_MISALIGNED
+int handle_misaligned_load(struct pt_regs *regs);
+int handle_misaligned_store(struct pt_regs *regs);
+#else
+static inline int handle_misaligned_load(struct pt_regs *regs)
+{
+ return -1;
+}
+static inline int handle_misaligned_store(struct pt_regs *regs)
+{
+ return -1;
+}
+#endif
+
#endif /* _ASM_RISCV_ENTRY_COMMON_H */

arch/riscv/include/asm/errata_list.h

View file
diff --git a/arch/riscv/include/asm/errata_list.h b/arch/riscv/include/asm/errata_list.h
index 0ac18a4..83ed25e 100644
--- a/arch/riscv/include/asm/errata_list.h
+++ b/arch/riscv/include/asm/errata_list.h
@@ -117,9 +117,9 @@ asm volatile(ALTERNATIVE( \
* | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 |
* 0000000 11001 00000 000 00000 0001011
*/
-#define THEAD_inval_A0 ".long 0x0265000b"
-#define THEAD_clean_A0 ".long 0x0255000b"
-#define THEAD_flush_A0 ".long 0x0275000b"
+#define THEAD_INVAL_A0 ".long 0x0265000b"
+#define THEAD_CLEAN_A0 ".long 0x0255000b"
+#define THEAD_FLUSH_A0 ".long 0x0275000b"
#define THEAD_SYNC_S ".long 0x0190000b"
#define ALT_CMO_OP(_op, _start, _size, _cachesize) \

arch/riscv/include/asm/hwcap.h

View file
diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h
index fe6656a..06d3052 100644
--- a/arch/riscv/include/asm/hwcap.h
+++ b/arch/riscv/include/asm/hwcap.h
@@ -8,9 +8,6 @@
#ifndef _ASM_RISCV_HWCAP_H
#define _ASM_RISCV_HWCAP_H
-#include <asm/alternative-macros.h>
-#include <asm/errno.h>
-#include <linux/bits.h>
#include <uapi/asm/hwcap.h>
#define RISCV_ISA_EXT_a ('a' - 'a')
@@ -69,92 +66,4 @@
#define RISCV_ISA_EXT_SxAIA RISCV_ISA_EXT_SSAIA
#endif
-#ifndef __ASSEMBLY__
-
-#include <linux/jump_label.h>
-#include <asm/cpufeature.h>
-
-unsigned long riscv_get_elf_hwcap(void);
-
-struct riscv_isa_ext_data {
- const unsigned int id;
- const char *name;
- const char *property;
-};
-
-extern const struct riscv_isa_ext_data riscv_isa_ext[];
-extern const size_t riscv_isa_ext_count;
-extern bool riscv_isa_fallback;
-
-unsigned long riscv_isa_extension_base(const unsigned long *isa_bitmap);
-
-#define riscv_isa_extension_mask(ext) BIT_MASK(RISCV_ISA_EXT_##ext)
-
-bool __riscv_isa_extension_available(const unsigned long *isa_bitmap, int bit);
-#define riscv_isa_extension_available(isa_bitmap, ext) \
- __riscv_isa_extension_available(isa_bitmap, RISCV_ISA_EXT_##ext)
-
-static __always_inline bool
-riscv_has_extension_likely(const unsigned long ext)
-{
- compiletime_assert(ext < RISCV_ISA_EXT_MAX,
- "ext must be < RISCV_ISA_EXT_MAX");
-
- if (IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) {
- asm_volatile_goto(
- ALTERNATIVE("j %l[l_no]", "nop", 0, %[ext], 1)
- :
- : [ext] "i" (ext)
- :
- : l_no);
- } else {
- if (!__riscv_isa_extension_available(NULL, ext))
- goto l_no;
- }
-
- return true;
-l_no:
- return false;
-}

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/insn-def.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/pgtable-64.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/pgtable-bits.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/pgtable.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/processor.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/sbi.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/switch_to.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/tlb.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/tlbflush.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/asm/vector.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/include/uapi/asm/elf.h

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/copy-unaligned.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/cpu.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/cpufeature.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/entry.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/fpu.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/head.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/hibernate-asm.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/mcount-dyn.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/mcount.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/module.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/probes/rethook_trampoline.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/probes/simulate-insn.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/probes/uprobes.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/process.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/sbi.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/signal.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/smpboot.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/suspend_entry.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/Kconfig.debug

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_module_linking_main.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_set16.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_set32.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_set6.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_set8.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_sub16.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_sub32.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_sub6.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_sub64.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_sub8.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/tests/module_test/test_uleb128.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/traps.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/traps_misaligned.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/vdso/flush_icache.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/vdso/getcpu.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/vdso/rt_sigreturn.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/vdso/sys_hwprobe.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kernel/vdso/vdso.lds.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kvm/aia.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kvm/main.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kvm/tlb.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kvm/vcpu_fp.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kvm/vcpu_onereg.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/kvm/vcpu_vector.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/lib/clear_page.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/lib/memcpy.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/lib/memmove.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/lib/memset.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/lib/uaccess.S

View file

This diff is incomplete. Download the complete patch.

arch/riscv/mm/Makefile

View file

This diff is incomplete. Download the complete patch.

arch/riscv/mm/cache-ops.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/mm/dma-noncoherent.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/mm/init.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/mm/pageattr.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/mm/pmem.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/mm/ptdump.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/mm/tlbflush.c

View file

This diff is incomplete. Download the complete patch.

arch/riscv/purgatory/entry.S

View file

This diff is incomplete. Download the complete patch.

drivers/clocksource/timer-riscv.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/efi/libstub/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/of/property.c

View file

This diff is incomplete. Download the complete patch.

drivers/perf/riscv_pmu_sbi.c

View file

This diff is incomplete. Download the complete patch.