Commit 07ebd38a authored by Linus Torvalds's avatar Linus Torvalds

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

Pull RISC-V fixes from Palmer Dabbelt:

 - Fixes for a handful of KASAN-related crashes.

 - A fix to avoid a crash during boot for SPARSEMEM &&
   !SPARSEMEM_VMEMMAP configurations.

 - A fix to stop reporting some incorrect errors under DEBUG_VIRTUAL.

 - A fix for the K210's device tree to properly populate the interrupt
   map, so hart1 will get interrupts again.

* tag 'riscv-for-linus-5.17-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: dts: k210: fix broken IRQs on hart1
  riscv: Fix kasan pud population
  riscv: Move high_memory initialization to setup_bootmem
  riscv: Fix config KASAN && DEBUG_VIRTUAL
  riscv: Fix DEBUG_VIRTUAL false warnings
  riscv: Fix config KASAN && SPARSEMEM && !SPARSE_VMEMMAP
  riscv: Fix is_linear_mapping with recent move of KASAN region
parents 3f509f59 74583f1b
...@@ -113,7 +113,8 @@ plic0: interrupt-controller@c000000 { ...@@ -113,7 +113,8 @@ plic0: interrupt-controller@c000000 {
compatible = "canaan,k210-plic", "sifive,plic-1.0.0"; compatible = "canaan,k210-plic", "sifive,plic-1.0.0";
reg = <0xC000000 0x4000000>; reg = <0xC000000 0x4000000>;
interrupt-controller; interrupt-controller;
interrupts-extended = <&cpu0_intc 11>, <&cpu1_intc 11>; interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>,
<&cpu1_intc 11>, <&cpu1_intc 9>;
riscv,ndev = <65>; riscv,ndev = <65>;
}; };
......
...@@ -119,7 +119,7 @@ extern phys_addr_t phys_ram_base; ...@@ -119,7 +119,7 @@ extern phys_addr_t phys_ram_base;
((x) >= kernel_map.virt_addr && (x) < (kernel_map.virt_addr + kernel_map.size)) ((x) >= kernel_map.virt_addr && (x) < (kernel_map.virt_addr + kernel_map.size))
#define is_linear_mapping(x) \ #define is_linear_mapping(x) \
((x) >= PAGE_OFFSET && (!IS_ENABLED(CONFIG_64BIT) || (x) < kernel_map.virt_addr)) ((x) >= PAGE_OFFSET && (!IS_ENABLED(CONFIG_64BIT) || (x) < PAGE_OFFSET + KERN_VIRT_SIZE))
#define linear_mapping_pa_to_va(x) ((void *)((unsigned long)(x) + kernel_map.va_pa_offset)) #define linear_mapping_pa_to_va(x) ((void *)((unsigned long)(x) + kernel_map.va_pa_offset))
#define kernel_mapping_pa_to_va(y) ({ \ #define kernel_mapping_pa_to_va(y) ({ \
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#ifndef CONFIG_MMU #ifndef CONFIG_MMU
#define KERNEL_LINK_ADDR PAGE_OFFSET #define KERNEL_LINK_ADDR PAGE_OFFSET
#define KERN_VIRT_SIZE (UL(-1))
#else #else
#define ADDRESS_SPACE_END (UL(-1)) #define ADDRESS_SPACE_END (UL(-1))
......
...@@ -24,6 +24,9 @@ obj-$(CONFIG_KASAN) += kasan_init.o ...@@ -24,6 +24,9 @@ obj-$(CONFIG_KASAN) += kasan_init.o
ifdef CONFIG_KASAN ifdef CONFIG_KASAN
KASAN_SANITIZE_kasan_init.o := n KASAN_SANITIZE_kasan_init.o := n
KASAN_SANITIZE_init.o := n KASAN_SANITIZE_init.o := n
ifdef CONFIG_DEBUG_VIRTUAL
KASAN_SANITIZE_physaddr.o := n
endif
endif endif
obj-$(CONFIG_DEBUG_VIRTUAL) += physaddr.o obj-$(CONFIG_DEBUG_VIRTUAL) += physaddr.o
...@@ -125,7 +125,6 @@ void __init mem_init(void) ...@@ -125,7 +125,6 @@ void __init mem_init(void)
else else
swiotlb_force = SWIOTLB_NO_FORCE; swiotlb_force = SWIOTLB_NO_FORCE;
#endif #endif
high_memory = (void *)(__va(PFN_PHYS(max_low_pfn)));
memblock_free_all(); memblock_free_all();
print_vm_layout(); print_vm_layout();
...@@ -195,6 +194,7 @@ static void __init setup_bootmem(void) ...@@ -195,6 +194,7 @@ static void __init setup_bootmem(void)
min_low_pfn = PFN_UP(phys_ram_base); min_low_pfn = PFN_UP(phys_ram_base);
max_low_pfn = max_pfn = PFN_DOWN(phys_ram_end); max_low_pfn = max_pfn = PFN_DOWN(phys_ram_end);
high_memory = (void *)(__va(PFN_PHYS(max_low_pfn)));
dma32_phys_limit = min(4UL * SZ_1G, (unsigned long)PFN_PHYS(max_low_pfn)); dma32_phys_limit = min(4UL * SZ_1G, (unsigned long)PFN_PHYS(max_low_pfn));
set_max_mapnr(max_low_pfn - ARCH_PFN_OFFSET); set_max_mapnr(max_low_pfn - ARCH_PFN_OFFSET);
......
...@@ -113,8 +113,11 @@ static void __init kasan_populate_pud(pgd_t *pgd, ...@@ -113,8 +113,11 @@ static void __init kasan_populate_pud(pgd_t *pgd,
base_pud = pt_ops.get_pud_virt(pfn_to_phys(_pgd_pfn(*pgd))); base_pud = pt_ops.get_pud_virt(pfn_to_phys(_pgd_pfn(*pgd)));
} else { } else {
base_pud = (pud_t *)pgd_page_vaddr(*pgd); base_pud = (pud_t *)pgd_page_vaddr(*pgd);
if (base_pud == lm_alias(kasan_early_shadow_pud)) if (base_pud == lm_alias(kasan_early_shadow_pud)) {
base_pud = memblock_alloc(PTRS_PER_PUD * sizeof(pud_t), PAGE_SIZE); base_pud = memblock_alloc(PTRS_PER_PUD * sizeof(pud_t), PAGE_SIZE);
memcpy(base_pud, (void *)kasan_early_shadow_pud,
sizeof(pud_t) * PTRS_PER_PUD);
}
} }
pudp = base_pud + pud_index(vaddr); pudp = base_pud + pud_index(vaddr);
...@@ -202,8 +205,7 @@ asmlinkage void __init kasan_early_init(void) ...@@ -202,8 +205,7 @@ asmlinkage void __init kasan_early_init(void)
for (i = 0; i < PTRS_PER_PTE; ++i) for (i = 0; i < PTRS_PER_PTE; ++i)
set_pte(kasan_early_shadow_pte + i, set_pte(kasan_early_shadow_pte + i,
mk_pte(virt_to_page(kasan_early_shadow_page), pfn_pte(virt_to_pfn(kasan_early_shadow_page), PAGE_KERNEL));
PAGE_KERNEL));
for (i = 0; i < PTRS_PER_PMD; ++i) for (i = 0; i < PTRS_PER_PMD; ++i)
set_pmd(kasan_early_shadow_pmd + i, set_pmd(kasan_early_shadow_pmd + i,
......
...@@ -8,12 +8,10 @@ ...@@ -8,12 +8,10 @@
phys_addr_t __virt_to_phys(unsigned long x) phys_addr_t __virt_to_phys(unsigned long x)
{ {
phys_addr_t y = x - PAGE_OFFSET;
/* /*
* Boundary checking aginst the kernel linear mapping space. * Boundary checking aginst the kernel linear mapping space.
*/ */
WARN(y >= KERN_VIRT_SIZE, WARN(!is_linear_mapping(x) && !is_kernel_mapping(x),
"virt_to_phys used for non-linear address: %pK (%pS)\n", "virt_to_phys used for non-linear address: %pK (%pS)\n",
(void *)x, (void *)x); (void *)x, (void *)x);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment