17 Mar, 2020

7 commits

  • Few v0.1 SBI calls are being replaced by new SBI calls that follows
    v0.2 calling convention.

    Implement the replacement extensions and few additional new SBI
    function calls that makes way for a better SBI interface in future.

    Signed-off-by: Bin Meng
    Reviewed-by: Pragnesh Patel

    Bin Meng
     
  • We now have SBI v0.2 which is more scalable and extendable to handle
    future needs for RISC-V supervisor interfaces.

    Introduce a new config and move all SBI v0.1 code under that config.
    This allows to implement the new replacement SBI extensions cleanly
    and remove v0.1 extensions easily in future. Currently, the config
    is enabled by default. Once all M-mode software, with v0.1, is no
    longer in use, this config option and all relevant code can be easily
    removed.

    This commit is inspired from Linux kernel patch:
    https://patchwork.kernel.org/patch/11407361/

    Signed-off-by: Bin Meng
    Reviewed-by: Pragnesh Patel

    Bin Meng
     
  • Few v0.1 SBI calls are being replaced by new SBI calls that follows
    v0.2 calling convention.

    This patch just defines these new extensions.

    This commit is inspired from Linux kernel patch:
    https://patchwork.kernel.org/patch/11407359/

    Signed-off-by: Bin Meng
    Reviewed-by: Pragnesh Patel

    Bin Meng
     
  • The SBI v0.2 introduces a base extension which is backward compatible
    with v0.1. Implement all helper functions and minimum required SBI
    calls from v0.2 for now. All other base extension function will be
    added later as per need.

    As v0.2 calling convention is backward compatible with v0.1, remove
    the v0.1 helper functions and just use v0.2 calling convention.

    Add a new Kconfig options CONFIG_SBI for the new SBI v0.2 codes, and
    let CONFIG_SBI_IPI depend on it.

    This commit is inspired from Linux kernel patch:
    https://patchwork.kernel.org/patch/11407363/

    Signed-off-by: Bin Meng
    Reviewed-by: Pragnesh Patel

    Bin Meng
     
  • As per the new SBI specification, current SBI implementation version
    is defined as 0.1 and will be removed/replaced in future. Each of the
    function call in 0.1 is defined as a separate extension which makes
    easier to replace them one at a time.

    Rename existing implementation to reflect that. This patch is just
    a preparatory patch for SBI v0.2 and doesn't introduce any functional
    changes.

    This commit is inspired from Linux kernel patch:
    https://patchwork.kernel.org/patch/11407355/

    Signed-off-by: Bin Meng
    Reviewed-by: Pragnesh Patel

    Bin Meng
     
  • There is no need for S-mode U-Boot to call sbi_clear_ipi() as it
    can be cleared directly from S-mode. This saves some cycles.

    Signed-off-by: Bin Meng
    Reviewed-by: Lukas Auer

    Bin Meng
     
  • Currently sbi_remote_sfence_vma{,_asid} does not pass their arguments
    to SBI at all, which is semantically incorrect.

    This keeps in sync with Linux kernel commit:
    a21344dfc6ad: fix sbi_remote_sfence_vma{,_asid}

    Signed-off-by: Bin Meng
    Reviewed-by: Lukas Auer

    Bin Meng
     

19 Feb, 2020

3 commits


11 Feb, 2020

1 commit


10 Feb, 2020

