aboutsummaryrefslogtreecommitdiff
path: root/platform
AgeCommit message (Collapse)AuthorFilesLines
2024-05-09platform: generic: thead: add Canaan Kendryte K230Yangyu Chen1-0/+5
Canaan Kendryte K230 SoC has T-Head C908 cores inside. The dt-binding has been merged into the linux kernel [1]. However, it has early version of C908 core which does not have Sscofpmf and need to use T-Head PMU extension. Thus, we add a K230 compatible string to thead_generic_match and set quirk for T-Head PMU. [1] https://lore.kernel.org/linux-riscv/tencent_4D85743622F39109466913393EE2F6C5980A@qq.com/ Signed-off-by: Yangyu Chen <cyy@cyyself.name> Reviewed-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-05-09platform: generic: thead: separate T-Head PMU ErrataYangyu Chen2-2/+7
As Guo Ren said from the kernel mailing list [1], future T-Head CPUs, including the newer versions of T-Head C908, will feature standard Sscofpmf extension. For these CPUs, T-Head's implementation of PMU Overflow Interrupts may not needed anymore. In this case, we shouldn't apply T-Head PMU for all T-Head CPUs. Thus, this patch separated T-Head PMU errata. [1] https://lore.kernel.org/linux-riscv/Zh9sUUUT09LZb0MO@gmail.com/ Signed-off-by: Yangyu Chen <cyy@cyyself.name> Reviewed-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-05-09platform: andes: Change all occurrences of andes45 to andesBen Zong-You Xie11-84/+86
To make the framework suit all Andes CPUs, change all occurrences of andes45 to andes. In addition, we fix some coding style problems and remove an unused macro in andes.h. Signed-off-by: Ben Zong-You Xie <ben717@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-05-09platform: andes: Rename files with the prefix andes45Ben Zong-You Xie3-0/+0
Rename files with the prefix andes45 to andes. Signed-off-by: Ben Zong-You Xie <ben717@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-04-10firmware: remove FW_TEXT_STARTXiang W6-13/+3
Now opensbi can run at any address via dynamic relocation. We can remove FW_TEXT_START. Signed-off-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org>
2024-04-05platform: generic: allwinner: Optimize current hart scratch accessSamuel Holland1-1/+1
The address of the local scratch area is stored in each hart's mscratch CSR. It is more efficient to read the CSR than to compute the address from the hart ID. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-03-20platform: generic: allwinner: sun20i-d1: Remove duplicated CSR definitionsChristoph Müllner1-18/+9
All T-Head CSRs are already defined in thead/c9xx_encoding.h. Let's reuse the values from there instead of redefining them with a slightly different name. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-03-04platform: andes: Drop andes_pmu_setup()Yu Chien Peter Lin2-24/+0
andes_pmu_setup() [1] was intended to populate event mapping from hardcoded arrays, however, this increases firmware size and we should just use PMU DT node [2] instead. Link: https://lists.infradead.org/pipermail/opensbi/2023-November/006032.html [1] Link: https://github.com/riscv-software-src/opensbi/blob/v1.4/docs/pmu_support.md#example-3 [2] Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-02-24platform: Apply relocatable addressInochi Amaoto2-4/+21
Since jump and payload firmware support relocatable address, make general platform use runtime relocatable address. Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-02-22platform: starfive: call starfive_jh7110_inst_init() in pm_reset_init()Nam Cao1-1/+6
The function starfive_jh7110_inst_init() initialize some power management unit address and clock addresses, needed for the reset driver. It doesn't do anything else, and also the reset driver doesn't work without calling this function. Thus, it does not make much sense that this function is independent from pm_reset_init(). Delete the separate call to starfive_jh7110_inst_init(), and instead just call this function inside pm_reset_init(). Doing this also fixes another problem: if starfive_jh7110_inst_init() returns an error code, it gets propagated to final_init() and OpenSBI hangs. This hang is not necessary, because failures within starfive_jh7110_inst_init() only mean OpenSBI cannot perform reboot or shutdown, but the system can still function normally. Signed-off-by: Nam Cao <namcao@linutronix.de> Tested-by: Minda Chen <minda.chen@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-02-22platform: starfive: return error if needed devices are not presentNam Cao1-0/+4
Jh7110's reset driver needs power management device and clock controller device to work. Currently, the driver proceed anyway without these devices, and invalid addresses (jh7110_inst.pmu_reg_base and jh7110_inst.clk_reg_base) are used during reboot, which causes unpredictable broken behaviors. If these devices are not present, return -SBI_ENODEV. Signed-off-by: Nam Cao <namcao@linutronix.de> Tested-by: Minda Chen <minda.chen@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-02-22platform: starfive: rename "stf,axp15060-regulator" -> "x-powers,axp15060"Nam Cao1-1/+1
OpenSBI uses the device tree compatible string "stf,axp15060-regulator" for the regulator node. However, the string used by U-Boot (and Linux) is actually "x-powers,axp15060". As OpenSBI gets the device tree from U-Boot, this causes the regulator device to be undetected, and OpenSBI does not use this device to perform board reset/shutdown. Rename this device tree compatible string to match U-Boot (and Linux). Signed-off-by: Nam Cao <namcao@linutronix.de> Acked-by: Minda Chen <minda.chen@starfivetech.com> Tested-by: Minda Chen <minda.chen@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-02-22platform: starfive: remove redundant compatibility check in pmic_opsNam Cao1-22/+14
pmic_ops() is only called if a compatible device is found in device tree. It is redundant for this function to check the compability again. Remove this check. Signed-off-by: Nam Cao <namcao@linutronix.de> Tested-by: Minda Chen <minda.chen@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-02-22platform: starfive: get I2C offset address from clocks propertyNam Cao1-10/+14
The current code gets the I2C offset address using the device tree node name: it get the I2C device index from the 4th character in the node name (for example, "i2c5" -> i2c device 5). However, the device tree node's name in U-Boot is actually just "i2c" without the number, so the current code cannot be used with the device tree from U-Boot. Get the I2C offset address from the "clocks" property instead. Signed-off-by: Nam Cao <namcao@linutronix.de> Reviewed-by: Minda Chen <minda.chen@starfivetech.com> Tested-by: Minda Chen <minda.chen@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-02-22platform: starfive: correct system clock device tree nodeNam Cao1-1/+1
Starfive names the system clock device tree node "starfive,jh7110-clkgen" in all their git repositories. However, a different name is used in upstream U-Boot (and also Linux): "starfive,jh7110-syscrg". Since OpenSBI gets the device tree from U-Boot, this inconsistency leads the problem that OpenSBI doesn't know the system clock device exists. Correct this name to keep the consistency. Signed-off-by: Nam Cao <namcao@linutronix.de> Acked-by: Minda Chen <minda.chen@starfivetech.com> Tested-by: Minda Chen <minda.chen@starfivetech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-02-20platform: generic: Parse system suspend test from config node.Cheng Yang1-1/+1
This patch update generic_domains_init() so that "system-suspend-test" is parsed from "/chosen/opensbi-config" DT node. Signed-off-by: Cheng Yang <yangcheng.work@foxmail.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2024-02-20platform: generic: Add support for specify coldboot harts in DTCheng Yang1-1/+64
Added support for the generic platform to specify the set of coldboot hart in DT. If not specified in DT, all harts are allowed to coldboot as before. The functions related to sbi_hartmask are not available before coldboot, so I used bitmap, and added a new bitmap_test() function to test whether a certain bit of the bitmap is set. Signed-off-by: Cheng Yang <yangcheng.work@foxmail.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-12-19lib: sbi: Allow ecall handlers to directly update register stateAnup Patel4-15/+12
Some of the upcoming SBI extensions (such as SSE) will directly update register state so improve the prototype of ecall handler to accommodate this. Further, this flexibility allows us to push the trap redirection from sbi_ecall_handler() to the sbi_ecall_legacy_handler(). Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-12-19lib: utils/irqchip: Add shared MMIO region for PLIC in root domainAnup Patel6-0/+14
On platforms with Smepmp, the MMIO regions accessed by M-mode need to be explicitly marked with M-mode only read/write or shared (both (M-mode and S-mode) read/write permission. If the above is not done then runtime PLIC access from M-mode on platforms with Smepmp will result in access fault when further results in CPU hotplug not working. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-12-19platform: generic: Fine tune fw_platform_calculate_heap_size()Anup Patel1-1/+2
Let's use SBI_TLB_INFO_SIZE instead of hard-coded 0x40 in fw_platform_calculate_heap_size() to fine tune the heap size required for per-hart TLB fifos. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-12-11platform: recalculate heap size to support new tlb entry numberInochi Amaoto1-1/+15
Previous patch introduced a change that using hart count as the default number of tlb entries in the fifo. This makes the default tlb fifo size grow in square with the number of harts. So the default heap size is not enough to allocate tlb fifo when the hart count is big. Fixes: 52fd64b ("platform: Uses hart count as the default size of tlb info") Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-12-06platform: andes: Factor out is_andes() helperYu Chien Peter Lin2-9/+13
We will need is_andes(45) in the following patch, so factor out the code that parses marchid to make it reusable for checking any Andes CPU variants. Also improves the comment in ae350_hart_start(). Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-12-06platform: rzfive: Enable Andes PMU for RZ/FiveYu Chien Peter Lin2-1/+5
Enable Andes PMU extension support for RZ/Five. We also staticize renesas_rzfive_early_init() as it is not used outside of this unit. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-12-06platform: andes: Enable Andes PMU for AE350Yu Chien Peter Lin2-0/+4
Enable Andes PMU extension support for AE350 platforms. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-12-06platform: andes: Add Andes custom PMU supportYu Chien Peter Lin5-0/+160
Before the ratification of Sscofpmf, the Andes PMU extension was designed to support the sampling and filtering with hardware performance counters (zihpm), it works with the current SBI PMU extension and Linux SBI PMU driver. We implement 1) the PMU device callbacks that update the corresponding bits on custom CSRs, 2) extentions_init() to detect the hardware support of Andes PMU and initialize the per-hart PMU related CSR, and 3) pmu_init() to register PMU device and populate event mappings. Also define a andes_pmu_setup() function which is in preparation for adding default PMU mappings in andes_hpm.h Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-12-06platform: generic: Introduce pmu_init() platform overrideYu Chien Peter Lin2-0/+7
Add pmu_init() platform override, which will be used to register PMU device and populate event mappings. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-12-06platform: include: andes45: Add PMU related CSR definesYu Chien Peter Lin1-0/+26
Add CSR definitions for Andes PMU extension. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Atish Patra <atishp@rivosinc.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
2023-12-06sbi: sbi_pmu: Improve sbi_pmu_init() error handlingYu Chien Peter Lin1-1/+7
This patch makes the following changes: - As sbi_platform_pmu_init() returns a negative error code on failure, let sbi_pmu_init() print out the error code with sbi_dprintf(). - In order to distinguish the SBI_EFAIL error returned by sbi_pmu_add_*_counter_map(), return SBI_ENOENT to indicate that fdt_pmu_setup() failed to locate "riscv,pmu" node, and generic_pmu_init() ignores such case. Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Atish Patra <atishp@rivosinc.com>
2023-11-17lib: sbi: change sbi_hart_features.extensions as an arrayXiang W1-1/+1
In the future there may be a lot of ISA extensions, a 'long' may not be able to accommodate, changed to an array for the future. Addresses-Coverity-ID: 1568357 Out-of-bounds access Fixes: 6259b2ec2d09 ("lib: utils/fdt: Fix fdt_parse_isa_extensions() implementation") Signed-off-by: Xiang W <wxjstz@126.com> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-11-16platform: generic: Add Sophgo sg2042 platform supportInochi Amaoto4-0/+79
Add Sophgo sg2042 soc support Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Guo Ren <guoren@kernel.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-11-16utils/reset: Remove fdt_reset_theadGuo Ren1-1/+0
In the past, we used fdt_reset_thead to help customers with prototype verification. However, with the emergence of the Big-little SoC system, it can no longer meet the demand. Therefore, we use zero_stage_boot instead of fdt_reset_thead. It cleans up the opensbi code and ends the disputation of reset_sample's dts. This patch removes the fdt_reset_thead component and updates the related doc. Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-11-16platform: Uses hart count as the default size of tlb infoInochi Amaoto1-1/+1
For platform with high number of harts, it is better to auto detect a suitable number of entries in tlb fifo. Since allocating tlb entry for all online harts can reduce the wait time significantly, using the number of the online harts can make most platforms happy. This auto detection can avoid most duplicate code for setting tlb fifo size. Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Acked-by: Guo Ren <guoren@kernel.org> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-11-16platform: generic: thead: improve tlb flush errataInochi Amaoto1-1/+1
Flushing the tlb entries can solve the thead tlb problem, but flushing it by address will miss something and lead to a exception in some rare cases, and this is more common for sg2042. To solve this problem, flush the tlb entries by asid in the custom trap handler to ensure it is refreshed. Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Guo Ren <guoren@kernel.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-11-14platform: generic: thead: initialize PMU by default in thead generic platformInochi Amaoto2-2/+12
Since all the SoC with thead c9xx cores need this initialization at now, initialize the c9xx pmu in the thead generic platform by default. Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-11-14platform: generic: thead: separate implement of T-HEAD c9xx errataInochi Amaoto7-18/+49
Separate the implement of T-HEAD c9xx errata to allow any platform with bug related to c9xx cores can use it. Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-11-14platform: generic: thead: separate implement of T-HEAD c9xx pmuInochi Amaoto6-49/+87
Separate the implement of T-HEAD c9xx pmu to allow any platform with c9xx cores can use it. Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-11-14platform: generic: thead: move to thead c9xx header to vendor specific postionInochi Amaoto2-3/+3
The CSR encoding for t-head c9xx cores is shared across all the platforms with these cores. So move header thead_c9xx.h to the thead subdir. Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Acked-by: Guo Ren <guoren@kernel.org> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-10-04platform: generic: thead: fix stale TLB entries for th1520/sg2042Inochi Amaoto5-0/+78
The TLB entries remain functional all the time once added in T-HEAD th1520 and Sophgo sg2042 (even if the MMU is then disabled afterwards). If there are some stale TLB entries that contains the address of SBI, it will cause unexpected memory access and issue a illegal instruction error. To avoid this, a TLB flush is needed to drop these TLB entries before any memory access in the trap handler. To handle this workaroud, add a custom trap handler with executing TLB flush first in the T-HEAD platform to fix affected socs. Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-09-24lib: sbi: Prefer hartindex over hartid in IPI frameworkAnup Patel1-1/+1
Let us prefer hartindex over hartid in IPI framework which in-turn forces IPI users to also prefer hartindex. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-09-10platform: Allow platforms to specify the size of tlb fifoXiang W2-0/+9
For some platforms with a particularly high number of harts, if the tlb fifo is too small, it case harts to wait. Platforms should be allowed to specify the size of the tlb fifo. Signed-off-by: Xiang W <wxjstz@126.com> Signed-off-by: Xing Xiaoguang <xiaoguang.xing@sophgo.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-09-10platform: generic: allwinner: fix OF process for T-HEAD c9xx pmuInochi Amaoto1-10/+15
T-HEAD c9xx pmu needs to clear OV bits of MCOUNTEROF in any condition to avoid unnecessary OF interrupts. In addition, the S-mode SCOUNTEROF only have OF bit set when the related bits of MCOUNTERWEN is set, so also configure MCOUNTERWEN to allow kernel to access valid SCOUNTEROF. Signed-off-by: Haijiao Liu <haijiao.liu@sophgo.com> Co-authored-by: Inochi Amaoto <inochiama@outlook.com> Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Samuel Holland <samuel@sholland.org>
2023-08-22platform: generic: allwinner: correct mhpmevent countInochi Amaoto1-1/+2
Only the CSR mhpmevent 3-9,13-17 of D1 have valid function, so change the mhpm_mask to a valid value to avoid invalid usage. Due to the openc906 pmu code https://github.com/T-head-Semi/openc906/blob/main/C906_RTL_FACTORY/gen_rtl/pmu/rtl/aq_hpcp_top.v Signed-off-by: Inochi Amaoto <inochiama@outlook.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-07-31lib: utils/reset: Remove SiFive Test reset driverAnup Patel1-1/+0
The functionality of SiFive Test reset driver is easily available through Syscon reset driver so let us remove the SiFive Test driver. Signed-off-by: Anup Patel <apatel@ventanamicro.com>
2023-07-31lib: utils/reset: Add syscon based reboot and poweroffAnup Patel1-0/+1
Let us have common FDT based reset driver for syscon reboot and poweroff. The device tree bindings for syscon reboot and poweroff are already available in the Linux kernel sources. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Xiang W <wxjstz@126.com>
2023-07-31lib: utils/regmap: Add simple FDT based syscon regmap driverAnup Patel1-0/+1
Let us add a simple FDT based system regmap driver which follows the device tree bindings already defined in the Linux kernel. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Xiang W <wxjstz@126.com>
2023-07-31lib: utils/regmap: Add simple FDT based regmap frameworkAnup Patel1-1/+1
We add a simple FDT based regmap framework which is built on top of generic regmap library. The phandle of FDT regmap DT node is treated as unique regmap ID. The FDT based regmap drivers will be probed on-demand from fdt_regmap_get_by_phandle() and fdt_regmap_get() called by the regmap client drivers. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Xiang W <wxjstz@126.com>
2023-07-31lib: utils/regmap: Add generic regmap access libraryAnup Patel1-1/+2
We add generic regmap access library which is independent of hardware description format (FDT or ACPI). The OpenSBI platform support or regmap drivers can register regmap instances which can be discovered by different regmap clients based on the unique ID of regmap instances. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Xiang W <wxjstz@126.com>
2023-07-13lib: utils: Add detection of Smepmp from ISA string in FDTHimanshu Chauhan1-0/+9
- Add function to parse ISA string in FDT. - Set Smepmp feature bit in extensions if "smepmp" string is found in ISA string. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-07-07gpio/desginware: add Synopsys DesignWare APB GPIO supportBen Dooks1-0/+1
Add a driver for the Synopsys DesignWare APB GPIO IP block found in many SoCs. Signed-off-by: Ben Dooks <ben.dooks@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
2023-06-21lib: reset: Move fdt_reset_init into generic_early_initGuo Ren1-3/+3
The fdt_reset_thead driver needs to modify the __reset_thead_csr_stub text region for the secondary harts booting. After that, the sbi_hart_pmp_configure may lock down the text region with M_READABLE & M_EXECUTABLE attributes in the future. Currently, the M_READABLE & M_EXECUtABLE have no effect on m-mode, the L-bit in pmpcfg csr is useless for the current opensbi scenario. See: Priv-isa-spec 3.7.1.2. Locking and Privilege Mode When the L bit is clear, any M-mode access matching the PMP entry will succeed; the R/W/X permissions apply only to S and U modes. That's why current fdt_reset_thead could still work well after commit: 230278dcf127 ("lib: sbi: Add separate entries for firmware RX and RW regions"). So this patch fixes up a fake bug for the M-mode permission setting of the future. Fixes: 230278dcf127 ("lib: sbi: Add separate entries for firmware RX and RW regions") Link: http://lists.infradead.org/pipermail/opensbi/2023-June/005176.html Reported-by: Jessica Clarke <jrtc27@jrtc27.com> Signed-off-by: Guo Ren <guoren@linux.alibaba.com> Signed-off-by: Guo Ren <guoren@kernel.org> Reviewed-by: Anup Patel <anup@brainfault.org>