Skip to content

Commit 568d850

Browse files
committed
Merge tag 'riscv/for-v5.4-rc1-b' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux
Pull more RISC-V updates from Paul Walmsley: "Some additional RISC-V updates. This includes one significant fix: - Prevent interrupts from being unconditionally re-enabled during exception handling if they were disabled in the context in which the exception occurred Also a few other fixes: - Fix a build error when sparse memory support is manually enabled - Prevent CPUs beyond CONFIG_NR_CPUS from being enabled in early boot And a few minor improvements: - DT improvements: in the FU540 SoC DT files, improve U-Boot compatibility by adding an "ethernet0" alias, drop an unnecessary property from the DT files, and add support for the PWM device - KVM preparation: add a KVM-related macro for future RISC-V KVM support, and export some symbols required to build KVM support as modules - defconfig additions: build more drivers by default for QEMU configurations" * tag 'riscv/for-v5.4-rc1-b' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: Avoid interrupts being erroneously enabled in handle_exception() riscv: dts: sifive: Drop "clock-frequency" property of cpu nodes riscv: dts: sifive: Add ethernet0 to the aliases node RISC-V: Export kernel symbols for kvm KVM: RISC-V: Add KVM_REG_RISCV for ONE_REG interface arch/riscv: disable excess harts before picking main boot hart RISC-V: Enable VIRTIO drivers in RV64 and RV32 defconfig RISC-V: Fix building error when CONFIG_SPARSEMEM_MANUAL=y riscv: dts: Add DT support for SiFive FU540 PWM driver
2 parents 70570a6 + c82dd6d commit 568d850

File tree

10 files changed

+74
-19
lines changed

10 files changed

+74
-19
lines changed

arch/riscv/boot/dts/sifive/fu540-c000.dtsi

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
aliases {
1414
serial0 = &uart0;
1515
serial1 = &uart1;
16+
ethernet0 = &eth0;
1617
};
1718

1819
chosen {
@@ -60,7 +61,6 @@
6061
};
6162
};
6263
cpu2: cpu@2 {
63-
clock-frequency = <0>;
6464
compatible = "sifive,u54-mc", "sifive,rocket0", "riscv";
6565
d-cache-block-size = <64>;
6666
d-cache-sets = <64>;
@@ -84,7 +84,6 @@
8484
};
8585
};
8686
cpu3: cpu@3 {
87-
clock-frequency = <0>;
8887
compatible = "sifive,u54-mc", "sifive,rocket0", "riscv";
8988
d-cache-block-size = <64>;
9089
d-cache-sets = <64>;
@@ -108,7 +107,6 @@
108107
};
109108
};
110109
cpu4: cpu@4 {
111-
clock-frequency = <0>;
112110
compatible = "sifive,u54-mc", "sifive,rocket0", "riscv";
113111
d-cache-block-size = <64>;
114112
d-cache-sets = <64>;
@@ -230,6 +228,24 @@
230228
#size-cells = <0>;
231229
status = "disabled";
232230
};
231+
pwm0: pwm@10020000 {
232+
compatible = "sifive,fu540-c000-pwm", "sifive,pwm0";
233+
reg = <0x0 0x10020000 0x0 0x1000>;
234+
interrupt-parent = <&plic0>;
235+
interrupts = <42 43 44 45>;
236+
clocks = <&prci PRCI_CLK_TLCLK>;
237+
#pwm-cells = <3>;
238+
status = "disabled";
239+
};
240+
pwm1: pwm@10021000 {
241+
compatible = "sifive,fu540-c000-pwm", "sifive,pwm0";
242+
reg = <0x0 0x10021000 0x0 0x1000>;
243+
interrupt-parent = <&plic0>;
244+
interrupts = <46 47 48 49>;
245+
clocks = <&prci PRCI_CLK_TLCLK>;
246+
#pwm-cells = <3>;
247+
status = "disabled";
248+
};
233249

234250
};
235251
};

arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,11 @@
8585
reg = <0>;
8686
};
8787
};
88+
89+
&pwm0 {
90+
status = "okay";
91+
};
92+
93+
&pwm1 {
94+
status = "okay";
95+
};

