diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-04-11 08:49:42 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-04-12 18:34:42 -0400 |
commit | 8b5e78dab27fdcc41dec91ec5305b89270682a75 (patch) | |
tree | d640853a6d3a802a56e2f5e36b5e3dfb8b65b56b /drivers/gpu/nvgpu/include/nvgpu/semaphore.h | |
parent | 776bab70c3c105ef458aea47c198f68c5c957c9b (diff) |
gpu: nvgpu: use nvgpu list for semaphore lists
Use nvgpu list APIs instead of linux list APIs
for list of semaphore pools and h/w semaphores
Jira NVGPU-13
Change-Id: I7ad3ec2db568eb4ab7e207e3109084391c9c0ee7
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1460578
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include/nvgpu/semaphore.h')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/semaphore.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/semaphore.h b/drivers/gpu/nvgpu/include/nvgpu/semaphore.h index 285fcdeb..d395940d 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/semaphore.h +++ b/drivers/gpu/nvgpu/include/nvgpu/semaphore.h | |||
@@ -53,7 +53,14 @@ struct nvgpu_semaphore_int { | |||
53 | u32 nr_incrs; /* Number of increments programmed. */ | 53 | u32 nr_incrs; /* Number of increments programmed. */ |
54 | struct nvgpu_semaphore_pool *p; /* Pool that owns this sema. */ | 54 | struct nvgpu_semaphore_pool *p; /* Pool that owns this sema. */ |
55 | struct channel_gk20a *ch; /* Channel that owns this sema. */ | 55 | struct channel_gk20a *ch; /* Channel that owns this sema. */ |
56 | struct list_head hw_sema_list; /* List of HW semaphores. */ | 56 | struct nvgpu_list_node hw_sema_list; /* List of HW semaphores. */ |
57 | }; | ||
58 | |||
59 | static inline struct nvgpu_semaphore_int * | ||
60 | nvgpu_semaphore_int_from_hw_sema_list(struct nvgpu_list_node *node) | ||
61 | { | ||
62 | return (struct nvgpu_semaphore_int *) | ||
63 | ((uintptr_t)node - offsetof(struct nvgpu_semaphore_int, hw_sema_list)); | ||
57 | }; | 64 | }; |
58 | 65 | ||
59 | /* | 66 | /* |
@@ -75,13 +82,13 @@ struct nvgpu_semaphore { | |||
75 | */ | 82 | */ |
76 | struct nvgpu_semaphore_pool { | 83 | struct nvgpu_semaphore_pool { |
77 | struct page *page; /* This pool's page of memory */ | 84 | struct page *page; /* This pool's page of memory */ |
78 | struct list_head pool_list_entry; /* Node for list of pools. */ | 85 | struct nvgpu_list_node pool_list_entry; /* Node for list of pools. */ |
79 | void *cpu_va; /* CPU access to the pool. */ | 86 | void *cpu_va; /* CPU access to the pool. */ |
80 | u64 gpu_va; /* GPU access to the pool. */ | 87 | u64 gpu_va; /* GPU access to the pool. */ |
81 | u64 gpu_va_ro; /* GPU access to the pool. */ | 88 | u64 gpu_va_ro; /* GPU access to the pool. */ |
82 | int page_idx; /* Index into sea bitmap. */ | 89 | int page_idx; /* Index into sea bitmap. */ |
83 | 90 | ||
84 | struct list_head hw_semas; /* List of HW semas. */ | 91 | struct nvgpu_list_node hw_semas; /* List of HW semas. */ |
85 | DECLARE_BITMAP(semas_alloced, PAGE_SIZE / SEMAPHORE_SIZE); | 92 | DECLARE_BITMAP(semas_alloced, PAGE_SIZE / SEMAPHORE_SIZE); |
86 | 93 | ||
87 | struct nvgpu_semaphore_sea *sema_sea; /* Sea that owns this pool. */ | 94 | struct nvgpu_semaphore_sea *sema_sea; /* Sea that owns this pool. */ |
@@ -110,6 +117,14 @@ struct nvgpu_semaphore_pool { | |||
110 | struct kref ref; | 117 | struct kref ref; |
111 | }; | 118 | }; |
112 | 119 | ||
120 | static inline struct nvgpu_semaphore_pool * | ||
121 | nvgpu_semaphore_pool_from_pool_list_entry(struct nvgpu_list_node *node) | ||
122 | { | ||
123 | return (struct nvgpu_semaphore_pool *) | ||
124 | ((uintptr_t)node - | ||
125 | offsetof(struct nvgpu_semaphore_pool, pool_list_entry)); | ||
126 | }; | ||
127 | |||
113 | /* | 128 | /* |
114 | * A sea of semaphores pools. Each pool is owned by a single VM. Since multiple | 129 | * A sea of semaphores pools. Each pool is owned by a single VM. Since multiple |
115 | * channels can share a VM each channel gets it's own HW semaphore from the | 130 | * channels can share a VM each channel gets it's own HW semaphore from the |
@@ -117,7 +132,7 @@ struct nvgpu_semaphore_pool { | |||
117 | * signifies when a particular job is done. | 132 | * signifies when a particular job is done. |
118 | */ | 133 | */ |
119 | struct nvgpu_semaphore_sea { | 134 | struct nvgpu_semaphore_sea { |
120 | struct list_head pool_list; /* List of pools in this sea. */ | 135 | struct nvgpu_list_node pool_list; /* List of pools in this sea. */ |
121 | struct gk20a *gk20a; | 136 | struct gk20a *gk20a; |
122 | 137 | ||
123 | size_t size; /* Number of pages available. */ | 138 | size_t size; /* Number of pages available. */ |