-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kernel: arch: introduce k_float_enable() #31816
Conversation
checkpatch got angry if I used ENOSYS in arch_float_enalbe() stub functions... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be in the right direction.
* | ||
* The function is used to enable the preservation of floating | ||
* point context information for a particular thread. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some text, also, here, that this API is optional , and depends on the architecture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added such text.
Conflicting k_float_enable() on x86 platform... I will check. |
25f314c
to
ab2d5bb
Compare
Changes in v2.
|
ab2d5bb
to
05b090c
Compare
@@ -179,7 +179,7 @@ static inline void FpCtxInit(struct k_thread *thread) | |||
* The locking isn't really needed when the routine is called by a cooperative | |||
* thread (since context switching can't occur), but it is harmless. | |||
*/ | |||
void k_float_enable(struct k_thread *thread, unsigned int options) | |||
void z_float_enable(struct k_thread *thread, unsigned int options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming it to arch_float_enable()
will get rid of the z_float_enable()
redirection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review. Yes, right. This is to keep consistency with existed k_float_disable() implementation.
If change such k_float_*() redirection of x86, it's better to change in an other commit (or PR ?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to update it in another PR.
@katsuster pls, take a look at the compliance check failures |
@ioannisg |
Regarding I have no position on this PR nor on whether the checkpatch diagnostics on |
Based on the information provided in #23727 I believe the Zephyr standard solution would be to use |
@katsuster we concluded that you should replace |
@pabigot Thanks for describing about ENOSYS and ENOTSUP. |
#33637 updates the checkpatch behavior. |
This patch introduce new API to enable FPU of thread. This is pair of existed k_float_disable() API. And also add empty arch_float_enable() into each architectures that have arch_float_disable(). The arc and riscv already implemented arch_float_enable() so I do not touch these implementations. Motivation: Current Zephyr implementation does not allow to use FPU on main and other system threads like as work queue. Users need to create an other thread with K_FP_REGS for floating point programs. Users can use FPU more easily if they can enable FPU on running threads. Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
This patch replaces ENOSYS into ENOTSUP to keep consistency with the return value specification of k_float_enable(). Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
@ruuddw @evgeniy-paltsev @abrodkin please review for arc |
The PR said "The arc and riscv already implemented arch_float_enable() so I do not touch these implementations." so I didn't pay much attention, thanks for explicitly asking. I see an "option" parameter has been added (used by x86), that's fine. |
This patch introduce new API to enable FPU of thread. This is pair of
existed k_float_disable() API. And also add empty arch_float_enable()
into each architectures that have arch_float_disable(). The arc and
riscv already implemented arch_float_enable() so I do not touch
these implementations.
Motivation: Current Zephyr implementation does not allow to use FPU
on main and other system threads like as work queue. Users need to
create an other thread with K_FP_REGS for floating point programs.
Users can use FPU more easily if they can enable FPU on running
threads.