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
52
53
54
55
56
57
58
59
60
61
62
|
From 92323a400e85ed853dfd2bb644ffa37f72854362 Mon Sep 17 00:00:00 2001
From: Yong Zhao <yong.zhao@amd.com>
Date: Mon, 11 Jul 2016 13:47:39 -0400
Subject: [PATCH 1165/4131] drm/amdkfd: Simplify the KFD signal_page structure
Change-Id: I24e507ad80ede76e18649229dbd613f27913db7c
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_events.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index 6a354f3..f110eba 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
@@ -51,6 +51,9 @@ struct kfd_event_waiter {
uint32_t input_index;
};
+#define SLOTS_PER_PAGE KFD_SIGNAL_EVENT_LIMIT
+#define SLOT_BITMAP_LONGS BITS_TO_LONGS(SLOTS_PER_PAGE)
+
/* Over-complicated pooled allocator for event notification slots.
*
* Each signal event needs a 64-bit signal slot where the signaler will write a 1
@@ -67,14 +70,9 @@ struct signal_page {
uint64_t __user *user_address;
uint32_t page_index; /* Index into the mmap aperture. */
unsigned int free_slots;
- unsigned long used_slot_bitmap[0];
+ unsigned long used_slot_bitmap[SLOT_BITMAP_LONGS];
};
-#define SLOTS_PER_PAGE KFD_SIGNAL_EVENT_LIMIT
-#define SLOT_BITMAP_SIZE BITS_TO_LONGS(SLOTS_PER_PAGE)
-#define BITS_PER_PAGE (ilog2(SLOTS_PER_PAGE)+1)
-#define SIGNAL_PAGE_SIZE (sizeof(struct signal_page) + SLOT_BITMAP_SIZE * sizeof(long))
-
/*
* For signal events, the event ID is used as the interrupt user data.
* For SQ s_sendmsg interrupts, this is limited to 8 bits.
@@ -135,7 +133,7 @@ static bool allocate_signal_page(struct file *devkfd, struct kfd_process *p)
unsigned int slot;
int i;
- page = kzalloc(SIGNAL_PAGE_SIZE, GFP_KERNEL);
+ page = kzalloc(sizeof(struct signal_page), GFP_KERNEL);
if (!page)
goto fail_alloc_signal_page;
@@ -202,7 +200,7 @@ allocate_signal_page_dgpu(struct kfd_process *p,
{
struct signal_page *my_page;
- my_page = kzalloc(SIGNAL_PAGE_SIZE, GFP_KERNEL);
+ my_page = kzalloc(sizeof(struct signal_page), GFP_KERNEL);
if (!my_page)
return false;
--
2.7.4
|