1. 27 10月, 2021 1 次提交
  2. 04 9月, 2021 1 次提交
  3. 25 8月, 2021 1 次提交
  4. 14 8月, 2021 2 次提交
  5. 12 8月, 2021 6 次提交
  6. 07 8月, 2021 1 次提交
  7. 23 7月, 2021 3 次提交
  8. 22 7月, 2021 1 次提交
  9. 06 7月, 2021 1 次提交
  10. 01 7月, 2021 1 次提交
  11. 15 6月, 2021 1 次提交
  12. 12 6月, 2021 1 次提交
  13. 09 6月, 2021 1 次提交
  14. 02 6月, 2021 1 次提交
    • J
      riscv: mm: Fix W+X mappings at boot · 8a4102a0
      Jisheng Zhang 提交于
      When the kernel mapping was moved the last 2GB of the address space,
      (__va(PFN_PHYS(max_low_pfn))) is much smaller than the .data section
      start address, the last set_memory_nx() in protect_kernel_text_data()
      will fail, thus the .data section is still mapped as W+X. This results
      in below W+X mapping waring at boot. Fix it by passing the correct
      .data section page num to the set_memory_nx().
      
      [    0.396516] ------------[ cut here ]------------
      [    0.396889] riscv/mm: Found insecure W+X mapping at address (____ptrval____)/0xffffffff80c00000
      [    0.398347] WARNING: CPU: 0 PID: 1 at arch/riscv/mm/ptdump.c:258 note_page+0x244/0x24a
      [    0.398964] Modules linked in:
      [    0.399459] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.13.0-rc1+ #14
      [    0.400003] Hardware name: riscv-virtio,qemu (DT)
      [    0.400591] epc : note_page+0x244/0x24a
      [    0.401368]  ra : note_page+0x244/0x24a
      [    0.401772] epc : ffffffff80007c86 ra : ffffffff80007c86 sp : ffffffe000e7bc30
      [    0.402304]  gp : ffffffff80caae88 tp : ffffffe000e70000 t0 : ffffffff80cb80cf
      [    0.402800]  t1 : ffffffff80cb80c0 t2 : 0000000000000000 s0 : ffffffe000e7bc80
      [    0.403310]  s1 : ffffffe000e7bde8 a0 : 0000000000000053 a1 : ffffffff80c83ff0
      [    0.403805]  a2 : 0000000000000010 a3 : 0000000000000000 a4 : 6c7e7a5137233100
      [    0.404298]  a5 : 6c7e7a5137233100 a6 : 0000000000000030 a7 : ffffffffffffffff
      [    0.404849]  s2 : ffffffff80e00000 s3 : 0000000040000000 s4 : 0000000000000000
      [    0.405393]  s5 : 0000000000000000 s6 : 0000000000000003 s7 : ffffffe000e7bd48
      [    0.405935]  s8 : ffffffff81000000 s9 : ffffffffc0000000 s10: ffffffe000e7bd48
      [    0.406476]  s11: 0000000000001000 t3 : 0000000000000072 t4 : ffffffffffffffff
      [    0.407016]  t5 : 0000000000000002 t6 : ffffffe000e7b978
      [    0.407435] status: 0000000000000120 badaddr: 0000000000000000 cause: 0000000000000003
      [    0.408052] Call Trace:
      [    0.408343] [<ffffffff80007c86>] note_page+0x244/0x24a
      [    0.408855] [<ffffffff8010c5a6>] ptdump_hole+0x14/0x1e
      [    0.409263] [<ffffffff800f65c6>] walk_pgd_range+0x2a0/0x376
      [    0.409690] [<ffffffff800f6828>] walk_page_range_novma+0x4e/0x6e
      [    0.410146] [<ffffffff8010c5f8>] ptdump_walk_pgd+0x48/0x78
      [    0.410570] [<ffffffff80007d66>] ptdump_check_wx+0xb4/0xf8
      [    0.410990] [<ffffffff80006738>] mark_rodata_ro+0x26/0x2e
      [    0.411407] [<ffffffff8031961e>] kernel_init+0x44/0x108
      [    0.411814] [<ffffffff80002312>] ret_from_exception+0x0/0xc
      [    0.412309] ---[ end trace 7ec3459f2547ea83 ]---
      [    0.413141] Checked W+X mappings: failed, 512 W+X pages found
      
      Fixes: 2bfc6cd8 ("riscv: Move kernel mapping outside of linear mapping")
      Signed-off-by: NJisheng Zhang <jszhang@kernel.org>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      8a4102a0
  15. 30 5月, 2021 1 次提交
  16. 26 5月, 2021 3 次提交
  17. 07 5月, 2021 2 次提交
  18. 01 5月, 2021 1 次提交
  19. 26 4月, 2021 7 次提交
    • V
      RISC-V: enable XIP · 44c92257
      Vitaly Wool 提交于
      Introduce XIP (eXecute In Place) support for RISC-V platforms.
      It allows code to be executed directly from non-volatile storage
      directly addressable by the CPU, such as QSPI NOR flash which can
      be found on many RISC-V platforms. This makes way for significant
      optimization of RAM footprint. The XIP kernel is not compressed
      since it has to run directly from flash, so it will occupy more
      space on the non-volatile storage. The physical flash address used
      to link the kernel object files and for storing it has to be known
      at compile time and is represented by a Kconfig option.
      
      XIP on RISC-V will for the time being only work on MMU-enabled
      kernels.
      Signed-off-by: NVitaly Wool <vitaly.wool@konsulko.com>
      [Alex: Rebase on top of "Move kernel mapping outside the linear mapping" ]
      Signed-off-by: NAlexandre Ghiti <alex@ghiti.fr>
      [Palmer: disable XIP for allyesconfig]
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      44c92257
    • N
      RISC-V: Add crash kernel support · 56409750
      Nick Kossifidis 提交于
      This patch allows Linux to act as a crash kernel for use with
      kdump. Userspace will let the crash kernel know about the
      memory region it can use through linux,usable-memory property
      on the /memory node (overriding its reg property), and about the
      memory region where the elf core header of the previous kernel
      is saved, through a reserved-memory node with a compatible string
      of "linux,elfcorehdr". This approach is the least invasive and
      re-uses functionality already present.
      
      I tested this on riscv64 qemu and it works as expected, you
      may test it by retrieving the dmesg of the previous kernel
      through /proc/vmcore, using the vmcore-dmesg utility from
      kexec-tools.
      Signed-off-by: NNick Kossifidis <mick@ics.forth.gr>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      56409750
    • N
      RISC-V: Add kdump support · e53d2818
      Nick Kossifidis 提交于
      This patch adds support for kdump, the kernel will reserve a
      region for the crash kernel and jump there on panic. In order
      for userspace tools (kexec-tools) to prepare the crash kernel
      kexec image, we also need to expose some information on
      /proc/iomem for the memory regions used by the kernel and for
      the region reserved for crash kernel. Note that on userspace
      the device tree is used to determine the system's memory
      layout so the "System RAM" on /proc/iomem is ignored.
      
      I tested this on riscv64 qemu and works as expected, you may
      test it by triggering a crash through /proc/sysrq_trigger:
      
      echo c > /proc/sysrq_trigger
      Signed-off-by: NNick Kossifidis <mick@ics.forth.gr>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      e53d2818
    • Z
      riscv/mm: Use BUG_ON instead of if condition followed by BUG. · e75e6bf4
      zhouchuangao 提交于
      BUG_ON() uses unlikely in if(), which can be optimized at compile time.
      Signed-off-by: Nzhouchuangao <zhouchuangao@vivo.com>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      e75e6bf4
    • J
      riscv: Mark some global variables __ro_after_init · de31ea4a
      Jisheng Zhang 提交于
      All of these are never modified after init, so they can be
      __ro_after_init.
      Signed-off-by: NJisheng Zhang <jszhang@kernel.org>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      de31ea4a
    • J
      riscv: add __init section marker to some functions · 1987501b
      Jisheng Zhang 提交于
      They are not needed after booting, so mark them as __init to move them
      to the __init section.
      Signed-off-by: NJisheng Zhang <jszhang@kernel.org>
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      1987501b
    • A
      riscv: Move kernel mapping outside of linear mapping · 2bfc6cd8
      Alexandre Ghiti 提交于
      This is a preparatory patch for relocatable kernel and sv48 support.
      
      The kernel used to be linked at PAGE_OFFSET address therefore we could use
      the linear mapping for the kernel mapping. But the relocated kernel base
      address will be different from PAGE_OFFSET and since in the linear mapping,
      two different virtual addresses cannot point to the same physical address,
      the kernel mapping needs to lie outside the linear mapping so that we don't
      have to copy it at the same physical offset.
      
      The kernel mapping is moved to the last 2GB of the address space, BPF
      is now always after the kernel and modules use the 2GB memory range right
      before the kernel, so BPF and modules regions do not overlap. KASLR
      implementation will simply have to move the kernel in the last 2GB range
      and just take care of leaving enough space for BPF.
      
      In addition, by moving the kernel to the end of the address space, both
      sv39 and sv48 kernels will be exactly the same without needing to be
      relocated at runtime.
      Suggested-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAlexandre Ghiti <alex@ghiti.fr>
      [Palmer: Squash the STRICT_RWX fix, and a !MMU fix]
      Signed-off-by: NPalmer Dabbelt <palmerdabbelt@google.com>
      2bfc6cd8
  20. 10 3月, 2021 1 次提交
  21. 27 2月, 2021 1 次提交
  22. 23 2月, 2021 1 次提交
  23. 19 2月, 2021 1 次提交