[PATCH v2 3/9] bsps/leon3: Make GPTIMER fall back mandatory

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Oct 19 13:44:38 UTC 2023


Hello Martin,

thanks for the review.

On 19.10.23 12:22, Martin Åberg wrote:
> 
> On 2023-10-13 13:00, Sebastian Huber wrote:
>> Hello Martin,
>>
>> On 13.10.23 12:09, Martin Åberg wrote:
>>>
>>> What are the implications when using RTEMS_MULTIPROCESSING together 
>>> with "use_gptimer"?
>>>
>>> In bsps/sparc/leon3/include/bsp/leon3.h, we have:
>>>  >  #if defined(RTEMS_MULTIPROCESSING)
>>>  >  #define LEON3_CLOCK_INDEX \
>>>  >    ( rtems_configuration_get_user_multiprocessing_table() ? 
>>> LEON3_Cpu_Index : 0 )
>>>  >  #else
>>>  >  #define LEON3_CLOCK_INDEX 0
>>>  >  #endif
>>>
>>> Can LEON3_COUNTER_GPTIMER_INDEX of CPU0 be equal to LEON3_CLOCK_INDEX 
>>> of CPU1 here?
>>
>> The individual RTEMS instances could share the GPTIMER configured in 
>> free-running mode.
> 
> LEON3_Timer_Regs is probed in amba.c. There is a link time option to set 
> GPTIMER core index (leon3_timer_core_index). Instances could have unique 
> GPTIMER cores associated.
> 
> The preprocessor symbols LEON3_CLOCK_INDEX (clock driver) and 
> LEON3_COUNTER_GPTIMER_INDEX (timecounter) are used as subtimer index of 
> the GPTIMER core LEON3_Timer_Regs.
> 
> For CPU0 these are:
>    - LEON3_CLOCK_INDEX is 0 (equal to hardware processor index)
>    - LEON3_COUNTER_GPTIMER_INDEX is 1 (LEON3_CLOCK_INDEX+1)
> For CPU1 these are:
>    - LEON3_CLOCK_INDEX is 1 (equal to hardware processor index)
>    - LEON3_COUNTER_GPTIMER_INDEX is 2 (LEON3_CLOCK_INDEX+1)
> etc...
> 
> In the case when LEON3_Timer_Regs is different on CPU0 and CPU1, there 
> is no conflict but will leave low-numbered subtimers unused. (Behavior 
> not introduced by this patch.)
> 
> In the case when LEON3_Timer_Regs is equal on the CPU0 and CPU1 
> instances, it appears there is now a conflict between 
> CPU0:LEON3_COUNTER_GPTIMER_INDEX and CPU1:LEON3_CLOCK_INDEX.

Ok, I suggest to change the LEON3_CLOCK_INDEX definition to:

/**
  * @brief This constant defines the index of the GPTIMER timer used by the
  *   clock driver.
  */
#if defined(RTEMS_MULTIPROCESSING)
#define LEON3_CLOCK_INDEX \
   ( leon3_timer_core_index != 0 ? 0 : 2 * LEON3_Cpu_Index )
#else
#define LEON3_CLOCK_INDEX 0
#endif

/**
  * @brief This constant defines the index of the GPTIMER timer used by the
  *   CPU counter if the CPU counter uses the GPTIMER.
  */
#if defined(RTEMS_SMP)
#define LEON3_COUNTER_GPTIMER_INDEX ( LEON3_CLOCK_INDEX + 1 )
#else
#define LEON3_COUNTER_GPTIMER_INDEX LEON3_CLOCK_INDEX
#endif

The rtems_configuration_get_user_multiprocessing_table() is always != 
NULL if RTEMS_MULTIPROCESSING is defined.

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list