I was trying to add some asm code in ko module, simply:
asm volatile("vpush {d8}")
Error occurs while compiling:
Error: selected processor does not support ARM mode `vpush {d8}'
Is this expected? Thanks.
I was trying to add some asm code in ko module, simply:
asm volatile("vpush {d8}")
Error occurs while compiling:
Error: selected processor does not support ARM mode `vpush {d8}'
Is this expected? Thanks.
Floating points are not used in kernel development in general. Not every hardware supports FP, some platforms may have advanced power features and can turn on and off FP unit at times. Handling all these is quite cumbersome and you can always find another way to solve your issue.
Robert Love's "Linux Kernel Development"
No (Easy) Use of Floating Point
... Using a floating point inside the kernel requires manually saving and restoring the floating point registers, among other possible chores. The short answer is: Don’t do it! Except in the rare cases, no floating-point operations are in the kernel.
And more... https://stackoverflow.com/a/13886805/1163019
It is that your compiler invocation doesn't specify any mfpu
directives in compliance to above, so you get that error message.
The main downside of kernel mode NEON (or vfp) is the register state must be saved/restored as a context switch can take place at any moment. So even if a co-processor is used, the challenge is to make any user visible state look the same when it runs. That is the Zeitgeist of this issue.
More recent kernels have Kconfig KERNEL_MODE_NEON inside Floating Point Emulation. The kernel mode NEON support is limited and documentation is found in Documentation/arm/kernel_mode_neon.txt. In order to make the kernel_neon_begin()
and kernel_neon_end()
register save/restores work, pre-emption is also disabled while they are in use; otherwise the scheduler would have to know that some kernel mode had change the NEON/VFP state and get it somewhere.
The KERNEL_MODE_NEON commit can be seen and it has restrictions for different GCC versions which can emit NEON code anywhere when compiled with -mpfu=neon
; so any external call into the NEON compilation unit should be wrapped with kernel_neon_begin()
and kernel_neon_end()
. It should be present since 3.11 kernels.