| .. | .. |
|---|
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
|---|
| 2 | 2 | /* |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * (C) COPYRIGHT 2018-2021 ARM Limited. All rights reserved. |
|---|
| 4 | + * (C) COPYRIGHT 2018-2022 ARM Limited. All rights reserved. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * This program is free software and is provided to you under the terms of the |
|---|
| 7 | 7 | * GNU General Public License version 2 as published by the Free Software |
|---|
| .. | .. |
|---|
| 23 | 23 | #define _KBASE_CSF_FIRMWARE_H_ |
|---|
| 24 | 24 | |
|---|
| 25 | 25 | #include "device/mali_kbase_device.h" |
|---|
| 26 | | -#include <uapi/gpu/arm/bifrost/csf/mali_gpu_csf_registers.h> |
|---|
| 26 | +#include <csf/mali_kbase_csf_registers.h> |
|---|
| 27 | 27 | |
|---|
| 28 | 28 | /* |
|---|
| 29 | 29 | * PAGE_KERNEL_RO was only defined on 32bit ARM in 4.19 in: |
|---|
| .. | .. |
|---|
| 75 | 75 | #define MAX_SUPPORTED_CSGS 31 |
|---|
| 76 | 76 | /* GROUP_STREAM_NUM: At least 8 CSs per CSG, but no more than 32 */ |
|---|
| 77 | 77 | #define MIN_SUPPORTED_STREAMS_PER_GROUP 8 |
|---|
| 78 | | -/* Maximum CSs per csg. */ |
|---|
| 78 | +/* MAX_SUPPORTED_STREAMS_PER_GROUP: Maximum CSs per csg. */ |
|---|
| 79 | 79 | #define MAX_SUPPORTED_STREAMS_PER_GROUP 32 |
|---|
| 80 | | - |
|---|
| 81 | | -/* Waiting timeout for status change acknowledgment, in milliseconds */ |
|---|
| 82 | | -#define CSF_FIRMWARE_TIMEOUT_MS (3000) /* Relaxed to 3000ms from 800ms due to Android */ |
|---|
| 83 | 80 | |
|---|
| 84 | 81 | struct kbase_device; |
|---|
| 85 | 82 | |
|---|
| .. | .. |
|---|
| 327 | 324 | u32 kbase_csf_firmware_global_output( |
|---|
| 328 | 325 | const struct kbase_csf_global_iface *iface, u32 offset); |
|---|
| 329 | 326 | |
|---|
| 330 | | -/* Calculate the offset to the Hw doorbell page corresponding to the |
|---|
| 331 | | - * doorbell number. |
|---|
| 327 | +/** |
|---|
| 328 | + * kbase_csf_ring_doorbell() - Ring the doorbell |
|---|
| 329 | + * |
|---|
| 330 | + * @kbdev: An instance of the GPU platform device |
|---|
| 331 | + * @doorbell_nr: Index of the HW doorbell page |
|---|
| 332 | 332 | */ |
|---|
| 333 | | -static u32 csf_doorbell_offset(int doorbell_nr) |
|---|
| 334 | | -{ |
|---|
| 335 | | - WARN_ON(doorbell_nr >= CSF_NUM_DOORBELL); |
|---|
| 336 | | - |
|---|
| 337 | | - return CSF_HW_DOORBELL_PAGE_OFFSET + |
|---|
| 338 | | - (doorbell_nr * CSF_HW_DOORBELL_PAGE_SIZE); |
|---|
| 339 | | -} |
|---|
| 340 | | - |
|---|
| 341 | | -static inline void kbase_csf_ring_doorbell(struct kbase_device *kbdev, |
|---|
| 342 | | - int doorbell_nr) |
|---|
| 343 | | -{ |
|---|
| 344 | | - WARN_ON(doorbell_nr >= CSF_NUM_DOORBELL); |
|---|
| 345 | | - |
|---|
| 346 | | - kbase_reg_write(kbdev, csf_doorbell_offset(doorbell_nr), (u32)1); |
|---|
| 347 | | -} |
|---|
| 333 | +void kbase_csf_ring_doorbell(struct kbase_device *kbdev, int doorbell_nr); |
|---|
| 348 | 334 | |
|---|
| 349 | 335 | /** |
|---|
| 350 | 336 | * kbase_csf_read_firmware_memory - Read a value in a GPU address |
|---|
| 337 | + * |
|---|
| 338 | + * @kbdev: Device pointer |
|---|
| 339 | + * @gpu_addr: GPU address to read |
|---|
| 340 | + * @value: output pointer to which the read value will be written. |
|---|
| 351 | 341 | * |
|---|
| 352 | 342 | * This function read a value in a GPU address that belongs to |
|---|
| 353 | 343 | * a private firmware memory region. The function assumes that the location |
|---|
| 354 | 344 | * is not permanently mapped on the CPU address space, therefore it maps it |
|---|
| 355 | 345 | * and then unmaps it to access it independently. |
|---|
| 356 | | - * |
|---|
| 357 | | - * @kbdev: Device pointer |
|---|
| 358 | | - * @gpu_addr: GPU address to read |
|---|
| 359 | | - * @value: output pointer to which the read value will be written. |
|---|
| 360 | 346 | */ |
|---|
| 361 | 347 | void kbase_csf_read_firmware_memory(struct kbase_device *kbdev, |
|---|
| 362 | 348 | u32 gpu_addr, u32 *value); |
|---|
| .. | .. |
|---|
| 364 | 350 | /** |
|---|
| 365 | 351 | * kbase_csf_update_firmware_memory - Write a value in a GPU address |
|---|
| 366 | 352 | * |
|---|
| 353 | + * @kbdev: Device pointer |
|---|
| 354 | + * @gpu_addr: GPU address to write |
|---|
| 355 | + * @value: Value to write |
|---|
| 356 | + * |
|---|
| 367 | 357 | * This function writes a given value in a GPU address that belongs to |
|---|
| 368 | 358 | * a private firmware memory region. The function assumes that the destination |
|---|
| 369 | 359 | * is not permanently mapped on the CPU address space, therefore it maps it |
|---|
| 370 | 360 | * and then unmaps it to access it independently. |
|---|
| 371 | | - * |
|---|
| 372 | | - * @kbdev: Device pointer |
|---|
| 373 | | - * @gpu_addr: GPU address to write |
|---|
| 374 | | - * @value: Value to write |
|---|
| 375 | 361 | */ |
|---|
| 376 | 362 | void kbase_csf_update_firmware_memory(struct kbase_device *kbdev, |
|---|
| 377 | 363 | u32 gpu_addr, u32 value); |
|---|
| 378 | 364 | |
|---|
| 379 | 365 | /** |
|---|
| 380 | | - * kbase_csf_firmware_early_init() - Early initializatin for the firmware. |
|---|
| 366 | + * kbase_csf_read_firmware_memory_exe - Read a value in a GPU address in the |
|---|
| 367 | + * region of its final execution location. |
|---|
| 368 | + * |
|---|
| 369 | + * @kbdev: Device pointer |
|---|
| 370 | + * @gpu_addr: GPU address to read |
|---|
| 371 | + * @value: Output pointer to which the read value will be written |
|---|
| 372 | + * |
|---|
| 373 | + * This function read a value in a GPU address that belongs to a private loaded |
|---|
| 374 | + * firmware memory region based on its final execution location. The function |
|---|
| 375 | + * assumes that the location is not permanently mapped on the CPU address space, |
|---|
| 376 | + * therefore it maps it and then unmaps it to access it independently. This function |
|---|
| 377 | + * needs to be used when accessing firmware memory regions which will be moved to |
|---|
| 378 | + * their final execution location during firmware boot using an address based on the |
|---|
| 379 | + * final execution location. |
|---|
| 380 | + */ |
|---|
| 381 | +void kbase_csf_read_firmware_memory_exe(struct kbase_device *kbdev, |
|---|
| 382 | + u32 gpu_addr, u32 *value); |
|---|
| 383 | + |
|---|
| 384 | +/** |
|---|
| 385 | + * kbase_csf_update_firmware_memory_exe - Write a value in a GPU address in the |
|---|
| 386 | + * region of its final execution location. |
|---|
| 387 | + * |
|---|
| 388 | + * @kbdev: Device pointer |
|---|
| 389 | + * @gpu_addr: GPU address to write |
|---|
| 390 | + * @value: Value to write |
|---|
| 391 | + * |
|---|
| 392 | + * This function writes a value in a GPU address that belongs to a private loaded |
|---|
| 393 | + * firmware memory region based on its final execution location. The function |
|---|
| 394 | + * assumes that the location is not permanently mapped on the CPU address space, |
|---|
| 395 | + * therefore it maps it and then unmaps it to access it independently. This function |
|---|
| 396 | + * needs to be used when accessing firmware memory regions which will be moved to |
|---|
| 397 | + * their final execution location during firmware boot using an address based on the |
|---|
| 398 | + * final execution location. |
|---|
| 399 | + */ |
|---|
| 400 | +void kbase_csf_update_firmware_memory_exe(struct kbase_device *kbdev, |
|---|
| 401 | + u32 gpu_addr, u32 value); |
|---|
| 402 | + |
|---|
| 403 | +/** |
|---|
| 404 | + * kbase_csf_firmware_early_init() - Early initialization for the firmware. |
|---|
| 381 | 405 | * @kbdev: Kbase device |
|---|
| 382 | 406 | * |
|---|
| 383 | 407 | * Initialize resources related to the firmware. Must be called at kbase probe. |
|---|
| .. | .. |
|---|
| 387 | 411 | int kbase_csf_firmware_early_init(struct kbase_device *kbdev); |
|---|
| 388 | 412 | |
|---|
| 389 | 413 | /** |
|---|
| 390 | | - * kbase_csf_firmware_init() - Load the firmware for the CSF MCU |
|---|
| 414 | + * kbase_csf_firmware_early_term() - Terminate resources related to the firmware |
|---|
| 415 | + * after the firmware unload has been done. |
|---|
| 416 | + * |
|---|
| 417 | + * @kbdev: Device pointer |
|---|
| 418 | + * |
|---|
| 419 | + * This should be called only when kbase probe fails or gets rmmoded. |
|---|
| 420 | + */ |
|---|
| 421 | +void kbase_csf_firmware_early_term(struct kbase_device *kbdev); |
|---|
| 422 | + |
|---|
| 423 | +/** |
|---|
| 424 | + * kbase_csf_firmware_late_init() - Late initialization for the firmware. |
|---|
| 425 | + * @kbdev: Kbase device |
|---|
| 426 | + * |
|---|
| 427 | + * Initialize resources related to the firmware. But must be called after |
|---|
| 428 | + * backend late init is done. Must be used at probe time only. |
|---|
| 429 | + * |
|---|
| 430 | + * Return: 0 if successful, negative error code on failure |
|---|
| 431 | + */ |
|---|
| 432 | +int kbase_csf_firmware_late_init(struct kbase_device *kbdev); |
|---|
| 433 | + |
|---|
| 434 | +/** |
|---|
| 435 | + * kbase_csf_firmware_load_init() - Load the firmware for the CSF MCU |
|---|
| 391 | 436 | * @kbdev: Kbase device |
|---|
| 392 | 437 | * |
|---|
| 393 | 438 | * Request the firmware from user space and load it into memory. |
|---|
| 394 | 439 | * |
|---|
| 395 | 440 | * Return: 0 if successful, negative error code on failure |
|---|
| 396 | 441 | */ |
|---|
| 397 | | -int kbase_csf_firmware_init(struct kbase_device *kbdev); |
|---|
| 442 | +int kbase_csf_firmware_load_init(struct kbase_device *kbdev); |
|---|
| 398 | 443 | |
|---|
| 399 | 444 | /** |
|---|
| 400 | | - * kbase_csf_firmware_term() - Unload the firmware |
|---|
| 445 | + * kbase_csf_firmware_unload_term() - Unload the firmware |
|---|
| 401 | 446 | * @kbdev: Kbase device |
|---|
| 402 | 447 | * |
|---|
| 403 | | - * Frees the memory allocated by kbase_csf_firmware_init() |
|---|
| 448 | + * Frees the memory allocated by kbase_csf_firmware_load_init() |
|---|
| 404 | 449 | */ |
|---|
| 405 | | -void kbase_csf_firmware_term(struct kbase_device *kbdev); |
|---|
| 450 | +void kbase_csf_firmware_unload_term(struct kbase_device *kbdev); |
|---|
| 451 | + |
|---|
| 452 | +#if IS_ENABLED(CONFIG_MALI_CORESIGHT) |
|---|
| 453 | +/** |
|---|
| 454 | + * kbase_csf_firmware_mcu_register_write - Write to MCU register |
|---|
| 455 | + * |
|---|
| 456 | + * @kbdev: Instance of a gpu platform device that implements a csf interface. |
|---|
| 457 | + * @reg_addr: Register address to write into |
|---|
| 458 | + * @reg_val: Value to be written |
|---|
| 459 | + * |
|---|
| 460 | + * Write a desired value to a register in MCU address space. |
|---|
| 461 | + * |
|---|
| 462 | + * return: 0 on success, or negative on failure. |
|---|
| 463 | + */ |
|---|
| 464 | +int kbase_csf_firmware_mcu_register_write(struct kbase_device *const kbdev, u32 const reg_addr, |
|---|
| 465 | + u32 const reg_val); |
|---|
| 466 | +/** |
|---|
| 467 | + * kbase_csf_firmware_mcu_register_read - Read from MCU register |
|---|
| 468 | + * |
|---|
| 469 | + * @kbdev: Instance of a gpu platform device that implements a csf interface. |
|---|
| 470 | + * @reg_addr: Register address to read from |
|---|
| 471 | + * @reg_val: Value as present in reg_addr register |
|---|
| 472 | + * |
|---|
| 473 | + * Read a value from MCU address space. |
|---|
| 474 | + * |
|---|
| 475 | + * return: 0 on success, or negative on failure. |
|---|
| 476 | + */ |
|---|
| 477 | +int kbase_csf_firmware_mcu_register_read(struct kbase_device *const kbdev, u32 const reg_addr, |
|---|
| 478 | + u32 *reg_val); |
|---|
| 479 | + |
|---|
| 480 | +/** |
|---|
| 481 | + * kbase_csf_firmware_mcu_register_poll - Poll MCU register |
|---|
| 482 | + * |
|---|
| 483 | + * @kbdev: Instance of a gpu platform device that implements a csf interface. |
|---|
| 484 | + * @reg_addr: Register address to read from |
|---|
| 485 | + * @val_mask: Value to mask the read value for comparison |
|---|
| 486 | + * @reg_val: Value to be compared against |
|---|
| 487 | + * |
|---|
| 488 | + * Continue to read a value from MCU address space until it matches given mask and value. |
|---|
| 489 | + * |
|---|
| 490 | + * return: 0 on success, or negative on failure. |
|---|
| 491 | + */ |
|---|
| 492 | +int kbase_csf_firmware_mcu_register_poll(struct kbase_device *const kbdev, u32 const reg_addr, |
|---|
| 493 | + u32 const val_mask, u32 const reg_val); |
|---|
| 494 | +#endif /* IS_ENABLED(CONFIG_MALI_CORESIGHT) */ |
|---|
| 406 | 495 | |
|---|
| 407 | 496 | /** |
|---|
| 408 | 497 | * kbase_csf_firmware_ping - Send the ping request to firmware. |
|---|
| 409 | 498 | * |
|---|
| 410 | | - * The function sends the ping request to firmware. |
|---|
| 411 | | - * |
|---|
| 412 | 499 | * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 500 | + * |
|---|
| 501 | + * The function sends the ping request to firmware. |
|---|
| 413 | 502 | */ |
|---|
| 414 | 503 | void kbase_csf_firmware_ping(struct kbase_device *kbdev); |
|---|
| 415 | 504 | |
|---|
| 416 | 505 | /** |
|---|
| 417 | 506 | * kbase_csf_firmware_ping_wait - Send the ping request to firmware and waits. |
|---|
| 418 | 507 | * |
|---|
| 508 | + * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 509 | + * @wait_timeout_ms: Timeout to get the acknowledgment for PING request from FW. |
|---|
| 510 | + * |
|---|
| 419 | 511 | * The function sends the ping request to firmware and waits to confirm it is |
|---|
| 420 | 512 | * alive. |
|---|
| 421 | 513 | * |
|---|
| 422 | | - * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 423 | | - * |
|---|
| 424 | 514 | * Return: 0 on success, or negative on failure. |
|---|
| 425 | 515 | */ |
|---|
| 426 | | -int kbase_csf_firmware_ping_wait(struct kbase_device *kbdev); |
|---|
| 516 | +int kbase_csf_firmware_ping_wait(struct kbase_device *kbdev, unsigned int wait_timeout_ms); |
|---|
| 427 | 517 | |
|---|
| 428 | 518 | /** |
|---|
| 429 | 519 | * kbase_csf_firmware_set_timeout - Set a hardware endpoint progress timeout. |
|---|
| .. | .. |
|---|
| 442 | 532 | |
|---|
| 443 | 533 | /** |
|---|
| 444 | 534 | * kbase_csf_enter_protected_mode - Send the Global request to firmware to |
|---|
| 445 | | - * enter protected mode and wait for its |
|---|
| 446 | | - * completion. |
|---|
| 535 | + * enter protected mode. |
|---|
| 447 | 536 | * |
|---|
| 448 | 537 | * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 538 | + * |
|---|
| 539 | + * The function must be called with kbdev->csf.scheduler.interrupt_lock held |
|---|
| 540 | + * and it does not wait for the protected mode entry to complete. |
|---|
| 449 | 541 | */ |
|---|
| 450 | 542 | void kbase_csf_enter_protected_mode(struct kbase_device *kbdev); |
|---|
| 451 | 543 | |
|---|
| 544 | +/** |
|---|
| 545 | + * kbase_csf_wait_protected_mode_enter - Wait for the completion of PROTM_ENTER |
|---|
| 546 | + * Global request sent to firmware. |
|---|
| 547 | + * |
|---|
| 548 | + * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 549 | + * |
|---|
| 550 | + * This function needs to be called after kbase_csf_enter_protected_mode() to |
|---|
| 551 | + * wait for the GPU to actually enter protected mode. GPU reset is triggered if |
|---|
| 552 | + * the wait is unsuccessful. |
|---|
| 553 | + * |
|---|
| 554 | + * Return: 0 on success, or negative on failure. |
|---|
| 555 | + */ |
|---|
| 556 | +int kbase_csf_wait_protected_mode_enter(struct kbase_device *kbdev); |
|---|
| 557 | + |
|---|
| 452 | 558 | static inline bool kbase_csf_firmware_mcu_halted(struct kbase_device *kbdev) |
|---|
| 453 | 559 | { |
|---|
| 560 | +#if IS_ENABLED(CONFIG_MALI_BIFROST_NO_MALI) |
|---|
| 561 | + return true; |
|---|
| 562 | +#else |
|---|
| 454 | 563 | return (kbase_reg_read(kbdev, GPU_CONTROL_REG(MCU_STATUS)) == |
|---|
| 455 | 564 | MCU_STATUS_HALTED); |
|---|
| 565 | +#endif /* CONFIG_MALI_BIFROST_NO_MALI */ |
|---|
| 456 | 566 | } |
|---|
| 457 | 567 | |
|---|
| 458 | 568 | /** |
|---|
| .. | .. |
|---|
| 470 | 580 | * |
|---|
| 471 | 581 | * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 472 | 582 | */ |
|---|
| 473 | | -static inline void kbase_csf_firmware_enable_mcu(struct kbase_device *kbdev) |
|---|
| 474 | | -{ |
|---|
| 475 | | - /* Trigger the boot of MCU firmware, Use the AUTO mode as |
|---|
| 476 | | - * otherwise on fast reset, to exit protected mode, MCU will |
|---|
| 477 | | - * not reboot by itself to enter normal mode. |
|---|
| 478 | | - */ |
|---|
| 479 | | - kbase_reg_write(kbdev, GPU_CONTROL_REG(MCU_CONTROL), MCU_CNTRL_AUTO); |
|---|
| 480 | | -} |
|---|
| 583 | +void kbase_csf_firmware_enable_mcu(struct kbase_device *kbdev); |
|---|
| 481 | 584 | |
|---|
| 482 | 585 | /** |
|---|
| 483 | 586 | * kbase_csf_firmware_disable_mcu - Send the command to disable MCU |
|---|
| 484 | 587 | * |
|---|
| 485 | 588 | * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 486 | 589 | */ |
|---|
| 487 | | -static inline void kbase_csf_firmware_disable_mcu(struct kbase_device *kbdev) |
|---|
| 488 | | -{ |
|---|
| 489 | | - kbase_reg_write(kbdev, GPU_CONTROL_REG(MCU_CONTROL), MCU_CNTRL_DISABLE); |
|---|
| 490 | | -} |
|---|
| 590 | +void kbase_csf_firmware_disable_mcu(struct kbase_device *kbdev); |
|---|
| 491 | 591 | |
|---|
| 492 | 592 | /** |
|---|
| 493 | 593 | * kbase_csf_firmware_disable_mcu_wait - Wait for the MCU to reach disabled |
|---|
| .. | .. |
|---|
| 497 | 597 | */ |
|---|
| 498 | 598 | void kbase_csf_firmware_disable_mcu_wait(struct kbase_device *kbdev); |
|---|
| 499 | 599 | |
|---|
| 600 | +#ifdef KBASE_PM_RUNTIME |
|---|
| 500 | 601 | /** |
|---|
| 501 | | - * kbase_trigger_firmware_reload - Trigger the reboot of MCU firmware, for the |
|---|
| 502 | | - * cold boot case firmware image would be |
|---|
| 503 | | - * reloaded from filesystem into memory. |
|---|
| 602 | + * kbase_csf_firmware_trigger_mcu_sleep - Send the command to put MCU in sleep |
|---|
| 603 | + * state. |
|---|
| 604 | + * |
|---|
| 605 | + * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 606 | + */ |
|---|
| 607 | +void kbase_csf_firmware_trigger_mcu_sleep(struct kbase_device *kbdev); |
|---|
| 608 | + |
|---|
| 609 | +/** |
|---|
| 610 | + * kbase_csf_firmware_is_mcu_in_sleep - Check if sleep request has completed |
|---|
| 611 | + * and MCU has halted. |
|---|
| 612 | + * |
|---|
| 613 | + * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 614 | + * |
|---|
| 615 | + * Return: true if sleep request has completed, otherwise false. |
|---|
| 616 | + */ |
|---|
| 617 | +bool kbase_csf_firmware_is_mcu_in_sleep(struct kbase_device *kbdev); |
|---|
| 618 | +#endif |
|---|
| 619 | + |
|---|
| 620 | +/** |
|---|
| 621 | + * kbase_csf_firmware_trigger_reload() - Trigger the reboot of MCU firmware, for |
|---|
| 622 | + * the cold boot case firmware image would |
|---|
| 623 | + * be reloaded from filesystem into memory. |
|---|
| 504 | 624 | * |
|---|
| 505 | 625 | * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 506 | 626 | */ |
|---|
| .. | .. |
|---|
| 529 | 649 | * requests, sent after the reboot of MCU firmware, have |
|---|
| 530 | 650 | * completed or not. |
|---|
| 531 | 651 | * |
|---|
| 532 | | - * Return: true if the Global configuration requests completed otherwise false. |
|---|
| 533 | | - * |
|---|
| 534 | 652 | * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 653 | + * |
|---|
| 654 | + * Return: true if the Global configuration requests completed otherwise false. |
|---|
| 535 | 655 | */ |
|---|
| 536 | 656 | bool kbase_csf_firmware_global_reinit_complete(struct kbase_device *kbdev); |
|---|
| 537 | 657 | |
|---|
| .. | .. |
|---|
| 556 | 676 | * request has completed or not, that was sent to update |
|---|
| 557 | 677 | * the core attributes. |
|---|
| 558 | 678 | * |
|---|
| 679 | + * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 680 | + * |
|---|
| 559 | 681 | * Return: true if the Global configuration request to update the core |
|---|
| 560 | 682 | * attributes has completed, otherwise false. |
|---|
| 561 | | - * |
|---|
| 562 | | - * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 563 | 683 | */ |
|---|
| 564 | 684 | bool kbase_csf_firmware_core_attr_updated(struct kbase_device *kbdev); |
|---|
| 565 | 685 | |
|---|
| 566 | 686 | /** |
|---|
| 567 | | - * Request the global control block of CSF interface capabilities |
|---|
| 568 | | - * |
|---|
| 569 | | - * Return: Total number of CSs, summed across all groups. |
|---|
| 687 | + * kbase_csf_firmware_get_glb_iface - Request the global control block of CSF |
|---|
| 688 | + * interface capabilities |
|---|
| 570 | 689 | * |
|---|
| 571 | 690 | * @kbdev: Kbase device. |
|---|
| 572 | 691 | * @group_data: Pointer where to store all the group data |
|---|
| .. | .. |
|---|
| 589 | 708 | * @instr_features: Instrumentation features. Bits 7:4 hold the max size |
|---|
| 590 | 709 | * of events. Bits 3:0 hold the offset update rate. |
|---|
| 591 | 710 | * (csf >= 1,1,0) |
|---|
| 711 | + * |
|---|
| 712 | + * Return: Total number of CSs, summed across all groups. |
|---|
| 592 | 713 | */ |
|---|
| 593 | 714 | u32 kbase_csf_firmware_get_glb_iface( |
|---|
| 594 | 715 | struct kbase_device *kbdev, struct basep_cs_group_control *group_data, |
|---|
| .. | .. |
|---|
| 597 | 718 | u32 *group_num, u32 *prfcnt_size, u32 *instr_features); |
|---|
| 598 | 719 | |
|---|
| 599 | 720 | /** |
|---|
| 600 | | - * Get CSF firmware header timeline metadata content |
|---|
| 601 | | - * |
|---|
| 602 | | - * Return: The firmware timeline metadata content which match @p name. |
|---|
| 721 | + * kbase_csf_firmware_get_timeline_metadata - Get CSF firmware header timeline |
|---|
| 722 | + * metadata content |
|---|
| 603 | 723 | * |
|---|
| 604 | 724 | * @kbdev: Kbase device. |
|---|
| 605 | 725 | * @name: Name of the metadata which metadata content to be returned. |
|---|
| 606 | 726 | * @size: Metadata size if specified metadata found. |
|---|
| 727 | + * |
|---|
| 728 | + * Return: The firmware timeline metadata content which match @p name. |
|---|
| 607 | 729 | */ |
|---|
| 608 | 730 | const char *kbase_csf_firmware_get_timeline_metadata(struct kbase_device *kbdev, |
|---|
| 609 | 731 | const char *name, size_t *size); |
|---|
| 610 | 732 | |
|---|
| 611 | 733 | /** |
|---|
| 612 | | - * kbase_csf_firmware_mcu_shared_mapping_init - |
|---|
| 613 | | - * Allocate and map MCU shared memory. |
|---|
| 734 | + * kbase_csf_firmware_mcu_shared_mapping_init - Allocate and map MCU shared memory. |
|---|
| 735 | + * |
|---|
| 736 | + * @kbdev: Kbase device the memory mapping shall belong to. |
|---|
| 737 | + * @num_pages: Number of memory pages to map. |
|---|
| 738 | + * @cpu_map_properties: Either PROT_READ or PROT_WRITE. |
|---|
| 739 | + * @gpu_map_properties: Either KBASE_REG_GPU_RD or KBASE_REG_GPU_WR. |
|---|
| 740 | + * @csf_mapping: Object where to write metadata for the memory mapping. |
|---|
| 614 | 741 | * |
|---|
| 615 | 742 | * This helper function allocates memory and maps it on both the CPU |
|---|
| 616 | 743 | * and the GPU address spaces. Most of the properties of the mapping |
|---|
| .. | .. |
|---|
| 622 | 749 | * will be ignored by the function. |
|---|
| 623 | 750 | * |
|---|
| 624 | 751 | * Return: 0 if success, or an error code on failure. |
|---|
| 625 | | - * |
|---|
| 626 | | - * @kbdev: Kbase device the memory mapping shall belong to. |
|---|
| 627 | | - * @num_pages: Number of memory pages to map. |
|---|
| 628 | | - * @cpu_map_properties: Either PROT_READ or PROT_WRITE. |
|---|
| 629 | | - * @gpu_map_properties: Either KBASE_REG_GPU_RD or KBASE_REG_GPU_WR. |
|---|
| 630 | | - * @csf_mapping: Object where to write metadata for the memory mapping. |
|---|
| 631 | 752 | */ |
|---|
| 632 | 753 | int kbase_csf_firmware_mcu_shared_mapping_init( |
|---|
| 633 | 754 | struct kbase_device *kbdev, |
|---|
| .. | .. |
|---|
| 645 | 766 | void kbase_csf_firmware_mcu_shared_mapping_term( |
|---|
| 646 | 767 | struct kbase_device *kbdev, struct kbase_csf_mapping *csf_mapping); |
|---|
| 647 | 768 | |
|---|
| 648 | | -#ifndef MALI_KBASE_BUILD |
|---|
| 649 | | -/** |
|---|
| 650 | | - * mali_kutf_process_fw_utf_entry() - Process the "Firmware UTF tests" section |
|---|
| 651 | | - * |
|---|
| 652 | | - * Read "Firmware UTF tests" section from the firmware image and create |
|---|
| 653 | | - * necessary kutf app+suite+tests. |
|---|
| 654 | | - * |
|---|
| 655 | | - * Return: 0 if successful, negative error code on failure. In both cases |
|---|
| 656 | | - * caller will have to invoke mali_kutf_fw_utf_entry_cleanup for the cleanup |
|---|
| 657 | | - * |
|---|
| 658 | | - * @kbdev: Kbase device structure |
|---|
| 659 | | - * @fw_data: Pointer to the start of firmware binary image loaded from disk |
|---|
| 660 | | - * @fw_size: Size (in bytes) of the firmware image |
|---|
| 661 | | - * @entry: Pointer to the start of the section |
|---|
| 662 | | - */ |
|---|
| 663 | | -int mali_kutf_process_fw_utf_entry(struct kbase_device *kbdev, |
|---|
| 664 | | - const void *fw_data, size_t fw_size, const u32 *entry); |
|---|
| 665 | | - |
|---|
| 666 | | -/** |
|---|
| 667 | | - * mali_kutf_fw_utf_entry_cleanup() - Remove the Fw UTF tests debugfs entries |
|---|
| 668 | | - * |
|---|
| 669 | | - * Destroy the kutf apps+suites+tests created on parsing "Firmware UTF tests" |
|---|
| 670 | | - * section from the firmware image. |
|---|
| 671 | | - * |
|---|
| 672 | | - * @kbdev: Kbase device structure |
|---|
| 673 | | - */ |
|---|
| 674 | | -void mali_kutf_fw_utf_entry_cleanup(struct kbase_device *kbdev); |
|---|
| 675 | | -#endif |
|---|
| 676 | | - |
|---|
| 677 | | -#ifdef CONFIG_MALI_BIFROST_DEBUG |
|---|
| 769 | +#ifdef CONFIG_MALI_BIFROST_DEBUG |
|---|
| 678 | 770 | extern bool fw_debug; |
|---|
| 679 | 771 | #endif |
|---|
| 680 | 772 | |
|---|
| .. | .. |
|---|
| 691 | 783 | * kbase_csf_firmware_enable_gpu_idle_timer() - Activate the idle hysteresis |
|---|
| 692 | 784 | * monitoring operation |
|---|
| 693 | 785 | * |
|---|
| 786 | + * @kbdev: Kbase device structure |
|---|
| 787 | + * |
|---|
| 694 | 788 | * Program the firmware interface with its configured hysteresis count value |
|---|
| 695 | 789 | * and enable the firmware to act on it. The Caller is |
|---|
| 696 | 790 | * assumed to hold the kbdev->csf.scheduler.interrupt_lock. |
|---|
| 697 | | - * |
|---|
| 698 | | - * @kbdev: Kbase device structure |
|---|
| 699 | 791 | */ |
|---|
| 700 | 792 | void kbase_csf_firmware_enable_gpu_idle_timer(struct kbase_device *kbdev); |
|---|
| 701 | 793 | |
|---|
| .. | .. |
|---|
| 703 | 795 | * kbase_csf_firmware_disable_gpu_idle_timer() - Disable the idle time |
|---|
| 704 | 796 | * hysteresis monitoring operation |
|---|
| 705 | 797 | * |
|---|
| 798 | + * @kbdev: Kbase device structure |
|---|
| 799 | + * |
|---|
| 706 | 800 | * Program the firmware interface to disable the idle hysteresis timer. The |
|---|
| 707 | 801 | * Caller is assumed to hold the kbdev->csf.scheduler.interrupt_lock. |
|---|
| 708 | | - * |
|---|
| 709 | | - * @kbdev: Kbase device structure |
|---|
| 710 | 802 | */ |
|---|
| 711 | 803 | void kbase_csf_firmware_disable_gpu_idle_timer(struct kbase_device *kbdev); |
|---|
| 712 | 804 | |
|---|
| .. | .. |
|---|
| 741 | 833 | u32 kbase_csf_firmware_set_gpu_idle_hysteresis_time(struct kbase_device *kbdev, u32 dur); |
|---|
| 742 | 834 | |
|---|
| 743 | 835 | /** |
|---|
| 744 | | - * kbase_csf_firmware_get_mcu_core_pwroff_time - Get the MCU core power-off |
|---|
| 836 | + * kbase_csf_firmware_get_mcu_core_pwroff_time - Get the MCU shader Core power-off |
|---|
| 745 | 837 | * time value |
|---|
| 746 | 838 | * |
|---|
| 747 | 839 | * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 748 | 840 | * |
|---|
| 749 | | - * Return: the internally recorded MCU core power-off (nominal) value. The unit |
|---|
| 841 | + * Return: the internally recorded MCU shader Core power-off (nominal) timeout value. The unit |
|---|
| 750 | 842 | * of the value is in micro-seconds. |
|---|
| 751 | 843 | */ |
|---|
| 752 | 844 | u32 kbase_csf_firmware_get_mcu_core_pwroff_time(struct kbase_device *kbdev); |
|---|
| 753 | 845 | |
|---|
| 754 | 846 | /** |
|---|
| 755 | | - * kbase_csf_firmware_set_mcu_core_pwroff_time - Set the MCU core power-off |
|---|
| 847 | + * kbase_csf_firmware_set_mcu_core_pwroff_time - Set the MCU shader Core power-off |
|---|
| 756 | 848 | * time value |
|---|
| 757 | 849 | * |
|---|
| 758 | 850 | * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| .. | .. |
|---|
| 769 | 861 | * returned value is the source configuration flag, and it is set to '1' |
|---|
| 770 | 862 | * when CYCLE_COUNTER alternative source is used. |
|---|
| 771 | 863 | * |
|---|
| 772 | | - * The configured MCU core power-off timer will only have effect when the host |
|---|
| 864 | + * The configured MCU shader Core power-off timer will only have effect when the host |
|---|
| 773 | 865 | * driver has delegated the shader cores' power management to MCU. |
|---|
| 774 | 866 | * |
|---|
| 775 | 867 | * Return: the actual internal core power-off timer value in register defined |
|---|
| .. | .. |
|---|
| 780 | 872 | /** |
|---|
| 781 | 873 | * kbase_csf_interface_version - Helper function to build the full firmware |
|---|
| 782 | 874 | * interface version in a format compatible with |
|---|
| 783 | | - * with GLB_VERSION register |
|---|
| 875 | + * GLB_VERSION register |
|---|
| 784 | 876 | * |
|---|
| 785 | 877 | * @major: major version of csf interface |
|---|
| 786 | 878 | * @minor: minor version of csf interface |
|---|
| .. | .. |
|---|
| 808 | 900 | * Return: 0 if success, or negative error code on failure. |
|---|
| 809 | 901 | */ |
|---|
| 810 | 902 | int kbase_csf_trigger_firmware_config_update(struct kbase_device *kbdev); |
|---|
| 903 | + |
|---|
| 904 | +/** |
|---|
| 905 | + * kbase_csf_firmware_req_core_dump - Request a firmware core dump |
|---|
| 906 | + * |
|---|
| 907 | + * @kbdev: Instance of a GPU platform device that implements a CSF interface. |
|---|
| 908 | + * |
|---|
| 909 | + * Request a firmware core dump and wait for for firmware to acknowledge. |
|---|
| 910 | + * Firmware will enter infinite loop after the firmware core dump is created. |
|---|
| 911 | + * |
|---|
| 912 | + * Return: 0 if success, or negative error code on failure. |
|---|
| 913 | + */ |
|---|
| 914 | +int kbase_csf_firmware_req_core_dump(struct kbase_device *const kbdev); |
|---|
| 915 | + |
|---|
| 811 | 916 | #endif |
|---|