ebb.c (b9f12a5d97f652c77ef6803dccd0d40d1290f5be) | ebb.c (6873def90016cc1cde03c38e10a80146d980b48a) |
---|---|
1/* 2 * Copyright 2014, Michael Ellerman, IBM Corp. 3 * Licensed under GPLv2. 4 */ 5 6#define _GNU_SOURCE /* For CPU_ZERO etc. */ 7 8#include <sched.h> --- 321 unchanged lines hidden (view full) --- 330void event_leader_ebb_init(struct event *e) 331{ 332 event_ebb_init(e); 333 334 e->attr.exclusive = 1; 335 e->attr.pinned = 1; 336} 337 | 1/* 2 * Copyright 2014, Michael Ellerman, IBM Corp. 3 * Licensed under GPLv2. 4 */ 5 6#define _GNU_SOURCE /* For CPU_ZERO etc. */ 7 8#include <sched.h> --- 321 unchanged lines hidden (view full) --- 330void event_leader_ebb_init(struct event *e) 331{ 332 event_ebb_init(e); 333 334 e->attr.exclusive = 1; 335 e->attr.pinned = 1; 336} 337 |
338int core_busy_loop(void) 339{ 340 int rc; 341 342 asm volatile ( 343 "li 3, 0x3030\n" 344 "std 3, -96(1)\n" 345 "li 4, 0x4040\n" 346 "std 4, -104(1)\n" 347 "li 5, 0x5050\n" 348 "std 5, -112(1)\n" 349 "li 6, 0x6060\n" 350 "std 6, -120(1)\n" 351 "li 7, 0x7070\n" 352 "std 7, -128(1)\n" 353 "li 8, 0x0808\n" 354 "std 8, -136(1)\n" 355 "li 9, 0x0909\n" 356 "std 9, -144(1)\n" 357 "li 10, 0x1010\n" 358 "std 10, -152(1)\n" 359 "li 11, 0x1111\n" 360 "std 11, -160(1)\n" 361 "li 14, 0x1414\n" 362 "std 14, -168(1)\n" 363 "li 15, 0x1515\n" 364 "std 15, -176(1)\n" 365 "li 16, 0x1616\n" 366 "std 16, -184(1)\n" 367 "li 17, 0x1717\n" 368 "std 17, -192(1)\n" 369 "li 18, 0x1818\n" 370 "std 18, -200(1)\n" 371 "li 19, 0x1919\n" 372 "std 19, -208(1)\n" 373 "li 20, 0x2020\n" 374 "std 20, -216(1)\n" 375 "li 21, 0x2121\n" 376 "std 21, -224(1)\n" 377 "li 22, 0x2222\n" 378 "std 22, -232(1)\n" 379 "li 23, 0x2323\n" 380 "std 23, -240(1)\n" 381 "li 24, 0x2424\n" 382 "std 24, -248(1)\n" 383 "li 25, 0x2525\n" 384 "std 25, -256(1)\n" 385 "li 26, 0x2626\n" 386 "std 26, -264(1)\n" 387 "li 27, 0x2727\n" 388 "std 27, -272(1)\n" 389 "li 28, 0x2828\n" 390 "std 28, -280(1)\n" 391 "li 29, 0x2929\n" 392 "std 29, -288(1)\n" 393 "li 30, 0x3030\n" 394 "li 31, 0x3131\n" 395 396 "li 3, 0\n" 397 "0: " 398 "addi 3, 3, 1\n" 399 "cmpwi 3, 100\n" 400 "blt 0b\n" 401 402 /* Return 1 (fail) unless we get through all the checks */ 403 "li 0, 1\n" 404 405 /* Check none of our registers have been corrupted */ 406 "cmpwi 4, 0x4040\n" 407 "bne 1f\n" 408 "cmpwi 5, 0x5050\n" 409 "bne 1f\n" 410 "cmpwi 6, 0x6060\n" 411 "bne 1f\n" 412 "cmpwi 7, 0x7070\n" 413 "bne 1f\n" 414 "cmpwi 8, 0x0808\n" 415 "bne 1f\n" 416 "cmpwi 9, 0x0909\n" 417 "bne 1f\n" 418 "cmpwi 10, 0x1010\n" 419 "bne 1f\n" 420 "cmpwi 11, 0x1111\n" 421 "bne 1f\n" 422 "cmpwi 14, 0x1414\n" 423 "bne 1f\n" 424 "cmpwi 15, 0x1515\n" 425 "bne 1f\n" 426 "cmpwi 16, 0x1616\n" 427 "bne 1f\n" 428 "cmpwi 17, 0x1717\n" 429 "bne 1f\n" 430 "cmpwi 18, 0x1818\n" 431 "bne 1f\n" 432 "cmpwi 19, 0x1919\n" 433 "bne 1f\n" 434 "cmpwi 20, 0x2020\n" 435 "bne 1f\n" 436 "cmpwi 21, 0x2121\n" 437 "bne 1f\n" 438 "cmpwi 22, 0x2222\n" 439 "bne 1f\n" 440 "cmpwi 23, 0x2323\n" 441 "bne 1f\n" 442 "cmpwi 24, 0x2424\n" 443 "bne 1f\n" 444 "cmpwi 25, 0x2525\n" 445 "bne 1f\n" 446 "cmpwi 26, 0x2626\n" 447 "bne 1f\n" 448 "cmpwi 27, 0x2727\n" 449 "bne 1f\n" 450 "cmpwi 28, 0x2828\n" 451 "bne 1f\n" 452 "cmpwi 29, 0x2929\n" 453 "bne 1f\n" 454 "cmpwi 30, 0x3030\n" 455 "bne 1f\n" 456 "cmpwi 31, 0x3131\n" 457 "bne 1f\n" 458 459 /* Load junk into all our registers before we reload them from the stack. */ 460 "li 3, 0xde\n" 461 "li 4, 0xad\n" 462 "li 5, 0xbe\n" 463 "li 6, 0xef\n" 464 "li 7, 0xde\n" 465 "li 8, 0xad\n" 466 "li 9, 0xbe\n" 467 "li 10, 0xef\n" 468 "li 11, 0xde\n" 469 "li 14, 0xad\n" 470 "li 15, 0xbe\n" 471 "li 16, 0xef\n" 472 "li 17, 0xde\n" 473 "li 18, 0xad\n" 474 "li 19, 0xbe\n" 475 "li 20, 0xef\n" 476 "li 21, 0xde\n" 477 "li 22, 0xad\n" 478 "li 23, 0xbe\n" 479 "li 24, 0xef\n" 480 "li 25, 0xde\n" 481 "li 26, 0xad\n" 482 "li 27, 0xbe\n" 483 "li 28, 0xef\n" 484 "li 29, 0xdd\n" 485 486 "ld 3, -96(1)\n" 487 "cmpwi 3, 0x3030\n" 488 "bne 1f\n" 489 "ld 4, -104(1)\n" 490 "cmpwi 4, 0x4040\n" 491 "bne 1f\n" 492 "ld 5, -112(1)\n" 493 "cmpwi 5, 0x5050\n" 494 "bne 1f\n" 495 "ld 6, -120(1)\n" 496 "cmpwi 6, 0x6060\n" 497 "bne 1f\n" 498 "ld 7, -128(1)\n" 499 "cmpwi 7, 0x7070\n" 500 "bne 1f\n" 501 "ld 8, -136(1)\n" 502 "cmpwi 8, 0x0808\n" 503 "bne 1f\n" 504 "ld 9, -144(1)\n" 505 "cmpwi 9, 0x0909\n" 506 "bne 1f\n" 507 "ld 10, -152(1)\n" 508 "cmpwi 10, 0x1010\n" 509 "bne 1f\n" 510 "ld 11, -160(1)\n" 511 "cmpwi 11, 0x1111\n" 512 "bne 1f\n" 513 "ld 14, -168(1)\n" 514 "cmpwi 14, 0x1414\n" 515 "bne 1f\n" 516 "ld 15, -176(1)\n" 517 "cmpwi 15, 0x1515\n" 518 "bne 1f\n" 519 "ld 16, -184(1)\n" 520 "cmpwi 16, 0x1616\n" 521 "bne 1f\n" 522 "ld 17, -192(1)\n" 523 "cmpwi 17, 0x1717\n" 524 "bne 1f\n" 525 "ld 18, -200(1)\n" 526 "cmpwi 18, 0x1818\n" 527 "bne 1f\n" 528 "ld 19, -208(1)\n" 529 "cmpwi 19, 0x1919\n" 530 "bne 1f\n" 531 "ld 20, -216(1)\n" 532 "cmpwi 20, 0x2020\n" 533 "bne 1f\n" 534 "ld 21, -224(1)\n" 535 "cmpwi 21, 0x2121\n" 536 "bne 1f\n" 537 "ld 22, -232(1)\n" 538 "cmpwi 22, 0x2222\n" 539 "bne 1f\n" 540 "ld 23, -240(1)\n" 541 "cmpwi 23, 0x2323\n" 542 "bne 1f\n" 543 "ld 24, -248(1)\n" 544 "cmpwi 24, 0x2424\n" 545 "bne 1f\n" 546 "ld 25, -256(1)\n" 547 "cmpwi 25, 0x2525\n" 548 "bne 1f\n" 549 "ld 26, -264(1)\n" 550 "cmpwi 26, 0x2626\n" 551 "bne 1f\n" 552 "ld 27, -272(1)\n" 553 "cmpwi 27, 0x2727\n" 554 "bne 1f\n" 555 "ld 28, -280(1)\n" 556 "cmpwi 28, 0x2828\n" 557 "bne 1f\n" 558 "ld 29, -288(1)\n" 559 "cmpwi 29, 0x2929\n" 560 "bne 1f\n" 561 562 /* Load 0 (success) to return */ 563 "li 0, 0\n" 564 565 "1: mr %0, 0\n" 566 567 : "=r" (rc) 568 : /* no inputs */ 569 : "3", "4", "5", "6", "7", "8", "9", "10", "11", "14", 570 "15", "16", "17", "18", "19", "20", "21", "22", "23", 571 "24", "25", "26", "27", "28", "29", "30", "31", 572 "memory" 573 ); 574 575 return rc; 576} 577 578int core_busy_loop_with_freeze(void) 579{ 580 int rc; 581 582 mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) & ~MMCR0_FC); 583 rc = core_busy_loop(); 584 mtspr(SPRN_MMCR0, mfspr(SPRN_MMCR0) | MMCR0_FC); 585 586 return rc; 587} 588 | |
589int ebb_child(union pipe read_pipe, union pipe write_pipe) 590{ 591 struct event event; 592 uint64_t val; 593 594 FAIL_IF(wait_for_parent(read_pipe)); 595 596 event_init_named(&event, 0x1001e, "cycles"); --- 131 unchanged lines hidden --- | 338int ebb_child(union pipe read_pipe, union pipe write_pipe) 339{ 340 struct event event; 341 uint64_t val; 342 343 FAIL_IF(wait_for_parent(read_pipe)); 344 345 event_init_named(&event, 0x1001e, "cycles"); --- 131 unchanged lines hidden --- |