Skip to content

Commit 97d8894

Browse files
committed
Merge tag 'riscv-for-linus-6.12-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull RISC-V updates from Palmer Dabbelt: - Support using Zkr to seed KASLR - Support IPI-triggered CPU backtracing - Support for generic CPU vulnerabilities reporting to userspace - A few cleanups for missing licenses - The size limit on the XIP kernel has been removed - Support for tracing userspace stacks - Support for the Svvptc extension - Various cleanups and fixes throughout the tree * tag 'riscv-for-linus-6.12-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: (47 commits) crash: Fix riscv64 crash memory reserve dead loop perf/riscv-sbi: Add platform specific firmware event handling tools: Optimize ring buffer for riscv tools: Add riscv barrier implementation RISC-V: Don't have MAX_PHYSMEM_BITS exceed phys_addr_t ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE riscv: Enable bitops instrumentation riscv: Omit optimized string routines when using KASAN ACPI: RISCV: Make acpi_numa_get_nid() to be static riscv: Randomize lower bits of stack address selftests: riscv: Allow mmap test to compile on 32-bit riscv: Make riscv_isa_vendor_ext_andes array static riscv: Use LIST_HEAD() to simplify code riscv: defconfig: Disable RZ/Five peripheral support RISC-V: Implement kgdb_roundup_cpus() to enable future NMI Roundup riscv: avoid Imbalance in RAS riscv: cacheinfo: Add back init_cache_level() function riscv: Remove unused _TIF_WORK_MASK drivers/perf: riscv: Remove redundant macro check riscv: define ILLEGAL_POINTER_VALUE for 64bit ...
2 parents 7108fff + b3f835c commit 97d8894

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+700
-167
lines changed

Documentation/devicetree/bindings/riscv/extensions.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ properties:
171171
memory types as ratified in the 20191213 version of the privileged
172172
ISA specification.
173173

174+
- const: svvptc
175+
description:
176+
The standard Svvptc supervisor-level extension for
177+
address-translation cache behaviour with respect to invalid entries
178+
as ratified at commit 4a69197e5617 ("Update to ratified state") of
179+
riscv-svvptc.
180+
174181
- const: zacas
175182
description: |
176183
The Zacas extension for Atomic Compare-and-Swap (CAS) instructions

arch/riscv/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ config RISCV
7070
select ARCH_USE_CMPXCHG_LOCKREF if 64BIT
7171
select ARCH_USE_MEMTEST
7272
select ARCH_USE_QUEUED_RWLOCKS
73+
select ARCH_USE_SYM_ANNOTATIONS
7374
select ARCH_USES_CFI_TRAPS if CFI_CLANG
7475
select ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH if MMU
7576
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
@@ -94,6 +95,7 @@ config RISCV
9495
select GENERIC_ATOMIC64 if !64BIT
9596
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
9697
select GENERIC_CPU_DEVICES
98+
select GENERIC_CPU_VULNERABILITIES
9799
select GENERIC_EARLY_IOREMAP
98100
select GENERIC_ENTRY
99101
select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO
@@ -204,6 +206,7 @@ config RISCV
204206
select THREAD_INFO_IN_TASK
205207
select TRACE_IRQFLAGS_SUPPORT
206208
select UACCESS_MEMCPY if !MMU
209+
select USER_STACKTRACE_SUPPORT
207210
select ZONE_DMA32 if 64BIT
208211

209212
config CLANG_SUPPORTS_DYNAMIC_FTRACE
@@ -323,6 +326,11 @@ config GENERIC_HWEIGHT
323326
config FIX_EARLYCON_MEM
324327
def_bool MMU
325328

329+
config ILLEGAL_POINTER_VALUE
330+
hex
331+
default 0 if 32BIT
332+
default 0xdead000000000000 if 64BIT
333+
326334
config PGTABLE_LEVELS
327335
int
328336
default 5 if 64BIT

