aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/nvidia_info.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-04-18 21:33:21 -0400
committerGlenn Elliott <gelliott@cs.unc.edu>2012-04-18 21:33:21 -0400
commit149ef3b424a49e6b928c5e23fea83380ed95ea38 (patch)
tree38b9a7397875be56f31f9f04f86fcf1f9e4966ac /litmus/nvidia_info.c
parentf916cdb8e6a9ee2c917fddb7351e6bb39f6c953e (diff)
Zap line-endings
Diffstat (limited to 'litmus/nvidia_info.c')
-rw-r--r--litmus/nvidia_info.c142
1 files changed, 71 insertions, 71 deletions
diff --git a/litmus/nvidia_info.c b/litmus/nvidia_info.c
index fd6398121fbf..889313c854e6 100644
--- a/litmus/nvidia_info.c
+++ b/litmus/nvidia_info.c
@@ -41,10 +41,10 @@ typedef struct
41{ 41{
42 void *priv; /* private data */ 42 void *priv; /* private data */
43 void *os_state; /* os-specific device state */ 43 void *os_state; /* os-specific device state */
44 44
45 int rmInitialized; 45 int rmInitialized;
46 int flags; 46 int flags;
47 47
48 /* PCI config info */ 48 /* PCI config info */
49 NvU32 domain; 49 NvU32 domain;
50 NvU16 bus; 50 NvU16 bus;
@@ -54,31 +54,31 @@ typedef struct
54 NvU16 subsystem_id; 54 NvU16 subsystem_id;
55 NvU32 gpu_id; 55 NvU32 gpu_id;
56 void *handle; 56 void *handle;
57 57
58 NvU32 pci_cfg_space[16]; 58 NvU32 pci_cfg_space[16];
59 59
60 /* physical characteristics */ 60 /* physical characteristics */
61 litmus_nv_aperture_t bars[3]; 61 litmus_nv_aperture_t bars[3];
62 litmus_nv_aperture_t *regs; 62 litmus_nv_aperture_t *regs;
63 litmus_nv_aperture_t *fb, ud; 63 litmus_nv_aperture_t *fb, ud;
64 litmus_nv_aperture_t agp; 64 litmus_nv_aperture_t agp;
65 65
66 NvU32 interrupt_line; 66 NvU32 interrupt_line;
67 67
68 NvU32 agp_config; 68 NvU32 agp_config;
69 NvU32 agp_status; 69 NvU32 agp_status;
70 70
71 NvU32 primary_vga; 71 NvU32 primary_vga;
72 72
73 NvU32 sim_env; 73 NvU32 sim_env;
74 74
75 NvU32 rc_timer_enabled; 75 NvU32 rc_timer_enabled;
76 76
77 /* list of events allocated for this device */ 77 /* list of events allocated for this device */
78 void *event_list; 78 void *event_list;
79 79
80 void *kern_mappings; 80 void *kern_mappings;
81 81
82} litmus_nv_state_t; 82} litmus_nv_state_t;
83 83
84typedef struct work_struct litmus_nv_task_t; 84typedef struct work_struct litmus_nv_task_t;
@@ -91,11 +91,11 @@ typedef struct litmus_nv_work_s {
91typedef struct litmus_nv_linux_state_s { 91typedef struct litmus_nv_linux_state_s {
92 litmus_nv_state_t nv_state; 92 litmus_nv_state_t nv_state;
93 atomic_t usage_count; 93 atomic_t usage_count;
94 94
95 struct pci_dev *dev; 95 struct pci_dev *dev;
96 void *agp_bridge; 96 void *agp_bridge;
97 void *alloc_queue; 97 void *alloc_queue;
98 98
99 void *timer_sp; 99 void *timer_sp;
100 void *isr_sp; 100 void *isr_sp;
101 void *pci_cfgchk_sp; 101 void *pci_cfgchk_sp;
@@ -108,29 +108,29 @@ typedef struct litmus_nv_linux_state_s {
108 /* keep track of any pending bottom halfes */ 108 /* keep track of any pending bottom halfes */
109 struct tasklet_struct tasklet; 109 struct tasklet_struct tasklet;
110 litmus_nv_work_t work; 110 litmus_nv_work_t work;
111 111
112 /* get a timer callback every second */ 112 /* get a timer callback every second */
113 struct timer_list rc_timer; 113 struct timer_list rc_timer;
114 114
115 /* lock for linux-specific data, not used by core rm */ 115 /* lock for linux-specific data, not used by core rm */
116 struct semaphore ldata_lock; 116 struct semaphore ldata_lock;
117 117
118 /* lock for linux-specific alloc queue */ 118 /* lock for linux-specific alloc queue */
119 struct semaphore at_lock; 119 struct semaphore at_lock;
120 120
121#if 0 121#if 0
122#if defined(NV_USER_MAP) 122#if defined(NV_USER_MAP)
123 /* list of user mappings */ 123 /* list of user mappings */
124 struct nv_usermap_s *usermap_list; 124 struct nv_usermap_s *usermap_list;
125 125
126 /* lock for VMware-specific mapping list */ 126 /* lock for VMware-specific mapping list */
127 struct semaphore mt_lock; 127 struct semaphore mt_lock;
128#endif /* defined(NV_USER_MAP) */ 128#endif /* defined(NV_USER_MAP) */
129#if defined(NV_PM_SUPPORT_OLD_STYLE_APM) 129#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
130 void *apm_nv_dev; 130 void *apm_nv_dev;
131#endif 131#endif
132#endif 132#endif
133 133
134 NvU32 device_num; 134 NvU32 device_num;
135 struct litmus_nv_linux_state_s *next; 135 struct litmus_nv_linux_state_s *next;
136} litmus_nv_linux_state_t; 136} litmus_nv_linux_state_t;
@@ -140,9 +140,9 @@ void dump_nvidia_info(const struct tasklet_struct *t)
140 litmus_nv_state_t* nvstate = NULL; 140 litmus_nv_state_t* nvstate = NULL;
141 litmus_nv_linux_state_t* linuxstate = NULL; 141 litmus_nv_linux_state_t* linuxstate = NULL;
142 struct pci_dev* pci = NULL; 142 struct pci_dev* pci = NULL;
143 143
144 nvstate = (litmus_nv_state_t*)(t->data); 144 nvstate = (litmus_nv_state_t*)(t->data);
145 145
146 if(nvstate) 146 if(nvstate)
147 { 147 {
148 TRACE("NV State:\n" 148 TRACE("NV State:\n"
@@ -170,21 +170,21 @@ void dump_nvidia_info(const struct tasklet_struct *t)
170 nvstate->subsystem_id, 170 nvstate->subsystem_id,
171 nvstate->gpu_id, 171 nvstate->gpu_id,
172 nvstate->interrupt_line); 172 nvstate->interrupt_line);
173 173
174 linuxstate = container_of(nvstate, litmus_nv_linux_state_t, nv_state); 174 linuxstate = container_of(nvstate, litmus_nv_linux_state_t, nv_state);
175 } 175 }
176 else 176 else
177 { 177 {
178 TRACE("INVALID NVSTATE????\n"); 178 TRACE("INVALID NVSTATE????\n");
179 } 179 }
180 180
181 if(linuxstate) 181 if(linuxstate)
182 { 182 {
183 int ls_offset = (void*)(&(linuxstate->device_num)) - (void*)(linuxstate); 183 int ls_offset = (void*)(&(linuxstate->device_num)) - (void*)(linuxstate);
184 int ns_offset_raw = (void*)(&(linuxstate->device_num)) - (void*)(&(linuxstate->nv_state)); 184 int ns_offset_raw = (void*)(&(linuxstate->device_num)) - (void*)(&(linuxstate->nv_state));
185 int ns_offset_desired = (void*)(&(linuxstate->device_num)) - (void*)(nvstate); 185 int ns_offset_desired = (void*)(&(linuxstate->device_num)) - (void*)(nvstate);
186 186
187 187
188 TRACE("LINUX NV State:\n" 188 TRACE("LINUX NV State:\n"
189 "\tlinux nv state ptr: %p\n" 189 "\tlinux nv state ptr: %p\n"
190 "\taddress of tasklet: %p\n" 190 "\taddress of tasklet: %p\n"
@@ -200,9 +200,9 @@ void dump_nvidia_info(const struct tasklet_struct *t)
200 linuxstate->device_num, 200 linuxstate->device_num,
201 (t == &(linuxstate->tasklet)), 201 (t == &(linuxstate->tasklet)),
202 linuxstate->dev); 202 linuxstate->dev);
203 203
204 pci = linuxstate->dev; 204 pci = linuxstate->dev;
205 205
206 TRACE("Offsets:\n" 206 TRACE("Offsets:\n"
207 "\tOffset from LinuxState: %d, %x\n" 207 "\tOffset from LinuxState: %d, %x\n"
208 "\tOffset from NVState: %d, %x\n" 208 "\tOffset from NVState: %d, %x\n"
@@ -249,7 +249,7 @@ int init_nvidia_info(void)
249{ 249{
250 mutex_lock(&module_mutex); 250 mutex_lock(&module_mutex);
251 nvidia_mod = find_module("nvidia"); 251 nvidia_mod = find_module("nvidia");
252 mutex_unlock(&module_mutex); 252 mutex_unlock(&module_mutex);
253 if(nvidia_mod != NULL) 253 if(nvidia_mod != NULL)
254 { 254 {
255 TRACE("%s : Found NVIDIA module. Core Code: %p to %p\n", __FUNCTION__, 255 TRACE("%s : Found NVIDIA module. Core Code: %p to %p\n", __FUNCTION__,
@@ -280,7 +280,7 @@ int is_nvidia_func(void* func_addr)
280 __FUNCTION__, func_addr, ret); 280 __FUNCTION__, func_addr, ret);
281 }*/ 281 }*/
282 } 282 }
283 283
284 return(ret); 284 return(ret);
285} 285}
286 286
@@ -303,7 +303,7 @@ u32 get_tasklet_nv_device_num(const struct tasklet_struct *t)
303 303
304 void* state = (void*)(t->data); 304 void* state = (void*)(t->data);
305 void* device_num_ptr = state + DEVICE_NUM_OFFSET; 305 void* device_num_ptr = state + DEVICE_NUM_OFFSET;
306 306
307 //dump_nvidia_info(t); 307 //dump_nvidia_info(t);
308 return(*((u32*)device_num_ptr)); 308 return(*((u32*)device_num_ptr));
309#endif 309#endif
@@ -334,14 +334,14 @@ static nv_device_registry_t NV_DEVICE_REG[NV_DEVICE_NUM];
334int init_nv_device_reg(void) 334int init_nv_device_reg(void)
335{ 335{
336 int i; 336 int i;
337 337
338 memset(NV_DEVICE_REG, 0, sizeof(NV_DEVICE_REG)); 338 memset(NV_DEVICE_REG, 0, sizeof(NV_DEVICE_REG));
339 339
340 for(i = 0; i < NV_DEVICE_NUM; ++i) 340 for(i = 0; i < NV_DEVICE_NUM; ++i)
341 { 341 {
342 raw_spin_lock_init(&NV_DEVICE_REG[i].lock); 342 raw_spin_lock_init(&NV_DEVICE_REG[i].lock);
343 } 343 }
344 344
345 return(1); 345 return(1);
346} 346}
347 347
@@ -360,7 +360,7 @@ int get_nv_device_id(struct task_struct* owner)
360 if(NV_DEVICE_REG[i].device_owner == owner) 360 if(NV_DEVICE_REG[i].device_owner == owner)
361 return(i); 361 return(i);
362 } 362 }
363 return(-1); 363 return(-1);
364} 364}
365*/ 365*/
366 366
@@ -380,42 +380,42 @@ void pai_check_priority_increase(struct task_struct *t, int reg_device_id)
380{ 380{
381 unsigned long flags; 381 unsigned long flags;
382 nv_device_registry_t *reg = &NV_DEVICE_REG[reg_device_id]; 382 nv_device_registry_t *reg = &NV_DEVICE_REG[reg_device_id];
383 383
384 if(reg->max_prio_owner != t) { 384 if(reg->max_prio_owner != t) {
385 385
386 raw_spin_lock_irqsave(&reg->lock, flags); 386 raw_spin_lock_irqsave(&reg->lock, flags);
387 387
388 if(reg->max_prio_owner != t) { 388 if(reg->max_prio_owner != t) {
389 if(litmus->compare(t, reg->max_prio_owner)) { 389 if(litmus->compare(t, reg->max_prio_owner)) {
390 litmus->change_prio_pai_tasklet(reg->max_prio_owner, t); 390 litmus->change_prio_pai_tasklet(reg->max_prio_owner, t);
391 reg->max_prio_owner = t; 391 reg->max_prio_owner = t;
392 } 392 }
393 } 393 }
394 394
395 raw_spin_unlock_irqrestore(&reg->lock, flags); 395 raw_spin_unlock_irqrestore(&reg->lock, flags);
396 } 396 }
397} 397}
398 398
399 399
400void pai_check_priority_decrease(struct task_struct *t, int reg_device_id) 400void pai_check_priority_decrease(struct task_struct *t, int reg_device_id)
401{ 401{
402 unsigned long flags; 402 unsigned long flags;
403 nv_device_registry_t *reg = &NV_DEVICE_REG[reg_device_id]; 403 nv_device_registry_t *reg = &NV_DEVICE_REG[reg_device_id];
404 404
405 if(reg->max_prio_owner == t) { 405 if(reg->max_prio_owner == t) {
406 406
407 raw_spin_lock_irqsave(&reg->lock, flags); 407 raw_spin_lock_irqsave(&reg->lock, flags);
408 408
409 if(reg->max_prio_owner == t) { 409 if(reg->max_prio_owner == t) {
410 reg->max_prio_owner = find_hp_owner(reg, NULL); 410 reg->max_prio_owner = find_hp_owner(reg, NULL);
411 if(reg->max_prio_owner != t) { 411 if(reg->max_prio_owner != t) {
412 litmus->change_prio_pai_tasklet(t, reg->max_prio_owner); 412 litmus->change_prio_pai_tasklet(t, reg->max_prio_owner);
413 } 413 }
414 } 414 }
415 415
416 raw_spin_unlock_irqrestore(&reg->lock, flags); 416 raw_spin_unlock_irqrestore(&reg->lock, flags);
417 } 417 }
418} 418}
419#endif 419#endif
420 420
421static int __reg_nv_device(int reg_device_id, struct task_struct *t) 421static int __reg_nv_device(int reg_device_id, struct task_struct *t)
@@ -430,30 +430,30 @@ static int __reg_nv_device(int reg_device_id, struct task_struct *t)
430 // TODO: check if taks is already registered. 430 // TODO: check if taks is already registered.
431 return ret; // assume already registered. 431 return ret; // assume already registered.
432 } 432 }
433 433
434 raw_spin_lock_irqsave(&reg->lock, flags); 434 raw_spin_lock_irqsave(&reg->lock, flags);
435 435
436 if(reg->nr_owners < NV_MAX_SIMULT_USERS) { 436 if(reg->nr_owners < NV_MAX_SIMULT_USERS) {
437 TRACE_TASK(t, "registers GPU %d\n", reg_device_id); 437 TRACE_TASK(t, "registers GPU %d\n", reg_device_id);
438 for(i = 0; i < NV_MAX_SIMULT_USERS; ++i) { 438 for(i = 0; i < NV_MAX_SIMULT_USERS; ++i) {
439 if(reg->owners[i] == NULL) { 439 if(reg->owners[i] == NULL) {
440 reg->owners[i] = t; 440 reg->owners[i] = t;
441 441
442 //if(edf_higher_prio(t, reg->max_prio_owner)) { 442 //if(edf_higher_prio(t, reg->max_prio_owner)) {
443 if(litmus->compare(t, reg->max_prio_owner)) { 443 if(litmus->compare(t, reg->max_prio_owner)) {
444 old_max = reg->max_prio_owner; 444 old_max = reg->max_prio_owner;
445 reg->max_prio_owner = t; 445 reg->max_prio_owner = t;
446 446
447#ifdef CONFIG_LITMUS_PAI_SOFTIRQD 447#ifdef CONFIG_LITMUS_PAI_SOFTIRQD
448 litmus->change_prio_pai_tasklet(old_max, t); 448 litmus->change_prio_pai_tasklet(old_max, t);
449#endif 449#endif
450 } 450 }
451 451
452#ifdef CONFIG_LITMUS_SOFTIRQD 452#ifdef CONFIG_LITMUS_SOFTIRQD
453 down_and_set_stat(t, HELD, &tsk_rt(t)->klitirqd_sem); 453 down_and_set_stat(t, HELD, &tsk_rt(t)->klitirqd_sem);
454#endif 454#endif
455 ++(reg->nr_owners); 455 ++(reg->nr_owners);
456 456
457 break; 457 break;
458 } 458 }
459 } 459 }
@@ -461,13 +461,13 @@ static int __reg_nv_device(int reg_device_id, struct task_struct *t)
461 else 461 else
462 { 462 {
463 TRACE_CUR("%s: device %d is already in use!\n", __FUNCTION__, reg_device_id); 463 TRACE_CUR("%s: device %d is already in use!\n", __FUNCTION__, reg_device_id);
464 ret = -EBUSY; 464 ret = -EBUSY;
465 } 465 }
466 466
467 raw_spin_unlock_irqrestore(&reg->lock, flags); 467 raw_spin_unlock_irqrestore(&reg->lock, flags);
468 468
469 __set_bit(reg_device_id, &tsk_rt(t)->held_gpus); 469 __set_bit(reg_device_id, &tsk_rt(t)->held_gpus);
470 470
471 return(ret); 471 return(ret);
472} 472}
473 473
@@ -476,43 +476,43 @@ static int __clear_reg_nv_device(int de_reg_device_id, struct task_struct *t)
476 int ret = 0; 476 int ret = 0;
477 int i; 477 int i;
478 unsigned long flags; 478 unsigned long flags;
479 nv_device_registry_t *reg = &NV_DEVICE_REG[de_reg_device_id]; 479 nv_device_registry_t *reg = &NV_DEVICE_REG[de_reg_device_id];
480 480
481#ifdef CONFIG_LITMUS_SOFTIRQD 481#ifdef CONFIG_LITMUS_SOFTIRQD
482 struct task_struct* klitirqd_th = get_klitirqd(de_reg_device_id); 482 struct task_struct* klitirqd_th = get_klitirqd(de_reg_device_id);
483#endif 483#endif
484 484
485 WARN_ON(!test_bit(de_reg_device_id, &tsk_rt(t)->held_gpus)); 485 WARN_ON(!test_bit(de_reg_device_id, &tsk_rt(t)->held_gpus));
486 486
487 raw_spin_lock_irqsave(&reg->lock, flags); 487 raw_spin_lock_irqsave(&reg->lock, flags);
488 488
489 TRACE_TASK(t, "unregisters GPU %d\n", de_reg_device_id); 489 TRACE_TASK(t, "unregisters GPU %d\n", de_reg_device_id);
490 490
491 for(i = 0; i < NV_MAX_SIMULT_USERS; ++i) { 491 for(i = 0; i < NV_MAX_SIMULT_USERS; ++i) {
492 if(reg->owners[i] == t) { 492 if(reg->owners[i] == t) {
493#ifdef CONFIG_LITMUS_SOFTIRQD 493#ifdef CONFIG_LITMUS_SOFTIRQD
494 flush_pending(klitirqd_th, t); 494 flush_pending(klitirqd_th, t);
495#endif 495#endif
496 if(reg->max_prio_owner == t) { 496 if(reg->max_prio_owner == t) {
497 reg->max_prio_owner = find_hp_owner(reg, t); 497 reg->max_prio_owner = find_hp_owner(reg, t);
498#ifdef CONFIG_LITMUS_PAI_SOFTIRQD 498#ifdef CONFIG_LITMUS_PAI_SOFTIRQD
499 litmus->change_prio_pai_tasklet(t, reg->max_prio_owner); 499 litmus->change_prio_pai_tasklet(t, reg->max_prio_owner);
500#endif 500#endif
501 } 501 }
502 502
503#ifdef CONFIG_LITMUS_SOFTIRQD 503#ifdef CONFIG_LITMUS_SOFTIRQD
504 up_and_set_stat(t, NOT_HELD, &tsk_rt(t)->klitirqd_sem); 504 up_and_set_stat(t, NOT_HELD, &tsk_rt(t)->klitirqd_sem);
505#endif 505#endif
506 506
507 reg->owners[i] = NULL; 507 reg->owners[i] = NULL;
508 --(reg->nr_owners); 508 --(reg->nr_owners);
509 509
510 break; 510 break;
511 } 511 }
512 } 512 }
513 513
514 raw_spin_unlock_irqrestore(&reg->lock, flags); 514 raw_spin_unlock_irqrestore(&reg->lock, flags);
515 515
516 __clear_bit(de_reg_device_id, &tsk_rt(t)->held_gpus); 516 __clear_bit(de_reg_device_id, &tsk_rt(t)->held_gpus);
517 517
518 return(ret); 518 return(ret);