3 commits

  • The add instruction on risc-v can have any three sources and targets, so there
    is no need for an intermediate mov.

    Signed-off-by: Sean Anderson
    Reviewed-by: Rick Chen
    Reviewed-by: Bin Meng

    Sean Anderson
     
  • When debugging, it can be helpful to see more information about an
    unhandled exception. This patch adds an option to view the registers at
    the time of the trap, similar to the linux output on a kernel panic.

    Signed-off-by: Sean Anderson
    Reviewed-by: Rick Chen
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng

    Sean Anderson
     
  • Due to the two-instruction sequence needed to access arbitrary memory
    locations, the RISC-V linker aggressively optimises memory accesses and
    jumps at link-time. This is called "linker relaxation," and is discussed
    in this SiFive article
    .
    One of the optimizations in place is to assume that the __global_pointer
    symbol is placed in the gp register. To quote the article:

    "...The magic __global_pointer$ symbol is defined to point 0x800 bytes
    past the start of the .sdata section. The 0x800 magic number allows
    signed 12-bit offsets from __global_pointer$ to address symbols at the
    start of the .sdata section. The linker assumes that if this symbol is
    defined, then the gp register contains that value, which it can then use
    to relax accesses to global symbols within that 12-bit range. The
    compiler treats the gp register as a constant so it doesn't need to be
    saved or restored, which means it is generally only written by _start,
    the ELF entry point."

    However, U-Boot instead keeps the global data pointer in gp. This causes
    memory accesses and jumps optimized to use the gp pointer to fail. To
    fix this problem, we undefine the __global_pointer symbol.

    Signed-off-by: Sean Anderson
    Reviewed-by: Bin Meng
    Reviewed-by: Rick Chen

    Sean Anderson
     

06 Feb, 2020

1 commit

  • At present devres.h is included in all files that include dm.h but few
    make use of it. Also this pulls in linux/compat which adds several more
    headers. Drop the automatic inclusion and require files to include devres
    themselves. This provides a good indication of which files use devres.

    Signed-off-by: Simon Glass
    Reviewed-by: Anatolij Gustschin

    Simon Glass
     

26 Jan, 2020

1 commit

  • Subsystems such as USB expect dma_map_single() and dma_unmap_single() to
    do dcache flush/invalidate operations as required. For example, see
    see drivers/usb/gadget/udc/udc-core.c::usb_gadget_map_request().
    Currently drivers do this locally, (see drivers/usb/dwc3/ep0.c,
    drivers/mtd/nand/raw/denali.c etc..)
    Update arch specific dma_map_single() and dma_unmap_single() APIs to do
    cache flush/invalidate operations, so that drivers need not implement
    them locally.

    Signed-off-by: Vignesh Raghavendra
    Reviewed-by: Masahiro Yamada
    Reviewed-by: Rick Chen

    Vignesh Raghavendra
     

18 Jan, 2020

3 commits


10 Dec, 2019