arch/riscv/configs/defconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ CONFIG_IP_PNP_DHCP=y
2929
CONFIG_IP_PNP_BOOTP=y
3030
CONFIG_IP_PNP_RARP=y
3131
CONFIG_NETLINK_DIAG=y
32+
CONFIG_NET_9P=y
33+
CONFIG_NET_9P_VIRTIO=y
3234
CONFIG_PCI=y
3335
CONFIG_PCIEPORTBUS=y
3436
CONFIG_PCI_HOST_GENERIC=y
@@ -39,6 +41,7 @@ CONFIG_BLK_DEV_LOOP=y
3941
CONFIG_VIRTIO_BLK=y
4042
CONFIG_BLK_DEV_SD=y
4143
CONFIG_BLK_DEV_SR=y
44+
CONFIG_SCSI_VIRTIO=y
4245
CONFIG_ATA=y
4346
CONFIG_SATA_AHCI=y
4447
CONFIG_SATA_AHCI_PLATFORM=y
@@ -54,13 +57,15 @@ CONFIG_SERIAL_8250_CONSOLE=y
5457
CONFIG_SERIAL_OF_PLATFORM=y
5558
CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
5659
CONFIG_HVC_RISCV_SBI=y
60+
CONFIG_VIRTIO_CONSOLE=y
5761
CONFIG_HW_RANDOM=y
5862
CONFIG_HW_RANDOM_VIRTIO=y
5963
CONFIG_SPI=y
6064
CONFIG_SPI_SIFIVE=y
6165
# CONFIG_PTP_1588_CLOCK is not set
6266
CONFIG_DRM=y
6367
CONFIG_DRM_RADEON=y
68+
CONFIG_DRM_VIRTIO_GPU=y
6469
CONFIG_FRAMEBUFFER_CONSOLE=y
6570
CONFIG_USB=y
6671
CONFIG_USB_XHCI_HCD=y
@@ -73,7 +78,12 @@ CONFIG_USB_STORAGE=y
7378
CONFIG_USB_UAS=y
7479
CONFIG_MMC=y
7580
CONFIG_MMC_SPI=y
81+
CONFIG_VIRTIO_PCI=y
82+
CONFIG_VIRTIO_BALLOON=y
83+
CONFIG_VIRTIO_INPUT=y
7684
CONFIG_VIRTIO_MMIO=y
85+
CONFIG_RPMSG_CHAR=y
86+
CONFIG_RPMSG_VIRTIO=y
7787
CONFIG_EXT4_FS=y
7888
CONFIG_EXT4_FS_POSIX_ACL=y
7989
CONFIG_AUTOFS4_FS=y
@@ -86,6 +96,7 @@ CONFIG_NFS_V4=y
8696
CONFIG_NFS_V4_1=y
8797
CONFIG_NFS_V4_2=y
8898
CONFIG_ROOT_NFS=y
99+
CONFIG_9P_FS=y
89100
CONFIG_CRYPTO_USER_API_HASH=y
90101
CONFIG_CRYPTO_DEV_VIRTIO=y
91102
CONFIG_PRINTK_TIME=y

arch/riscv/configs/rv32_defconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ CONFIG_IP_PNP_DHCP=y
2929
CONFIG_IP_PNP_BOOTP=y
3030
CONFIG_IP_PNP_RARP=y
3131
CONFIG_NETLINK_DIAG=y
32+
CONFIG_NET_9P=y
33+
CONFIG_NET_9P_VIRTIO=y
3234
CONFIG_PCI=y
3335
CONFIG_PCIEPORTBUS=y
3436
CONFIG_PCI_HOST_GENERIC=y
@@ -39,6 +41,7 @@ CONFIG_BLK_DEV_LOOP=y
3941
CONFIG_VIRTIO_BLK=y
4042
CONFIG_BLK_DEV_SD=y
4143
CONFIG_BLK_DEV_SR=y
44+
CONFIG_SCSI_VIRTIO=y
4245
CONFIG_ATA=y
4346
CONFIG_SATA_AHCI=y
4447
CONFIG_SATA_AHCI_PLATFORM=y
@@ -54,11 +57,13 @@ CONFIG_SERIAL_8250_CONSOLE=y
5457
CONFIG_SERIAL_OF_PLATFORM=y
5558
CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
5659
CONFIG_HVC_RISCV_SBI=y
60+
CONFIG_VIRTIO_CONSOLE=y
5761
CONFIG_HW_RANDOM=y
5862
CONFIG_HW_RANDOM_VIRTIO=y
5963
# CONFIG_PTP_1588_CLOCK is not set
6064
CONFIG_DRM=y
6165
CONFIG_DRM_RADEON=y
66+
CONFIG_DRM_VIRTIO_GPU=y
6267
CONFIG_FRAMEBUFFER_CONSOLE=y
6368
CONFIG_USB=y
6469
CONFIG_USB_XHCI_HCD=y
@@ -69,7 +74,12 @@ CONFIG_USB_OHCI_HCD=y
6974
CONFIG_USB_OHCI_HCD_PLATFORM=y
7075
CONFIG_USB_STORAGE=y
7176
CONFIG_USB_UAS=y
77+
CONFIG_VIRTIO_PCI=y
78+
CONFIG_VIRTIO_BALLOON=y
79+
CONFIG_VIRTIO_INPUT=y
7280
CONFIG_VIRTIO_MMIO=y
81+
CONFIG_RPMSG_CHAR=y
82+
CONFIG_RPMSG_VIRTIO=y
7383
CONFIG_SIFIVE_PLIC=y
7484
CONFIG_EXT4_FS=y
7585
CONFIG_EXT4_FS_POSIX_ACL=y
@@ -83,6 +93,7 @@ CONFIG_NFS_V4=y
8393
CONFIG_NFS_V4_1=y
8494
CONFIG_NFS_V4_2=y
8595
CONFIG_ROOT_NFS=y
96+
CONFIG_9P_FS=y
8697
CONFIG_CRYPTO_USER_API_HASH=y
8798
CONFIG_CRYPTO_DEV_VIRTIO=y
8899
CONFIG_PRINTK_TIME=y

