mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: handle falcon copy pointer alignment for misra 11.3 deviation
Function for copying to/form IMEM/DMEM cast pointer to char to pointer to u32 since falcon data registers are read/written in 4-bytes. Firmware data is generally byte stream and hence we won't be able to deal in pointer to u32. Hence we need deviate from misra rule 11.3. Firmware data is also not aligned at word boundary sometimes hence we need to copy it byte by byte to conform to the dev- iation recommendation. Error: MISRA C-2012 Rule 11.3: ./hal/falcon/falcon_gk20a.c:296: misra_violation: The object pointer expression "src" of type "u8 *" is cast to type "u32 *". JIRA NVGPU-3271 Change-Id: Ic081f97226dbbcf08402970829624933402066eb Signed-off-by: Sagar Kamble <skamble@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2108547 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
60e3d135de
commit
13a7ef2cc7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2018-2019, 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"),
|
||||
@@ -77,3 +77,13 @@ int nvgpu_strnadd_u32(char *dst, const u32 value, size_t size, u32 radix)
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
bool nvgpu_mem_is_word_aligned(struct gk20a *g, u8 *addr)
|
||||
{
|
||||
if ((unsigned long)addr % 4UL != 0UL) {
|
||||
nvgpu_log_info(g, "addr (%p) not 4-byte aligned", addr);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user