arch/riscv/configs/defconfig

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,17 @@ CONFIG_VIRTIO_NET=y
137137
CONFIG_MACB=y
138138
CONFIG_E1000E=y
139139
CONFIG_R8169=y
140-
CONFIG_RAVB=y
141140
CONFIG_STMMAC_ETH=m
142141
CONFIG_MICREL_PHY=y
143142
CONFIG_MICROSEMI_PHY=y
144143
CONFIG_MOTORCOMM_PHY=y
145-
CONFIG_CAN_RCAR_CANFD=m
146144
CONFIG_INPUT_MOUSEDEV=y
147145
CONFIG_KEYBOARD_SUN4I_LRADC=m
148146
CONFIG_SERIAL_8250=y
149147
CONFIG_SERIAL_8250_CONSOLE=y
150148
CONFIG_SERIAL_8250_DW=y
151149
CONFIG_SERIAL_OF_PLATFORM=y
152150
CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
153-
CONFIG_SERIAL_SH_SCI=y
154151
CONFIG_VIRTIO_CONSOLE=y
155152
CONFIG_HW_RANDOM=y
156153
CONFIG_HW_RANDOM_VIRTIO=y
@@ -160,11 +157,9 @@ CONFIG_I2C_CHARDEV=m
160157
CONFIG_I2C_DESIGNWARE_CORE=y
161158
CONFIG_I2C_DESIGNWARE_PLATFORM=y
162159
CONFIG_I2C_MV64XXX=m
163-
CONFIG_I2C_RIIC=y
164160
CONFIG_SPI=y
165161
CONFIG_SPI_CADENCE_QUADSPI=m
166162
CONFIG_SPI_PL022=m
167-
CONFIG_SPI_RSPI=m
168163
CONFIG_SPI_SIFIVE=y
169164
CONFIG_SPI_SUN6I=y
170165
# CONFIG_PTP_1588_CLOCK is not set
@@ -177,7 +172,6 @@ CONFIG_POWER_RESET_GPIO_RESTART=y
177172
CONFIG_SENSORS_SFCTEMP=m
178173
CONFIG_CPU_THERMAL=y
179174
CONFIG_DEVFREQ_THERMAL=y
180-
CONFIG_RZG2L_THERMAL=y
181175
CONFIG_WATCHDOG=y
182176
CONFIG_SUNXI_WATCHDOG=y
183177
CONFIG_MFD_AXP20X_I2C=y
@@ -206,11 +200,11 @@ CONFIG_USB=y
206200
CONFIG_USB_OTG=y
207201
CONFIG_USB_XHCI_HCD=y
208202
CONFIG_USB_XHCI_PLATFORM=y
203+
# CONFIG_USB_XHCI_RCAR is not set
209204
CONFIG_USB_EHCI_HCD=y
210205
CONFIG_USB_EHCI_HCD_PLATFORM=y
211206
CONFIG_USB_OHCI_HCD=y
212207
CONFIG_USB_OHCI_HCD_PLATFORM=y
213-
CONFIG_USB_RENESAS_USBHS=m
214208
CONFIG_USB_STORAGE=y
215209
CONFIG_USB_UAS=y
216210
CONFIG_USB_CDNS_SUPPORT=m
@@ -222,7 +216,6 @@ CONFIG_USB_MUSB_HDRC=m
222216
CONFIG_USB_MUSB_SUNXI=m
223217
CONFIG_NOP_USB_XCEIV=m
224218
CONFIG_USB_GADGET=y
225-
CONFIG_USB_RENESAS_USBHS_UDC=m
226219
CONFIG_USB_CONFIGFS=m
227220
CONFIG_USB_CONFIGFS_SERIAL=y
228221
CONFIG_USB_CONFIGFS_ACM=y
@@ -240,7 +233,6 @@ CONFIG_MMC_SDHCI_PLTFM=y
240233
CONFIG_MMC_SDHCI_OF_DWCMSHC=y
241234
CONFIG_MMC_SDHCI_CADENCE=y
242235
CONFIG_MMC_SPI=y
243-
CONFIG_MMC_SDHI=y
244236
CONFIG_MMC_DW=y
245237
CONFIG_MMC_DW_STARFIVE=y
246238
CONFIG_MMC_SUNXI=y
@@ -258,15 +250,13 @@ CONFIG_CLK_SOPHGO_SG2042_PLL=y
258250
CONFIG_CLK_SOPHGO_SG2042_CLKGEN=y
259251
CONFIG_CLK_SOPHGO_SG2042_RPGATE=y
260252
CONFIG_SUN8I_DE2_CCU=m
261-
CONFIG_RENESAS_OSTM=y
262253
CONFIG_SUN50I_IOMMU=y
263254
CONFIG_RPMSG_CHAR=y
264255
CONFIG_RPMSG_CTRL=y
265256
CONFIG_RPMSG_VIRTIO=y
266257
CONFIG_PM_DEVFREQ=y
267258
CONFIG_IIO=y
268259
CONFIG_PHY_SUN4I_USB=m
269-
CONFIG_PHY_RCAR_GEN3_USB2=y
270260
CONFIG_PHY_STARFIVE_JH7110_DPHY_RX=m
271261
CONFIG_PHY_STARFIVE_JH7110_PCIE=m
272262
CONFIG_PHY_STARFIVE_JH7110_USB=m