arch/riscv/include/asm/pgtable.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ extern pgd_t swapper_pg_dir[];
8383
#define __S110 PAGE_SHARED_EXEC
8484
#define __S111 PAGE_SHARED_EXEC
8585

86+
#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
87+
#define VMALLOC_END (PAGE_OFFSET - 1)
88+
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
89+
90+
#define FIXADDR_TOP VMALLOC_START
91+
#ifdef CONFIG_64BIT
92+
#define FIXADDR_SIZE PMD_SIZE
93+
#else
94+
#define FIXADDR_SIZE PGDIR_SIZE
95+
#endif
96+
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
97+
8698
/*
8799
* Roughly size the vmemmap space to be large enough to fit enough
88100
* struct pages to map half the virtual address space. Then
@@ -424,18 +436,6 @@ extern void *dtb_early_va;
424436
extern void setup_bootmem(void);
425437
extern void paging_init(void);
426438

427-
#define VMALLOC_SIZE (KERN_VIRT_SIZE >> 1)
428-
#define VMALLOC_END (PAGE_OFFSET - 1)
429-
#define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
430-
431-
#define FIXADDR_TOP VMALLOC_START
432-
#ifdef CONFIG_64BIT
433-
#define FIXADDR_SIZE PMD_SIZE
434-
#else
435-
#define FIXADDR_SIZE PGDIR_SIZE
436-
#endif
437-
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
438-
439439
/*
440440
* Task size is 0x4000000000 for RV64 or 0x9fc00000 for RV32.
441441
* Note that PGDIR_SIZE must evenly divide TASK_SIZE.

arch/riscv/kernel/entry.S

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,13 @@ ENTRY(handle_exception)
166166
move a0, sp /* pt_regs */
167167
tail do_IRQ
168168
1:
169-
/* Exceptions run with interrupts enabled */
169+
/* Exceptions run with interrupts enabled or disabled
170+
depending on the state of sstatus.SR_SPIE */
171+
andi t0, s1, SR_SPIE
172+
beqz t0, 1f
170173
csrs CSR_SSTATUS, SR_SIE
171174

175+
1:
172176
/* Handle syscalls */
173177
li t0, EXC_SYSCALL
174178
beq s4, t0, handle_syscall

arch/riscv/kernel/head.S

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ _start_kernel:
6363
li t0, SR_FS
6464
csrc CSR_SSTATUS, t0
6565

66+
#ifdef CONFIG_SMP
67+
li t0, CONFIG_NR_CPUS
68+
bgeu a0, t0, .Lsecondary_park
69+
#endif
70+
6671
/* Pick one hart to run the main boot sequence */
6772
la a3, hart_lottery
6873
li a2, 1
@@ -154,9 +159,6 @@ relocate:
154159

155160
.Lsecondary_start:
156161
#ifdef CONFIG_SMP
157-
li a1, CONFIG_NR_CPUS
158-
bgeu a0, a1, .Lsecondary_park
159-
160162
/* Set trap vector to spin forever to help debug */
161163
la a3, .Lsecondary_park
162164
csrw CSR_STVEC, a3

arch/riscv/kernel/smp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,4 @@ void smp_send_reschedule(int cpu)
206206
{
207207
send_ipi_single(cpu, IPI_RESCHEDULE);
208208
}
209+
EXPORT_SYMBOL_GPL(smp_send_reschedule);

arch/riscv/kernel/time.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <asm/sbi.h>
1010

1111
unsigned long riscv_timebase;
12+
EXPORT_SYMBOL_GPL(riscv_timebase);
1213

1314
void __init time_init(void)
1415
{

include/uapi/linux/kvm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,7 @@ struct kvm_dirty_tlb {
11461146
#define KVM_REG_S390 0x5000000000000000ULL
11471147
#define KVM_REG_ARM64 0x6000000000000000ULL
11481148
#define KVM_REG_MIPS 0x7000000000000000ULL
1149+
#define KVM_REG_RISCV 0x8000000000000000ULL
11491150

11501151
#define KVM_REG_SIZE_SHIFT 52
11511152
#define KVM_REG_SIZE_MASK 0x00f0000000000000ULL

0 commit comments

Comments
 (0)