Merge tag 'riscv-for-linus-5.8-mw1' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Jun 2020 19:55:20 +0000 (12:55 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Jun 2020 19:55:20 +0000 (12:55 -0700)
Pull more RISC-V updates from Palmer Dabbelt:

 - Kconfig select statements are now sorted alphanumerically

 - first-level interrupts are now handled via a full irqchip driver

 - CPU hotplug is fixed

 - vDSO calls now use the common vDSO infrastructure

* tag 'riscv-for-linus-5.8-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
  riscv: set the permission of vdso_data to read-only
  riscv: use vDSO common flow to reduce the latency of the time-related functions
  riscv: fix build warning of missing prototypes
  RISC-V: Don't mark init section as non-executable
  RISC-V: Force select RISCV_INTC for CONFIG_RISCV
  RISC-V: Remove do_IRQ() function
  clocksource/drivers/timer-riscv: Use per-CPU timer interrupt
  irqchip: RISC-V per-HART local interrupt controller driver
  RISC-V: Rename and move plic_find_hart_id() to arch directory
  RISC-V: self-contained IPI handling routine
  RISC-V: Sort select statements alphanumerically

1  2 
arch/riscv/kernel/vdso.c
arch/riscv/mm/init.c
include/linux/cpuhotplug.h

diff --combined arch/riscv/kernel/vdso.c
  #include <linux/slab.h>
  #include <linux/binfmts.h>
  #include <linux/err.h>
+ #include <asm/page.h>
+ #ifdef GENERIC_TIME_VSYSCALL
+ #include <vdso/datapage.h>
+ #else
  #include <asm/vdso.h>
+ #endif
  
  extern char vdso_start[], vdso_end[];
  
@@@ -26,7 -30,7 +30,7 @@@ static union 
        struct vdso_data        data;
        u8                      page[PAGE_SIZE];
  } vdso_data_store __page_aligned_data;