arch/riscv/errata/sifive/errata_cip_453.S

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@
2121
1:
2222
.endm
2323

24-
ENTRY(sifive_cip_453_page_fault_trp)
24+
SYM_FUNC_START(sifive_cip_453_page_fault_trp)
2525
ADD_SIGN_EXT a0, t0, t1
2626
#ifdef CONFIG_MMU
2727
la t0, do_page_fault
2828
#else
2929
la t0, do_trap_unknown
3030
#endif
3131
jr t0
32-
END(sifive_cip_453_page_fault_trp)
32+
SYM_FUNC_END(sifive_cip_453_page_fault_trp)
3333

34-
ENTRY(sifive_cip_453_insn_fault_trp)
34+
SYM_FUNC_START(sifive_cip_453_insn_fault_trp)
3535
ADD_SIGN_EXT a0, t0, t1
3636
la t0, do_trap_insn_fault
3737
jr t0
38-
END(sifive_cip_453_insn_fault_trp)
38+
SYM_FUNC_END(sifive_cip_453_insn_fault_trp)

arch/riscv/include/asm/acpi.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,8 @@ static inline void acpi_get_cbo_block_size(struct acpi_table_header *table,
9191
#endif /* CONFIG_ACPI */
9292

9393
#ifdef CONFIG_ACPI_NUMA
94-
int acpi_numa_get_nid(unsigned int cpu);
9594
void acpi_map_cpus_to_nodes(void);
9695
#else
97-
static inline int acpi_numa_get_nid(unsigned int cpu) { return NUMA_NO_NODE; }
9896
static inline void acpi_map_cpus_to_nodes(void) { }
9997
#endif /* CONFIG_ACPI_NUMA */
10098

arch/riscv/include/asm/bitops.h

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -222,44 +222,44 @@ static __always_inline int variable_fls(unsigned int x)
222222
#define __NOT(x) (~(x))
223223

224224
/**
225-
* test_and_set_bit - Set a bit and return its old value
225+
* arch_test_and_set_bit - Set a bit and return its old value
226226
* @nr: Bit to set
227227
* @addr: Address to count from
228228
*
229229
* This operation may be reordered on other architectures than x86.
230230
*/
231-
static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
231+
static inline int arch_test_and_set_bit(int nr, volatile unsigned long *addr)
232232
{
233233
return __test_and_op_bit(or, __NOP, nr, addr);
234234
}
235235

236236
/**
237-
* test_and_clear_bit - Clear a bit and return its old value
237+
* arch_test_and_clear_bit - Clear a bit and return its old value
238238
* @nr: Bit to clear
239239
* @addr: Address to count from
240240
*
241241
* This operation can be reordered on other architectures other than x86.
242242
*/
243-
static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
243+
static inline int arch_test_and_clear_bit(int nr, volatile unsigned long *addr)
244244
{
245245
return __test_and_op_bit(and, __NOT, nr, addr);
246246
}
247247

248248
/**
249-
* test_and_change_bit - Change a bit and return its old value
249+
* arch_test_and_change_bit - Change a bit and return its old value
250250
* @nr: Bit to change
251251
* @addr: Address to count from
252252
*
253253
* This operation is atomic and cannot be reordered.
254254
* It also implies a memory barrier.
255255
*/
256-
static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
256+
static inline int arch_test_and_change_bit(int nr, volatile unsigned long *addr)
257257
{
258258
return __test_and_op_bit(xor, __NOP, nr, addr);
259259
}
260260

261261
/**
262-
* set_bit - Atomically set a bit in memory
262+
* arch_set_bit - Atomically set a bit in memory
263263
* @nr: the bit to set
264264
* @addr: the address to start counting from
265265
*
@@ -270,68 +270,68 @@ static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
270270
* Note that @nr may be almost arbitrarily large; this function is not
271271
* restricted to acting on a single-word quantity.
272272
*/
273-
static inline void set_bit(int nr, volatile unsigned long *addr)
273+
static inline void arch_set_bit(int nr, volatile unsigned long *addr)
274274
{
275275
__op_bit(or, __NOP, nr, addr);
276276
}
277277

278278
/**
279-
* clear_bit - Clears a bit in memory
279+
* arch_clear_bit - Clears a bit in memory
280280
* @nr: Bit to clear
281281
* @addr: Address to start counting from
282282
*
283283
* Note: there are no guarantees that this function will not be reordered
284284
* on non x86 architectures, so if you are writing portable code,
285285
* make sure not to rely on its reordering guarantees.
286286
*/
287-
static inline void clear_bit(int nr, volatile unsigned long *addr)
287+
static inline void arch_clear_bit(int nr, volatile unsigned long *addr)
288288
{
289289
__op_bit(and, __NOT, nr, addr);
290290
}
291291

292292
/**
293-
* change_bit - Toggle a bit in memory
293+
* arch_change_bit - Toggle a bit in memory
294294
* @nr: Bit to change
295295
* @addr: Address to start counting from
296296
*
297297
* change_bit() may be reordered on other architectures than x86.
298298
* Note that @nr may be almost arbitrarily large; this function is not
299299
* restricted to acting on a single-word quantity.
300300
*/
301-
static inline void change_bit(int nr, volatile unsigned long *addr)
301+
static inline void arch_change_bit(int nr, volatile unsigned long *addr)
302302
{
303303
__op_bit(xor, __NOP, nr, addr);
304304
}
305305

306306
/**
307-
* test_and_set_bit_lock - Set a bit and return its old value, for lock
307+
* arch_test_and_set_bit_lock - Set a bit and return its old value, for lock
308308
* @nr: Bit to set
309309
* @addr: Address to count from
310310
*
311311
* This operation is atomic and provides acquire barrier semantics.
312312
* It can be used to implement bit locks.
313313
*/
314-
static inline int test_and_set_bit_lock(
314+
static inline int arch_test_and_set_bit_lock(
315315
unsigned long nr, volatile unsigned long *addr)
316316
{
317317
return __test_and_op_bit_ord(or, __NOP, nr, addr, .aq);
318318
}
319319

320320
/**
321-
* clear_bit_unlock - Clear a bit in memory, for unlock
321+
* arch_clear_bit_unlock - Clear a bit in memory, for unlock
322322
* @nr: the bit to set
323323
* @addr: the address to start counting from
324324
*
325325
* This operation is atomic and provides release barrier semantics.
326326
*/
327-
static inline void clear_bit_unlock(
327+
static inline void arch_clear_bit_unlock(
328328
unsigned long nr, volatile unsigned long *addr)
329329
{
330330
__op_bit_ord(and, __NOT, nr, addr, .rl);
331331
}
332332

333333
/**
334-
* __clear_bit_unlock - Clear a bit in memory, for unlock
334+
* arch___clear_bit_unlock - Clear a bit in memory, for unlock
335335
* @nr: the bit to set
336336
* @addr: the address to start counting from
337337
*
@@ -345,13 +345,13 @@ static inline void clear_bit_unlock(
345345
* non-atomic property here: it's a lot more instructions and we still have to
346346
* provide release semantics anyway.
347347
*/
348-
static inline void __clear_bit_unlock(
348+
static inline void arch___clear_bit_unlock(
349349
unsigned long nr, volatile unsigned long *addr)
350350
{
351-
clear_bit_unlock(nr, addr);
351+
arch_clear_bit_unlock(nr, addr);
352352
}
353353

354-
static inline bool xor_unlock_is_negative_byte(unsigned long mask,
354+
static inline bool arch_xor_unlock_is_negative_byte(unsigned long mask,
355355
volatile unsigned long *addr)
356356
{
357357
unsigned long res;
@@ -369,6 +369,9 @@ static inline bool xor_unlock_is_negative_byte(unsigned long mask,
369369
#undef __NOT
370370
#undef __AMO
371371

372+
#include <asm-generic/bitops/instrumented-atomic.h>
373+
#include <asm-generic/bitops/instrumented-lock.h>
374+
372375
#include <asm-generic/bitops/non-atomic.h>
373376
#include <asm-generic/bitops/le.h>
374377
#include <asm-generic/bitops/ext2-atomic.h>

arch/riscv/include/asm/cacheflush.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,23 @@ do { \
4646
} while (0)
4747

4848
#ifdef CONFIG_64BIT
49-
#define flush_cache_vmap(start, end) flush_tlb_kernel_range(start, end)
49+
extern u64 new_vmalloc[NR_CPUS / sizeof(u64) + 1];
50+
extern char _end[];
51+
#define flush_cache_vmap flush_cache_vmap
52+
static inline void flush_cache_vmap(unsigned long start, unsigned long end)
53+
{
54+
if (is_vmalloc_or_module_addr((void *)start)) {
55+
int i;
56+
57+
/*
58+
* We don't care if concurrently a cpu resets this value since
59+
* the only place this can happen is in handle_exception() where
60+
* an sfence.vma is emitted.
61+
*/
62+
for (i = 0; i < ARRAY_SIZE(new_vmalloc); ++i)
63+
new_vmalloc[i] = -1ULL;
64+
}
65+
}
5066
#define flush_cache_vmap_early(start, end) local_flush_tlb_kernel_range(start, end)
5167
#endif
5268

arch/riscv/include/asm/exec.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+
#ifndef __ASM_EXEC_H
4+
#define __ASM_EXEC_H
5+
6+
extern unsigned long arch_align_stack(unsigned long sp);
7+
8+
#endif /* __ASM_EXEC_H */

arch/riscv/include/asm/fence.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
12
#ifndef _ASM_RISCV_FENCE_H
23
#define _ASM_RISCV_FENCE_H
34

arch/riscv/include/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
#define RISCV_ISA_EXT_ZCF 83
9393
#define RISCV_ISA_EXT_ZCMOP 84
9494
#define RISCV_ISA_EXT_ZAWRS 85
95+
#define RISCV_ISA_EXT_SVVPTC 86
9596

9697
#define RISCV_ISA_EXT_XLINUXENVCFG 127
9798

0 commit comments

Comments
 (0)