diff mbox series

[v5,3/4] lib: sbi: sw check exception delegation

Message ID 20240910163522.2584936-4-debug@rivosinc.com
State New
Headers show
Series zicfilp and zicfiss support in opensbi | expand

Commit Message

Deepak Gupta Sept. 10, 2024, 4:35 p.m. UTC
zicfiss and zicfilp introduces new exception (cause=18). Delegate this
exception to S mode because cfi violations in U / S will be reported
via this exception.

Signed-off-by: Deepak Gupta <debug@rivosinc.com>
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
---
 lib/sbi/sbi_hart.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Samuel Holland Sept. 14, 2024, 5:05 p.m. UTC | #1
On 2024-09-10 11:35 AM, Deepak Gupta wrote:
> zicfiss and zicfilp introduces new exception (cause=18). Delegate this
> exception to S mode because cfi violations in U / S will be reported
> via this exception.
> 
> Signed-off-by: Deepak Gupta <debug@rivosinc.com>
> Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
> Reviewed-by: Atish Patra <atishp@rivosinc.com>
> ---
>  lib/sbi/sbi_hart.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
> index e1bc346..fa00f69 100644
> --- a/lib/sbi/sbi_hart.c
> +++ b/lib/sbi/sbi_hart.c
> @@ -207,7 +207,8 @@ static int delegate_traps(struct sbi_scratch *scratch)
>  	if (sbi_platform_has_mfaults_delegation(plat))
>  		exceptions |= (1U << CAUSE_FETCH_PAGE_FAULT) |
>  			      (1U << CAUSE_LOAD_PAGE_FAULT) |
> -			      (1U << CAUSE_STORE_PAGE_FAULT);
> +			      (1U << CAUSE_STORE_PAGE_FAULT)|

nit: missing space before |

> +			      (1U << CAUSE_SW_CHECK_EXCP);
>  
>  	/*
>  	 * If hypervisor extension available then we only handle hypervisor
diff mbox series

Patch

diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index e1bc346..fa00f69 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -207,7 +207,8 @@  static int delegate_traps(struct sbi_scratch *scratch)
 	if (sbi_platform_has_mfaults_delegation(plat))
 		exceptions |= (1U << CAUSE_FETCH_PAGE_FAULT) |
 			      (1U << CAUSE_LOAD_PAGE_FAULT) |
-			      (1U << CAUSE_STORE_PAGE_FAULT);
+			      (1U << CAUSE_STORE_PAGE_FAULT)|
+			      (1U << CAUSE_SW_CHECK_EXCP);
 
 	/*
 	 * If hypervisor extension available then we only handle hypervisor