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

accel/ivpu: Update JSM API header to 3.33.0

New API header includes additional status codes and range definitions
for error handling and improved API documentation.

Signed-off-by: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com>
Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
Link: https://lore.kernel.org/r/20251007083451.2816990-1-karol.wachowski@linux.intel.com

authored by

Andrzej Kacprowski and committed by
Karol Wachowski
39a0283d e00f7867

+96 -54
+96 -54
drivers/accel/ivpu/vpu_jsm_api.h
··· 23 23 /* 24 24 * Minor version changes when API backward compatibility is preserved. 25 25 */ 26 - #define VPU_JSM_API_VER_MINOR 32 26 + #define VPU_JSM_API_VER_MINOR 33 27 27 28 28 /* 29 29 * API header changed (field names, documentation, formatting) but API itself has not been changed 30 30 */ 31 - #define VPU_JSM_API_VER_PATCH 5 31 + #define VPU_JSM_API_VER_PATCH 0 32 32 33 33 /* 34 34 * Index in the API version table ··· 76 76 #define VPU_JSM_STATUS_PREEMPTED_MID_INFERENCE 0xDU 77 77 /* Job status returned when the job was preempted mid-command */ 78 78 #define VPU_JSM_STATUS_PREEMPTED_MID_COMMAND 0xDU 79 + /* Range of status codes that require engine reset */ 80 + #define VPU_JSM_STATUS_ENGINE_RESET_REQUIRED_MIN 0xEU 79 81 #define VPU_JSM_STATUS_MVNCI_CONTEXT_VIOLATION_HW 0xEU 80 82 #define VPU_JSM_STATUS_MVNCI_PREEMPTION_TIMED_OUT 0xFU 83 + #define VPU_JSM_STATUS_ENGINE_RESET_REQUIRED_MAX 0x1FU 81 84 82 85 /* 83 86 * Host <-> VPU IPC channels. ··· 407 404 /** Index of the first free entry in buffer. */ 408 405 u32 first_free_entry_idx; 409 406 /** 410 - * Incremented each time NPU wraps around 411 - * the buffer to write next entry. 407 + * Incremented whenever the NPU wraps around the buffer and writes 408 + * to the first entry again. 412 409 */ 413 410 u32 wraparound_count; 414 411 }; ··· 457 454 * Host <-> VPU IPC messages types. 458 455 */ 459 456 enum vpu_ipc_msg_type { 457 + /** Unsupported command */ 460 458 VPU_JSM_MSG_UNKNOWN = 0xFFFFFFFF, 461 459 462 - /* IPC Host -> Device, Async commands */ 460 + /** IPC Host -> Device, base id for async commands */ 463 461 VPU_JSM_MSG_ASYNC_CMD = 0x1100, 462 + /** 463 + * Reset engine. The NPU cancels all the jobs currently executing on the target 464 + * engine making the engine become idle and then does a HW reset, before returning 465 + * to the host. 466 + * @see struct vpu_ipc_msg_payload_engine_reset 467 + */ 464 468 VPU_JSM_MSG_ENGINE_RESET = VPU_JSM_MSG_ASYNC_CMD, 465 469 /** 466 470 * Preempt engine. The NPU stops (preempts) all the jobs currently ··· 477 467 * the target engine, but it stops processing them (until the queue doorbell 478 468 * is rung again); the host is responsible to reset the job queue, either 479 469 * after preemption or when resubmitting jobs to the queue. 470 + * @see vpu_ipc_msg_payload_engine_preempt 480 471 */ 481 472 VPU_JSM_MSG_ENGINE_PREEMPT = 0x1101, 482 473 /** ··· 594 583 * @see vpu_ipc_msg_payload_hws_resume_engine 595 584 */ 596 585 VPU_JSM_MSG_HWS_ENGINE_RESUME = 0x111b, 597 - /* Control command: Enable survivability/DCT mode */ 586 + /** 587 + * Control command: Enable survivability/DCT mode 588 + * @see vpu_ipc_msg_payload_pwr_dct_control 589 + */ 598 590 VPU_JSM_MSG_DCT_ENABLE = 0x111c, 599 - /* Control command: Disable survivability/DCT mode */ 591 + /** 592 + * Control command: Disable survivability/DCT mode 593 + * This command has no payload 594 + */ 600 595 VPU_JSM_MSG_DCT_DISABLE = 0x111d, 601 596 /** 602 597 * Dump VPU state. To be used for debug purposes only. 603 - * NOTE: Please introduce new ASYNC commands before this one. * 598 + * This command has no payload. 599 + * NOTE: Please introduce new ASYNC commands before this one. 604 600 */ 605 601 VPU_JSM_MSG_STATE_DUMP = 0x11FF, 606 602 607 - /* IPC Host -> Device, General commands */ 603 + /** IPC Host -> Device, base id for general commands */ 608 604 VPU_JSM_MSG_GENERAL_CMD = 0x1200, 605 + /** Unsupported command */ 609 606 VPU_JSM_MSG_BLOB_DEINIT_DEPRECATED = VPU_JSM_MSG_GENERAL_CMD, 610 607 /** 611 608 * Control dyndbg behavior by executing a dyndbg command; equivalent to 612 609 * Linux command: 613 610 * @verbatim echo '<dyndbg_cmd>' > <debugfs>/dynamic_debug/control @endverbatim 611 + * @see vpu_ipc_msg_payload_dyndbg_control 614 612 */ 615 613 VPU_JSM_MSG_DYNDBG_CONTROL = 0x1201, 616 614 /** ··· 627 607 */ 628 608 VPU_JSM_MSG_PWR_D0I3_ENTER = 0x1202, 629 609 630 - /* IPC Device -> Host, Job completion */ 610 + /** 611 + * IPC Device -> Host, Job completion 612 + * @see struct vpu_ipc_msg_payload_job_done 613 + */ 631 614 VPU_JSM_MSG_JOB_DONE = 0x2100, 632 615 /** 633 616 * IPC Device -> Host, Fence signalled ··· 645 622 * @see vpu_ipc_msg_payload_engine_reset_done 646 623 */ 647 624 VPU_JSM_MSG_ENGINE_RESET_DONE = VPU_JSM_MSG_ASYNC_CMD_DONE, 625 + /** 626 + * Preempt complete message 627 + * @see vpu_ipc_msg_payload_engine_preempt_done 628 + */ 648 629 VPU_JSM_MSG_ENGINE_PREEMPT_DONE = 0x2201, 649 630 VPU_JSM_MSG_REGISTER_DB_DONE = 0x2202, 650 631 VPU_JSM_MSG_UNREGISTER_DB_DONE = 0x2203, ··· 756 729 * @see vpu_ipc_msg_payload_hws_resume_engine 757 730 */ 758 731 VPU_JSM_MSG_HWS_RESUME_ENGINE_DONE = 0x221c, 759 - /* Response to control command: Enable survivability/DCT mode */ 732 + /** 733 + * Response to control command: Enable survivability/DCT mode 734 + * This command has no payload 735 + */ 760 736 VPU_JSM_MSG_DCT_ENABLE_DONE = 0x221d, 761 - /* Response to control command: Disable survivability/DCT mode */ 737 + /** 738 + * Response to control command: Disable survivability/DCT mode 739 + * This command has no payload 740 + */ 762 741 VPU_JSM_MSG_DCT_DISABLE_DONE = 0x221e, 763 742 /** 764 743 * Response to state dump control command. 765 - * NOTE: Please introduce new ASYNC responses before this one. * 744 + * This command has no payload. 745 + * NOTE: Please introduce new ASYNC responses before this one. 766 746 */ 767 747 VPU_JSM_MSG_STATE_DUMP_RSP = 0x22FF, 768 748 ··· 787 753 788 754 enum vpu_ipc_msg_status { VPU_JSM_MSG_FREE, VPU_JSM_MSG_ALLOCATED }; 789 755 790 - /* 791 - * Host <-> LRT IPC message payload definitions 756 + /** 757 + * Engine reset request payload 758 + * @see VPU_JSM_MSG_ENGINE_RESET 792 759 */ 793 760 struct vpu_ipc_msg_payload_engine_reset { 794 - /* Engine to be reset. */ 761 + /** Engine to be reset. */ 795 762 u32 engine_idx; 796 - /* Reserved */ 763 + /** Reserved */ 797 764 u32 reserved_0; 798 765 }; 799 766 767 + /** 768 + * Engine preemption request struct 769 + * @see VPU_JSM_MSG_ENGINE_PREEMPT 770 + */ 800 771 struct vpu_ipc_msg_payload_engine_preempt { 801 - /* Engine to be preempted. */ 772 + /** Engine to be preempted. */ 802 773 u32 engine_idx; 803 - /* ID of the preemption request. */ 774 + /** ID of the preemption request. */ 804 775 u32 preempt_id; 805 776 }; 806 777 ··· 974 935 u64 next_buffer_size; 975 936 }; 976 937 938 + /** 939 + * Device -> host job completion message. 940 + * @see VPU_JSM_MSG_JOB_DONE 941 + */ 977 942 struct vpu_ipc_msg_payload_job_done { 978 - /* Engine to which the job was submitted. */ 943 + /** Engine to which the job was submitted. */ 979 944 u32 engine_idx; 980 - /* Index of the doorbell to which the job was submitted */ 945 + /** Index of the doorbell to which the job was submitted */ 981 946 u32 db_idx; 982 - /* ID of the completed job */ 947 + /** ID of the completed job */ 983 948 u32 job_id; 984 - /* Status of the completed job */ 949 + /** Status of the completed job */ 985 950 u32 job_status; 986 - /* Host SSID */ 951 + /** Host SSID */ 987 952 u32 host_ssid; 988 - /* Zero Padding */ 953 + /** Zero Padding */ 989 954 u32 reserved_0; 990 - /* Command queue id */ 955 + /** Command queue id */ 991 956 u64 cmdq_id; 992 957 }; 993 958 ··· 1040 997 impacted_contexts[VPU_MAX_ENGINE_RESET_IMPACTED_CONTEXTS]; 1041 998 }; 1042 999 1000 + /** 1001 + * Preemption response struct 1002 + * @see VPU_JSM_MSG_ENGINE_PREEMPT_DONE 1003 + */ 1043 1004 struct vpu_ipc_msg_payload_engine_preempt_done { 1044 - /* Engine preempted. */ 1005 + /** Engine preempted. */ 1045 1006 u32 engine_idx; 1046 - /* ID of the preemption request. */ 1007 + /** ID of the preemption request. */ 1047 1008 u32 preempt_id; 1048 1009 }; 1049 1010 ··· 1599 1552 }; 1600 1553 1601 1554 /** 1602 - * Payload for VPU_JSM_MSG_DYNDBG_CONTROL requests. 1555 + * Payload for @ref VPU_JSM_MSG_DYNDBG_CONTROL requests. 1603 1556 * 1604 - * VPU_JSM_MSG_DYNDBG_CONTROL are used to control the VPU FW Dynamic Debug 1605 - * feature, which allows developers to selectively enable / disable MVLOG_DEBUG 1606 - * messages. This is equivalent to the Dynamic Debug functionality provided by 1607 - * Linux 1608 - * (https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html) 1609 - * The host can control Dynamic Debug behavior by sending dyndbg commands, which 1610 - * have the same syntax as Linux 1611 - * dyndbg commands. 1557 + * VPU_JSM_MSG_DYNDBG_CONTROL requests are used to control the VPU FW dynamic debug 1558 + * feature, which allows developers to selectively enable/disable code to obtain 1559 + * additional FW information. This is equivalent to the dynamic debug functionality 1560 + * provided by Linux. The host can control dynamic debug behavior by sending dyndbg 1561 + * commands, using the same syntax as for Linux dynamic debug commands. 1612 1562 * 1613 - * NOTE: in order for MVLOG_DEBUG messages to be actually printed, the host 1614 - * still has to set the logging level to MVLOG_DEBUG, using the 1615 - * VPU_JSM_MSG_TRACE_SET_CONFIG command. 1563 + * @see https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html. 1616 1564 * 1617 - * The host can see the current dynamic debug configuration by executing a 1618 - * special 'show' command. The dyndbg configuration will be printed to the 1619 - * configured logging destination using MVLOG_INFO logging level. 1565 + * NOTE: 1566 + * As the dynamic debug feature uses MVLOG messages to provide information, the host 1567 + * must first set the logging level to MVLOG_DEBUG, using the @ref VPU_JSM_MSG_TRACE_SET_CONFIG 1568 + * command. 1620 1569 */ 1621 1570 struct vpu_ipc_msg_payload_dyndbg_control { 1622 1571 /** 1623 - * Dyndbg command (same format as Linux dyndbg); must be a NULL-terminated 1624 - * string. 1572 + * Dyndbg command to be executed. 1625 1573 */ 1626 1574 char dyndbg_cmd[VPU_DYNDBG_CMD_MAX_LEN]; 1627 1575 }; ··· 1637 1595 }; 1638 1596 1639 1597 /** 1640 - * Payload for VPU_JSM_MSG_DCT_ENABLE message. 1598 + * Payload for @ref VPU_JSM_MSG_DCT_ENABLE message. 1641 1599 * 1642 1600 * Default values for DCT active/inactive times are 5.3ms and 30ms respectively, 1643 1601 * corresponding to a 85% duty cycle. This payload allows the host to tune these ··· 1694 1652 struct vpu_ipc_msg_payload_pwr_dct_control pwr_dct_control; 1695 1653 }; 1696 1654 1697 - /* 1698 - * Host <-> LRT IPC message base structure. 1655 + /** 1656 + * Host <-> NPU IPC message base structure. 1699 1657 * 1700 1658 * NOTE: All instances of this object must be aligned on a 64B boundary 1701 1659 * to allow proper handling of VPU cache operations. 1702 1660 */ 1703 1661 struct vpu_jsm_msg { 1704 - /* Reserved */ 1662 + /** Reserved */ 1705 1663 u64 reserved_0; 1706 - /* Message type, see vpu_ipc_msg_type enum. */ 1664 + /** Message type, see @ref vpu_ipc_msg_type. */ 1707 1665 u32 type; 1708 - /* Buffer status, see vpu_ipc_msg_status enum. */ 1666 + /** Buffer status, see @ref vpu_ipc_msg_status. */ 1709 1667 u32 status; 1710 - /* 1668 + /** 1711 1669 * Request ID, provided by the host in a request message and passed 1712 1670 * back by VPU in the response message. 1713 1671 */ 1714 1672 u32 request_id; 1715 - /* Request return code set by the VPU, see VPU_JSM_STATUS_* defines. */ 1673 + /** Request return code set by the VPU, see VPU_JSM_STATUS_* defines. */ 1716 1674 u32 result; 1717 1675 u64 reserved_1; 1718 - /* Message payload depending on message type, see vpu_ipc_msg_payload union. */ 1676 + /** Message payload depending on message type, see vpu_ipc_msg_payload union. */ 1719 1677 union vpu_ipc_msg_payload payload; 1720 1678 }; 1721 1679