summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-14 10:56:09 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-14 11:57:48 +0200
commitb61d5cac7c5f1ba801a8d0f896313b2e5cd01111 (patch)
treeb76e1012bcf602b35b426582ab4e97c38ed5df8f
parent042072bfdfa6ff6a54c74cc54476c5175377bf63 (diff)
downloadrtems-b61d5cac7c5f1ba801a8d0f896313b2e5cd01111.tar.bz2
bsps: Add CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR
Add CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR clock driver option. If defined, then do the clock tick processing on the boot processor on behalf of all other processors. Currently, this is intended as a workaround for a Qemu shortcoming on ARM. Update #2737.
-rw-r--r--c/src/lib/libbsp/arm/realview-pbx-a9/configure.ac5
-rw-r--r--c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c4
-rw-r--r--c/src/lib/libbsp/shared/clockdrv_shell.h29
3 files changed, 31 insertions, 7 deletions
diff --git a/c/src/lib/libbsp/arm/realview-pbx-a9/configure.ac b/c/src/lib/libbsp/arm/realview-pbx-a9/configure.ac
index f26f726e07..5b641849c0 100644
--- a/c/src/lib/libbsp/arm/realview-pbx-a9/configure.ac
+++ b/c/src/lib/libbsp/arm/realview-pbx-a9/configure.ac
@@ -41,6 +41,11 @@ RTEMS_BSPOPTS_HELP([CLOCK_DRIVER_USE_FAST_IDLE],
occurs while the IDLE thread is executing. This can significantly reduce
simulation times.])
+RTEMS_BSPOPTS_SET([CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR],[*qemu*],[1])
+RTEMS_BSPOPTS_HELP([CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR],
+[If defined, then do the clock tick processing on the boot processor on behalf
+of all other processors.])
+
RTEMS_CHECK_SMP
AM_CONDITIONAL(HAS_SMP,[test "$rtems_cv_HAS_SMP" = "yes"])
diff --git a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
index 3dcf708bcc..63a3dd7fd2 100644
--- a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
+++ b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
@@ -94,7 +94,7 @@ static void a9mpcore_clock_gt_init(
| A9MPCORE_GT_CTRL_TMR_EN;
}
-#ifdef RTEMS_SMP
+#if defined(RTEMS_SMP) && !defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
typedef struct {
uint64_t cmpval;
uint32_t interval;
@@ -116,7 +116,7 @@ static void a9mpcore_clock_secondary_initialization(
uint32_t interval
)
{
-#ifdef RTEMS_SMP
+#if defined(RTEMS_SMP) && !defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
a9mpcore_clock_init_data init_data = {
.cmpval = cmpval,
.interval = interval
diff --git a/c/src/lib/libbsp/shared/clockdrv_shell.h b/c/src/lib/libbsp/shared/clockdrv_shell.h
index af038610a6..6609f5ea9b 100644
--- a/c/src/lib/libbsp/shared/clockdrv_shell.h
+++ b/c/src/lib/libbsp/shared/clockdrv_shell.h
@@ -21,6 +21,7 @@
#include <rtems/clockdrv.h>
#include <rtems/score/percpu.h>
#include <rtems/score/smpimpl.h>
+#include <rtems/score/watchdogimpl.h>
#ifdef Clock_driver_nanoseconds_since_last_tick
#error "Update driver to use the timecounter instead of nanoseconds extension"
@@ -64,11 +65,29 @@
* instead of the default.
*/
#ifndef Clock_driver_timecounter_tick
- #ifdef CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER
- #define Clock_driver_timecounter_tick() rtems_clock_tick()
- #else
- #define Clock_driver_timecounter_tick() rtems_timecounter_tick()
- #endif
+static void Clock_driver_timecounter_tick( void )
+{
+#if defined(CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER)
+ rtems_clock_tick();
+#elif defined(RTEMS_SMP) && defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
+ uint32_t cpu_count = _SMP_Get_processor_count();
+ uint32_t cpu_index;
+
+ for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
+ Per_CPU_Control *cpu;
+
+ cpu = _Per_CPU_Get_by_index( cpu_index );
+
+ if ( _Per_CPU_Is_boot_processor( cpu ) ) {
+ rtems_timecounter_tick();
+ } else if ( _Processor_mask_Is_set( _SMP_Online_processors, cpu_index ) ) {
+ _Watchdog_Tick( cpu );
+ }
+ }
+#else
+ rtems_timecounter_tick();
+#endif
+}
#endif
/**