summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorSai Nikhil <snikhil@nvidia.com>2018-08-17 01:20:17 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-08-29 11:59:31 -0400
commit2f97e683feed3c3ba3c8722c4f6ab7466bcef0c0 (patch)
treec0f90c3dc6909122cfde071efff8ff24d2b61471 /drivers/gpu/nvgpu/include
parent19cd7ffb5def933db323fe682ec4a263eb1923f9 (diff)
gpu: nvgpu: common: fix MISRA Rule 10.4
MISRA Rule 10.4 only allows the usage of arithmetic operations on operands of the same essential type category. Adding "U" at the end of the integer literals to have same type of operands when an arithmetic operation is performed. This fix violations where an arithmetic operation is performed on signed and unsigned int types. In balloc_get_order_list() the argument "int order" has been changed to a u64 because all callers of this function pass a u64 argument. JIRA NVGPU-992 Change-Id: Ie2964f9f1dfb2865a9bd6e6cdd65e7cda6c1f638 Signed-off-by: Sai Nikhil <snikhil@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1784419 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> Reviewed-by: Adeel Raza <araza@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/allocator.h12
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/gmmu.h6
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/posix/types.h2
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/vm.h12
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/vm_area.h4
5 files changed, 18 insertions, 18 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/allocator.h b/drivers/gpu/nvgpu/include/nvgpu/allocator.h
index a38e8d51..698aafb3 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/allocator.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/allocator.h
@@ -186,11 +186,11 @@ nvgpu_alloc_carveout_from_co_entry(struct nvgpu_list_node *node)
186 * pointing to the allocation base (requires GPU_ALLOC_FORCE_CONTIG to be 186 * pointing to the allocation base (requires GPU_ALLOC_FORCE_CONTIG to be
187 * set as well). 187 * set as well).
188 */ 188 */
189#define GPU_ALLOC_GVA_SPACE 0x1 189#define GPU_ALLOC_GVA_SPACE BIT(0)
190#define GPU_ALLOC_NO_ALLOC_PAGE 0x2 190#define GPU_ALLOC_NO_ALLOC_PAGE BIT(1)
191#define GPU_ALLOC_4K_VIDMEM_PAGES 0x4 191#define GPU_ALLOC_4K_VIDMEM_PAGES BIT(2)
192#define GPU_ALLOC_FORCE_CONTIG 0x8 192#define GPU_ALLOC_FORCE_CONTIG BIT(3)
193#define GPU_ALLOC_NO_SCATTER_GATHER 0x10 193#define GPU_ALLOC_NO_SCATTER_GATHER BIT(4)
194 194
195static inline void alloc_lock(struct nvgpu_allocator *a) 195static inline void alloc_lock(struct nvgpu_allocator *a)
196{ 196{
@@ -236,7 +236,7 @@ int nvgpu_lockless_allocator_init(struct gk20a *g, struct nvgpu_allocator *na,
236 const char *name, u64 base, u64 length, 236 const char *name, u64 base, u64 length,
237 u64 struct_size, u64 flags); 237 u64 struct_size, u64 flags);
238 238
239#define GPU_BALLOC_MAX_ORDER 31 239#define GPU_BALLOC_MAX_ORDER 31U
240 240
241/* 241/*
242 * Allocator APIs. 242 * Allocator APIs.
diff --git a/drivers/gpu/nvgpu/include/nvgpu/gmmu.h b/drivers/gpu/nvgpu/include/nvgpu/gmmu.h
index a83b0dd8..e58f5498 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/gmmu.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/gmmu.h
@@ -54,9 +54,9 @@ enum gk20a_mem_rw_flag {
54 * structure is of course depending on this. The MIN_SHIFT define is the right 54 * structure is of course depending on this. The MIN_SHIFT define is the right
55 * number of bits to shift to determine which list to use in the array of lists. 55 * number of bits to shift to determine which list to use in the array of lists.
56 */ 56 */
57#define NVGPU_PD_CACHE_MIN 256 57#define NVGPU_PD_CACHE_MIN 256U
58#define NVGPU_PD_CACHE_MIN_SHIFT 9 58#define NVGPU_PD_CACHE_MIN_SHIFT 9U
59#define NVGPU_PD_CACHE_COUNT 4 59#define NVGPU_PD_CACHE_COUNT 4U
60 60
61struct nvgpu_pd_mem_entry { 61struct nvgpu_pd_mem_entry {
62 struct nvgpu_mem mem; 62 struct nvgpu_mem mem;
diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/types.h b/drivers/gpu/nvgpu/include/nvgpu/posix/types.h
index 4b525923..97686eec 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/posix/types.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/posix/types.h
@@ -72,7 +72,7 @@ typedef long long s64;
72 }) 72 })
73#define min3(a, b, c) min(min(a, b), c) 73#define min3(a, b, c) min(min(a, b), c)
74 74
75#define PAGE_SIZE 4096 75#define PAGE_SIZE 4096U
76 76
77#define ARRAY_SIZE(array) \ 77#define ARRAY_SIZE(array) \
78 (sizeof(array) / sizeof((array)[0])) 78 (sizeof(array) / sizeof((array)[0]))
diff --git a/drivers/gpu/nvgpu/include/nvgpu/vm.h b/drivers/gpu/nvgpu/include/nvgpu/vm.h
index ad8c7cca..b47d4ee0 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/vm.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/vm.h
@@ -207,12 +207,12 @@ struct vm_gk20a {
207/* 207/*
208 * Mapping flags. 208 * Mapping flags.
209 */ 209 */
210#define NVGPU_VM_MAP_FIXED_OFFSET (1 << 0) 210#define NVGPU_VM_MAP_FIXED_OFFSET BIT32(0)
211#define NVGPU_VM_MAP_CACHEABLE (1 << 1) 211#define NVGPU_VM_MAP_CACHEABLE BIT32(1)
212#define NVGPU_VM_MAP_IO_COHERENT (1 << 2) 212#define NVGPU_VM_MAP_IO_COHERENT BIT32(2)
213#define NVGPU_VM_MAP_UNMAPPED_PTE (1 << 3) 213#define NVGPU_VM_MAP_UNMAPPED_PTE BIT32(3)
214#define NVGPU_VM_MAP_DIRECT_KIND_CTRL (1 << 4) 214#define NVGPU_VM_MAP_DIRECT_KIND_CTRL BIT32(4)
215#define NVGPU_VM_MAP_L3_ALLOC (1 << 5) 215#define NVGPU_VM_MAP_L3_ALLOC BIT32(5)
216 216
217#define NVGPU_KIND_INVALID -1 217#define NVGPU_KIND_INVALID -1
218 218
diff --git a/drivers/gpu/nvgpu/include/nvgpu/vm_area.h b/drivers/gpu/nvgpu/include/nvgpu/vm_area.h
index a055ada3..53e1cb85 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/vm_area.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/vm_area.h
@@ -60,8 +60,8 @@ nvgpu_vm_area_from_vm_area_list(struct nvgpu_list_node *node)
60/* 60/*
61 * Alloc space flags. 61 * Alloc space flags.
62 */ 62 */
63#define NVGPU_VM_AREA_ALLOC_FIXED_OFFSET (1 << 0) 63#define NVGPU_VM_AREA_ALLOC_FIXED_OFFSET BIT(0)
64#define NVGPU_VM_AREA_ALLOC_SPARSE (1 << 1) 64#define NVGPU_VM_AREA_ALLOC_SPARSE BIT(1)
65 65
66int nvgpu_vm_area_alloc(struct vm_gk20a *vm, u32 pages, u32 page_size, 66int nvgpu_vm_area_alloc(struct vm_gk20a *vm, u32 pages, u32 page_size,
67 u64 *addr, u32 flags); 67 u64 *addr, u32 flags);