- Nov 30, 2021
-
-
Nikita Shubin authored
Fix missing space in sbi_hart_pmp_configure error printing. Signed-off-by:
Nikita Shubin <n.shubin@yadro.com> Reviewed-by:
Dong Du <Dd_nirvana@sjtu.edu.cn> Reviewed-by:
Xiang w <wxjstz@126.com>
-
- Nov 23, 2021
-
-
Vagrant Cascadian authored
Fix a spelling typo in error print. Signed-off-by:
Vagrant Cascadian <vagrant@debian.org> Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Xiang W <wxjstz@126.com>
-
- Nov 18, 2021
-
-
Gabriel Somlo authored
Add support for the UART provided by the LiteX SoC framework (https://github.com/enjoy-digital/litex ), based on its FDT info (described in the Linux tree at Documentation/devicetree/bindings/serial/litex,liteuart.yaml). Signed-off-by:
Gabriel Somlo <gsomlo@gmail.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Nov 12, 2021
-
-
Xiang W authored
We should clear A bits in prot variable before enabling A_NA4 or A_NAPOT. Signed-off-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Nikita Shubin authored
da9063 PMIC can be used to reset/shutdown the Sifive Unmatched board. shutdown is done simply by writing SHUTDOWN bit to DA9063_REG_CONTROL_F register. reset via setting WAKEUP bit in DA9063_REG_CONTROL_F register followed by masking POWER and POWER1 domains and setting STANDBY bit in DA9063_REG_CONTROL_A, originally discovered by Alexandre Ghiti on linux-riscv maillists. Tested-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Tested-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by:
Nikita Shubin <n.shubin@yadro.com>
-
Nikita Shubin authored
Minimum SiFive I2C driver to read/send bytes over I2C bus. This allows querying information and perform operation of onboard PMIC, as well as power-off and reset. Tested-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Tested-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by:
Nikita Shubin <n.shubin@yadro.com>
-
Nikita Shubin authored
FDT based I2C framework on the top of I2C library. The drivers are probed on demand by fdt_i2c_adapter_get function. Tested-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Tested-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by:
Nikita Shubin <n.shubin@yadro.com>
-
Nikita Shubin authored
Helper library to keep track of registered I2C adapters, identified by dts offset, basic send/read functions and adapter configuration (enable, set dividers, etc...). Tested-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Tested-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by:
Nikita Shubin <n.shubin@yadro.com>
-
Nikita Shubin authored
Move driver init code to separate function, so it can be reused elsewhere. Tested-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Tested-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by:
Nikita Shubin <n.shubin@yadro.com>
-
Nikita Shubin authored
Make gpio_system_reset_check return priority instead of just true/false. Make default 128 priority for reset/shutdown. Tested-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Tested-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Signed-off-by:
Nikita Shubin <n.shubin@yadro.com>
-
- Nov 11, 2021
-
-
Vasan VS authored
We should ensure that pmpcfg0.pmp0cfg is set to zero before using pmpaddr0 CSR for detecting implemented PMP address bits. Fixes: bf216328 ("lib: sbi: Detect PMP granularity and number of address bits") Signed-off-by:
Vasan VS <vasan.vs@gmail.com> Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Dong Du <Dd_nirvana@sjtu.edu.cn>
-
Atish Patra authored
The first 32 bits of the initial value for the counter should be preserved while updating the mhpmcounter for 32bit. Fixes: 13d40f21 ("lib: sbi: Add PMU support") Signed-off-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Reviewed-by:
Dong Du <Dd_nirvana@sjtu.edu.cn> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Atish Patra authored
As per the DT schema rules, the prefix should be vendor. As the PMU properties are generic for all vendors, change the prefix to riscv instead of pmu. Reviewed-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
Atish Patra authored
Some platforms such as hifive unmatched doesn't implement mcountinhibit csr. However, it has hardware events that can be monitored using 2 hpmcounter it has (i.e. mhpmcounter3 & mhpmcounter4). Currently, PMU extension disabled if mcountinhibit is absent. That's not really necessary as long as the supervisor OS keeps track of the delta value of the counters. Without mcountinhibit, the delta value won't be entirely accurate because the counters are freely running. However, that should be fine to produce an approximate counter value which can help performance analysis. Perf sampling won't work though as sscof extension is not present in hifive unmatched. Reviewed-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
Atish Patra authored
The mhpm bits represent the number of bits available in mhpmcounter while counter width describes a zero indexed value. Fix the counter width calculation. Fixes: 13d40f21 ("lib: sbi: Add PMU support") Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
Atish Patra authored
The hardware solely relies on the event selector value in mhpmevent to figure out what event to monitor using that counter. It should be reset when counter reset happens. Reviewed-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
Atish Patra authored
A platform may use programmable counters for cycle/instret events. The priv spec allows that provided that cycle/instret also report those events in addition to the programmable counters. We should allow that functionality in OpenSBI. Reviewed-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
Atish Patra authored
OpenSBI doesn't use any counters for its own usage. Thus, all the counters can be made accessible for lower privilege mode always. However, the mcountinhibit must be set so that the counter doesn't increment. As a result, we don't have to enable/disable mcounteren at every start/stop. Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
Atish Patra authored
This patch adds sscofpmf extension in pmu module which includes following things. 1. Enable overflow irq when starting a counter. 2. Setting the correct event filters passed from supervisor. 3. Delegating the overflow interrupt to the supervisor. 4. Add RV32 support for sscofpmf. Reviewed-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
Atish Patra authored
OpenSBI doesn't handle PMU counters for now. Delegate the overflow counter to S-mode always. Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
Atish Patra authored
Sscofpmf ISA extension introduces PMU counter overflow and filtering support. It introduces a read only `scountovf` csr that can be used to detect if a hart supports this extension at runtime. However, this feature is only useful if the hart already supports mcounteren and mcountinhibit. Add a dynamic detection mechanism and boot time print message if sscofpmf is present. Reviewed-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
Atish Patra authored
The Sscofpmf extension introduces mhpmevent[h] csrs to handle filtering /overflow bits in RV32. There is no way to read/write mcountinhibit using mcountinhibit csr using a variable. Updated the support to read/write mhpmevent[h] and mcountinhibit csr. Reviewed-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
Atish Patra authored
[1] https://drive.google.com/file/d/1KcjgbLM5L1ZKY8934aJl8aQwGlMz6Cbo/view Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com> Signed-off-by:
Atish Patra <atish.patra@wdc.com>
-
- Nov 08, 2021
-
-
Heinrich Schuchardt authored
The initialization of a reset driver may fail for various reasons, like a PMIC based reset driver not finding the required I2C driver. The return code of the init routine may take other error values than -ENODEV. If the initialization of a reset driver fails, this should not lead to the board hanging. It is enough that the reset driver does not call sbi_system_reset_add_device() to avoid invoking the driver for a device that could not be initialized. Change the return type of fdt_reset_init() to void. Print a message if an error occurs. Signed-off-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Dong Du <Dd_nirvana@sjtu.edu.cn> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Heinrich Schuchardt authored
Move the fdt_reset_init() invocation from generic_early_init() to generic_final_init(). This allows to print error messages. Ignore the return value of fdt_reset_init() as we should not stop booting due to failure to initialize reset drivers. Signed-off-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Dong Du <Dd_nirvana@sjtu.edu.cn> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Heinrich Schuchardt authored
Moving the sbi_boot_print_general() call after the sbi_platform_final_init() call allows to print devices initialized in the latter. To keep the overall print sequence the same also move sbi_boot_print_domains(). Signed-off-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Nov 03, 2021
-
-
Nikita Shubin authored
Convert static array to sbi_list. This removes size limitation, makes add/remove more efficient and saves space. Signed-off-by:
Nikita Shubin <n.shubin@yadro.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Nov 02, 2021
-
-
Anup Patel authored
The parameter passed to HFENCE.GVMA instruction in rs1 register is guest physical address right shifted by 2 (i.e. divided by 4). Unfortunately, we overlooked the semantics of rs1 registers for HFENCE.GVMA instruction and never right shifted guest physical address by 2. This issue did not manifest for hypervisors till now because all H-extension implementations (such as QEMU, Spike, Rocket Core FPGA, etc) we tried till now were conservatively flushing everything upon any HFENCE.GVMA instruction. This patch fixes GPA passed to __sbi_hfence_gvma_vmid_gpa() and __sbi_hfence_gvma_gpa() functions. Fixes: 331ff6a1 ("lib: Support stage1 and stage2 tlb flushing") Reported-by:
Ian Huang <ihuang@ventanamicro.com> Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Dong Du <Dd_nirvana@sjtu.edu.cn>
-
Alexandre Ghiti authored
This simply adds an helper to get fdt address which is more explicit than sbi_scratch_thishart_arg1_ptr. Signed-off-by:
Alexandre Ghiti <alexandre.ghiti@canonical.com> Reviewed-by:
Xiang W <wxjstz@126.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Dong Du authored
Although we have PRILX to help us print unsigned long without considering the 32bit/64bit differences, there are still some places using 08lx and 016lx manually --- leading to redundant code. This commit fixes the issue by using PRILX all the time. Signed-off-by:
Dong Du <Dd_nirvana@sjtu.edu.cn> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Anup Patel authored
Now that sbi_system support multiple system reset devices, we should register separate devices for GPIO restart and GPIO poweroff because DT describes these as separate devices with different compatible strings. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Dong Du <Dd_nirvana@sjtu.edu.cn>
-
- Oct 21, 2021
-
-
Samuel Holland authored
The T-HEAD PLIC implementation requires setting a delegation bit to allow access from S-mode. Now that the T-HEAD PLIC has its own compatible string, set this bit automatically from the PLIC driver, instead of reaching into the PLIC's MMIO space from another driver. Signed-off-by:
Samuel Holland <samuel@sholland.org> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Oct 20, 2021
-
-
Wei Fu authored
When we are doing opensbi development, we want to know the build time and compiler info for debug purpose. To enable this message, please add "BUILD_INFO=y", like: ``` make BUILD_INFO=y ``` NOTE: Using `BUILD_INFO=y` without specifying SOURCE_DATE_EPOCH will violate "reproducible builds". So it's ONLY for development and debug purpose, and should NOT be used in a product which follows "reproducible builds". Signed-off-by:
Wei Fu <wefu@redhat.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Alistair Francis <alistair.francis@wdc.com>
-
- Oct 18, 2021
-
-
Heinrich Schuchardt authored
The SBI specification requires that sbi_system_reset() returns SBI_ERR_INVALID_PARAM if reset_type or reset_reason are not valid. Signed-off-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Atish Patra <atish.patra@wdc.com> Reviewed-by:
Xiang W <wxjstz@126.com>
-
Anup Patel authored
Instead of saving context only for default non-retentive suspend, we should save context for all non-retentive suspend types. Fixes: 74756891 ("lib: sbi: Implement SBI HSM suspend function") Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Dong Du <Dd_nirvana@sjtu.edu.cn> Reviewed-by:
Xiang W <wxjstz@126.com>
-
- Oct 11, 2021
-
-
Nikita Shubin authored
Let's make system_reset_check returning priority instead of only true/false. In that case 0 - means not supported, and anything above means priority that makes existing reset handlers being used in first place, unless it is decided to lower their priority. The handler with the most priority wins. Signed-off-by:
Nikita Shubin <n.shubin@yadro.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
Nikita Shubin authored
To support different handlers for different types of resets, we are adding a sbi_list of restart handlers. Instead of sbi_system_reset_set_device we use sbi_system_reset_add_device to reflect the actual meaning. Signed-off-by:
Nikita Shubin <n.shubin@yadro.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Oct 01, 2021
-
-
Heinrich Schuchardt authored
The GPIO reset driver supports reset and poweroff. But not all boards support both. gpio_system_reset_check() must detect this situation. Signed-off-by:
Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by:
Anup Patel <anup.patel@wdc.com>
-
- Sep 26, 2021
-
-
Anup Patel authored
We should use sbi_timer_mdelay() instead of custom gpio_mdelay() in the gpio reset driver. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Reviewed-by:
Xiang W <wxjstz@126.com>
-
Anup Patel authored
We now have frequency of the timer device provided by the platform support so we can emulate desired delay using a loop where the number loop iterations are based on timer frequency. This patch provides sbi_timer_delay_loop() for above purpose. Signed-off-by:
Anup Patel <anup.patel@wdc.com> Reviewed-by:
Bin Meng <bmeng.cn@gmail.com> Reviewed-by:
Xiang W <wxjstz@126.com>
-