diff options
Diffstat (limited to 'nvdebug.h')
| -rw-r--r-- | nvdebug.h | 202 |
1 files changed, 116 insertions, 86 deletions
| @@ -10,6 +10,9 @@ | |||
| 10 | * | 10 | * |
| 11 | * This function should not depend on any Linux-internal headers, and may be | 11 | * This function should not depend on any Linux-internal headers, and may be |
| 12 | * included outside of nvdebug. | 12 | * included outside of nvdebug. |
| 13 | * | ||
| 14 | * Style: This file uses up to 82-character lines to accomodate 2-character | ||
| 15 | * indented quotes from open-gpu-doc without reflowing. | ||
| 13 | */ | 16 | */ |
| 14 | #include <linux/types.h> | 17 | #include <linux/types.h> |
| 15 | 18 | ||
| @@ -53,7 +56,7 @@ struct gk20a; | |||
| 53 | on either runqueue.)" | 56 | on either runqueue.)" |
| 54 | 57 | ||
| 55 | INST_PTR_LO : lower 20 bits of the 4k-aligned instance block pointer | 58 | INST_PTR_LO : lower 20 bits of the 4k-aligned instance block pointer |
| 56 | INST_PTR_HI : upper 32 bit of instance block pointer | 59 | INST_PTR_HI : upper 32 bits of instance block pointer |
| 57 | INST_TARGET (TGI) : aperture of the instance block | 60 | INST_TARGET (TGI) : aperture of the instance block |
| 58 | 61 | ||
| 59 | USERD_PTR_LO : upper 24 bits of the low 32 bits, of the 512-byte-aligned USERD pointer | 62 | USERD_PTR_LO : upper 24 bits of the low 32 bits, of the 512-byte-aligned USERD pointer |
| @@ -78,14 +81,14 @@ static inline const char *target_to_text(enum INST_TARGET t) { | |||
| 78 | } | 81 | } |
| 79 | } | 82 | } |
| 80 | 83 | ||
| 81 | // Support: Volta, Ampere, Turing, Ampere | 84 | // Support: Volta, Ampere, Turing, Ampere, Hopper, Ada |
| 82 | struct gv100_runlist_chan { | 85 | struct gv100_runlist_chan { |
| 83 | // 0:63 | 86 | // 0:63 |
| 84 | enum ENTRY_TYPE entry_type:1; | 87 | enum ENTRY_TYPE entry_type:1; |
| 85 | uint32_t runqueue_selector:1; | 88 | uint32_t runqueue_selector:1; |
| 86 | uint32_t padding:2; | 89 | uint32_t :2; |
| 87 | enum INST_TARGET inst_target:2; | 90 | enum INST_TARGET inst_target:2; |
| 88 | uint32_t padding2:2; | 91 | uint32_t :2; |
| 89 | uint32_t userd_ptr_lo:24; | 92 | uint32_t userd_ptr_lo:24; |
| 90 | uint32_t userd_ptr_hi:32; | 93 | uint32_t userd_ptr_hi:32; |
| 91 | // 64:128 | 94 | // 64:128 |
| @@ -95,15 +98,15 @@ struct gv100_runlist_chan { | |||
| 95 | } __attribute__((packed)); | 98 | } __attribute__((packed)); |
| 96 | 99 | ||
| 97 | // Support: Fermi, Kepler*, Maxwell, Pascal | 100 | // Support: Fermi, Kepler*, Maxwell, Pascal |
| 98 | // *In Kepler, inst fields may be unpopulated? | 101 | // *On Kepler (and older?), inst fields are unpopulated (ex. gk104) |
| 99 | struct gm107_runlist_chan { | 102 | struct gm107_runlist_chan { |
| 100 | uint32_t chid:12; | 103 | uint32_t chid:12; |
| 101 | uint32_t padding0:1; | 104 | uint32_t :1; |
| 102 | enum ENTRY_TYPE entry_type:1; | 105 | enum ENTRY_TYPE entry_type:1; |
| 103 | uint32_t padding1:18; | 106 | uint32_t :18; |
| 104 | uint32_t inst_ptr_lo:20; | 107 | uint32_t inst_ptr_lo:20; |
| 105 | enum INST_TARGET inst_target:2; // Totally guessing on this | 108 | enum INST_TARGET inst_target:2; // Totally guessing on this |
| 106 | uint32_t padding2:10; | 109 | uint32_t :10; |
| 107 | } __attribute__((packed)); | 110 | } __attribute__((packed)); |
| 108 | 111 | ||
| 109 | #define gk110_runlist_chan gm107_runlist_chan | 112 | #define gk110_runlist_chan gm107_runlist_chan |
| @@ -131,20 +134,20 @@ struct gm107_runlist_chan { | |||
| 131 | than 1GHz." | 134 | than 1GHz." |
| 132 | */ | 135 | */ |
| 133 | 136 | ||
| 134 | // Support: Volta, Turing*, Ampere* | 137 | // Support: Volta, Turing*, Ampere*, Hopper, Ada |
| 135 | // *These treat bits 4:11 (8 bits) as GFID (unused) | 138 | // *These treat bits 4:11 (8 bits) as GFID (unused) |
| 136 | struct gv100_runlist_tsg { | 139 | struct gv100_runlist_tsg { |
| 137 | // 0:63 | 140 | // 0:63 |
| 138 | enum ENTRY_TYPE entry_type:1; | 141 | enum ENTRY_TYPE entry_type:1; |
| 139 | uint64_t padding:15; | 142 | uint64_t :15; |
| 140 | uint32_t timeslice_scale:4; | 143 | uint32_t timeslice_scale:4; |
| 141 | uint64_t padding2:4; | 144 | uint64_t :4; |
| 142 | uint32_t timeslice_timeout:8; | 145 | uint32_t timeslice_timeout:8; |
| 143 | uint32_t tsg_length:8; | 146 | uint32_t tsg_length:8; |
| 144 | uint32_t padding3:24; | 147 | uint32_t :24; |
| 145 | // 64:128 | 148 | // 64:128 |
| 146 | uint32_t tsgid:12; | 149 | uint32_t tsgid:12; |
| 147 | uint64_t padding4:52; | 150 | uint64_t :52; |
| 148 | } __attribute__((packed)); | 151 | } __attribute__((packed)); |
| 149 | #define MAX_TSGID (1 << 12) | 152 | #define MAX_TSGID (1 << 12) |
| 150 | 153 | ||
| @@ -153,12 +156,12 @@ struct gv100_runlist_tsg { | |||
| 153 | // Last 32 bits appear to contain an undocumented inst ptr | 156 | // Last 32 bits appear to contain an undocumented inst ptr |
| 154 | struct gk110_runlist_tsg { | 157 | struct gk110_runlist_tsg { |
| 155 | uint32_t tsgid:12; | 158 | uint32_t tsgid:12; |
| 156 | uint32_t padding0:1; | 159 | uint32_t :1; |
| 157 | enum ENTRY_TYPE entry_type:1; | 160 | enum ENTRY_TYPE entry_type:1; |
| 158 | uint32_t timeslice_scale:4; | 161 | uint32_t timeslice_scale:4; |
| 159 | uint32_t timeslice_timeout:8; | 162 | uint32_t timeslice_timeout:8; |
| 160 | uint32_t tsg_length:6; | 163 | uint32_t tsg_length:6; |
| 161 | uint32_t padding1:32; | 164 | uint32_t :32; |
| 162 | } __attribute__((packed)); | 165 | } __attribute__((packed)); |
| 163 | 166 | ||
| 164 | 167 | ||
| @@ -175,11 +178,11 @@ enum PREEMPT_TYPE {PREEMPT_TYPE_CHANNEL = 0, PREEMPT_TYPE_TSG = 1}; | |||
| 175 | typedef union { | 178 | typedef union { |
| 176 | struct { | 179 | struct { |
| 177 | uint32_t id:12; | 180 | uint32_t id:12; |
| 178 | uint32_t padding:8; | 181 | uint32_t :8; |
| 179 | bool is_pending:1; | 182 | bool is_pending:1; |
| 180 | uint32_t padding2:3; | 183 | uint32_t :3; |
| 181 | enum PREEMPT_TYPE type:2; | 184 | enum PREEMPT_TYPE type:2; |
| 182 | uint32_t padding3:6; | 185 | uint32_t :6; |
| 183 | } __attribute__((packed)); | 186 | } __attribute__((packed)); |
| 184 | uint32_t raw; | 187 | uint32_t raw; |
| 185 | } pfifo_preempt_t; | 188 | } pfifo_preempt_t; |
| @@ -220,7 +223,7 @@ typedef union { | |||
| 220 | bool runlist_11:1; | 223 | bool runlist_11:1; |
| 221 | bool runlist_12:1; | 224 | bool runlist_12:1; |
| 222 | bool runlist_13:1; | 225 | bool runlist_13:1; |
| 223 | uint32_t padding:18; | 226 | uint32_t :18; |
| 224 | } __attribute__((packed)); | 227 | } __attribute__((packed)); |
| 225 | uint32_t raw; | 228 | uint32_t raw; |
| 226 | } runlist_preempt_t; | 229 | } runlist_preempt_t; |
| @@ -313,7 +316,8 @@ typedef union { | |||
| 313 | of this, the layout was modified to allow for larger runlist pointers (upper | 316 | of this, the layout was modified to allow for larger runlist pointers (upper |
| 314 | 52 of 64 bits). | 317 | 52 of 64 bits). |
| 315 | 318 | ||
| 316 | Support: Turing, Ampere, Lovelace?, Hopper? | 319 | Support: Turing, Ampere*, Hopper*, Ada* |
| 320 | *Only the register layout | ||
| 317 | */ | 321 | */ |
| 318 | // Support: Turing | 322 | // Support: Turing |
| 319 | #define NV_PFIFO_RUNLIST_BASE_TU102(i) (0x00002B00+(i)*16) // Read/write | 323 | #define NV_PFIFO_RUNLIST_BASE_TU102(i) (0x00002B00+(i)*16) // Read/write |
| @@ -324,9 +328,9 @@ typedef union { | |||
| 324 | typedef union { | 328 | typedef union { |
| 325 | struct { | 329 | struct { |
| 326 | enum INST_TARGET target:2; | 330 | enum INST_TARGET target:2; |
| 327 | uint32_t padding:10; | 331 | uint32_t :10; |
| 328 | uint64_t ptr:28; | 332 | uint64_t ptr:28; |
| 329 | uint32_t padding2:24; | 333 | uint32_t :24; |
| 330 | } __attribute__((packed)); | 334 | } __attribute__((packed)); |
| 331 | uint64_t raw; | 335 | uint64_t raw; |
| 332 | } runlist_base_tu102_t; | 336 | } runlist_base_tu102_t; |
| @@ -453,7 +457,7 @@ typedef union { | |||
| 453 | bool runlist_8:1; | 457 | bool runlist_8:1; |
| 454 | bool runlist_9:1; | 458 | bool runlist_9:1; |
| 455 | bool runlist_10:1; | 459 | bool runlist_10:1; |
| 456 | uint32_t padding:21; | 460 | uint32_t :21; |
| 457 | } __attribute__((packed)); | 461 | } __attribute__((packed)); |
| 458 | uint32_t raw; | 462 | uint32_t raw; |
| 459 | } runlist_disable_t; | 463 | } runlist_disable_t; |
| @@ -546,17 +550,17 @@ typedef union { | |||
| 546 | uint32_t minor_revision:4; | 550 | uint32_t minor_revision:4; |
| 547 | uint32_t major_revision:4; | 551 | uint32_t major_revision:4; |
| 548 | uint32_t reserved:4; | 552 | uint32_t reserved:4; |
| 549 | uint32_t padding0:8; | 553 | uint32_t :8; |
| 550 | uint32_t implementation:4; | 554 | uint32_t implementation:4; |
| 551 | uint32_t architecture:5; | 555 | uint32_t architecture:5; |
| 552 | uint32_t padding1:3; | 556 | uint32_t :3; |
| 553 | } __attribute__((packed)); | 557 | } __attribute__((packed)); |
| 554 | uint32_t raw; | 558 | uint32_t raw; |
| 555 | // Arch << 4 + impl is also often used | 559 | // Arch << 4 + impl is also often used |
| 556 | struct { | 560 | struct { |
| 557 | uint32_t padding2:20; | 561 | uint32_t :20; |
| 558 | uint32_t chip_id:9; | 562 | uint32_t chip_id:9; |
| 559 | uint32_t padding3:3; | 563 | uint32_t :3; |
| 560 | } __attribute__((packed)); | 564 | } __attribute__((packed)); |
| 561 | } mc_boot_0_t; | 565 | } mc_boot_0_t; |
| 562 | 566 | ||
| @@ -679,35 +683,35 @@ typedef union { | |||
| 679 | enum DEVICE_INFO_TYPE info_type:2; | 683 | enum DEVICE_INFO_TYPE info_type:2; |
| 680 | bool fault_id_is_valid:1; | 684 | bool fault_id_is_valid:1; |
| 681 | uint32_t fault_id:7; | 685 | uint32_t fault_id:7; |
| 682 | uint32_t padding0:2; | 686 | uint32_t :2; |
| 683 | uint32_t pri_base:12; | 687 | uint32_t pri_base:12; |
| 684 | uint32_t padding1:2; | 688 | uint32_t :2; |
| 685 | uint32_t inst_id:4; | 689 | uint32_t inst_id:4; |
| 686 | uint32_t is_not_enum2:1; | 690 | uint32_t is_not_enum2:1; |
| 687 | bool has_next_entry:1; | 691 | bool has_next_entry:1; |
| 688 | } __attribute__((packed)); | 692 | } __attribute__((packed)); |
| 689 | // ENUM type fields | 693 | // ENUM type fields |
| 690 | struct { | 694 | struct { |
| 691 | uint32_t padding2:2; | 695 | uint32_t :2; |
| 692 | bool reset_is_valid:1; | 696 | bool reset_is_valid:1; |
| 693 | bool intr_is_valid:1; | 697 | bool intr_is_valid:1; |
| 694 | bool runlist_is_valid:1; | 698 | bool runlist_is_valid:1; |
| 695 | bool engine_is_valid:1; | 699 | bool engine_is_valid:1; |
| 696 | |||
