1. Aug 22, 2022
    • Vivian Wang's avatar
      include: Add mstatus[h].GVA encodings · 9529e360
      Vivian Wang authored
      
      
      The machine mode GVA field is in mstatus for RV64 and mstatush for RV32,
      and is available if the hypervisor extension is available. If an
      exception occurs, we may need to redirect the trap to HS-mode, in which
      case, hstatus.GVA should be set to same as the machine mode GVA bit.
      
      Add MSTATUS_GVA for RV64, MSTATUSH_GVA for RV32, and their SHIFT
      encodings. The SHIFT index is helpful in assembly code, since field
      extraction can be implemented in only one register. In pseudocode:
      
      - For RV32: gva = (mstatus >> MSTATUS_GVA_SHIFT) & 1;
      - For RV64: gva = (mstatush >> MSTATUSH_GVA_SHIFT) & 1;
      
      Signed-off-by: default avatarVivian Wang <dramforever@live.com>
      Reviewed-by: default avatarAndrew Jones <ajones@ventanamicro.com>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      9529e360
  2. Aug 08, 2022
  3. Jul 30, 2022
  4. Jul 20, 2022
  5. Jul 11, 2022
    • Ben Dooks's avatar
      lib: sbi: add check for ipi device for hsm start · caa5eeac
      Ben Dooks authored
      
      
      If the ecall SBI_EXT_HSM_HART_START is called it might try to wake the
      secondary hart using sbi_ipi_raw_send() to send an IPI to the hart.
      This can fail if there is no IPI device but no error is returned from
      sbi_ipi_raw_send() so the ecall returns as if the action completed and
      the caller continues without noticing (in the case of Linux it just hangs
      waiting for the secondary hart to become active)
      
      Fix this by changing sbi_ipi_raw_send() to return and error, and if an
      error is returned, then return it via SBI_EXT_HSM_HART_START call.
      
      Signed-off-by: default avatarBen Dooks <ben.dooks@sifive.com>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      caa5eeac
  6. Jul 08, 2022
    • Adnan Rahman Chowdhury's avatar
      lib: sbi_timer: Added a conditional wait function which can timeout · 994c8cfb
      Adnan Rahman Chowdhury authored
      
      
      Motivation: Suppose a peripheral needs to be configured to transmit
      data. There is an SFR bit which indicates that the peripheral is ready
      to transmit. The firmware should check the bit and will only transmit
      data when the peripheral is ready. When the firmware starts polling the
      SFR, the peripheral could be busy transmitting/receiving other data so
      the firmware must wait till that completes. Assuming that there is no
      other way, the firmware shouldn't wait indefinitely.
      
      The function sbi_timer_waitms_until() will constantly check whether a
      certain condition is satisfied, or timeout occurs. It can be used for
      the cases when a timeout is required.
      
      Signed-off-by: default avatarAdnan Rahman Chowdhury <adnan.chowdhury@sifive.com>
      Reviewed-by: default avatarXiang W <wxjstz@126.com>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      994c8cfb
  7. Jun 25, 2022
    • Anup Patel's avatar
      include: Bump-up version to 1.1 · 4489876e
      Anup Patel authored
      
      
      This patch updates OpenSBI version to 1.1 as part of
      release preparation.
      
      Signed-off-by: default avatarAnup Patel <apatel@ventanamicro.com>
      4489876e
    • Sergey Matyukevich's avatar
      lib: pmu: allow to use the highest available counter · 3f66465f
      Sergey Matyukevich authored
      
      
      OpenSBI explicitly assumes that there is no pmu hardware counter with
      index 1: hardware uses that bit for TM control. So OpenSBI filters
      out that index in sanity checks. However OpenSBI also excludes that
      counter when reports total amount of hardware counters to Linux. As
      a result, Linux uses incomplete counters mask excluding the highest
      available counter.
      
      Return accurate number of counters, update the firmware counter
      starting index, fix range checks that include num_hw_ctrs.
      
      The simple test is to make sure that there is no counter multiplexing
      in the following command:
      
      $ perf stat -e \
      	r8000000000000000,r8000000000000001,r8000000000000002,r8000000000000003, \
      	r8000000000000004,r8000000000000005,r8000000000000006,r8000000000000007, \
      	r8000000000000008,r8000000000000009,r800000000000000a,r800000000000000b, \
      	r800000000000000c,r800000000000000d,r800000000000000e,r800000000000000f  \
      	ls
      
      Note that 16 firmware events with 16 counters won't require multiplexing.
      
      Signed-off-by: default avatarSergey Matyukevich <geomatsi@gmail.com>
      Signed-off-by: default avatarAtish Patra <atishp@rivosinc.com>
      Reviewed-by: default avatarAtish Patra <atishp@rivosinc.com>
      3f66465f
  8. Jun 24, 2022
  9. Jun 22, 2022
  10. Jun 21, 2022