Skip to content

Add feature to simplify lazy stacking of FPU context #611

@christian-herber-nxp

Description

@christian-herber-nxp

https://docs.zephyrproject.org/latest/kernel/services/other/float.html#risc-v-architecture

Zephyr has a concept of lazy stacking of FPU registers.
In a nutshell, FPU registers are not stacked, and FPU accesses cause an illegal instruction exception.
As RISC-V does not have a dedicated FP exception, the exception handler has to decode if the faulting instruction is an FPU instruction.
This is quite cumbersome: https://github.com/zephyrproject-rtos/zephyr/blob/c0a2928f46e962e05504981e7e4dacaca9be4114/arch/riscv/core/isr.S#L238

This code is difficult to maintain (e.g. does not support Zfinx (for Zfinx, a completely different strategy should anyway be chosen) or Zfa), and adds a significant penalty on the execution time.

I am not proposing a solution for now, but there should be plenty ways in which adding a single bit somewhere makes all this code obsolete.
Same thing would apply to V.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions