Changeset 2086948a in rtems
- Timestamp:
- 05/11/18 04:54:59 (5 years ago)
- Branches:
- 5, master
- Children:
- fe2cd01b
- Parents:
- 853c5ef
- git-author:
- Sebastian Huber <sebastian.huber@…> (05/11/18 04:54:59)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (06/28/18 13:02:12)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
bsps/riscv/riscv/start/start.S
r853c5ef r2086948a 53 53 .option pop 54 54 55 #ifdef RTEMS_SMP 56 csrr s0, mhartid 57 bnez s0, .Lloop_forever 58 #endif 59 55 60 la t0, ISR_Handler 56 61 csrw mtvec, t0 … … 70 75 71 76 j boot_card 77 78 #ifdef RTEMS_SMP 79 .Lloop_forever: 80 j .Lloop_forever 81 #endif 72 82 73 83 .align 4 -
c/src/lib/libbsp/riscv/riscv/Makefile.am
r853c5ef r2086948a 62 62 librtemsbsp_a_SOURCES += ../../../../../../bsps/riscv/riscv/console/console-io.c 63 63 64 if HAS_SMP 65 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspsmp-dummy.c 66 endif 64 67 65 68 include $(top_srcdir)/../../../../automake/local.am -
cpukit/score/cpu/riscv/include/rtems/score/cpu.h
r853c5ef r2086948a 81 81 unsigned long mepc; 82 82 #ifdef RTEMS_SMP 83 /**84 * @brief On SMP configurations the thread context must contain a boolean85 * indicator to signal if this context is executing on a processor.86 *87 * This field must be updated during a context switch. The context switch88 * to the heir must wait until the heir context indicates that it is no89 * longer executing on a processor. The context switch must also check if90 * a thread dispatch is necessary to honor updates of the heir thread for91 * this processor. This indicator must be updated using an atomic test and92 * set operation to ensure that at most one processor uses the heir93 * context at the same time.94 *95 * @code96 * void _CPU_Context_switch(97 * Context_Control *executing,98 * Context_Control *heir99 * )100 * {101 * save( executing );102 *103 * executing->is_executing = false;104 * memory_barrier();105 *106 * if ( test_and_set( &heir->is_executing ) ) {107 * do {108 * Per_CPU_Control *cpu_self = _Per_CPU_Get_snapshot();109 *110 * if ( cpu_self->dispatch_necessary ) {111 * heir = _Thread_Get_heir_and_make_it_executing( cpu_self );112 * }113 * } while ( test_and_set( &heir->is_executing ) );114 * }115 *116 * restore( heir );117 * }118 * @endcode119 */120 83 volatile bool is_executing; 121 84 #endif … … 481 444 482 445 #ifdef RTEMS_SMP 483 /** 484 * @brief Performs CPU specific SMP initialization in the context of the boot 485 * processor. 486 * 487 * This function is invoked on the boot processor during system 488 * initialization. All interrupt stacks are allocated at this point in case 489 * the CPU port allocates the interrupt stacks. This function is called 490 * before _CPU_SMP_Start_processor() or _CPU_SMP_Finalize_initialization() is 491 * used. 492 * 493 * @return The count of physically or virtually available processors. 494 * Depending on the configuration the application may use not all processors. 495 */ 446 496 447 uint32_t _CPU_SMP_Initialize( void ); 497 448 498 /**499 * @brief Starts a processor specified by its index.500 *501 * This function is invoked on the boot processor during system502 * initialization.503 *504 * This function will be called after _CPU_SMP_Initialize().505 *506 * @param[in] cpu_index The processor index.507 *508 * @retval true Successful operation.509 * @retval false Unable to start this processor.510 */511 449 bool _CPU_SMP_Start_processor( uint32_t cpu_index ); 512 450 513 /**514 * @brief Performs final steps of CPU specific SMP initialization in the515 * context of the boot processor.516 *517 * This function is invoked on the boot processor during system518 * initialization.519 *520 * This function will be called after all processors requested by the521 * application have been started.522 *523 * @param[in] cpu_count The minimum value of the count of processors524 * requested by the application configuration and the count of physically or525 * virtually available processors.526 */527 451 void _CPU_SMP_Finalize_initialization( uint32_t cpu_count ); 528 452 529 /** 530 * @brief Returns the index of the current processor. 531 * 532 * An architecture specific method must be used to obtain the index of the 533 * current processor in the system. The set of processor indices is the 534 * range of integers starting with zero up to the processor count minus one. 535 */ 536 uint32_t _CPU_SMP_Get_current_processor( void ); 537 538 /** 539 * @brief Sends an inter-processor interrupt to the specified target 540 * processor. 541 * 542 * This operation is undefined for target processor indices out of range. 543 * 544 * @param[in] target_processor_index The target processor index. 545 */ 453 void _CPU_SMP_Prepare_start_multitasking( void ); 454 455 static inline uint32_t _CPU_SMP_Get_current_processor( void ) 456 { 457 unsigned long mhartid; 458 459 __asm__ volatile ( "csrr %0, mhartid" : "=&r" ( mhartid ) ); 460 461 return (uint32_t) mhartid; 462 } 463 546 464 void _CPU_SMP_Send_interrupt( uint32_t target_processor_index ); 547 465 548 /** 549 * @brief Broadcasts a processor event. 550 * 551 * Some architectures provide a low-level synchronization primitive for 552 * processors in a multi-processor environment. Processors waiting for this 553 * event may go into a low-power state and stop generating system bus 554 * transactions. This function must ensure that preceding store operations 555 * can be observed by other processors. 556 * 557 * @see _CPU_SMP_Processor_event_receive(). 558 */ 559 void _CPU_SMP_Processor_event_broadcast( void ); 560 561 /** 562 * @brief Receives a processor event. 563 * 564 * This function will wait for the processor event and may wait forever if no 565 * such event arrives. 566 * 567 * @see _CPU_SMP_Processor_event_broadcast(). 568 */ 466 static inline void _CPU_SMP_Processor_event_broadcast( void ) 467 { 468 __asm__ volatile ( "" : : : "memory" ); 469 } 470 569 471 static inline void _CPU_SMP_Processor_event_receive( void ) 570 472 { … … 572 474 } 573 475 574 /**575 * @brief Gets the is executing indicator of the thread context.576 *577 * @param[in] context The context.578 */579 476 static inline bool _CPU_Context_Get_is_executing( 580 477 const Context_Control *context … … 584 481 } 585 482 586 /**587 * @brief Sets the is executing indicator of the thread context.588 *589 * @param[in] context The context.590 * @param[in] is_executing The new value for the is executing indicator.591 */592 483 static inline void _CPU_Context_Set_is_executing( 593 484 Context_Control *context, … … 597 488 context->is_executing = is_executing; 598 489 } 490 599 491 #endif /* RTEMS_SMP */ 600 492 -
cpukit/score/cpu/riscv/include/rtems/score/cpuimpl.h
r853c5ef r2086948a 6 6 7 7 /* 8 * Copyright (c) 2013 embedded brains GmbH8 * Copyright (c) 2013, 2018 embedded brains GmbH 9 9 * 10 10 * Redistribution and use in source and binary forms, with or without … … 37 37 #define CPU_PER_CPU_CONTROL_SIZE 0 38 38 39 #if __riscv_xlen == 32 40 41 #define CPU_INTERRUPT_FRAME_SIZE 144 42 43 #elif __riscv_xlen == 64 44 45 #define CPU_INTERRUPT_FRAME_SIZE 288 46 47 #endif /* __riscv_xlen */ 48 39 49 #ifndef ASM 40 50 -
testsuites/smptests/smpfatal08/init.c
r853c5ef r2086948a 72 72 73 73 #if defined(RTEMS_PARAVIRT) \ 74 || (!defined(__leon__) && !defined(__PPC__) && !defined(__arm__)) 74 || (!defined(__leon__) && !defined(__PPC__) \ 75 && !defined(__arm__) && !defined(__riscv)) 75 76 uint32_t _CPU_SMP_Get_current_processor(void) 76 77 {
Note: See TracChangeset
for help on using the changeset viewer.