1. Feb 08, 2023
  2. Jan 27, 2023
  3. Jan 24, 2023
    • Samuel Holland's avatar
      platform: generic: allwinner: Advertise nonretentive suspend · c45992cc
      Samuel Holland authored
      
      
      Add D1's nonretentive suspend state to the devicetree so S-mode software
      knows about it and can use it.
      
      Latency and power measurements were taken on an Allwinner Nezha board:
       - Entry latency was measured from the beginning of sbi_ecall_handler()
         to before the call to wfi() in sun20i_d1_hart_suspend().
       - Exit latency was measured from the beginning of sbi_init() to before
         the call to sbi_hart_switch_mode() in init_warmboot().
       - There was a 17.5 mW benefit from non-retentive suspend compared to
         WFI, with a 170 mW cost during the 107 us entry/exit period. This
         provides a break-even point around 1040 us. Residency includes entry
         latency, so round this up to 1100 us.
       - The hardware power sequence latency (after the WFI) is assumed to be
         negligible, so set the wakeup latency to the exit latency.
      
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      c45992cc
    • Samuel Holland's avatar
      lib: utils: Add fdt_add_cpu_idle_states() helper function · 33bf9174
      Samuel Holland authored
      
      
      Since the availability and latency properties of CPU idle states depend
      on the specific SBI HSM implementation, it is appropriate that the idle
      states are added to the devicetree at runtime by that implementation.
      
      This helper function adds a platform-provided array of idle states to
      the devicetree, following the SBI idle state binding.
      
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      33bf9174
  4. Jan 23, 2023
  5. Jan 22, 2023
  6. Jan 13, 2023
    • Samuel Holland's avatar
      platform: generic: allwinner: Fix PLIC array bounds · da5594bf
      Samuel Holland authored
      The two referenced commits passed incorrect bounds to the PLIC save/
      restore functions, causing out-of-bounds memory access. The functions
      expect "num" to be the 1-based number of interrupt sources, equivalent
      to the "riscv,ndev" devicetree property. Thus, "num" must be strictly
      smaller than the 0-based size of the array storing the register values.
      
      However, the referenced commits incorrectly passed in the unmodified
      size of the array as "num". Fix this by reducing PLIC_SOURCES (matching
      "riscv,ndev" on this platform), while keeping the same array sizes.
      
      Addresses-Coverity-ID: 1530251 ("Out-of-bounds access")
      Addresses-Coverity-ID: 1530252 ("Out-of-bounds access")
      Fixes: 8509e46c ("lib: utils/irqchip: plic: Ensure no out-of-bound access in priority save/restore helpers")
      Fixes: 9a2eeb4a
      
       ("lib: utils/irqchip: plic: Ensure no out-of-bound access in context save/restore helpers")
      Signed-off-by: default avatarSamuel Holland <samuel@sholland.org>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      da5594bf
  7. Jan 09, 2023
  8. Jan 07, 2023
  9. Jan 06, 2023
    • Bin Meng's avatar
      lib: utils/sys: Allow custom HTIF base address for RV32 · 65638f8d
      Bin Meng authored
      commit 6dde4358 ("lib: utils/sys: Extend HTIF library to allow custom base address")
      forgot to update do_tohost_fromhost() codes for RV32, which still
      accesses the HTIF registers using the ELF symbol address directly.
      
      Fixes: 6dde4358
      
       ("lib: utils/sys: Extend HTIF library to allow custom base address")
      Signed-off-by: default avatarBin Meng <bmeng@tinylab.org>
      Tested-by: default avatarDaniel Henrique Barboza <dbarboza@ventanamicro.com>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      65638f8d
    • Rahul Pathak's avatar
      Makefile: Remove -N ldflag to prevent linker RWX warning · 6509127a
      Rahul Pathak authored
      -N option coalesce all sections into single LOAD segment which causes
      data and other sections to have executable permission causing warning
      with new binutils ld 2.39.
      New ld emits warning when any segment have all three permissions RWX.
      
      ld.bfd: warning: test.elf has a LOAD segment with RWX permissions
      ld.bfd: warning: fw_dynamic.elf has a LOAD segment with RWX permissions
      ld.bfd: warning: fw_jump.elf has a LOAD segment with RWX permissions
      ld.bfd: warning: fw_payload.elf has a LOAD segment with RWX permissions
      
      This option was added in below commit -
      commit: eeab92f2
      
       ("Makefile: Convert to a more standard format")
      
      Removing -N option allows to have text and rodata into one LOAD
      segment and other sections into separate LOAD segment which prevents
      RWX permissions on single LOAD segment. Here X == E
      
      Current
       LOAD           0x0000000000000120 0x0000000080000000 0x0000000080000000
                       0x000000000001d4d0 0x0000000000032ed8  RWE    0x10
      
      -N removed
        LOAD           0x0000000000001000 0x0000000080000000 0x0000000080000000
                       0x00000000000198cc 0x00000000000198cc  R E    0x1000
        LOAD           0x000000000001b000 0x000000008001a000 0x000000008001a000
                       0x00000000000034d0 0x0000000000018ed8  RW     0x1000
      
      Signed-off-by: default avatarRahul Pathak <rpathak@ventanamicro.com>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Tested-by: default avatarSamuel Holland <samuel@sholland.org>
      6509127a