RE: [PATCH v2 1/1] bsps/riscv: Add per cpu clock interrupt
> -Original Message- > From: Gedare Bloom > Sent: Monday, March 22, 2021 5:52 PM > To: Sebastian Huber > Cc: Sommer, Jan ; devel@rtems.org > Subject: Re: [PATCH v2 1/1] bsps/riscv: Add per cpu clock interrupt > > On Mon, Mar 22, 2021 at 10:28 AM Sebastian Huber > wrote: > > > > > > On 22/03/2021 16:56, Jan Sommer wrote: > > > diff --git a/bsps/riscv/riscv/clock/clockdrv.c > > > b/bsps/riscv/riscv/clock/clockdrv.c > > > index d085b6bd95..e8a39c8591 100644 > > > --- a/bsps/riscv/riscv/clock/clockdrv.c > > > +++ b/bsps/riscv/riscv/clock/clockdrv.c > > > @@ -41,6 +41,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > > > > #include > > > > > > @@ -92,13 +93,18 @@ static void riscv_clock_at_tick(riscv_timecounter > *tc) > > > { > > > volatile RISCV_CLINT_regs *clint; > > > uint64_t value; > > > + uint32_t cpu = 0; > > > + > > > +#if defined(RTEMS_SMP) > > > + cpu = _CPU_SMP_Get_current_processor(); #endif > > You can use rtems_scheduler_get_processor() to get rid of this include > > of an implementation header and the #if. > > > > Nice catch. Jan, you can push it with the modification to use the API function > instead. (Note: BSPs are in a gray area, but generally considered as > "application" layer, so we should prefer they use the APIs, and if they need > to poke into the internals of RTEMS, we need to consider why and what can > be done to avoid violation of the > layer/encapsulation.) > Thanks. Pushed to master with the changes applied. > > -- > > embedded brains GmbH > > Herr Sebastian HUBER > > Dornierstr. 4 > > 82178 Puchheim > > Germany > > email: sebastian.hu...@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/ > > > > ___ > > devel mailing list > > devel@rtems.org > > http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
RE: [PATCH v2 1/1] bsps/riscv: Add per cpu clock interrupt
> -Original Message- > From: Sebastian Huber > Sent: Monday, March 22, 2021 5:28 PM > To: Sommer, Jan ; devel@rtems.org > Subject: Re: [PATCH v2 1/1] bsps/riscv: Add per cpu clock interrupt > > > On 22/03/2021 16:56, Jan Sommer wrote: > > diff --git a/bsps/riscv/riscv/clock/clockdrv.c > > b/bsps/riscv/riscv/clock/clockdrv.c > > index d085b6bd95..e8a39c8591 100644 > > --- a/bsps/riscv/riscv/clock/clockdrv.c > > +++ b/bsps/riscv/riscv/clock/clockdrv.c > > @@ -41,6 +41,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > > > @@ -92,13 +93,18 @@ static void riscv_clock_at_tick(riscv_timecounter > *tc) > > { > > volatile RISCV_CLINT_regs *clint; > > uint64_t value; > > + uint32_t cpu = 0; > > + > > +#if defined(RTEMS_SMP) > > + cpu = _CPU_SMP_Get_current_processor(); #endif > You can use rtems_scheduler_get_processor() to get rid of this include of an > implementation header and the #if. > Great. I was looking for that, but thought the function should be used by higher level applications because of the scheduler in the name. Should have looked closer to see that it will end up _CPU_SMP_Get_current_processor in the end anyways. Thanks, Jan > -- > embedded brains GmbH > Herr Sebastian HUBER > Dornierstr. 4 > 82178 Puchheim > Germany > email: sebastian.hu...@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/ ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH v2 1/1] bsps/riscv: Add per cpu clock interrupt
On Mon, Mar 22, 2021 at 10:28 AM Sebastian Huber wrote: > > > On 22/03/2021 16:56, Jan Sommer wrote: > > diff --git a/bsps/riscv/riscv/clock/clockdrv.c > > b/bsps/riscv/riscv/clock/clockdrv.c > > index d085b6bd95..e8a39c8591 100644 > > --- a/bsps/riscv/riscv/clock/clockdrv.c > > +++ b/bsps/riscv/riscv/clock/clockdrv.c > > @@ -41,6 +41,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > > > @@ -92,13 +93,18 @@ static void riscv_clock_at_tick(riscv_timecounter *tc) > > { > > volatile RISCV_CLINT_regs *clint; > > uint64_t value; > > + uint32_t cpu = 0; > > + > > +#if defined(RTEMS_SMP) > > + cpu = _CPU_SMP_Get_current_processor(); > > +#endif > You can use rtems_scheduler_get_processor() to get rid of this include > of an implementation header and the #if. > Nice catch. Jan, you can push it with the modification to use the API function instead. (Note: BSPs are in a gray area, but generally considered as "application" layer, so we should prefer they use the APIs, and if they need to poke into the internals of RTEMS, we need to consider why and what can be done to avoid violation of the layer/encapsulation.) > -- > embedded brains GmbH > Herr Sebastian HUBER > Dornierstr. 4 > 82178 Puchheim > Germany > email: sebastian.hu...@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/ > > ___ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH v2 1/1] bsps/riscv: Add per cpu clock interrupt
On 22/03/2021 16:56, Jan Sommer wrote: diff --git a/bsps/riscv/riscv/clock/clockdrv.c b/bsps/riscv/riscv/clock/clockdrv.c index d085b6bd95..e8a39c8591 100644 --- a/bsps/riscv/riscv/clock/clockdrv.c +++ b/bsps/riscv/riscv/clock/clockdrv.c @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -92,13 +93,18 @@ static void riscv_clock_at_tick(riscv_timecounter *tc) { volatile RISCV_CLINT_regs *clint; uint64_t value; + uint32_t cpu = 0; + +#if defined(RTEMS_SMP) + cpu = _CPU_SMP_Get_current_processor(); +#endif You can use rtems_scheduler_get_processor() to get rid of this include of an implementation header and the #if. -- embedded brains GmbH Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.hu...@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/ ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel