mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
RISC-V Fixes for 5.0-rc5
This patch set contains a handful of mostly-independent patches: * A patch that causes our port to respect TIF_NEED_RESCHED, which fixes CONFIG_PREEMPT=y kernels. * A fix to avoid double-put on OF nodes. * Fix a misspelling of target in our Kconfig. * Generic PCIe is enabled in our defconfig. * A fix to our SBI early console to properly handle line endings. * A fix such that max_low_pfn is counted in PFNs. * A change to TASK_UNMAPPED_BASE to match what other arches do. This has passed by standard "boot Fedora" flow. -----BEGIN PGP SIGNATURE----- iQJHBAABCAAxFiEEAM520YNJYN/OiG3470yhUCzLq0EFAlxR5B4THHBhbG1lckBk YWJiZWx0LmNvbQAKCRDvTKFQLMurQf7aEACfy+2EHqgTo5lzRZCwxmjzb4rm5gyH 1GuR+2NPiwjPADxCqpO7tLFwSoLWU46K7GKfTrjXWbW2hNfBiHfPv62mPSX7dWR0 kbUMRK0z5qm4mE1K8mmDFWPntGchuuRz1rfPI2Dv8McVybz2MbrvlrJ3zXXK/Qcu 07cWbmeGd2RWIfj+tSYo+i5Aq4VPWQ6X00ToZlIZ4/4v69mFVgjqTIcc3Jx7unt1 vGFRjP8jDVibwFAE1yDcUl9OCxqW/wUuwTpPW2HgN+55dktjBxvESl/pMl0AeGYk ehKdsaBVk/BkQT2XkYDIPxqK4Yb0VsuPOoH0Jsj+l3tSGjSeRA/LwlHiY7hALIVj LTg2FvEKs++hLnzwV6D5Qqj8TcdowSm/hDJttjEewM+IhLPOVGLz16yRcM9jIC7E 1Jc6ByTo6HgVxhasF/ehT5SowJc1nOR3nS9VVd2P0yYysdN0m/kcfSgxQ1GoXMmC 2tnMlwJO7pm8akuV2ifxUsM6KlRP47auLtTbRxuebpYnd6YKng7NRLF8Um2tgck4 wtULBEXZCLYhHB55Lyy+wWDr7Pi3XK7qyvoTNP+AEJHcPtI23TsGKzB0Hu2unvxE s9r+0NGuiiuLAsR6Jba9FFSeZR7mJ9u1Bm0fz89Ob6dr1lYf0UUjqqQfHTfVZr40 F7SqTyD+pe7IoQ== =Z3YY -----END PGP SIGNATURE----- Merge tag 'riscv-for-linus-5.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux Pull RISC-V fixes from Palmer Dabbelt: "This contains a handful of mostly-independent patches: - make our port respect TIF_NEED_RESCHED, which fixes CONFIG_PREEMPT=y kernels - fix double-put of OF nodes - fix a misspelling of target in our Kconfig - generic PCIe is enabled in our defconfig - fix our SBI early console to properly handle line endings - fix max_low_pfn being counted in PFNs - a change to TASK_UNMAPPED_BASE to match what other arches do This has passed my standard 'boot Fedora' flow" * tag 'riscv-for-linus-5.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux: riscv: Adjust mmap base address at a third of task size riscv: fixup max_low_pfn with PFN_DOWN. tty/serial: use uart_console_write in the RISC-V SBL early console RISC-V: defconfig: Add CRYPTO_DEV_VIRTIO=y RISC-V: defconfig: Enable Generic PCIE by default RISC-V: defconfig: Move CONFIG_PCI{,E_XILINX} RISC-V: Kconfig: fix spelling mistake "traget" -> "target" RISC-V: asm/page.h: fix spelling mistake "CONFIG_64BITS" -> "CONFIG_64BIT" RISC-V: fix bad use of of_node_put RISC-V: Add _TIF_NEED_RESCHED check for kernel thread when CONFIG_PREEMPT=y
This commit is contained in:
commit
74b13e7efe
@ -103,7 +103,7 @@ choice
|
||||
prompt "Base ISA"
|
||||
default ARCH_RV64I
|
||||
help
|
||||
This selects the base ISA that this kernel will traget and must match
|
||||
This selects the base ISA that this kernel will target and must match
|
||||
the target platform.
|
||||
|
||||
config ARCH_RV32I
|
||||
|
@ -13,8 +13,6 @@ CONFIG_BLK_DEV_INITRD=y
|
||||
CONFIG_EXPERT=y
|
||||
CONFIG_BPF_SYSCALL=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_PCI=y
|
||||
CONFIG_PCIE_XILINX=y
|
||||
CONFIG_MODULES=y
|
||||
CONFIG_MODULE_UNLOAD=y
|
||||
CONFIG_NET=y
|
||||
@ -28,6 +26,10 @@ CONFIG_IP_PNP_DHCP=y
|
||||
CONFIG_IP_PNP_BOOTP=y
|
||||
CONFIG_IP_PNP_RARP=y
|
||||
CONFIG_NETLINK_DIAG=y
|
||||
CONFIG_PCI=y
|
||||
CONFIG_PCIEPORTBUS=y
|
||||
CONFIG_PCI_HOST_GENERIC=y
|
||||
CONFIG_PCIE_XILINX=y
|
||||
CONFIG_DEVTMPFS=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_VIRTIO_BLK=y
|
||||
@ -63,7 +65,6 @@ CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_UAS=y
|
||||
CONFIG_VIRTIO_MMIO=y
|
||||
CONFIG_SIFIVE_PLIC=y
|
||||
CONFIG_RAS=y
|
||||
CONFIG_EXT4_FS=y
|
||||
CONFIG_EXT4_FS_POSIX_ACL=y
|
||||
CONFIG_AUTOFS4_FS=y
|
||||
@ -77,5 +78,6 @@ CONFIG_NFS_V4_1=y
|
||||
CONFIG_NFS_V4_2=y
|
||||
CONFIG_ROOT_NFS=y
|
||||
CONFIG_CRYPTO_USER_API_HASH=y
|
||||
CONFIG_CRYPTO_DEV_VIRTIO=y
|
||||
CONFIG_PRINTK_TIME=y
|
||||
# CONFIG_RCU_TRACE is not set
|
||||
|
@ -80,7 +80,7 @@ typedef struct page *pgtable_t;
|
||||
#define __pgd(x) ((pgd_t) { (x) })
|
||||
#define __pgprot(x) ((pgprot_t) { (x) })
|
||||
|
||||
#ifdef CONFIG_64BITS
|
||||
#ifdef CONFIG_64BIT
|
||||
#define PTE_FMT "%016lx"
|
||||
#else
|
||||
#define PTE_FMT "%08lx"
|
||||
|
@ -22,7 +22,7 @@
|
||||
* This decides where the kernel will search for a free chunk of vm
|
||||
* space during mmap's.
|
||||
*/
|
||||
#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE >> 1)
|
||||
#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
|
||||
|
||||
#define STACK_TOP TASK_SIZE
|
||||
#define STACK_TOP_MAX STACK_TOP
|
||||
|
@ -39,6 +39,7 @@ void asm_offsets(void)
|
||||
OFFSET(TASK_STACK, task_struct, stack);
|
||||
OFFSET(TASK_TI, task_struct, thread_info);
|
||||
OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags);
|
||||
OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count);
|
||||
OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp);
|
||||
OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp);
|
||||
OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu);
|
||||
|
@ -144,6 +144,10 @@ _save_context:
|
||||
REG_L x2, PT_SP(sp)
|
||||
.endm
|
||||
|
||||
#if !IS_ENABLED(CONFIG_PREEMPT)
|
||||
.set resume_kernel, restore_all
|
||||
#endif
|
||||
|
||||
ENTRY(handle_exception)
|
||||
SAVE_ALL
|
||||
|
||||
@ -228,7 +232,7 @@ ret_from_exception:
|
||||
REG_L s0, PT_SSTATUS(sp)
|
||||
csrc sstatus, SR_SIE
|
||||
andi s0, s0, SR_SPP
|
||||
bnez s0, restore_all
|
||||
bnez s0, resume_kernel
|
||||
|
||||
resume_userspace:
|
||||
/* Interrupts must be disabled here so flags are checked atomically */
|
||||
@ -250,6 +254,18 @@ restore_all:
|
||||
RESTORE_ALL
|
||||
sret
|
||||
|
||||
#if IS_ENABLED(CONFIG_PREEMPT)
|
||||
resume_kernel:
|
||||
REG_L s0, TASK_TI_PREEMPT_COUNT(tp)
|
||||
bnez s0, restore_all
|
||||
need_resched:
|
||||
REG_L s0, TASK_TI_FLAGS(tp)
|
||||
andi s0, s0, _TIF_NEED_RESCHED
|
||||
beqz s0, restore_all
|
||||
call preempt_schedule_irq
|
||||
j need_resched
|
||||
#endif
|
||||
|
||||
work_pending:
|
||||
/* Enter slow path for supplementary processing */
|
||||
la ra, ret_from_exception
|
||||
|
@ -181,7 +181,7 @@ static void __init setup_bootmem(void)
|
||||
BUG_ON(mem_size == 0);
|
||||
|
||||
set_max_mapnr(PFN_DOWN(mem_size));
|
||||
max_low_pfn = memblock_end_of_DRAM();
|
||||
max_low_pfn = PFN_DOWN(memblock_end_of_DRAM());
|
||||
|
||||
#ifdef CONFIG_BLK_DEV_INITRD
|
||||
setup_initrd();
|
||||
|
@ -57,15 +57,12 @@ void __init setup_smp(void)
|
||||
|
||||
while ((dn = of_find_node_by_type(dn, "cpu"))) {
|
||||
hart = riscv_of_processor_hartid(dn);
|
||||
if (hart < 0) {
|
||||
of_node_put(dn);
|
||||
if (hart < 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hart == cpuid_to_hartid_map(0)) {
|
||||
BUG_ON(found_boot_cpu);
|
||||
found_boot_cpu = 1;
|
||||
of_node_put(dn);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -73,7 +70,6 @@ void __init setup_smp(void)
|
||||
set_cpu_possible(cpuid, true);
|
||||
set_cpu_present(cpuid, true);
|
||||
cpuid++;
|
||||
of_node_put(dn);
|
||||
}
|
||||
|
||||
BUG_ON(!found_boot_cpu);
|
||||
|
@ -28,7 +28,8 @@ static void __init zone_sizes_init(void)
|
||||
unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0, };
|
||||
|
||||
#ifdef CONFIG_ZONE_DMA32
|
||||
max_zone_pfns[ZONE_DMA32] = PFN_DOWN(min(4UL * SZ_1G, max_low_pfn));
|
||||
max_zone_pfns[ZONE_DMA32] = PFN_DOWN(min(4UL * SZ_1G,
|
||||
(unsigned long) PFN_PHYS(max_low_pfn)));
|
||||
#endif
|
||||
max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
|
||||
|
||||
|
@ -10,13 +10,16 @@
|
||||
#include <linux/serial_core.h>
|
||||
#include <asm/sbi.h>
|
||||
|
||||
static void sbi_console_write(struct console *con,
|
||||
const char *s, unsigned int n)
|
||||
static void sbi_putc(struct uart_port *port, int c)
|
||||
{
|
||||
int i;
|
||||
sbi_console_putchar(c);
|
||||
}
|
||||
|
||||
for (i = 0; i < n; ++i)
|
||||
sbi_console_putchar(s[i]);
|
||||
static void sbi_console_write(struct console *con,
|
||||
const char *s, unsigned n)
|
||||
{
|
||||
struct earlycon_device *dev = con->data;
|
||||
uart_console_write(&dev->port, s, n, sbi_putc);
|
||||
}
|
||||
|
||||
static int __init early_sbi_setup(struct earlycon_device *device,
|
||||
|
Loading…
Reference in New Issue
Block a user