mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: fixing MISRA Rule 21.2 violation
- "va_start", "time" a reserved identifiers or macro names described in Section 7, "Library", of the C standard, shall not be declared. JIRA NVGPU-6536 Change-Id: I868362819dd7178eb7b165f243fb6d36322d8372 Signed-off-by: srajum <srajum@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2582291 (cherry picked from commit 29c2c55b184cf16aee51614da895747750217885) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2674867 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com> Reviewed-by: Vaibhav Kachore <vkachore@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
mobile promotions
parent
41a1212744
commit
8e56c73eab
@@ -640,7 +640,7 @@ static int nvgpu_vm_init_vma(struct gk20a *g, struct vm_gk20a *vm,
|
||||
* is set.
|
||||
*/
|
||||
if (!big_pages || unified_va) {
|
||||
user_vma_start = vm->va_start;
|
||||
user_vma_start = vm->virtaddr_start;
|
||||
user_vma_limit = nvgpu_safe_sub_u64(vm->va_limit,
|
||||
kernel_reserved);
|
||||
user_lp_vma_start = user_vma_limit;
|
||||
@@ -650,14 +650,14 @@ static int nvgpu_vm_init_vma(struct gk20a *g, struct vm_gk20a *vm,
|
||||
* Ensure small_big_split falls between user vma
|
||||
* start and end.
|
||||
*/
|
||||
if ((small_big_split <= vm->va_start) ||
|
||||
if ((small_big_split <= vm->virtaddr_start) ||
|
||||
(small_big_split >=
|
||||
nvgpu_safe_sub_u64(vm->va_limit,
|
||||
kernel_reserved))) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
user_vma_start = vm->va_start;
|
||||
user_vma_start = vm->virtaddr_start;
|
||||
user_vma_limit = small_big_split;
|
||||
user_lp_vma_start = small_big_split;
|
||||
user_lp_vma_limit = nvgpu_safe_sub_u64(vm->va_limit,
|
||||
@@ -759,7 +759,7 @@ static int nvgpu_vm_init_attributes(struct mm_gk20a *mm,
|
||||
vm->vma[GMMU_PAGE_SIZE_BIG] = &vm->user_lp;
|
||||
}
|
||||
|
||||
vm->va_start = low_hole;
|
||||
vm->virtaddr_start = low_hole;
|
||||
vm->va_limit = aperture_size;
|
||||
|
||||
vm->big_page_size = vm->gmmu_page_sizes[GMMU_PAGE_SIZE_BIG];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Virtualized GPU VM
|
||||
*
|
||||
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -48,7 +48,7 @@ int vgpu_vm_as_alloc_share(struct gk20a *g, struct vm_gk20a *vm)
|
||||
|
||||
msg.cmd = TEGRA_VGPU_CMD_AS_ALLOC_SHARE;
|
||||
msg.handle = vgpu_get_handle(g);
|
||||
p->va_start = vm->va_start;
|
||||
p->va_start = vm->virtaddr_start;
|
||||
p->va_limit = vm->va_limit;
|
||||
p->big_page_size = vm->big_page_size;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
({ \
|
||||
const struct nvgpu_timeout *t_ptr = (timeout); \
|
||||
int ret_cpu = 0; \
|
||||
if (nvgpu_current_time_ns() > t_ptr->time) { \
|
||||
if (nvgpu_current_time_ns() > t_ptr->time_duration) { \
|
||||
if ((t_ptr->flags & NVGPU_TIMER_SILENT_TIMEOUT) == 0U) { \
|
||||
nvgpu_err(t_ptr->g, "Timeout detected @ %p" fmt, \
|
||||
caller, ##arg); \
|
||||
|
||||
@@ -68,7 +68,7 @@ struct nvgpu_timeout {
|
||||
* Timeout duration/count.
|
||||
*/
|
||||
union {
|
||||
s64 time;
|
||||
s64 time_duration;
|
||||
struct {
|
||||
u32 max_attempts;
|
||||
u32 attempted;
|
||||
|
||||
@@ -240,7 +240,7 @@ struct vm_gk20a {
|
||||
char name[NVGPU_VM_NAME_LEN];
|
||||
|
||||
/** Start GPU address of the context. */
|
||||
u64 va_start;
|
||||
u64 virtaddr_start;
|
||||
/** End GPU address of the context. */
|
||||
u64 va_limit;
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ int nvgpu_timeout_init_flags(struct gk20a *g, struct nvgpu_timeout *timeout,
|
||||
if (flags & NVGPU_TIMER_RETRY_TIMER)
|
||||
timeout->retries.max_attempts = duration;
|
||||
else
|
||||
timeout->time = ktime_to_ns(ktime_add_ns(ktime_get(),
|
||||
timeout->time_duration = ktime_to_ns(ktime_add_ns(ktime_get(),
|
||||
(s64)NSEC_PER_MSEC * duration));
|
||||
|
||||
return 0;
|
||||
@@ -113,7 +113,7 @@ static int nvgpu_timeout_expired_msg_cpu(struct nvgpu_timeout *timeout,
|
||||
if (nvgpu_timeout_is_pre_silicon(timeout))
|
||||
return 0;
|
||||
|
||||
if (ktime_after(now, ns_to_ktime(timeout->time))) {
|
||||
if (ktime_after(now, ns_to_ktime(timeout->time_duration))) {
|
||||
if (!(timeout->flags & NVGPU_TIMER_SILENT_TIMEOUT)) {
|
||||
char buf[128];
|
||||
|
||||
@@ -204,7 +204,7 @@ bool nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout)
|
||||
return timeout->retries.attempted >=
|
||||
timeout->retries.max_attempts;
|
||||
else
|
||||
return ktime_after(ktime_get(), ns_to_ktime(timeout->time));
|
||||
return ktime_after(ktime_get(), ns_to_ktime(timeout->time_duration));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -177,7 +177,7 @@ int nvgpu_timeout_init_flags(struct gk20a *g, struct nvgpu_timeout *timeout,
|
||||
} else {
|
||||
duration_ns = (s64)duration;
|
||||
duration_ns = nvgpu_safe_mult_s64(duration_ns, NSEC_PER_MSEC);
|
||||
timeout->time = nvgpu_safe_add_s64(nvgpu_current_time_ns(),
|
||||
timeout->time_duration = nvgpu_safe_add_s64(nvgpu_current_time_ns(),
|
||||
duration_ns);
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ bool nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout)
|
||||
return (timeout->retries.attempted >=
|
||||
timeout->retries.max_attempts);
|
||||
} else {
|
||||
return time_after(get_time_ns(), timeout->time);
|
||||
return time_after(get_time_ns(), timeout->time_duration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user