diff options
Diffstat (limited to 'nvdebug.h')
| -rw-r--r-- | nvdebug.h | 14 |
1 files changed, 13 insertions, 1 deletions
| @@ -4,8 +4,10 @@ | |||
| 4 | 4 | ||
| 5 | // TODO(jbakita): Don't depend on these. | 5 | // TODO(jbakita): Don't depend on these. |
| 6 | #include <nvgpu/gk20a.h> // For struct gk20a | 6 | #include <nvgpu/gk20a.h> // For struct gk20a |
| 7 | #include <os/linux/os_linux.h> // For struct nvgpu_os_linux | ||
| 8 | #include <linux/proc_fs.h> // For PDE_DATA() macro | 7 | #include <linux/proc_fs.h> // For PDE_DATA() macro |
| 8 | #include <linux/device.h> // For dev_get_drvdata() | ||
| 9 | #include <linux/version.h> // For KERNEL_VERSION and LINUX_VERSION_CODE | ||
| 10 | #include <asm/io.h> | ||
| 9 | 11 | ||
| 10 | /* Runlist Channel | 12 | /* Runlist Channel |
| 11 | A timeslice group (TSG) is composed of channels. Each channel is a FIFO queue | 13 | A timeslice group (TSG) is composed of channels. Each channel is a FIFO queue |
| @@ -943,7 +945,17 @@ static inline int file2parentgpuidx(const struct file *f) { | |||
| 943 | return (uintptr_t)PDE_DATA(file_dentry(f)->d_parent->d_inode); | 945 | return (uintptr_t)PDE_DATA(file_dentry(f)->d_parent->d_inode); |
| 944 | } | 946 | } |
| 945 | 947 | ||
| 948 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) | ||
| 949 | // Commit 643eb158a3 in nvgpu moved the mapped registers to the second entry | ||
| 950 | // of the gk20a struct (after a function pointer). This change was made as L4T | ||
| 951 | // was upgraded from Linux 4.9 to 5.10 (r32 -> r34+) | ||
| 952 | // Note that this is wrong if nvgpu was built without CONFIG_NVGPU_NON_FUSA | ||
| 953 | // i.e. if FUSA was enabled, this is wrong. | ||
| 954 | #define gk20a_regs(gk20a) ((void*)gk20a + sizeof(void(*)(void))) | ||
| 955 | #else | ||
| 956 | #include <os/linux/os_linux.h> // For struct nvgpu_os_linux, which holds regs | ||
| 946 | #define gk20a_regs(gk20a) (container_of(gk20a, struct nvgpu_os_linux, g)->regs) | 957 | #define gk20a_regs(gk20a) (container_of(gk20a, struct nvgpu_os_linux, g)->regs) |
| 958 | #endif | ||
| 947 | 959 | ||
| 948 | // Similar to nvgpu_readl() | 960 | // Similar to nvgpu_readl() |
| 949 | // (except we don't try to resolve situations where regs is NULL) | 961 | // (except we don't try to resolve situations where regs is NULL) |
