Re: [PATCH 3/5] ARC: handle DSP presence in HW

From: Eugeniy Paltsev
Date: Fri Jan 10 2020 - 09:54:45 EST


Hi Vineet,

>From: Vineet Gupta <vgupta@xxxxxxxxxxxx>
>Sent: Tuesday, January 7, 2020 04:03
>To: Eugeniy Paltsev; linux-snps-arc@xxxxxxxxxxxxxxxxxxx
>Cc: linux-kernel@xxxxxxxxxxxxxxx; Alexey Brodkin
>Subject: Re: [PATCH 3/5] ARC: handle DSP presence in HW
>[snip]
>> +static inline bool dsp_exist(void)
>> +{
>> + struct bcr_generic bcr;
>> +
>> + READ_BCR(ARC_AUX_DSP_BUILD, bcr);
>> + return !!bcr.ver;
>
>open code these use once / one liners in the call site itself.
>
>>
>> @@ -444,6 +445,9 @@ static void arc_chk_core_config(void)
>> /* Accumulator Low:High pair (r58:59) present if DSP MPY or FPU */
>> present = cpu->extn_mpy.dsp | cpu->extn.fpu_sp | cpu->extn.fpu_dp;
>> CHK_OPT_STRICT(CONFIG_ARC_HAS_ACCL_REGS, present);
>> +
>> + present = dsp_exist();
>
>Open code as suggested above.
>
>> + CHK_OPT_STRICT(CONFIG_ARC_DSP_KERNEL, present);
>> }

My idea here is to encapsulate implementation of everything dsp-related in the
file with dsp code. So I'm even thinking about moving the config check itself
to some function like
'arc_chk_dsp_config' which will be located in dsp.x file
and call it from arc_chk_core_config in setup.c

This requires to move config check helpers to separate file/header from the setup.c
However this allows encapsulate all DSP code (and some new subsystems code later on) in its files instead of spread it across the arc code.

What do you think about it? If you really dislike this idea I can drop it.
---
Eugeniy Paltsev