mirror of
https://gitlab.com/qemu-project/opensbi.git
synced 2025-11-10 05:37:55 +08:00
lib: sbi_domain_context: preserve firmware PMP entries during domain context switch
When SmePMP is enabled, clearing firmware PMP entries during a domain context switch can temporarily revoke access to OpenSBI’s own code and data, leading to faults. Keep firmware PMP entries enabled across switches so firmware regions remain accessible and executable. Signed-off-by: Yu-Chien Peter Lin <peter.lin@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20251008084444.3525615-9-peter.lin@sifive.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
committed by
Anup Patel
parent
b210376fe2
commit
0250db4dad
@ -122,6 +122,10 @@ static int switch_to_next_domain_context(struct hart_context *ctx,
|
||||
|
||||
/* Reconfigure PMP settings for the new domain */
|
||||
for (int i = 0; i < pmp_count; i++) {
|
||||
/* Don't revoke firmware access permissions */
|
||||
if (sbi_hart_smepmp_is_fw_region(i))
|
||||
continue;
|
||||
|
||||
sbi_platform_pmp_disable(sbi_platform_thishart_ptr(), i);
|
||||
pmp_disable(i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user