1. 18 7月, 2022 1 次提交
    • A
      riscv/mm: enable ARCH_HAS_VM_GET_PAGE_PROT · 4147b5e2
      Anshuman Khandual 提交于
      This enables ARCH_HAS_VM_GET_PAGE_PROT on the platform and exports
      standard vm_get_page_prot() implementation via DECLARE_VM_GET_PAGE_PROT,
      which looks up a private and static protection_map[] array.  Subsequently
      all __SXXX and __PXXX macros can be dropped which are no longer needed.
      
      Link: https://lkml.kernel.org/r/20220711070600.2378316-17-anshuman.khandual@arm.comSigned-off-by: NAnshuman Khandual <anshuman.khandual@arm.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Brian Cain <bcain@quicinc.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dinh Nguyen <dinguyen@kernel.org>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Guo Ren <guoren@kernel.org>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Vineet Gupta <vgupta@kernel.org>
      Cc: WANG Xuerui <kernel@xen0n.name>
      Cc: Will Deacon <will@kernel.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      4147b5e2
  2. 17 6月, 2022 1 次提交
  3. 02 6月, 2022 1 次提交
  4. 20 5月, 2022 2 次提交
  5. 18 5月, 2022 1 次提交
  6. 13 5月, 2022 1 次提交
  7. 12 5月, 2022 4 次提交
  8. 08 5月, 2022 1 次提交
  9. 31 3月, 2022 1 次提交
  10. 23 3月, 2022 2 次提交
  11. 22 3月, 2022 1 次提交
  12. 11 3月, 2022 1 次提交
  13. 15 2月, 2022 1 次提交
  14. 21 1月, 2022 2 次提交
  15. 20 1月, 2022 5 次提交
    • K
      mm: percpu: generalize percpu related config · 7ecd19cf
      Kefeng Wang 提交于
      Patch series "mm: percpu: Cleanup percpu first chunk function".
      
      When supporting page mapping percpu first chunk allocator on arm64, we
      found there are lots of duplicated codes in percpu embed/page first chunk
      allocator.  This patchset is aimed to cleanup them and should no function
      change.
      
      The currently supported status about 'embed' and 'page' in Archs shows
      below,
      
      	embed: NEED_PER_CPU_PAGE_FIRST_CHUNK
      	page:  NEED_PER_CPU_EMBED_FIRST_CHUNK
      
      		embed	page
      	------------------------
      	arm64	  Y	 Y
      	mips	  Y	 N
      	powerpc	  Y	 Y
      	riscv	  Y	 N
      	sparc	  Y	 Y
      	x86	  Y	 Y
      	------------------------
      
      There are two interfaces about percpu first chunk allocator,
      
       extern int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
                                      size_t atom_size,
                                      pcpu_fc_cpu_distance_fn_t cpu_distance_fn,
      -                               pcpu_fc_alloc_fn_t alloc_fn,
      -                               pcpu_fc_free_fn_t free_fn);
      +                               pcpu_fc_cpu_to_node_fn_t cpu_to_nd_fn);
      
       extern int __init pcpu_page_first_chunk(size_t reserved_size,
      -                               pcpu_fc_alloc_fn_t alloc_fn,
      -                               pcpu_fc_free_fn_t free_fn,
      -                               pcpu_fc_populate_pte_fn_t populate_pte_fn);
      +                               pcpu_fc_cpu_to_node_fn_t cpu_to_nd_fn);
      
      The pcpu_fc_alloc_fn_t/pcpu_fc_free_fn_t is killed, we provide generic
      pcpu_fc_alloc() and pcpu_fc_free() function, which are called in the
      pcpu_embed/page_first_chunk().
      
      1) For pcpu_embed_first_chunk(), pcpu_fc_cpu_to_node_fn_t is needed to be
         provided when archs supported NUMA.
      
      2) For pcpu_page_first_chunk(), the pcpu_fc_populate_pte_fn_t is killed too,
         a generic pcpu_populate_pte() which marked '__weak' is provided, if you
         need a different function to populate pte on the arch(like x86), please
         provide its own implementation.
      
      [1] https://github.com/kevin78/linux.git percpu-cleanup
      
      This patch (of 4):
      
      The HAVE_SETUP_PER_CPU_AREA/NEED_PER_CPU_EMBED_FIRST_CHUNK/
      NEED_PER_CPU_PAGE_FIRST_CHUNK/USE_PERCPU_NUMA_NODE_ID configs, which have
      duplicate definitions on platforms that subscribe it.
      
      Move them into mm, drop these redundant definitions and instead just
      select it on applicable platforms.
      
      Link: https://lkml.kernel.org/r/20211216112359.103822-1-wangkefeng.wang@huawei.com
      Link: https://lkml.kernel.org/r/20211216112359.103822-2-wangkefeng.wang@huawei.comSigned-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
      Acked-by: Catalin Marinas <catalin.marinas@arm.com>	[arm64]
      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: "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: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Dennis Zhou <dennis@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Tejun Heo <tj@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7ecd19cf
    • A
      riscv: Implement sv48 support · e8a62cc2
      Alexandre Ghiti 提交于
      By adding a new 4th level of page table, give the possibility to 64bit
      kernel to address 2^48 bytes of virtual address: in practice, that offers
      128TB of virtual address space to userspace and allows up to 64TB of
      physical memory.
      
      If the underlying hardware does not support sv48, we will automatically
      fallback to a standard 3-level page table by folding the new PUD level into
      PGDIR level. In order to detect HW capabilities at runtime, we
      use SATP feature that ignores writes with an unsupported mode.
      Signed-off-by: NAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      e8a62cc2
    • A
      riscv: Allow to dynamically define VA_BITS · 3270bfdb
      Alexandre Ghiti 提交于
      With 4-level page table folding at runtime, we don't know at compile time
      the size of the virtual address space so we must set VA_BITS dynamically
      so that sparsemem reserves the right amount of memory for struct pages.
      Signed-off-by: NAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      3270bfdb
    • A
      riscv: Move KASAN mapping next to the kernel mapping · f7ae0233
      Alexandre Ghiti 提交于
      Now that KASAN_SHADOW_OFFSET is defined at compile time as a config,
      this value must remain constant whatever the size of the virtual address
      space, which is only possible by pushing this region at the end of the
      address space next to the kernel mapping.
      Signed-off-by: NAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      f7ae0233
    • A
      riscv: Get rid of MAXPHYSMEM configs · db1503d3
      Alexandre Ghiti 提交于
      CONFIG_MAXPHYSMEM_* are actually never used, even the nommu defconfigs
      selecting the MAXPHYSMEM_2GB had no effects on PAGE_OFFSET since it was
      preempted by !MMU case right before.
      
      In addition, the move of the kernel mapping at the end of the address
      space broke the use of MAXPHYSMEM_2G with MMU since it defines PAGE_OFFSET
      at the same address as the kernel mapping.
      Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Fixes: 2bfc6cd8 ("riscv: Move kernel mapping outside of linear mapping")
      Signed-off-by: NAlexandre Ghiti <alexandre.ghiti@canonical.com>
      Tested-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Tested-by: NConor Dooley <Conor.Dooley@microchip.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPalmer Dabbelt <palmer@rivosinc.com>
      db1503d3
  16. 08 1月, 2022 1 次提交
  17. 06 1月, 2022 2 次提交
  18. 25 11月, 2021 1 次提交
  19. 29 10月, 2021 1 次提交
  20. 26 10月, 2021 2 次提交
    • M
      irq: remove handle_domain_{irq,nmi}() · 0953fb26
      Mark Rutland 提交于
      Now that entry code handles IRQ entry (including setting the IRQ regs)
      before calling irqchip code, irqchip code can safely call
      generic_handle_domain_irq(), and there's no functional reason for it to
      call handle_domain_irq().
      
      Let's cement this split of responsibility and remove handle_domain_irq()
      entirely, updating irqchip drivers to call generic_handle_domain_irq().
      
      For consistency, handle_domain_nmi() is similarly removed and replaced
      with a generic_handle_domain_nmi() function which also does not perform
      any entry logic.
      
      Previously handle_domain_{irq,nmi}() had a WARN_ON() which would fire
      when they were called in an inappropriate context. So that we can
      identify similar issues going forward, similar WARN_ON_ONCE() logic is
      added to the generic_handle_*() functions, and comments are updated for
      clarity and consistency.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      0953fb26
    • M
      irq: riscv: perform irqentry in entry code · 7ecbc648
      Mark Rutland 提交于
      In preparation for removing HANDLE_DOMAIN_IRQ_IRQENTRY, have arch/riscv
      perform all the irqentry accounting in its entry code. As arch/riscv
      uses GENERIC_IRQ_MULTI_HANDLER, we can use generic_handle_arch_irq() to
      do so.
      
      Since generic_handle_arch_irq() handles the irq entry and setting the
      irq regs, and happens before the irqchip code calls handle_IPI(), we can
      remove the redundant irq entry and irq regs manipulation from
      handle_IPI().
      
      There should be no functional change as a result of this patch.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Reviewed-by: NGuo Ren <guoren@kernel.org>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      7ecbc648
  21. 25 10月, 2021 1 次提交
    • M
      irq: add a (temporary) CONFIG_HANDLE_DOMAIN_IRQ_IRQENTRY · 2fe35f8e
      Mark Rutland 提交于
      Going forward we want architecture/entry code to perform all the
      necessary work to enter/exit IRQ context, with irqchip code merely
      handling the mapping of the interrupt to any handler(s). Among other
      reasons, this is necessary to consistently fix some longstanding issues
      with the ordering of lockdep/RCU/tracing instrumentation which many
      architectures get wrong today in their entry code.
      
      Importantly, rcu_irq_{enter,exit}() must be called precisely once per
      IRQ exception, so that rcu_is_cpu_rrupt_from_idle() can correctly
      identify when an interrupt was taken from an idle context which must be
      explicitly preempted. Currently handle_domain_irq() calls
      rcu_irq_{enter,exit}() via irq_{enter,exit}(), but entry code needs to
      be able to call rcu_irq_{enter,exit}() earlier for correct ordering
      across lockdep/RCU/tracing updates for sequences such as:
      
        lockdep_hardirqs_off(CALLER_ADDR0);
        rcu_irq_enter();
        trace_hardirqs_off_finish();
      
      To permit each architecture to be converted to the new style in turn,
      this patch adds a new CONFIG_HANDLE_DOMAIN_IRQ_IRQENTRY selected by all
      current users of HANDLE_DOMAIN_IRQ, which gates the existing behaviour.
      When CONFIG_HANDLE_DOMAIN_IRQ_IRQENTRY is not selected,
      handle_domain_irq() requires entry code to perform the
      irq_{enter,exit}() work, with an explicit check for this matching the
      style of handle_domain_nmi().
      
      Subsequent patches will:
      
      1) Add the necessary IRQ entry accounting to each architecture in turn,
         dropping CONFIG_HANDLE_DOMAIN_IRQ_IRQENTRY from that architecture's
         Kconfig.
      
      2) Remove CONFIG_HANDLE_DOMAIN_IRQ_IRQENTRY once it is no longer
         selected.
      
      3) Convert irqchip drivers to consistently use
         generic_handle_domain_irq() rather than handle_domain_irq().
      
      4) Remove handle_domain_irq() and CONFIG_HANDLE_DOMAIN_IRQ.
      
      ... which should leave us with a clear split of responsiblity across the
      entry and irqchip code, making it possible to perform additional
      cleanups and fixes for the aforementioned longstanding issues with entry
      code.
      
      There should be no functional change as a result of this patch.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Reviewed-by: NMarc Zyngier <maz@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      2fe35f8e
  22. 07 10月, 2021 1 次提交
  23. 05 10月, 2021 1 次提交
    • T
      riscv/vdso: Add support for time namespaces · dffe11e2
      Tong Tiangen 提交于
      Implement generic vdso time namespace support which also enables time
      namespaces for riscv. This is quite similar to what arm64 does.
      
      selftest/timens test result:
        1..10
        ok 1 Passed for CLOCK_BOOTTIME (syscall)
        ok 2 Passed for CLOCK_BOOTTIME (vdso)
        ok 3 # SKIP CLOCK_BOOTTIME_ALARM isn't supported
        ok 4 # SKIP CLOCK_BOOTTIME_ALARM isn't supported
        ok 5 Passed for CLOCK_MONOTONIC (syscall)
        ok 6 Passed for CLOCK_MONOTONIC (vdso)
        ok 7 Passed for CLOCK_MONOTONIC_COARSE (syscall)
        ok 8 Passed for CLOCK_MONOTONIC_COARSE (vdso)
        ok 9 Passed for CLOCK_MONOTONIC_RAW (syscall)
        ok 10 Passed for CLOCK_MONOTONIC_RAW (vdso)
        # Totals: pass:8 fail:0 xfail:0 xpass:0 skip:2 error:0
      Signed-off-by: NTong Tiangen <tongtiangen@huawei.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      dffe11e2
  24. 04 10月, 2021 1 次提交
  25. 14 9月, 2021 1 次提交
  26. 11 9月, 2021 1 次提交
  27. 09 9月, 2021 1 次提交
  28. 27 8月, 2021 1 次提交