1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <linux/slab.h>
25#include "kfd_priv.h"
26
27void print_queue_properties(struct queue_properties *q)
28{
29 if (!q)
30 return;
31
32 pr_debug("Printing queue properties:\n");
33 pr_debug("Queue Type: %u\n", q->type);
34 pr_debug("Queue Size: %llu\n", q->queue_size);
35 pr_debug("Queue percent: %u\n", q->queue_percent);
36 pr_debug("Queue Address: 0x%llX\n", q->queue_address);
37 pr_debug("Queue Id: %u\n", q->queue_id);
38 pr_debug("Queue Process Vmid: %u\n", q->vmid);
39 pr_debug("Queue Read Pointer: 0x%p\n", q->read_ptr);
40 pr_debug("Queue Write Pointer: 0x%p\n", q->write_ptr);
41 pr_debug("Queue Doorbell Pointer: 0x%p\n", q->doorbell_ptr);
42 pr_debug("Queue Doorbell Offset: %u\n", q->doorbell_off);
43}
44
45void print_queue(struct queue *q)
46{
47 if (!q)
48 return;
49 pr_debug("Printing queue:\n");
50 pr_debug("Queue Type: %u\n", q->properties.type);
51 pr_debug("Queue Size: %llu\n", q->properties.queue_size);
52 pr_debug("Queue percent: %u\n", q->properties.queue_percent);
53 pr_debug("Queue Address: 0x%llX\n", q->properties.queue_address);
54 pr_debug("Queue Id: %u\n", q->properties.queue_id);
55 pr_debug("Queue Process Vmid: %u\n", q->properties.vmid);
56 pr_debug("Queue Read Pointer: 0x%p\n", q->properties.read_ptr);
57 pr_debug("Queue Write Pointer: 0x%p\n", q->properties.write_ptr);
58 pr_debug("Queue Doorbell Pointer: 0x%p\n", q->properties.doorbell_ptr);
59 pr_debug("Queue Doorbell Offset: %u\n", q->properties.doorbell_off);
60 pr_debug("Queue MQD Address: 0x%p\n", q->mqd);
61 pr_debug("Queue MQD Gart: 0x%llX\n", q->gart_mqd_addr);
62 pr_debug("Queue Process Address: 0x%p\n", q->process);
63 pr_debug("Queue Device Address: 0x%p\n", q->device);
64}
65
66int init_queue(struct queue **q, const struct queue_properties *properties)
67{
68 struct queue *tmp;
69
70 BUG_ON(!q);
71
72 tmp = kzalloc(sizeof(struct queue), GFP_KERNEL);
73 if (!tmp)
74 return -ENOMEM;
75
76 memcpy(&tmp->properties, properties, sizeof(struct queue_properties));
77
78 *q = tmp;
79 return 0;
80}
81
82void uninit_queue(struct queue *q)
83{
84 kfree(q);
85}
86