Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[CELL] spufs: fix decr_status meanings

The decr_status in the LSCSA is confusedly used as two meanings:
* SPU decrementer was running
* SPU decrementer was wrapped as a result of adjust
and the code to set decr_status is missing.

This patch fixes these problems by using the decr_status argument as a
set of flags. This requires a rebuild of the shipped spu_restore code.

Signed-off-by: Masato Noguchi <Masato.Noguchi@jp.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>

authored by

Masato Noguchi and committed by
Arnd Bergmann
1cfc0f86 cfd529b2

+290 -244
+1 -1
arch/powerpc/platforms/cell/spufs/spu_restore.c
··· 90 90 * decrementer value from LSCSA. 91 91 */ 92 92 offset = LSCSA_QW_OFFSET(decr_status); 93 - decr_running = regs_spill[offset].slot[0]; 93 + decr_running = regs_spill[offset].slot[0] & SPU_DECR_STATUS_RUNNING; 94 94 if (decr_running) { 95 95 offset = LSCSA_QW_OFFSET(decr); 96 96 decr = regs_spill[offset].slot[0];
+272 -240
arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
··· 10 10 0x24fd8081, 11 11 0x1cd80081, 12 12 0x33001180, 13 - 0x42030003, 13 + 0x42034003, 14 14 0x33800284, 15 15 0x1c010204, 16 16 0x40200000, ··· 24 24 0x23fffd84, 25 25 0x1c100183, 26 26 0x217ffa85, 27 - 0x3080a000, 28 - 0x3080a201, 29 - 0x3080a402, 30 - 0x3080a603, 31 - 0x3080a804, 32 - 0x3080aa05, 33 - 0x3080ac06, 34 - 0x3080ae07, 35 - 0x3080b008, 36 - 0x3080b209, 37 - 0x3080b40a, 38 - 0x3080b60b, 39 - 0x3080b80c, 40 - 0x3080ba0d, 41 - 0x3080bc0e, 42 - 0x3080be0f, 27 + 0x3080b000, 28 + 0x3080b201, 29 + 0x3080b402, 30 + 0x3080b603, 31 + 0x3080b804, 32 + 0x3080ba05, 33 + 0x3080bc06, 34 + 0x3080be07, 35 + 0x3080c008, 36 + 0x3080c209, 37 + 0x3080c40a, 38 + 0x3080c60b, 39 + 0x3080c80c, 40 + 0x3080ca0d, 41 + 0x3080cc0e, 42 + 0x3080ce0f, 43 43 0x00003ffc, 44 44 0x00000000, 45 45 0x00000000, ··· 48 48 0x3ec00083, 49 49 0xb0a14103, 50 50 0x01a00204, 51 - 0x3ec10082, 52 - 0x4202800e, 53 - 0x04000703, 54 - 0xb0a14202, 55 - 0x21a00803, 56 - 0x3fbf028d, 57 - 0x3f20068d, 58 - 0x3fbe0682, 51 + 0x3ec10083, 52 + 0x4202c002, 53 + 0xb0a14203, 54 + 0x21a00802, 55 + 0x3fbf028a, 56 + 0x3f20050a, 57 + 0x3fbe0502, 59 58 0x3fe30102, 60 59 0x21a00882, 61 - 0x3f82028f, 62 - 0x3fe3078f, 63 - 0x3fbf0784, 60 + 0x3f82028b, 61 + 0x3fe3058b, 62 + 0x3fbf0584, 64 63 0x3f200204, 65 64 0x3fbe0204, 66 65 0x3fe30204, ··· 74 75 0x21a00083, 75 76 0x40800082, 76 77 0x21a00b02, 77 - 0x10002818, 78 - 0x42a00002, 79 - 0x32800007, 80 - 0x4207000c, 81 - 0x18008208, 82 - 0x40a0000b, 83 - 0x4080020a, 84 - 0x40800709, 85 - 0x00200000, 86 - 0x42070002, 87 - 0x3ac30384, 78 + 0x10002612, 79 + 0x42a00003, 80 + 0x42074006, 81 + 0x1800c204, 82 + 0x40a00008, 83 + 0x40800789, 84 + 0x1c010305, 85 + 0x34000302, 88 86 0x1cffc489, 89 - 0x00200000, 90 - 0x18008383, 91 - 0x38830382, 92 - 0x4cffc486, 93 - 0x3ac28185, 94 - 0xb0408584, 95 - 0x28830382, 96 - 0x1c020387, 97 - 0x38828182, 98 - 0xb0408405, 99 - 0x1802c408, 100 - 0x28828182, 101 - 0x217ff886, 102 - 0x04000583, 87 + 0x3ec00303, 88 + 0x3ec00287, 89 + 0xb0408403, 90 + 0x24000302, 91 + 0x34000282, 92 + 0x1c020306, 93 + 0xb0408207, 94 + 0x18020204, 95 + 0x24000282, 96 + 0x217ffa09, 97 + 0x04000403, 103 98 0x21a00803, 104 - 0x3fbe0682, 99 + 0x3fbe0502, 105 100 0x3fe30102, 106 - 0x04000106, 107 - 0x21a00886, 108 - 0x04000603, 109 - 0x21a00903, 110 - 0x40803c02, 111 - 0x21a00982, 112 - 0x40800003, 113 - 0x04000184, 101 + 0x04000105, 102 + 0x21a00885, 103 + 0x42074002, 104 + 0x21a00902, 105 + 0x40803c03, 106 + 0x21a00983, 107 + 0x04000484, 114 108 0x21a00a04, 115 109 0x40802202, 116 110 0x21a00a82, 117 - 0x42028005, 118 - 0x34208702, 119 - 0x21002282, 111 + 0x30809c03, 112 + 0x34000182, 113 + 0x14004102, 114 + 0x21002782, 120 115 0x21a00804, 121 - 0x21a00886, 122 - 0x3fbf0782, 116 + 0x21a00885, 117 + 0x3fbf0582, 123 118 0x3f200102, 124 119 0x3fbe0102, 125 120 0x3fe30102, ··· 126 133 0x40800083, 127 134 0x21a00b83, 128 135 0x01a00c02, 129 - 0x01a00d83, 130 - 0x3420c282, 136 + 0x01a00d84, 137 + 0x3080a003, 138 + 0x34000182, 131 139 0x21a00e02, 132 - 0x34210283, 133 - 0x21a00f03, 134 - 0x34200284, 135 - 0x77400200, 136 - 0x3421c282, 140 + 0x3080a203, 141 + 0x34000182, 142 + 0x21a00f02, 143 + 0x3080a403, 144 + 0x34000182, 145 + 0x77400100, 146 + 0x3080a603, 147 + 0x34000182, 137 148 0x21a00702, 138 - 0x34218283, 139 - 0x21a00083, 140 - 0x34214282, 149 + 0x3080a803, 150 + 0x34000182, 151 + 0x21a00082, 152 + 0x3080aa03, 153 + 0x34000182, 141 154 0x21a00b02, 142 - 0x4200480c, 143 - 0x00200000, 144 - 0x1c010286, 145 - 0x34220284, 146 - 0x34220302, 147 - 0x0f608203, 148 - 0x5c024204, 149 - 0x3b81810b, 150 - 0x42013c02, 151 - 0x00200000, 152 - 0x18008185, 153 - 0x38808183, 154 - 0x3b814182, 155 - 0x21004e84, 155 + 0x3080ae02, 156 + 0x3080ac04, 157 + 0x42004805, 158 + 0x34000103, 159 + 0x34000202, 160 + 0x1cffc183, 161 + 0x3b810106, 162 + 0x0f608184, 163 + 0x42013802, 164 + 0x5c020183, 165 + 0x38810102, 166 + 0x3b810102, 167 + 0x21000e83, 156 168 0x4020007f, 157 169 0x35000100, 158 - 0x000004e0, 159 - 0x000002a0, 160 - 0x000002e8, 161 - 0x00000428, 170 + 0x00000470, 171 + 0x000002f8, 172 + 0x00000430, 162 173 0x00000360, 163 - 0x000002e8, 164 - 0x000004a0, 165 - 0x00000468, 174 + 0x000002f8, 166 175 0x000003c8, 176 + 0x000004a8, 177 + 0x00000298, 167 178 0x00000360, 168 - 0x409ffe02, 169 - 0x30801203, 170 - 0x40800204, 171 - 0x3ec40085, 172 - 0x10009c09, 173 - 0x3ac10606, 174 - 0xb060c105, 175 - 0x4020007f, 176 - 0x4020007f, 177 - 0x20801203, 178 - 0x38810602, 179 - 0xb0408586, 180 - 0x28810602, 181 - 0x32004180, 182 - 0x34204702, 183 - 0x21a00382, 184 - 0x4020007f, 185 - 0x327fdc80, 186 - 0x409ffe02, 187 - 0x30801203, 188 - 0x40800204, 189 - 0x3ec40087, 190 - 0x40800405, 191 179 0x00200000, 192 - 0x40800606, 193 - 0x3ac10608, 194 - 0x3ac14609, 195 - 0x3ac1860a, 196 - 0xb060c107, 180 + 0x409ffe02, 181 + 0x30801203, 182 + 0x40800208, 183 + 0x3ec40084, 184 + 0x40800407, 185 + 0x3ac20289, 186 + 0xb060c104, 187 + 0x3ac1c284, 197 188 0x20801203, 189 + 0x38820282, 198 190 0x41004003, 199 - 0x38810602, 200 - 0x4020007f, 201 - 0xb0408188, 202 - 0x4020007f, 203 - 0x28810602, 204 - 0x41201002, 205 - 0x38814603, 206 - 0x10009c09, 207 - 0xb060c109, 208 - 0x4020007f, 209 - 0x28814603, 210 - 0x41193f83, 211 - 0x38818602, 212 - 0x60ffc003, 213 - 0xb040818a, 214 - 0x28818602, 215 - 0x32003080, 216 - 0x409ffe02, 217 - 0x30801203, 218 - 0x40800204, 219 - 0x3ec40087, 220 - 0x41201008, 221 - 0x10009c14, 222 - 0x40800405, 223 - 0x3ac10609, 224 - 0x40800606, 225 - 0x3ac1460a, 226 - 0xb060c107, 227 - 0x3ac1860b, 228 - 0x20801203, 229 - 0x38810602, 230 - 0xb0408409, 231 - 0x28810602, 232 - 0x38814603, 233 - 0xb060c40a, 234 - 0x4020007f, 235 - 0x28814603, 236 - 0x41193f83, 237 - 0x38818602, 238 - 0x60ffc003, 239 - 0xb040818b, 240 - 0x28818602, 241 - 0x32002380, 242 - 0x409ffe02, 243 - 0x30801204, 244 - 0x40800205, 245 - 0x3ec40083, 246 - 0x40800406, 247 - 0x3ac14607, 248 - 0x3ac18608, 249 - 0xb0810103, 250 - 0x41004002, 251 - 0x20801204, 252 - 0x4020007f, 253 - 0x38814603, 254 - 0x10009c0b, 255 - 0xb060c107, 256 - 0x4020007f, 257 - 0x4020007f, 258 - 0x28814603, 259 - 0x38818602, 260 - 0x4020007f, 261 - 0x4020007f, 262 - 0xb0408588, 263 - 0x28818602, 264 - 0x4020007f, 265 - 0x32001780, 266 - 0x409ffe02, 267 - 0x1000640e, 268 - 0x40800204, 269 - 0x30801203, 270 - 0x40800405, 271 - 0x3ec40087, 272 - 0x40800606, 273 - 0x3ac10608, 274 - 0x3ac14609, 275 - 0x3ac1860a, 276 - 0xb060c107, 277 - 0x20801203, 278 - 0x413d8003, 279 - 0x38810602, 280 - 0x4020007f, 281 - 0x327fd780, 282 - 0x409ffe02, 283 - 0x10007f0c, 284 - 0x40800205, 285 - 0x30801204, 286 - 0x40800406, 287 - 0x3ec40083, 288 - 0x3ac14607, 289 - 0x3ac18608, 290 - 0xb0810103, 291 - 0x413d8002, 292 - 0x20801204, 293 - 0x38814603, 294 - 0x4020007f, 295 - 0x327feb80, 296 - 0x409ffe02, 297 - 0x30801203, 298 - 0x40800204, 299 - 0x3ec40087, 300 - 0x40800405, 301 - 0x1000650a, 302 - 0x40800606, 303 - 0x3ac10608, 304 - 0x3ac14609, 305 - 0x3ac1860a, 306 - 0xb060c107, 307 - 0x20801203, 308 - 0x38810602, 309 - 0xb0408588, 310 - 0x4020007f, 311 - 0x327fc980, 191 + 0xb0408189, 192 + 0x28820282, 193 + 0x3881c282, 194 + 0xb0408304, 195 + 0x2881c282, 312 196 0x00400000, 313 197 0x40800003, 314 - 0x4020007f, 315 198 0x35000000, 199 + 0x30809e03, 200 + 0x34000182, 201 + 0x21a00382, 202 + 0x4020007f, 203 + 0x327fd700, 204 + 0x409ffe02, 205 + 0x30801203, 206 + 0x40800206, 207 + 0x3ec40084, 208 + 0x40800407, 209 + 0x40800608, 210 + 0x3ac1828a, 211 + 0x3ac20289, 212 + 0xb060c104, 213 + 0x3ac1c284, 214 + 0x20801203, 215 + 0x38818282, 216 + 0x41004003, 217 + 0xb040818a, 218 + 0x10005b0b, 219 + 0x41201003, 220 + 0x28818282, 221 + 0x3881c282, 222 + 0xb0408184, 223 + 0x41193f83, 224 + 0x60ffc003, 225 + 0x2881c282, 226 + 0x38820282, 227 + 0xb0408189, 228 + 0x28820282, 229 + 0x327fef80, 230 + 0x409ffe02, 231 + 0x30801203, 232 + 0x40800207, 233 + 0x3ec40086, 234 + 0x4120100b, 235 + 0x10005b14, 236 + 0x40800404, 237 + 0x3ac1c289, 238 + 0x40800608, 239 + 0xb060c106, 240 + 0x3ac10286, 241 + 0x3ac2028a, 242 + 0x20801203, 243 + 0x3881c282, 244 + 0x41193f83, 245 + 0x60ffc003, 246 + 0xb0408589, 247 + 0x2881c282, 248 + 0x38810282, 249 + 0xb0408586, 250 + 0x28810282, 251 + 0x38820282, 252 + 0xb040818a, 253 + 0x28820282, 254 + 0x4020007f, 255 + 0x327fe280, 256 + 0x409ffe02, 257 + 0x30801203, 258 + 0x40800207, 259 + 0x3ec40084, 260 + 0x40800408, 261 + 0x10005b14, 262 + 0x40800609, 263 + 0x3ac1c28a, 264 + 0x3ac2028b, 265 + 0xb060c104, 266 + 0x3ac24284, 267 + 0x20801203, 268 + 0x41201003, 269 + 0x3881c282, 270 + 0xb040830a, 271 + 0x2881c282, 272 + 0x38820282, 273 + 0xb040818b, 274 + 0x41193f83, 275 + 0x60ffc003, 276 + 0x28820282, 277 + 0x38824282, 278 + 0xb0408184, 279 + 0x28824282, 280 + 0x4020007f, 281 + 0x327fd580, 282 + 0x409ffe02, 283 + 0x1000658e, 284 + 0x40800206, 285 + 0x30801203, 286 + 0x40800407, 287 + 0x3ec40084, 288 + 0x40800608, 289 + 0x3ac1828a, 290 + 0x3ac20289, 291 + 0xb060c104, 292 + 0x3ac1c284, 293 + 0x20801203, 294 + 0x413d8003, 295 + 0x38818282, 296 + 0x4020007f, 297 + 0x327fd800, 298 + 0x409ffe03, 299 + 0x30801202, 300 + 0x40800207, 301 + 0x3ec40084, 302 + 0x10005b09, 303 + 0x3ac1c288, 304 + 0xb0408184, 305 + 0x4020007f, 306 + 0x4020007f, 307 + 0x20801202, 308 + 0x3881c282, 309 + 0xb0408308, 310 + 0x2881c282, 311 + 0x327fc680, 312 + 0x409ffe02, 313 + 0x1000588b, 314 + 0x40800208, 315 + 0x30801203, 316 + 0x40800407, 317 + 0x3ec40084, 318 + 0x3ac20289, 319 + 0xb060c104, 320 + 0x3ac1c284, 321 + 0x20801203, 322 + 0x413d8003, 323 + 0x38820282, 324 + 0x327fbd80, 325 + 0x00200000, 326 + 0x00000da0, 316 327 0x00000000, 328 + 0x00000000, 329 + 0x00000000, 330 + 0x00000d90, 331 + 0x00000000, 332 + 0x00000000, 333 + 0x00000000, 334 + 0x00000db0, 335 + 0x00000000, 336 + 0x00000000, 337 + 0x00000000, 338 + 0x00000dc0, 339 + 0x00000000, 340 + 0x00000000, 341 + 0x00000000, 342 + 0x00000d80, 343 + 0x00000000, 344 + 0x00000000, 345 + 0x00000000, 346 + 0x00000df0, 347 + 0x00000000, 348 + 0x00000000, 349 + 0x00000000, 350 + 0x00000de0, 351 + 0x00000000, 352 + 0x00000000, 353 + 0x00000000, 354 + 0x00000dd0, 355 + 0x00000000, 356 + 0x00000000, 357 + 0x00000000, 358 + 0x00000e04, 359 + 0x00000000, 360 + 0x00000000, 361 + 0x00000000, 362 + 0x00000e00, 317 363 0x00000000, 318 364 0x00000000, 319 365 0x00000000,
+10 -2
arch/powerpc/platforms/cell/spufs/switch.c
··· 1285 1285 cycles_t resume_time = get_cycles(); 1286 1286 cycles_t delta_time = resume_time - csa->suspend_time; 1287 1287 1288 + csa->lscsa->decr_status.slot[0] = SPU_DECR_STATUS_RUNNING; 1289 + if (csa->lscsa->decr.slot[0] < delta_time) { 1290 + csa->lscsa->decr_status.slot[0] |= 1291 + SPU_DECR_STATUS_WRAPPED; 1292 + } 1293 + 1288 1294 csa->lscsa->decr.slot[0] -= delta_time; 1295 + } else { 1296 + csa->lscsa->decr_status.slot[0] = 0; 1289 1297 } 1290 1298 } 1291 1299 ··· 1552 1544 * "wrapped" flag is set, OR in a '1' to 1553 1545 * CSA.SPU_Event_Status[Tm]. 1554 1546 */ 1555 - if (csa->lscsa->decr_status.slot[0] == 1) { 1547 + if (csa->lscsa->decr_status.slot[0] & SPU_DECR_STATUS_WRAPPED) { 1556 1548 csa->spu_chnldata_RW[0] |= 0x20; 1557 1549 } 1558 - if ((csa->lscsa->decr_status.slot[0] == 1) && 1550 + if ((csa->lscsa->decr_status.slot[0] & SPU_DECR_STATUS_WRAPPED) && 1559 1551 (csa->spu_chnlcnt_RW[0] == 0 && 1560 1552 ((csa->spu_chnldata_RW[2] & 0x20) == 0x0) && 1561 1553 ((csa->spu_chnldata_RW[0] & 0x20) != 0x1))) {
+7 -1
include/asm-powerpc/spu_csa.h
··· 50 50 #define SPU_STOPPED_STATUS_P_I 8 51 51 #define SPU_STOPPED_STATUS_R 9 52 52 53 + /* 54 + * Definitions for software decrementer status flag. 55 + */ 56 + #define SPU_DECR_STATUS_RUNNING 0x1 57 + #define SPU_DECR_STATUS_WRAPPED 0x2 58 + 53 59 #ifndef __ASSEMBLY__ 54 60 /** 55 61 * spu_reg128 - generic 128-bit register definition. ··· 69 63 * @gprs: Array of saved registers. 70 64 * @fpcr: Saved floating point status control register. 71 65 * @decr: Saved decrementer value. 72 - * @decr_status: Indicates decrementer run status. 66 + * @decr_status: Indicates software decrementer status flags. 73 67 * @ppu_mb: Saved PPU mailbox data. 74 68 * @ppuint_mb: Saved PPU interrupting mailbox data. 75 69 * @tag_mask: Saved tag group mask.