diff mbox series

[v3,1/3] xen/riscv: disable fpu

Message ID 1fe0c827b9e5c2fef569e25ad7ca377111228d29.1677838213.git.oleksii.kurochko@gmail.com (mailing list archive)
State New, archived
Headers show
Series Do basic initialization things | expand

Commit Message

Oleksii Kurochko March 3, 2023, 10:24 a.m. UTC
Disable FPU to detect illegal usage of floating point in kernel
space.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/riscv64/head.S | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Andrew Cooper March 3, 2023, 10:25 a.m. UTC | #1
On 03/03/2023 10:24 am, Oleksii Kurochko wrote:
> Disable FPU to detect illegal usage of floating point in kernel
> space.
>
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Bobby Eshleman March 9, 2023, 10:39 a.m. UTC | #2
On Fri, Mar 03, 2023 at 12:24:22PM +0200, Oleksii Kurochko wrote:
> Disable FPU to detect illegal usage of floating point in kernel
> space.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> ---
>  xen/arch/riscv/riscv64/head.S | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
> index ffd95f9f89..52fa41c778 100644
> --- a/xen/arch/riscv/riscv64/head.S
> +++ b/xen/arch/riscv/riscv64/head.S
> @@ -6,6 +6,13 @@ ENTRY(start)
>          /* Mask all interrupts */
>          csrw    CSR_SIE, zero
>  
> +        /*
> +         * Disable FPU to detect illegal usage of
> +         * floating point in kernel space
> +         */
> +        li      t0, SSTATUS_FS
> +        csrc    CSR_SSTATUS, t0
> +
>          la      sp, cpu0_boot_stack
>          li      t0, STACK_SIZE
>          add     sp, sp, t0
> -- 
> 2.39.0
> 
> 

Acked-by: Bobby Eshleman <bobbyeshleman@gmail.com>
Bobby Eshleman March 9, 2023, 10:42 a.m. UTC | #3
On Fri, Mar 03, 2023 at 12:24:22PM +0200, Oleksii Kurochko wrote:
> Disable FPU to detect illegal usage of floating point in kernel
> space.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> ---
>  xen/arch/riscv/riscv64/head.S | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
> index ffd95f9f89..52fa41c778 100644
> --- a/xen/arch/riscv/riscv64/head.S
> +++ b/xen/arch/riscv/riscv64/head.S
> @@ -6,6 +6,13 @@ ENTRY(start)
>          /* Mask all interrupts */
>          csrw    CSR_SIE, zero
>  
> +        /*
> +         * Disable FPU to detect illegal usage of
> +         * floating point in kernel space
> +         */
> +        li      t0, SSTATUS_FS
> +        csrc    CSR_SSTATUS, t0
> +
>          la      sp, cpu0_boot_stack
>          li      t0, STACK_SIZE
>          add     sp, sp, t0
> -- 
> 2.39.0
> 
> 

My last email had the wrong trailer:

Reviewed-by: Bobby Eshleman <bobbyeshleman@gmail.com>
diff mbox series

Patch

diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
index ffd95f9f89..52fa41c778 100644
--- a/xen/arch/riscv/riscv64/head.S
+++ b/xen/arch/riscv/riscv64/head.S
@@ -6,6 +6,13 @@  ENTRY(start)
         /* Mask all interrupts */
         csrw    CSR_SIE, zero
 
+        /*
+         * Disable FPU to detect illegal usage of
+         * floating point in kernel space
+         */
+        li      t0, SSTATUS_FS
+        csrc    CSR_SSTATUS, t0
+
         la      sp, cpu0_boot_stack
         li      t0, STACK_SIZE
         add     sp, sp, t0