Oded writes: This tag contains habanalabs driver changes for v5.13: - Add support to reset device after the user closes the file descriptor. Because we support a single user, we can reset the device (if needs to) after a user closes its file descriptor to make sure the device is in idle and clean state for the next user. - Add a new feature to allow the user to wait on interrupt. This is needed for future ASICs - Replace GFP_ATOMIC with GFP_KERNEL wherever possible and add code to support failure of allocating with GFP_ATOMIC. - Update code to support the latest firmware image: - More security features are done in the firmware - Remove hard-coded assumptions and replace them with values that are sent to the firmware on loading. - Print device unusable error - Reset device in case the communication between driver and firmware gets out of sync. - Support new PCI device ids for secured GAUDI. - Expose current power draw through the INFO IOCTL. - Support resetting the device upon a request from the BMC (through F/W). - Always use only a single MSI in GAUDI, due to H/W limitation. - Improve data-path code by taking out code from spinlock protection. - Allow user to specify custom timeout per Command Submission. - Some enhancements to debugfs. - Various minor changes and improvements. * tag 'misc-habanalabs-next-2021-04-10' of https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux: (41 commits) habanalabs: print f/w boot unknown error habanalabs: update to latest F/W communication header habanalabs/gaudi: skip iATU if F/W security is enabled habanalabs/gaudi: derive security status from pci id habanalabs: move dram scrub to free sequence habanalabs: send dynamic msi-x indexes to f/w habanalabs/gaudi: clear QM errors only if not in stop_on_err mode habanalabs: support DEVICE_UNUSABLE error indication from FW habanalabs: use strscpy instead of sprintf and strlcpy habanalabs: remove the store jobs array from CS IOCTL habanalabs/gaudi: add debugfs to DMA from the device habanalabs/gaudi: sync stream add protection to SOB reset flow habanalabs: add custom timeout flag per cs habanalabs: improve utilization calculation habanalabs: support legacy and new pll indexes habanalabs: move relevant datapath work outside cs lock habanalabs: avoid soft lockup bug upon mapping error habanalabs/gaudi: Update async events header habanalabs/gaudi: unsecure TPC cfg status registers habanalabs/gaudi: always use single-msi mode ...
Showing the changes to include/uapi (1 of 31 files). Show all
Unified · Split
| @@ -297,6 +297,7 @@ enum hl_device_status { · 296 unmodified lines | |||
| 297 | #define HL_INFO_SYNC_MANAGER 14 | 297 | #define HL_INFO_SYNC_MANAGER 14 |
| 298 | #define HL_INFO_TOTAL_ENERGY 15 | 298 | #define HL_INFO_TOTAL_ENERGY 15 |
| 299 | #define HL_INFO_PLL_FREQUENCY 16 | 299 | #define HL_INFO_PLL_FREQUENCY 16 |
| 300 | #define HL_INFO_POWER 17 | ||
| 300 | 301 | ||
| 301 | #define HL_INFO_VERSION_MAX_LEN 128 | 302 | #define HL_INFO_VERSION_MAX_LEN 128 |
| 302 | #define HL_INFO_CARD_NAME_MAX_LEN 16 | 303 | #define HL_INFO_CARD_NAME_MAX_LEN 16 |
| @@ -410,6 +411,14 @@ struct hl_pll_frequency_info { · 107 unmodified lines | |||
| 410 | __u16 output[HL_PLL_NUM_OUTPUTS]; | 411 | __u16 output[HL_PLL_NUM_OUTPUTS]; |
| 411 | }; | 412 | }; |
| 412 | 413 | ||
| 414 | /** | ||
| 415 | * struct hl_power_info - power information | ||
| 416 | * @power: power consumption | ||
| 417 | */ | ||
| 418 | struct hl_power_info { | ||
| 419 | __u64 power; | ||
| 420 | }; | ||
| 421 | |||
| 413 | /** | 422 | /** |
| 414 | * struct hl_info_sync_manager - sync manager information | 423 | * struct hl_info_sync_manager - sync manager information |
| 415 | * @first_available_sync_object: first available sob | 424 | * @first_available_sync_object: first available sob |
| @@ -621,6 +630,7 @@ struct hl_cs_chunk { · 205 unmodified lines | |||
| 621 | #define HL_CS_FLAGS_STAGED_SUBMISSION 0x40 | 630 | #define HL_CS_FLAGS_STAGED_SUBMISSION 0x40 |
| 622 | #define HL_CS_FLAGS_STAGED_SUBMISSION_FIRST 0x80 | 631 | #define HL_CS_FLAGS_STAGED_SUBMISSION_FIRST 0x80 |
| 623 | #define HL_CS_FLAGS_STAGED_SUBMISSION_LAST 0x100 | 632 | #define HL_CS_FLAGS_STAGED_SUBMISSION_LAST 0x100 |
| 633 | #define HL_CS_FLAGS_CUSTOM_TIMEOUT 0x200 | ||
| 624 | 634 | ||
| 625 | #define HL_CS_STATUS_SUCCESS 0 | 635 | #define HL_CS_STATUS_SUCCESS 0 |
| 626 | 636 | ||
| @@ -634,17 +644,10 @@ struct hl_cs_in { · 7 unmodified lines | |||
| 634 | /* holds address of array of hl_cs_chunk for execution phase */ | 644 | /* holds address of array of hl_cs_chunk for execution phase */ |
| 635 | __u64 chunks_execute; | 645 | __u64 chunks_execute; |
| 636 | 646 | ||
| 637 | union { | 647 | /* Sequence number of a staged submission CS |
| 638 | /* this holds address of array of hl_cs_chunk for store phase - | 648 | * valid only if HL_CS_FLAGS_STAGED_SUBMISSION is set |
| 639 | * Currently not in use | 649 | */ |
| 640 | */ | 650 | __u64 seq; |
| 641 | __u64 chunks_store; | ||
| 642 | |||
| 643 | /* Sequence number of a staged submission CS | ||
| 644 | * valid only if HL_CS_FLAGS_STAGED_SUBMISSION is set | ||
| 645 | */ | ||
| 646 | __u64 seq; | ||
| 647 | }; | ||
| 648 | 651 | ||
| 649 | /* Number of chunks in restore phase array. Maximum number is | 652 | /* Number of chunks in restore phase array. Maximum number is |
| 650 | * HL_MAX_JOBS_PER_CS | 653 | * HL_MAX_JOBS_PER_CS |
| @@ -656,8 +659,10 @@ struct hl_cs_in { · 5 unmodified lines | |||
| 656 | */ | 659 | */ |
| 657 | __u32 num_chunks_execute; | 660 | __u32 num_chunks_execute; |
| 658 | 661 | ||
| 659 | /* Number of chunks in restore phase array - Currently not in use */ | 662 | /* timeout in seconds - valid only if HL_CS_FLAGS_CUSTOM_TIMEOUT |
| 660 | __u32 num_chunks_store; | 663 | * is set |
| 664 | */ | ||
| 665 | __u32 timeout; | ||
| 661 | 666 | ||
| 662 | /* HL_CS_FLAGS_* */ | 667 | /* HL_CS_FLAGS_* */ |
| 663 | __u32 cs_flags; | 668 | __u32 cs_flags; |
| @@ -682,14 +687,46 @@ union hl_cs_args { · 18 unmodified lines | |||
| 682 | struct hl_cs_out out; | 687 | struct hl_cs_out out; |
| 683 | }; | 688 | }; |
| 684 | 689 | ||
| 690 | #define HL_WAIT_CS_FLAGS_INTERRUPT 0x2 | ||
| 691 | #define HL_WAIT_CS_FLAGS_INTERRUPT_MASK 0xFFF00000 | ||
| 692 | |||
| 685 | struct hl_wait_cs_in { | 693 | struct hl_wait_cs_in { |
| 686 | /* Command submission sequence number */ | 694 | union { |
| 687 | __u64 seq; | 695 | struct { |
| 688 | /* Absolute timeout to wait in microseconds */ | 696 | /* Command submission sequence number */ |
| 689 | __u64 timeout_us; | 697 | __u64 seq; |
| 698 | /* Absolute timeout to wait for command submission | ||
| 699 | * in microseconds | ||
| 700 | */ | ||
| 701 | __u64 timeout_us; | ||
| 702 | }; | ||
| 703 | |||
| 704 | struct { | ||
| 705 | /* User address for completion comparison. | ||
| 706 | * upon interrupt, driver will compare the value pointed | ||
| 707 | * by this address with the supplied target value. | ||
| 708 | * in order not to perform any comparison, set address | ||
| 709 | * to all 1s. | ||
| 710 | * Relevant only when HL_WAIT_CS_FLAGS_INTERRUPT is set | ||
| 711 | */ | ||
| 712 | __u64 addr; | ||
| 713 | /* Target value for completion comparison */ | ||
| 714 | __u32 target; | ||
| 715 | /* Absolute timeout to wait for interrupt | ||
| 716 | * in microseconds | ||
| 717 | */ | ||
| 718 | __u32 interrupt_timeout_us; | ||
| 719 | }; | ||
| 720 | }; | ||
| 721 | |||
| 690 | /* Context ID - Currently not in use */ | 722 | /* Context ID - Currently not in use */ |
| 691 | __u32 ctx_id; | 723 | __u32 ctx_id; |
| 692 | __u32 pad; | 724 | /* HL_WAIT_CS_FLAGS_* |
| 725 | * If HL_WAIT_CS_FLAGS_INTERRUPT is set, this field should include | ||
| 726 | * interrupt id according to HL_WAIT_CS_FLAGS_INTERRUPT_MASK, in order | ||
| 727 | * not to specify an interrupt id ,set mask to all 1s. | ||
| 728 | */ | ||
| 729 | __u32 flags; | ||
| 693 | }; | 730 | }; |
| 694 | 731 | ||
| 695 | #define HL_WAIT_CS_STATUS_COMPLETED 0 | 732 | #define HL_WAIT_CS_STATUS_COMPLETED 0 |
| @@ -999,8 +1036,8 @@ struct hl_debug_args { · 303 unmodified lines | |||
| 999 | * Each JOB will be enqueued on a specific queue, according to the user's input. | 1036 | * Each JOB will be enqueued on a specific queue, according to the user's input. |
| 1000 | * There can be more then one JOB per queue. | 1037 | * There can be more then one JOB per queue. |
| 1001 | * | 1038 | * |
| 1002 | * The CS IOCTL will receive three sets of JOBS. One set is for "restore" phase, | 1039 | * The CS IOCTL will receive two sets of JOBS. One set is for "restore" phase |
| 1003 | * a second set is for "execution" phase and a third set is for "store" phase. | 1040 | * and a second set is for "execution" phase. |
| 1004 | * The JOBS on the "restore" phase are enqueued only after context-switch | 1041 | * The JOBS on the "restore" phase are enqueued only after context-switch |
| 1005 | * (or if its the first CS for this context). The user can also order the | 1042 | * (or if its the first CS for this context). The user can also order the |
| 1006 | * driver to run the "restore" phase explicitly | 1043 | * driver to run the "restore" phase explicitly |