Want to add RISC-V-based PolarFire SoC support to RTEMS

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Aug 29 07:30:23 UTC 2022


Hello Padmarao,

On 26/08/2022 13:37, Padmarao.Begari at microchip.com wrote:
> The boot HARTID configurable is Ok but I am thinking about SMP.
> 
> The PolarFire SoC has 4 U54's with hartid 1,2,3,4 but the SMP
> starts with cpu number '0' to MAX cpu number then the PolarFire
> SoC U54's hartid number should become 0,1,2,3 to run the SMP.

the numbers returned by

static inline uint32_t _CPU_SMP_Get_current_processor( void )
{
   unsigned long mhartid;

   __asm__ volatile (
     ".option push\n"
     ".option arch, +zicsr\n"
     "csrr %0, mhartid\n"
     ".option pop" :
     "=&r" ( mhartid )
   );

   return (uint32_t) mhartid;
}

must be in the range 0, ..., CPU count - 1. For your chip you need 
something like

static inline uint32_t _CPU_SMP_Get_current_processor( void )
{
   unsigned long mhartid;

   __asm__ volatile (
     ".option push\n"
     ".option arch, +zicsr\n"
     "csrr %0, mhartid\n"
     ".option pop" :
     "=&r" ( mhartid )
   );

   return (uint32_t) mhartid + RISCV_MHARTID_OFFSET;
}

The RISCV_MHARTID_OFFSET could be a new CPU option which has 
BSP-dependent default values. It would be the first CPU option in RTEMS 
with BSP-dependent default values.

-- 
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 users mailing list