- Timestamp:
- Jul 15, 2015, 6:17:41 PM (9 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_boot/boot.c
r590 r615 164 164 unsigned int _tty0_boot_mode = 1; 165 165 166 // boot code does not use distributed locks to protect MMC 167 __attribute__((section(".kdata"))) 168 unsigned int _mmc_boot_mode = 1; 169 166 170 // boot code does not uses a lock to protect HBA command allocator 167 171 __attribute__((section(".kdata"))) -
soft/giet_vm/giet_drivers/mmc_driver.c
r545 r615 39 39 40 40 /////////////////////////////////////////////////////////////////////////////// 41 // Distributed locks protecting MMC components (one per cluster) 42 /////////////////////////////////////////////////////////////////////////////// 41 // Locks protecting MMC components (one per cluster) 42 // There are two kinds of lock: the _mmc_lock table contains all the locks and 43 // and is stored in the kernel data segment, whereas the _mmc_distributed_lock 44 // contains the addresses of locks which are distributed in every cluster (each 45 // cluster contains the lock which protects its own mmc_component). 46 // The global variable mmc_boot_mode define the type of lock which is used, 47 // and must be defined in both kernel_init.c and boot.c files. 48 // - the boot code must use a spin_lock because the kernel heap is not set. 49 // - the kernel code can use a sqt_lock when the kernel heap is set. 50 /////////////////////////////////////////////////////////////////////////////// 51 52 extern unsigned int _mmc_boot_mode; 43 53 44 54 __attribute__((section(".kdata"))) 45 spin_lock_t _mmc_lock[X_SIZE][Y_SIZE] __attribute__((aligned(64))); 55 spin_lock_t _mmc_lock[X_SIZE][Y_SIZE] __attribute__((aligned(64))); 56 57 __attribute__((section(".kdata"))) 58 spin_lock_t* _mmc_distributed_lock[X_SIZE][Y_SIZE]; 59 60 ////////////////////////////////////////////////////////////////////////////// 61 // This function initializes the distributed locks stored in the kernel heaps 62 ////////////////////////////////////////////////////////////////////////////// 63 64 void _mmc_init_locks() 65 { 66 unsigned int cx; // cluster X coordinate 67 unsigned int cy; // cluster Y coordinate 68 69 for ( cx = 0 ; cx < X_SIZE ; cx++ ) 70 { 71 for ( cy = 0 ; cy < Y_SIZE ; cy++ ) 72 { 73 _mmc_distributed_lock[cx][cy] = _remote_malloc( sizeof(spin_lock_t), cx, cy ); 74 _spin_lock_init( _mmc_distributed_lock[cx][cy] ); 75 } 76 } 77 } 46 78 47 79 /////////////////////////////////////////////////////////////////////////////// … … 105 137 106 138 // get the lock protecting exclusive access to MEMC 107 _spin_lock_acquire( &_mmc_lock[x][y] ); 139 if ( _mmc_boot_mode ) _spin_lock_acquire( &_mmc_lock[x][y] ); 140 else _spin_lock_acquire( _mmc_distributed_lock[x][y] ); 108 141 109 142 // write inval arguments … … 114 147 115 148 // release the lock 116 _spin_lock_release( &_mmc_lock[x][y] ); 149 if ( _mmc_boot_mode ) _spin_lock_release( &_mmc_lock[x][y] ); 150 else _spin_lock_release( _mmc_distributed_lock[x][y] ); 117 151 } 118 152 … … 140 174 141 175 // get the lock protecting exclusive access to MEMC 142 _spin_lock_acquire( &_mmc_lock[x][y] ); 176 if ( _mmc_boot_mode ) _spin_lock_acquire( &_mmc_lock[x][y] ); 177 else _spin_lock_acquire( _mmc_distributed_lock[x][y] ); 143 178 144 179 // write inval arguments … … 149 184 150 185 // release the lock 151 _spin_lock_release( &_mmc_lock[x][y] ); 186 if ( _mmc_boot_mode ) _spin_lock_release( &_mmc_lock[x][y] ); 187 else _spin_lock_release( _mmc_distributed_lock[x][y] ); 152 188 } 153 189 -
soft/giet_vm/giet_drivers/mmc_driver.h
r496 r615 11 11 #include <hard_config.h> 12 12 #include <kernel_locks.h> 13 #include <kernel_malloc.h> 13 14 14 15 /////////////////////////////////////////////////////////////////////////////////// … … 124 125 /////////////////////////////////////////////////////////////////////////////////// 125 126 127 extern void _mmc_init_locks(); 128 126 129 extern unsigned int _mmc_instrument( unsigned int x, 127 130 unsigned int y, -
soft/giet_vm/giet_kernel/kernel_init.c
r592 r615 113 113 unsigned int _tty0_boot_mode = 0; 114 114 115 // Kernel uses distributed locks to protect MMC 116 __attribute__((section(".kdata"))) 117 unsigned int _mmc_boot_mode = 0; 118 115 119 // Kernel uses sqt_lock to protect command allocator in HBA 116 120 __attribute__((section(".kdata"))) … … 161 165 #if GIET_DEBUG_INIT 162 166 _nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes kernel heap init\n", x, y, p ); 167 #endif 168 ////// distributed lock for MMC 169 _mmc_init_locks(); 170 171 #if GIET_DEBUG_INIT 172 _nolock_printf("\n[DEBUG KINIT] P[%d,%d,%d] completes MMC distributed lock init\n", x , y , p ); 163 173 #endif 164 174 ////// distributed lock for TTY0
Note: See TracChangeset
for help on using the changeset viewer.