aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/nvidia_info.h
blob: 8c2a5524512e3db3876cb2132683da78754aaafb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef __LITMUS_NVIDIA_H
#define __LITMUS_NVIDIA_H

#include <linux/interrupt.h>


#include <litmus/litmus_softirq.h>

#define NV_DEVICE_NUM CONFIG_NV_DEVICE_NUM

/* TODO: Make this a function that checks the PCIe bus or maybe proc settings */
#define num_online_gpus() (NV_DEVICE_NUM)


/* Functions used for decoding NVIDIA blobs. */

int init_nvidia_info(void);
void shutdown_nvidia_info(void);

int is_nvidia_func(void* func_addr);

void dump_nvidia_info(const struct tasklet_struct *t);

// Returns the Nvidia device # associated with provided tasklet and work_struct.
u32 get_tasklet_nv_device_num(const struct tasklet_struct *t);
u32 get_work_nv_device_num(const struct work_struct *t);

/* Functions for figuring out the priority of GPU-using tasks */

struct task_struct* get_nv_max_device_owner(u32 target_device_id);

#ifdef CONFIG_LITMUS_SOFTIRQD
struct task_struct* get_nv_klmirqd_thread(u32 target_device_id);
#endif

/* call when the GPU-holding task, t, blocks */
long enable_gpu_owner(struct task_struct *t);

/* call when the GPU-holding task, t, resumes */
long disable_gpu_owner(struct task_struct *t);

/* call when the GPU-holding task, t, increases its priority */
int gpu_owner_increase_priority(struct task_struct *t);

/* call when the GPU-holding task, t, decreases its priority */
int gpu_owner_decrease_priority(struct task_struct *t);


int reg_nv_device(int reg_device_id, int reg_action, struct task_struct *t);

#endif