Re: [PATCH 4/5] ARC: add support for DSP-enabled userspace applications

From: Eugeniy Paltsev
Date: Thu Jan 09 2020 - 14:02:01 EST


Hi Vineet,

>From: Vineet Gupta <vgupta@xxxxxxxxxxxx>
>On 12/27/19 10:03 AM, Eugeniy Paltsev wrote:
>> To be able to run DSP-enabled userspace applications we need to
>> save and restore following DSP-related registers:
>> At IRQ/exception entry/exit:
>> * ACC0_GLO, ACC0_GHI, DSP_CTRL
>> * ACC0_LO, ACC0_HI (we already save them as r58, r59 pair)
>> At context switch:
>> * DSP_BFLY0, DSP_FFT_CTRL
[snip]
>> +
>> +#ifndef __ASSEMBLY__
>> +
>> +/* some defines to simplify config sanitize in kernel/setup.c */
>> +#if defined(CONFIG_ARC_DSP_KERNEL) || \
>> + defined(CONFIG_ARC_DSP_USERSPACE)
>> +#define ARC_DSP_HANDLED 1
>> +#else
>> +#define ARC_DSP_HANDLED 0
>> +#endif
>
>This is a really bad idea - u r introducing explicit include dependencies which
>can change even outside of arch changes !
>We've dealt with enough of these problems with current.h, so best to avoid, even
>if there is some code clutter.

Hmm, would it be OK if I add this option as a private kconfig option?
I.E (for ARC_DSP_HANDLED):

---------------->8----------------------
config ARC_DSP_HANDLED
def_bool n

choice
prompt "DSP support"
default ARC_DSP_NONE
help
Depending on the configuration, CPU can contain DSP registers
(ACC0_GLO, ACC0_GHI, DSP_BFLY0, DSP_CTRL, DSP_FFT_CTRL).
Bellow is options describing how to handle these registers in
interrupt entry / exit and in context switch.

config ARC_DSP_NONE
bool "No DSP extension presence in HW"
help
No DSP extension presence in HW

config ARC_DSP_KERNEL
bool "DSP extension in HW, no support for userspace"
select ARC_HAS_ACCL_REGS
select ARC_DSP_HANDLED
help
DSP extension presence in HW, no support for DSP-enabled userspace
applications. We don't save / restore DSP registers and only do
some minimal preparations so userspace won't be able to break kernel

config ARC_DSP_USERSPACE
bool "Support DSP for userspace apps"
select ARC_HAS_ACCL_REGS
select ARC_DSP_HANDLED
help
DSP extension presence in HW, support save / restore DSP registers to
run DSP-enabled userspace applications
endchoice
---------------->8----------------------

---
Eugeniy Paltsev