1. 31 3月, 2022 1 次提交
  2. 30 3月, 2022 1 次提交
  3. 24 3月, 2022 1 次提交
  4. 23 3月, 2022 3 次提交
    • D
      drivers/base/node: consolidate node device subsystem initialization in node_dev_init() · 2848a28b
      David Hildenbrand 提交于
      ...  and call node_dev_init() after memory_dev_init() from driver_init(),
      so before any of the existing arch/subsys calls.  All online nodes should
      be known at that point: early during boot, arch code determines node and
      zone ranges and sets the relevant nodes online; usually this happens in
      setup_arch().
      
      This is in line with memory_dev_init(), which initializes the memory
      device subsystem and creates all memory block devices.
      
      Similar to memory_dev_init(), panic() if anything goes wrong, we don't
      want to continue with such basic initialization errors.
      
      The important part is that node_dev_init() gets called after
      memory_dev_init() and after cpu_dev_init(), but before any of the relevant
      archs call register_cpu() to register the new cpu device under the node
      device.  The latter should be the case for the current users of
      topology_init().
      
      Link: https://lkml.kernel.org/r/20220203105212.30385-1-david@redhat.comSigned-off-by: NDavid Hildenbrand <david@redhat.com>
      Reviewed-by: NOscar Salvador <osalvador@suse.de>
      Tested-by: Anatoly Pugachev <matorola@gmail.com> (sparc64)
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Oscar Salvador <osalvador@suse.de>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Rich Felker <dalias@libc.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2848a28b
    • A
      mm/hugetlb: generalize ARCH_WANT_GENERAL_HUGETLB · 07431506
      Anshuman Khandual 提交于
      ARCH_WANT_GENERAL_HUGETLB config has duplicate definitions on platforms
      that subscribe it.  Instead make it a generic config option which can be
      selected on applicable platforms when required.
      
      Link: https://lkml.kernel.org/r/1643718465-4324-1-git-send-email-anshuman.khandual@arm.comSigned-off-by: NAnshuman Khandual <anshuman.khandual@arm.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      07431506
    • V
      RISC-V: Add support for restartable sequence · 93917ad5
      Vincent Chen 提交于
      Add calls to rseq_signal_deliver() and rseq_syscall() to introduce RSEQ
      support.
      
      1. Call the rseq_signal_deliver() function to fixup on the pre-signal
         frame when a signal is delivered on top of a restartable sequence
         critical section.
      
      2. Check that system calls are not invoked from within rseq critical
         sections by invoking rseq_signal() from ret_from_syscall(). With
         CONFIG_DEBUG_RSEQ, such behavior results in termination of the
         process with SIGSEGV.
      Signed-off-by: NVincent Chen <vincent.chen@sifive.com>
      Reviewed-by: NMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      93917ad5
  5. 22 3月, 2022 4 次提交
  6. 18 3月, 2022 6 次提交
  7. 11 3月, 2022 11 次提交
  8. 10 3月, 2022 5 次提交
  9. 04 3月, 2022 7 次提交
    • N
      riscv: dts: k210: fix broken IRQs on hart1 · 74583f1b
      Niklas Cassel 提交于
      Commit 67d96729 ("riscv: Update Canaan Kendryte K210 device tree")
      incorrectly removed two entries from the PLIC interrupt-controller node's
      interrupts-extended property.
      
      The PLIC driver cannot know the mapping between hart contexts and hart ids,
      so this information has to be provided by device tree, as specified by the
      PLIC device tree binding.
      
      The PLIC driver uses the interrupts-extended property, and initializes the
      hart context registers in the exact same order as provided by the
      interrupts-extended property.
      
      In other words, if we don't specify the S-mode interrupts, the PLIC driver
      will simply initialize the hart0 S-mode hart context with the hart1 M-mode
      configuration. It is therefore essential to specify the S-mode IRQs even
      though the system itself will only ever be running in M-mode.
      
      Re-add the S-mode interrupts, so that we get working IRQs on hart1 again.
      
      Cc: <stable@vger.kernel.org>
      Fixes: 67d96729 ("riscv: Update Canaan Kendryte K210 device tree")
      Signed-off-by: NNiklas Cassel <niklas.cassel@wdc.com>
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      74583f1b
    • A
      riscv: Fix kasan pud population · e4fcfe6e
      Alexandre Ghiti 提交于
      In sv48, the kasan inner regions are not aligned on PGDIR_SIZE and then
      when we populate the kasan linear mapping region, we clear the kasan
      vmalloc region which is in the same PGD.
      
      Fix this by copying the content of the kasan early pud after allocating a
      new PGD for the first time.
      
      Fixes: e8a62cc2 ("riscv: Implement sv48 support")
      Signed-off-by: NAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      e4fcfe6e
    • A
      riscv: Move high_memory initialization to setup_bootmem · 625e24a5
      Alexandre Ghiti 提交于
      high_memory used to be initialized in mem_init, way after setup_bootmem.
      But a call to dma_contiguous_reserve in this function gives rise to the
      below warning because high_memory is equal to 0 and is used at the very
      beginning at cma_declare_contiguous_nid.
      
      It went unnoticed since the move of the kasan region redefined
      KERN_VIRT_SIZE so that it does not encompass -1 anymore.
      
      Fix this by initializing high_memory in setup_bootmem.
      
      ------------[ cut here ]------------
      virt_to_phys used for non-linear address: ffffffffffffffff (0xffffffffffffffff)
      WARNING: CPU: 0 PID: 0 at arch/riscv/mm/physaddr.c:14 __virt_to_phys+0xac/0x1b8
      Modules linked in:
      CPU: 0 PID: 0 Comm: swapper Not tainted 5.17.0-rc1-00007-ga68b89289e26 #27
      Hardware name: riscv-virtio,qemu (DT)
      epc : __virt_to_phys+0xac/0x1b8
       ra : __virt_to_phys+0xac/0x1b8
      epc : ffffffff80014922 ra : ffffffff80014922 sp : ffffffff84a03c30
       gp : ffffffff85866c80 tp : ffffffff84a3f180 t0 : ffffffff86bce657
       t1 : fffffffef09406e8 t2 : 0000000000000000 s0 : ffffffff84a03c70
       s1 : ffffffffffffffff a0 : 000000000000004f a1 : 00000000000f0000
       a2 : 0000000000000002 a3 : ffffffff8011f408 a4 : 0000000000000000
       a5 : 0000000000000000 a6 : 0000000000f00000 a7 : ffffffff84a03747
       s2 : ffffffd800000000 s3 : ffffffff86ef4000 s4 : ffffffff8467f828
       s5 : fffffff800000000 s6 : 8000000000006800 s7 : 0000000000000000
       s8 : 0000000480000000 s9 : 0000000080038ea0 s10: 0000000000000000
       s11: ffffffffffffffff t3 : ffffffff84a035c0 t4 : fffffffef09406e8
       t5 : fffffffef09406e9 t6 : ffffffff84a03758
      status: 0000000000000100 badaddr: 0000000000000000 cause: 0000000000000003
      [<ffffffff8322ef4c>] cma_declare_contiguous_nid+0xf2/0x64a
      [<ffffffff83212a58>] dma_contiguous_reserve_area+0x46/0xb4
      [<ffffffff83212c3a>] dma_contiguous_reserve+0x174/0x18e
      [<ffffffff83208fc2>] paging_init+0x12c/0x35e
      [<ffffffff83206bd2>] setup_arch+0x120/0x74e
      [<ffffffff83201416>] start_kernel+0xce/0x68c
      irq event stamp: 0
      hardirqs last  enabled at (0): [<0000000000000000>] 0x0
      hardirqs last disabled at (0): [<0000000000000000>] 0x0
      softirqs last  enabled at (0): [<0000000000000000>] 0x0
      softirqs last disabled at (0): [<0000000000000000>] 0x0
      ---[ end trace 0000000000000000 ]---
      
      Fixes: f7ae0233 ("riscv: Move KASAN mapping next to the kernel mapping")
      Signed-off-by: NAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      625e24a5
    • A
      riscv: Fix config KASAN && DEBUG_VIRTUAL · c648c4bb
      Alexandre Ghiti 提交于
      __virt_to_phys function is called very early in the boot process (ie
      kasan_early_init) so it should not be instrumented by KASAN otherwise it
      bugs.
      
      Fix this by declaring phys_addr.c as non-kasan instrumentable.
      Signed-off-by: NAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Fixes: 8ad8b727 (riscv: Add KASAN support)
      Cc: stable@vger.kernel.org
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      c648c4bb
    • A
      riscv: Fix DEBUG_VIRTUAL false warnings · 5f763b3b
      Alexandre Ghiti 提交于
      KERN_VIRT_SIZE used to encompass the kernel mapping before it was
      redefined when moving the kasan mapping next to the kernel mapping to only
      match the maximum amount of physical memory.
      
      Then, kernel mapping addresses that go through __virt_to_phys are now
      declared as wrong which is not true, one can use __virt_to_phys on such
      addresses.
      
      Fix this by redefining the condition that matches wrong addresses.
      
      Fixes: f7ae0233 ("riscv: Move KASAN mapping next to the kernel mapping")
      Signed-off-by: NAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      5f763b3b
    • A
      riscv: Fix config KASAN && SPARSEMEM && !SPARSE_VMEMMAP · a3d32803
      Alexandre Ghiti 提交于
      In order to get the pfn of a struct page* when sparsemem is enabled
      without vmemmap, the mem_section structures need to be initialized which
      happens in sparse_init.
      
      But kasan_early_init calls pfn_to_page way before sparse_init is called,
      which then tries to dereference a null mem_section pointer.
      
      Fix this by removing the usage of this function in kasan_early_init.
      
      Fixes: 8ad8b727 ("riscv: Add KASAN support")
      Signed-off-by: NAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      a3d32803
    • A
      riscv: Fix is_linear_mapping with recent move of KASAN region · 8b274f22
      Alexandre Ghiti 提交于
      The KASAN region was recently moved between the linear mapping and the
      kernel mapping, is_linear_mapping used to check the validity of an
      address by using the start of the kernel mapping, which is now wrong.
      
      Fix this by using the maximum size of the physical memory.
      
      Fixes: f7ae0233 ("riscv: Move KASAN mapping next to the kernel mapping")
      Signed-off-by: NAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      8b274f22
  10. 25 2月, 2022 1 次提交
    • A
      uaccess: generalize access_ok() · 12700c17
      Arnd Bergmann 提交于
      There are many different ways that access_ok() is defined across
      architectures, but in the end, they all just compare against the
      user_addr_max() value or they accept anything.
      
      Provide one definition that works for most architectures, checking
      against TASK_SIZE_MAX for user processes or skipping the check inside
      of uaccess_kernel() sections.
      
      For architectures without CONFIG_SET_FS(), this should be the fastest
      check, as it comes down to a single comparison of a pointer against a
      compile-time constant, while the architecture specific versions tend to
      do something more complex for historic reasons or get something wrong.
      
      Type checking for __user annotations is handled inconsistently across
      architectures, but this is easily simplified as well by using an inline
      function that takes a 'const void __user *' argument. A handful of
      callers need an extra __user annotation for this.
      
      Some architectures had trick to use 33-bit or 65-bit arithmetic on the
      addresses to calculate the overflow, however this simpler version uses
      fewer registers, which means it can produce better object code in the
      end despite needing a second (statically predicted) branch.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Acked-by: Mark Rutland <mark.rutland@arm.com> [arm64, asm-generic]
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: NStafford Horne <shorne@gmail.com>
      Acked-by: NDinh Nguyen <dinguyen@kernel.org>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      12700c17