AMD DC graphics display code enables -mhard-float, -msse, -msse2 without any visible FPU state protection

Christian König christian.koenig at amd.com
Thu Apr 9 18:15:57 UTC 2020


Am 09.04.20 um 19:09 schrieb Peter Zijlstra:
> On Thu, Apr 09, 2020 at 05:59:56PM +0200, Peter Zijlstra wrote:
> [SNIP]
>> I'll need another approach, let me consider.
> Christian; it says these files are generated, does that generator know
> which functions are wholly in FPU context and which are not?

Well that "generator" is still a human being :)

It's just that the formulae for the calculation come from the hardware 
team and we are not able to easily transcript them to fixed point 
calculations.

> My current thinking is that if I annotate all functions that are wholly
> inside kernel_fpu_start() with an __fpu function attribute, then I can
> verify that any call from regular text to fpu text only happens inside
> kernel_fpu_begin()/end(). And I can ensure that all !__fpu annotation
> fuctions only contain !fpu instructions.

Yeah, that sounds like a good idea to me and should be easily doable.

> Can that generator add the __fpu function attribute or is that something
> that would need to be done manually (which seems like it would be
> painful, since it is quite a bit of code) ?

We are currently in the process of moving all the stuff which requires 
floating point into a single C file(s) and then make sure that we only 
call those within kernel_fpu_begin()/end() blocks.

Annotating those function with __fpu or even saying to gcc that all code 
of those files should go into a special text.fpu segment shouldn't be 
much of a problem.

Regards,
Christian.


More information about the amd-gfx mailing list