nvgpu: gpu: Fix misra rule 10.3 in vm unit

For getting mapping kind is passed as signed 32 bit whereas it is stored
as unsigned 32 bit. So, change the kind type to s16 in struct
nvgpu_mapped_buf and also in the declaration from int to s16 to address
that. This is a dependent change for qnx
https://git-master.nvidia.com/r/#/c/2174451/.

Jira NVGPU-3891

Change-Id: I0578409313442ad0e2f09c8019d2701b4da53ec9
Signed-off-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2176497
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Shashank Singh
2019-08-16 10:57:56 +05:30
committed by mobile promotions
parent 115959bd40
commit c4e29841e5
4 changed files with 7 additions and 7 deletions

View File

@@ -1252,7 +1252,7 @@ int nvgpu_vm_map(struct vm_gk20a *vm,
mapped_buffer->vm = vm; mapped_buffer->vm = vm;
mapped_buffer->flags = binfo.flags; mapped_buffer->flags = binfo.flags;
nvgpu_assert(map_key_kind >= 0); nvgpu_assert(map_key_kind >= 0);
mapped_buffer->kind = (u32)map_key_kind; mapped_buffer->kind = map_key_kind;
mapped_buffer->va_allocated = va_allocated; mapped_buffer->va_allocated = va_allocated;
mapped_buffer->vm_area = vm_area; mapped_buffer->vm_area = vm_area;

View File

@@ -117,7 +117,7 @@ struct nvgpu_mapped_buf {
u32 pgsz_idx; u32 pgsz_idx;
u32 flags; u32 flags;
u32 kind; s16 kind;
bool va_allocated; bool va_allocated;
/* /*
@@ -260,7 +260,7 @@ struct nvgpu_mapped_buf *nvgpu_vm_find_mapping(struct vm_gk20a *vm,
struct nvgpu_os_buffer *os_buf, struct nvgpu_os_buffer *os_buf,
u64 map_addr, u64 map_addr,
u32 flags, u32 flags,
int kind); s16 kind);
/** /**
* Map a DMA buffer into the passed VM context. * Map a DMA buffer into the passed VM context.

View File

@@ -66,7 +66,7 @@ static u32 nvgpu_vm_translate_linux_flags(struct gk20a *g, u32 flags)
} }
static struct nvgpu_mapped_buf *nvgpu_vm_find_mapped_buf_reverse( static struct nvgpu_mapped_buf *nvgpu_vm_find_mapped_buf_reverse(
struct vm_gk20a *vm, struct dma_buf *dmabuf, u32 kind) struct vm_gk20a *vm, struct dma_buf *dmabuf, s16 kind)
{ {
struct nvgpu_rbtree_node *node = NULL; struct nvgpu_rbtree_node *node = NULL;
struct nvgpu_rbtree_node *root = vm->mapped_buffers; struct nvgpu_rbtree_node *root = vm->mapped_buffers;
@@ -126,7 +126,7 @@ struct nvgpu_mapped_buf *nvgpu_vm_find_mapping(struct vm_gk20a *vm,
struct nvgpu_os_buffer *os_buf, struct nvgpu_os_buffer *os_buf,
u64 map_addr, u64 map_addr,
u32 flags, u32 flags,
int kind) s16 kind)
{ {
struct gk20a *g = gk20a_from_vm(vm); struct gk20a *g = gk20a_from_vm(vm);
struct nvgpu_mapped_buf *mapped_buffer = NULL; struct nvgpu_mapped_buf *mapped_buffer = NULL;
@@ -137,7 +137,7 @@ struct nvgpu_mapped_buf *nvgpu_vm_find_mapping(struct vm_gk20a *vm,
return NULL; return NULL;
if (mapped_buffer->os_priv.dmabuf != os_buf->dmabuf || if (mapped_buffer->os_priv.dmabuf != os_buf->dmabuf ||
mapped_buffer->kind != (u32)kind) mapped_buffer->kind != kind)
return NULL; return NULL;
} else { } else {
mapped_buffer = mapped_buffer =

View File

@@ -36,7 +36,7 @@ struct nvgpu_mapped_buf *nvgpu_vm_find_mapping(struct vm_gk20a *vm,
struct nvgpu_os_buffer *os_buf, struct nvgpu_os_buffer *os_buf,
u64 map_addr, u64 map_addr,
u32 flags, u32 flags,
int kind) s16 kind)
{ {
/* /*
* No map caching for now. * No map caching for now.