- static struct vdso_data *vdso_data = &vdso_data_store.data;
+ struct vdso_data *vdso_data = &vdso_data_store.data;
  
  static int __init vdso_init(void)
  {
@@@ -61,7 -65,7 +65,7 @@@ int arch_setup_additional_pages(struct 
  
        vdso_len = (vdso_pages + 1) << PAGE_SHIFT;
  
 -      down_write(&mm->mmap_sem);
 +      mmap_write_lock(mm);
        vdso_base = get_unmapped_area(NULL, 0, vdso_len, 0, 0);
        if (IS_ERR_VALUE(vdso_base)) {
                ret = vdso_base;
         */
        mm->context.vdso = (void *)vdso_base;
  
-       ret = install_special_mapping(mm, vdso_base, vdso_len,
+       ret =
+          install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
                (VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC),
                vdso_pagelist);
  
-       if (unlikely(ret))
+       if (unlikely(ret)) {
                mm->context.vdso = NULL;
+               goto end;
+       }
  
+       vdso_base += (vdso_pages << PAGE_SHIFT);
+       ret = install_special_mapping(mm, vdso_base, PAGE_SIZE,
+               (VM_READ | VM_MAYREAD), &vdso_pagelist[vdso_pages]);
+       if (unlikely(ret))
+               mm->context.vdso = NULL;
  end:
 -      up_write(&mm->mmap_sem);
 +      mmap_write_unlock(mm);
        return ret;
  }
  
@@@ -91,5 -104,8 +104,8 @@@ const char *arch_vma_name(struct vm_are
  {
        if (vma->vm_mm && (vma->vm_start == (long)vma->vm_mm->context.vdso))
                return "[vdso]";
+       if (vma->vm_mm && (vma->vm_start ==
+                          (long)vma->vm_mm->context.vdso + PAGE_SIZE))
+               return "[vdso_data]";
        return NULL;
  }
diff --combined arch/riscv/mm/init.c
@@@ -18,6 -18,7 +18,6 @@@
  #include <asm/tlbflush.h>
  #include <asm/sections.h>
  #include <asm/soc.h>
 -#include <asm/pgtable.h>
  #include <asm/io.h>
  #include <asm/ptdump.h>
  
@@@ -235,12 -236,12 +235,12 @@@ static void __init create_pte_mapping(p
                                      uintptr_t va, phys_addr_t pa,
                                      phys_addr_t sz, pgprot_t prot)
  {
 -      uintptr_t pte_index = pte_index(va);
 +      uintptr_t pte_idx = pte_index(va);
  
        BUG_ON(sz != PAGE_SIZE);
  
 -      if (pte_none(ptep[pte_index]))
 -              ptep[pte_index] = pfn_pte(PFN_DOWN(pa), prot);
 +      if (pte_none(ptep[pte_idx]))
 +              ptep[pte_idx] = pfn_pte(PFN_DOWN(pa), prot);
  }
  
  #ifndef __PAGETABLE_PMD_FOLDED
@@@ -283,21 -284,21 +283,21 @@@ static void __init create_pmd_mapping(p
  {
        pte_t *ptep;
        phys_addr_t pte_phys;
 -      uintptr_t pmd_index = pmd_index(va);
 +      uintptr_t pmd_idx = pmd_index(va);
  
        if (sz == PMD_SIZE) {
 -              if (pmd_none(pmdp[pmd_index]))
 -                      pmdp[pmd_index] = pfn_pmd(PFN_DOWN(pa), prot);
 +              if (pmd_none(pmdp[pmd_idx]))
 +                      pmdp[pmd_idx] = pfn_pmd(PFN_DOWN(pa), prot);
                return;
        }
  
 -      if (pmd_none(pmdp[pmd_index])) {
 +      if (pmd_none(pmdp[pmd_idx])) {
                pte_phys = alloc_pte(va);
 -              pmdp[pmd_index] = pfn_pmd(PFN_DOWN(pte_phys), PAGE_TABLE);
 +              pmdp[pmd_idx] = pfn_pmd(PFN_DOWN(pte_phys), PAGE_TABLE);
                ptep = get_pte_virt(pte_phys);
                memset(ptep, 0, PAGE_SIZE);
        } else {
 -              pte_phys = PFN_PHYS(_pmd_pfn(pmdp[pmd_index]));
 +              pte_phys = PFN_PHYS(_pmd_pfn(pmdp[pmd_idx]));
                ptep = get_pte_virt(pte_phys);
        }
  
@@@ -325,21 -326,21 +325,21 @@@ static void __init create_pgd_mapping(p
  {
        pgd_next_t *nextp;
        phys_addr_t next_phys;
 -      uintptr_t pgd_index = pgd_index(va);
 +      uintptr_t pgd_idx = pgd_index(va);
  
        if (sz == PGDIR_SIZE) {
 -              if (pgd_val(pgdp[pgd_index]) == 0)
 -                      pgdp[pgd_index] = pfn_pgd(PFN_DOWN(pa), prot);
 +              if (pgd_val(pgdp[pgd_idx]) == 0)
 +                      pgdp[pgd_idx] = pfn_pgd(PFN_DOWN(pa), prot);
                return;
        }
  
 -      if (pgd_val(pgdp[pgd_index]) == 0) {
 +      if (pgd_val(pgdp[pgd_idx]) == 0) {
                next_phys = alloc_pgd_next(va);
 -              pgdp[pgd_index] = pfn_pgd(PFN_DOWN(next_phys), PAGE_TABLE);
 +              pgdp[pgd_idx] = pfn_pgd(PFN_DOWN(next_phys), PAGE_TABLE);
                nextp = get_pgd_next_virt(next_phys);
                memset(nextp, 0, PAGE_SIZE);
        } else {
 -              next_phys = PFN_PHYS(_pgd_pfn(pgdp[pgd_index]));
 +              next_phys = PFN_PHYS(_pgd_pfn(pgdp[pgd_idx]));
                nextp = get_pgd_next_virt(next_phys);
        }
  
@@@ -480,17 -481,6 +480,6 @@@ static void __init setup_vm_final(void
        csr_write(CSR_SATP, PFN_DOWN(__pa_symbol(swapper_pg_dir)) | SATP_MODE);
        local_flush_tlb_all();
  }
- void free_initmem(void)
- {
-       unsigned long init_begin = (unsigned long)__init_begin;
-       unsigned long init_end = (unsigned long)__init_end;
-       /* Make the region as non-execuatble. */
-       set_memory_nx(init_begin, (init_end - init_begin) >> PAGE_SHIFT);
-       free_initmem_default(POISON_FREE_INITMEM);
- }
  #else
  asmlinkage void __init setup_vm(uintptr_t dtb_pa)
  {
@@@ -102,6 -102,7 +102,7 @@@ enum cpuhp_state 
        CPUHP_AP_IRQ_ARMADA_XP_STARTING,
        CPUHP_AP_IRQ_BCM2836_STARTING,
        CPUHP_AP_IRQ_MIPS_GIC_STARTING,
+       CPUHP_AP_IRQ_RISCV_STARTING,
        CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING,
        CPUHP_AP_ARM_MVEBU_COHERENCY,
        CPUHP_AP_MICROCODE_LOADER,
        CPUHP_AP_ARM_XEN_STARTING,
        CPUHP_AP_ARM_KVMPV_STARTING,
        CPUHP_AP_ARM_CORESIGHT_STARTING,
 +      CPUHP_AP_ARM_CORESIGHT_CTI_STARTING,
        CPUHP_AP_ARM64_ISNDEP_STARTING,
        CPUHP_AP_SMPCFD_DYING,
        CPUHP_AP_X86_TBOOT_DYING,