1. 14 Sep, 2019 1 commit
  2. 14 Aug, 2019 1 commit
    • Vincent Chen's avatar
      riscv: Correct the initialized flow of FP register · 8ac71d7e
      Vincent Chen authored
      
      
        The following two reasons cause FP registers are sometimes not
      initialized before starting the user program.
      1. Currently, the FP context is initialized in flush_thread() function
         and we expect these initial values to be restored to FP register when
         doing FP context switch. However, the FP context switch only occurs in
         switch_to function. Hence, if this process does not be scheduled out
         and scheduled in before entering the user space, the FP registers
         have no chance to initialize.
      2. In flush_thread(), the state of reg->sstatus.FS inherits from the
         parent. Hence, the state of reg->sstatus.FS may be dirty. If this
         process is scheduled out during flush_thread() and initializing the
         FP register, the fstate_save() in switch_to will corrupt the FP context
         which has been initialized until flush_thread().
      
        To solve the 1st case, the initialization of the FP register will be
      completed in start_thread(). It makes sure all FP registers are initialized
      before starting the user program. For the 2nd case, the state of
      reg->sstatus.FS in start_thread will be set to SR_FS_OFF to prevent this
      process from corrupting FP context in doing context save. The FP state is
      set to SR_FS_INITIAL in start_trhead().
      
      Signed-off-by: default avatarVincent Chen <vincent.chen@sifive.com>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Fixes: 7db91e57
      
       ("RISC-V: Task implementation")
      Cc: stable@vger.kernel.org
      [paul.walmsley@sifive.com: fixed brace alignment issue reported by
       checkpatch]
      Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
      8ac71d7e
  3. 31 Jul, 2019 1 commit
    • Mao Han's avatar
      riscv: Fix perf record without libelf support · b399abe7
      Mao Han authored
      
      
      This patch fix following perf record error by linking vdso.so with
      build id.
      
      perf.data      perf.data.old
      [ perf record: Woken up 1 times to write data ]
      free(): double free detected in tcache 2
      Aborted
      
      perf record use filename__read_build_id(util/symbol-minimal.c) to get
      build id when libelf is not supported. When vdso.so is linked without
      build id, the section size of PT_NOTE will be zero, buf size will
      realloc to zero and cause memory corruption.
      
      Signed-off-by: default avatarMao Han <han_mao@c-sky.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
      b399abe7
  4. 11 Jul, 2019 1 commit
    • Atish Patra's avatar
      RISC-V: Add an Image header that boot loader can parse. · 0f327f2a
      Atish Patra authored
      
      
      Currently, the last stage boot loaders such as U-Boot can accept only
      uImage which is an unnecessary additional step in automating boot
      process.
      
      Add an image header that boot loader understands and boot Linux from
      flat Image directly.
      
      This header is based on ARM64 boot image header and provides an
      opportunity to combine both ARM64 & RISC-V image headers in future.
      
      Also make sure that PE/COFF header can co-exist in the same image so
      that EFI stub can be supported for RISC-V in future. EFI specification
      needs PE/COFF image header in the beginning of the kernel image in order
      to load it as an EFI application. In order to support EFI stub, code0
      should be replaced with "MZ" magic string and res4(at offset 0x3c)
      should point to the rest of the PE/COFF header (which will be added
      during EFI support).
      
      Tested on both QEMU and HiFive Unleashed using OpenSBI + U-Boot + Linux.
      
      Signed-off-by: default avatarAtish Patra <atish.patra@wdc.com>
      Reviewed-by: default avatarKarsten Merker <merker@debian.org>
      Tested-by: Karsten Merker <merker@debian.org> (QEMU+OpenSBI+U-Boot)
      Tested-by: Kevin Hilman <khilman@baylibre.com> (OpenSBI + U-Boot + Linux)
      [paul.walmsley@sifive.com: fixed whitespace in boot-image-header.txt;
       converted structure comment to kernel-doc format and added some detail]
      Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
      0f327f2a
  5. 09 Jul, 2019 1 commit
    • Anup Patel's avatar
      RISC-V: Setup initial page tables in two stages · 671f9a3e
      Anup Patel authored
      
      
      Currently, the setup_vm() does initial page table setup in one-shot
      very early before enabling MMU. Due to this, the setup_vm() has to map
      all possible kernel virtual addresses since it does not know size and
      location of RAM. This means we have kernel mappings for non-existent
      RAM and any buggy driver (or kernel) code doing out-of-bound access
      to RAM will not fault and cause underterministic behaviour.
      
      Further, the setup_vm() creates PMD mappings (i.e. 2M mappings) for
      RV64 systems. This means for PAGE_OFFSET=0xffffffe000000000 (i.e.
      MAXPHYSMEM_128GB=y), the setup_vm() will require 129 pages (i.e.
      516 KB) of memory for initial page tables which is never freed. The
      memory required for initial page tables will further increase if
      we chose a lower value of PAGE_OFFSET (e.g. 0xffffff0000000000)
      
      This patch implements two-staged initial page table setup, as follows:
      1. Early (i.e. setup_vm()): This stage maps kernel image and DTB in
      a early page table (i.e. early_pg_dir). The early_pg_dir will be used
      only by boot HART so it can be freed as-part of init memory free-up.
      2. Final (i.e. setup_vm_final()): This stage maps all possible RAM
      banks in the final page table (i.e. swapper_pg_dir). The boot HART
      will start using swapper_pg_dir at the end of setup_vm_final(). All
      non-boot HARTs directly use the swapper_pg_dir created by boot HART.
      
      We have following advantages with this new approach:
      1. Kernel mappings for non-existent RAM don't exists anymore.
      2. Memory consumed by initial page tables is now indpendent of the
      chosen PAGE_OFFSET.
      3. Memory consumed by initial page tables on RV64 system is 2 pages
      (i.e. 8 KB) which has significantly reduced and these pages will be
      freed as-part of the init memory free-up.
      
      The patch also provides a foundation for implementing strict kernel
      mappings where we protect kernel text and rodata using PTE permissions.
      
      Suggested-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Signed-off-by: default avatarAnup Patel <anup.patel@wdc.com>
      [paul.walmsley@sifive.com: updated to apply; fixed a checkpatch warning]
      Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
      671f9a3e
  6. 01 Jul, 2019 1 commit
  7. 19 Jun, 2019 2 commits
  8. 11 Jun, 2019 1 commit
    • Andreas Schwab's avatar
      riscv: export pm_power_off again · 40594558
      Andreas Schwab authored
      Commit bf0102a0
      
       ("riscv: call pm_power_off from machine_halt /
      machine_power_off") removed the export of pm_power_off, but it is used by
      several modules:
      
          ERROR: "pm_power_off" [drivers/mfd/rk808.ko] undefined!
          ERROR: "pm_power_off" [drivers/mfd/max8907.ko] undefined!
          ERROR: "pm_power_off" [drivers/mfd/axp20x.ko] undefined!
          ERROR: "pm_power_off" [drivers/char/ipmi/ipmi_poweroff.ko] undefined!
      
      Signed-off-by: default avatarAndreas Schwab <schwab@suse.de>
      Fixes: bf0102a0
      
       ("riscv: call pm_power_off from machine_halt / machine_power_off")
      Signed-off-by: default avatarPaul Walmsley <paul.walmsley@sifive.com>
      40594558
  9. 05 Jun, 2019 1 commit
  10. 30 May, 2019 2 commits
    • Thomas Gleixner's avatar
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 · 1802d0be
      Thomas Gleixner authored
      
      
      Based on 1 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license version 2 as
        published by the free software foundation this program is
        distributed in the hope that it will be useful but without any
        warranty without even the implied warranty of merchantability or
        fitness for a particular purpose see the gnu general public license
        for more details
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-only
      
      has been chosen to replace the boilerplate/reference in 655 file(s).
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarAllison Randal <allison@lohutok.net>
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarRichard Fontana <rfontana@redhat.com>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1802d0be
    • Thomas Gleixner's avatar
      treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 · c942fddf
      Thomas Gleixner authored
      
      
      Based on 3 normalized pattern(s):
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version this program is distributed in the
        hope that it will be useful but without any warranty without even
        the implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [kishon] [vijay] [abraham]
        [i] [kishon]@[ti] [com] this program is distributed in the hope that
        it will be useful but without any warranty without even the implied
        warranty of merchantability or fitness for a particular purpose see
        the gnu general public license for more details
      
        this program is free software you can redistribute it and or modify
        it under the terms of the gnu general public license as published by
        the free software foundation either version 2 of the license or at
        your option any later version [author] [graeme] [gregory]
        [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
        [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
        [hk] [hemahk]@[ti] [com] this program is distributed in the hope
        that it will be useful but without any warranty without even the
        implied warranty of merchantability or fitness for a particular
        purpose see the gnu general public license for more details
      
      extracted by the scancode license scanner the SPDX license identifier
      
        GPL-2.0-or-later
      
      has been chosen to replace the boilerplate/reference in 1105 file(s).
      
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: default avatarAllison Randal <allison@lohutok.net>
      Reviewed-by: default avatarRichard Fontana <rfontana@redhat.com>
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Cc: linux-spdx@vger.kernel.org
      Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c942fddf
  11. 29 May, 2019 3 commits
  12. 27 May, 2019 1 commit
  13. 24 May, 2019 1 commit
  14. 21 May, 2019 1 commit
  15. 17 May, 2019 8 commits
  16. 30 Apr, 2019 2 commits
  17. 29 Apr, 2019 1 commit
  18. 25 Apr, 2019 8 commits
  19. 14 Apr, 2019 1 commit
  20. 29 Mar, 2019 1 commit
  21. 27 Mar, 2019 1 commit