mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 14:58:13 +08:00
arch/risc-v/qemu-rv: Configure PMP before booting secondary harts.
Export qemu_rv_configure_mpu() and invoke it on the secondary-hart boot path before riscv_cpu_boot(). This keeps protected SMP builds from faulting on !CPU0 when userspace work is first scheduled there. Signed-off-by: Shunchao Hu <ankohuu@gmail.com>
This commit is contained in:
committed by
Alan C. Assis
parent
9028fe72c7
commit
fc6fd3f24d
@@ -227,6 +227,9 @@ void qemu_rv_start(int mhartid, const char *dtb)
|
||||
cpux:
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
# ifdef CONFIG_BUILD_PROTECTED
|
||||
qemu_rv_configure_mpu();
|
||||
# endif
|
||||
riscv_cpu_boot(mhartid);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: configure_mpu
|
||||
* Name: qemu_rv_configure_mpu
|
||||
*
|
||||
* Description:
|
||||
* This function configures the MPU for for kernel- / userspace separation.
|
||||
@@ -63,7 +63,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void configure_mpu(void)
|
||||
void qemu_rv_configure_mpu(void)
|
||||
{
|
||||
int ret;
|
||||
ret = riscv_append_pmp_region(UFLASH_F, UFLASH_START, UFLASH_SIZE);
|
||||
@@ -123,7 +123,7 @@ void qemu_rv_userspace(void)
|
||||
|
||||
/* Configure MPU / PMP to grant access to the userspace */
|
||||
|
||||
configure_mpu();
|
||||
qemu_rv_configure_mpu();
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BUILD_PROTECTED */
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BUILD_PROTECTED
|
||||
void qemu_rv_configure_mpu(void);
|
||||
void qemu_rv_userspace(void);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user