10 commits

  • Add a wait option to smp_call_function() to wait for the secondary harts
    to acknowledge the call-function request. The request is considered to
    be acknowledged once each secondary hart has cleared the corresponding
    IPI.

    As part of the call-function request, the secondary harts invalidate the
    instruction cache after clearing the IPI. This adds a delay between
    acknowledgment (clear IPI) and fulfillment (call function) of the
    request. We want to use the acknowledgment to be able to judge when the
    request has been completed. Remove the delay by clearing the IPI after
    cache invalidation and just before calling the function from the
    request.

    Signed-off-by: Lukas Auer
    Reviewed-by: Rick Chen
    Tested-by: Rick Chen
    Reviewed-by: Anup Patel

    Lukas Auer
     
  • Add the function riscv_get_ipi() for reading the pending status of IPIs.
    The supported controllers are Andes' Platform Level Interrupt Controller
    (PLIC), the Supervisor Binary Interface (SBI), and SiFive's Core Local
    Interruptor (CLINT).

    Signed-off-by: Lukas Auer
    Reviewed-by: Rick Chen

    Lukas Auer
     
  • Those are required for cfi-flash driver to get correct address information.
    Also modify size description correctly.

    Signed-off-by: Rick Chen
    Cc: KC Lin
    Cc: Alan Kao

    Rick Chen
     
  • Add CPU2 and CPU3 information in cpus node
    to support four cores SMP booting.

    Signed-off-by: Rick Chen
    Cc: KC Lin
    Cc: Alan Kao

    Rick Chen
     
  • For RV64, it will use sd instruction to clear t0
    register, and the increament will be 8 bytes. So
    if the difference between__bss_strat and __bss_end
    was not 8 bytes aligned, the clear bss loop will
    overflow and acks like system hang.

    Signed-off-by: Rick Chen
    Cc: KC Lin
    Cc: Alan Kao

    Rick Chen
     
  • The mcache_ctl csr only can be manipulated in M mode.
    Add SPL_RISCV_MMODE for U-Boot SPL to control cache
    operation.

    Signed-off-by: Rick Chen
    Cc: KC Lin
    Cc: Alan Kao

    Rick Chen
     
  • Fix two wrong settings of andes plic driver as below:

    1. Fix wrong pending register base definition.
    2. Declaring the en variable in enable_ipi() as unsigned int instead of
    int can help to fix wrong plic enabling setting in RV64.

    Signed-off-by: Rick Chen
    Cc: KC Lin
    Cc: Alan Kao

    Rick Chen
     
  • The U-Boot SPL will boot in M mode and load the FIT image which
    include OpenSBI and U-Boot proper images. After loading progress,
    it will jump to OpenSBI first and then U-Boot proper which will
    run in S mode.

    Also remove V5L2_CACHE due to U-Boot SPL code size consideration.
    Without this concern, it can be enable manually for performance.

    Signed-off-by: Rick Chen
    Cc: KC Lin
    Cc: Alan Kao

    Rick Chen
     
  • Sync the hifive-unleashed-a00 dts from Linux with
    below commit details:

    commit ("riscv: dts: HiFive
    Unleashed: add default chosen/stdout-path")

    Idea is to periodically sync the dts from Linux instead of
    tweaking internal changes one after another, so better not
    add any intermediate changes in between. This would help to
    maintain the dts files easy and meaningful since we are
    reusing device tree files from Linux.

    Signed-off-by: Jagan Teki
    Reviewed-by: Bin Meng
    Reviewed-by: Anup Patel

    Jagan Teki
     
  • This fixes a problem, where booting Linux using distro boot will
    sometimes lead to an invalid instruction exception on the main hart. The
    secondary harts are not affected and boot Linux successfully. The root
    cause of this problem is a stack overflow on the main hart.

    With distro boot, the current default stack size of 8KiB on RISC-V is
    not sufficient and will cause a stack overflow. The stacks are allocated
    sequentially. In the case of a stack overflow the stack of the main hart
    can reach into that of another hart and be corrupted.

    The stack overflow previously did not cause any problems, because only
    stack frames, which are not used anymore since the hart enters Linux,
    were corrupted. Starting with GCC 9, the stack usage has decreased. Now,
    only the most recent stack frame overflows into the stack of a secondary
    hart and is corrupted. The illegal instruction exception is caused by
    the secondary hart overwriting the return address in the stack frame of
    the main hart with an address that does not include valid code.

    Increase the default stack size of each hart to 16KiB to avoid this
    problem.

    Reported-by: Aurelien Jarno
    Signed-off-by: Lukas Auer
    Tested-by: David Abdurachmanov
    Tested-by: Aurelien Jarno
    Reviewed-by: Rick Chen

    Lukas Auer
     

03 Dec, 2019

5 commits


18 Oct, 2019

2 commits

  • The released Linux boot image header in v5.3 is different from the
    one present in U-Boot. Align the header with the new version. The
    changes in Linux are backward compatible. Previous U-Boot releases
    with older header will continue to work as well. As v5.3 kernel is
    the first one to support image header, there is no compatibility
    issue between new U-Boot (with this patch) and older kernel.

    Signed-off-by: Atish Patra
    Reviewed-by: Rick Chen

    Atish Patra
     
  • This patch adds a DM based driver model for gpio controller present in
    FU540-C000 SoC on HiFive Unleashed A00 board. This SoC has one GPIO
    bank and 16 GPIO lines in total, out of which GPIO0 to GPIO9 and
    GPIO15 are routed to the J1 header on the board.

    This implementation is ported from linux based gpio driver submitted
    for review by Wesley W. Terpstra and/or Atish Patra
    (many thanks !!). The linux driver can be referred
    here [1]

    [1]: https://lkml.org/lkml/2018/10/9/1103

    Signed-off-by: Sagar Shrikant Kadam
    Reviewed-by: Bin Meng

    Sagar Shrikant Kadam
     

03 Sep, 2019

4 commits