diff options
author | Sai Nikhil <snikhil@nvidia.com> | 2018-08-22 01:12:37 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-08-22 20:30:19 -0400 |
commit | d28a401e6d872f7ea6abb0c5cfc8f63e0235fe21 (patch) | |
tree | 66b5c4ad42135dbd9f5535fa3c86f8ecdd1a067c /drivers/gpu/nvgpu/include | |
parent | 650171566bff59e9eb372f213fdce4dfbb6da5bd (diff) |
gpu: nvgpu: common: fix MISRA 10.4 violations
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.
Jira NVGPU-992
Change-Id: Iab512139a025e035ec82a9dd74245bcf1f3869fb
Signed-off-by: Sai Nikhil <snikhil@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1789425
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Alex Waterman <alexw@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/pmu.h | 36 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_perfmon.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_pg.h | 48 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h | 40 |
5 files changed, 64 insertions, 64 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmu.h b/drivers/gpu/nvgpu/include/nvgpu/pmu.h index 28374b9d..1240530f 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/pmu.h +++ b/drivers/gpu/nvgpu/include/nvgpu/pmu.h | |||
@@ -84,21 +84,21 @@ | |||
84 | #define PMU_FALCON_REG_SIZE (32) | 84 | #define PMU_FALCON_REG_SIZE (32) |
85 | 85 | ||
86 | /* Choices for pmu_state */ | 86 | /* Choices for pmu_state */ |
87 | #define PMU_STATE_OFF 0 /* PMU is off */ | 87 | #define PMU_STATE_OFF 0U /* PMU is off */ |
88 | #define PMU_STATE_STARTING 1 /* PMU is on, but not booted */ | 88 | #define PMU_STATE_STARTING 1U /* PMU is on, but not booted */ |
89 | #define PMU_STATE_INIT_RECEIVED 2 /* PMU init message received */ | 89 | #define PMU_STATE_INIT_RECEIVED 2U /* PMU init message received */ |
90 | #define PMU_STATE_ELPG_BOOTING 3 /* PMU is booting */ | 90 | #define PMU_STATE_ELPG_BOOTING 3U /* PMU is booting */ |
91 | #define PMU_STATE_ELPG_BOOTED 4 /* ELPG is initialized */ | 91 | #define PMU_STATE_ELPG_BOOTED 4U /* ELPG is initialized */ |
92 | #define PMU_STATE_LOADING_PG_BUF 5 /* Loading PG buf */ | 92 | #define PMU_STATE_LOADING_PG_BUF 5U /* Loading PG buf */ |
93 | #define PMU_STATE_LOADING_ZBC 6 /* Loading ZBC buf */ | 93 | #define PMU_STATE_LOADING_ZBC 6U /* Loading ZBC buf */ |
94 | #define PMU_STATE_STARTED 7 /* Fully unitialized */ | 94 | #define PMU_STATE_STARTED 7U /* Fully unitialized */ |
95 | #define PMU_STATE_EXIT 8 /* Exit PMU state machine */ | 95 | #define PMU_STATE_EXIT 8U /* Exit PMU state machine */ |
96 | 96 | ||
97 | #define GK20A_PMU_UCODE_NB_MAX_OVERLAY 32 | 97 | #define GK20A_PMU_UCODE_NB_MAX_OVERLAY 32U |
98 | #define GK20A_PMU_UCODE_NB_MAX_DATE_LENGTH 64 | 98 | #define GK20A_PMU_UCODE_NB_MAX_DATE_LENGTH 64U |
99 | 99 | ||
100 | #define PMU_MAX_NUM_SEQUENCES (256) | 100 | #define PMU_MAX_NUM_SEQUENCES (256U) |
101 | #define PMU_SEQ_BIT_SHIFT (5) | 101 | #define PMU_SEQ_BIT_SHIFT (5U) |
102 | #define PMU_SEQ_TBL_SIZE \ | 102 | #define PMU_SEQ_TBL_SIZE \ |
103 | (PMU_MAX_NUM_SEQUENCES >> PMU_SEQ_BIT_SHIFT) | 103 | (PMU_MAX_NUM_SEQUENCES >> PMU_SEQ_BIT_SHIFT) |
104 | 104 | ||
@@ -132,8 +132,8 @@ enum { | |||
132 | #define PMU_PG_LPWR_FEATURE_RPPG 0x0 | 132 | #define PMU_PG_LPWR_FEATURE_RPPG 0x0 |
133 | #define PMU_PG_LPWR_FEATURE_MSCG 0x1 | 133 | #define PMU_PG_LPWR_FEATURE_MSCG 0x1 |
134 | 134 | ||
135 | #define PMU_MSCG_DISABLED 0 | 135 | #define PMU_MSCG_DISABLED 0U |
136 | #define PMU_MSCG_ENABLED 1 | 136 | #define PMU_MSCG_ENABLED 1U |
137 | 137 | ||
138 | /* Default Sampling Period of AELPG */ | 138 | /* Default Sampling Period of AELPG */ |
139 | #define APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US (1000000) | 139 | #define APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US (1000000) |
@@ -350,7 +350,7 @@ struct nvgpu_pmu { | |||
350 | u32 mscg_stat; | 350 | u32 mscg_stat; |
351 | u32 mscg_transition_state; | 351 | u32 mscg_transition_state; |
352 | 352 | ||
353 | int pmu_state; | 353 | u32 pmu_state; |
354 | 354 | ||
355 | #define PMU_ELPG_ENABLE_ALLOW_DELAY_MSEC 1 /* msec */ | 355 | #define PMU_ELPG_ENABLE_ALLOW_DELAY_MSEC 1 /* msec */ |
356 | struct nvgpu_pg_init pg_init; | 356 | struct nvgpu_pg_init pg_init; |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h index 68df80b4..e3317805 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h +++ b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_cmn.h | |||
@@ -32,7 +32,7 @@ | |||
32 | #define PMU_COMMAND_QUEUE_LPQ 1U | 32 | #define PMU_COMMAND_QUEUE_LPQ 1U |
33 | /* write by pmu, read by sw, accessed by interrupt handler, no lock */ | 33 | /* write by pmu, read by sw, accessed by interrupt handler, no lock */ |
34 | #define PMU_MESSAGE_QUEUE 4U | 34 | #define PMU_MESSAGE_QUEUE 4U |
35 | #define PMU_QUEUE_COUNT 5 | 35 | #define PMU_QUEUE_COUNT 5U |
36 | 36 | ||
37 | #define PMU_IS_COMMAND_QUEUE(id) \ | 37 | #define PMU_IS_COMMAND_QUEUE(id) \ |
38 | ((id) < PMU_MESSAGE_QUEUE) | 38 | ((id) < PMU_MESSAGE_QUEUE) |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_perfmon.h b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_perfmon.h index 91e89365..ba6e9ec8 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_perfmon.h +++ b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_perfmon.h | |||
@@ -32,7 +32,7 @@ | |||
32 | #define PMU_PERFMON_FLAG_ENABLE_DECREASE (0x00000002) | 32 | #define PMU_PERFMON_FLAG_ENABLE_DECREASE (0x00000002) |
33 | #define PMU_PERFMON_FLAG_CLEAR_PREV (0x00000004) | 33 | #define PMU_PERFMON_FLAG_CLEAR_PREV (0x00000004) |
34 | 34 | ||
35 | #define NV_PMU_PERFMON_MAX_COUNTERS 10 | 35 | #define NV_PMU_PERFMON_MAX_COUNTERS 10U |
36 | 36 | ||
37 | enum pmu_perfmon_cmd_start_fields { | 37 | enum pmu_perfmon_cmd_start_fields { |
38 | COUNTER_ALLOC | 38 | COUNTER_ALLOC |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_pg.h b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_pg.h index 1ba9963c..c156a6c0 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_pg.h +++ b/drivers/gpu/nvgpu/include/nvgpu/pmuif/gpmuif_pg.h | |||
@@ -28,9 +28,9 @@ | |||
28 | /*PG defines*/ | 28 | /*PG defines*/ |
29 | 29 | ||
30 | /* Identifier for each PG */ | 30 | /* Identifier for each PG */ |
31 | #define PMU_PG_ELPG_ENGINE_ID_GRAPHICS (0x00000000) | 31 | #define PMU_PG_ELPG_ENGINE_ID_GRAPHICS (0x00000000U) |
32 | #define PMU_PG_ELPG_ENGINE_ID_MS (0x00000004) | 32 | #define PMU_PG_ELPG_ENGINE_ID_MS (0x00000004U) |
33 | #define PMU_PG_ELPG_ENGINE_ID_INVALID_ENGINE (0x00000005) | 33 | #define PMU_PG_ELPG_ENGINE_ID_INVALID_ENGINE (0x00000005U) |
34 | #define PMU_PG_ELPG_ENGINE_MAX PMU_PG_ELPG_ENGINE_ID_INVALID_ENGINE | 34 | #define PMU_PG_ELPG_ENGINE_MAX PMU_PG_ELPG_ENGINE_ID_INVALID_ENGINE |
35 | 35 | ||
36 | /* PG message */ | 36 | /* PG message */ |
@@ -173,23 +173,23 @@ enum { | |||
173 | SLOWDOWN_FACTOR_FPDIV_BYMAX, | 173 | SLOWDOWN_FACTOR_FPDIV_BYMAX, |
174 | }; | 174 | }; |
175 | 175 | ||
176 | #define PMU_PG_PARAM_CMD_GR_INIT_PARAM 0x0 | 176 | #define PMU_PG_PARAM_CMD_GR_INIT_PARAM 0x0U |
177 | #define PMU_PG_PARAM_CMD_MS_INIT_PARAM 0x01 | 177 | #define PMU_PG_PARAM_CMD_MS_INIT_PARAM 0x01U |
178 | #define PMU_PG_PARAM_CMD_MCLK_CHANGE 0x04 | 178 | #define PMU_PG_PARAM_CMD_MCLK_CHANGE 0x04U |
179 | #define PMU_PG_PARAM_CMD_POST_INIT 0x06 | 179 | #define PMU_PG_PARAM_CMD_POST_INIT 0x06U |
180 | #define PMU_PG_PARAM_CMD_SUB_FEATURE_MASK_UPDATE 0x07 | 180 | #define PMU_PG_PARAM_CMD_SUB_FEATURE_MASK_UPDATE 0x07U |
181 | 181 | ||
182 | #define NVGPU_PMU_GR_FEATURE_MASK_SDIV_SLOWDOWN (1 << 0) | 182 | #define NVGPU_PMU_GR_FEATURE_MASK_SDIV_SLOWDOWN BIT32(0) |
183 | #define NVGPU_PMU_GR_FEATURE_MASK_POWER_GATING (1 << 2) | 183 | #define NVGPU_PMU_GR_FEATURE_MASK_POWER_GATING BIT32(2) |
184 | #define NVGPU_PMU_GR_FEATURE_MASK_RPPG (1 << 3) | 184 | #define NVGPU_PMU_GR_FEATURE_MASK_RPPG BIT32(3) |
185 | #define NVGPU_PMU_GR_FEATURE_MASK_PRIV_RING (1 << 5) | 185 | #define NVGPU_PMU_GR_FEATURE_MASK_PRIV_RING BIT32(5) |
186 | #define NVGPU_PMU_GR_FEATURE_MASK_UNBIND (1 << 6) | 186 | #define NVGPU_PMU_GR_FEATURE_MASK_UNBIND BIT32(6) |
187 | #define NVGPU_PMU_GR_FEATURE_MASK_SAVE_GLOBAL_STATE (1 << 7) | 187 | #define NVGPU_PMU_GR_FEATURE_MASK_SAVE_GLOBAL_STATE BIT32(7) |
188 | #define NVGPU_PMU_GR_FEATURE_MASK_RESET_ENTRY (1 << 8) | 188 | #define NVGPU_PMU_GR_FEATURE_MASK_RESET_ENTRY BIT32(8) |
189 | #define NVGPU_PMU_GR_FEATURE_MASK_HW_SEQUENCE (1 << 9) | 189 | #define NVGPU_PMU_GR_FEATURE_MASK_HW_SEQUENCE BIT32(9) |
190 | #define NVGPU_PMU_GR_FEATURE_MASK_ELPG_SRAM (1 << 10) | 190 | #define NVGPU_PMU_GR_FEATURE_MASK_ELPG_SRAM BIT32(10) |
191 | #define NVGPU_PMU_GR_FEATURE_MASK_ELPG_LOGIC (1 << 11) | 191 | #define NVGPU_PMU_GR_FEATURE_MASK_ELPG_LOGIC BIT32(11) |
192 | #define NVGPU_PMU_GR_FEATURE_MASK_ELPG_L2RPPG (1 << 12) | 192 | #define NVGPU_PMU_GR_FEATURE_MASK_ELPG_L2RPPG BIT32(12) |
193 | 193 | ||
194 | #define NVGPU_PMU_GR_FEATURE_MASK_ALL \ | 194 | #define NVGPU_PMU_GR_FEATURE_MASK_ALL \ |
195 | ( \ | 195 | ( \ |
@@ -206,10 +206,10 @@ enum { | |||
206 | NVGPU_PMU_GR_FEATURE_MASK_ELPG_L2RPPG \ | 206 | NVGPU_PMU_GR_FEATURE_MASK_ELPG_L2RPPG \ |
207 | ) | 207 | ) |
208 | 208 | ||
209 | #define NVGPU_PMU_MS_FEATURE_MASK_CLOCK_GATING (1 << 0) | 209 | #define NVGPU_PMU_MS_FEATURE_MASK_CLOCK_GATING BIT32(0) |
210 | #define NVGPU_PMU_MS_FEATURE_MASK_SW_ASR (1 << 1) | 210 | #define NVGPU_PMU_MS_FEATURE_MASK_SW_ASR BIT32(1) |
211 | #define NVGPU_PMU_MS_FEATURE_MASK_RPPG (1 << 8) | 211 | #define NVGPU_PMU_MS_FEATURE_MASK_RPPG BIT32(8) |
212 | #define NVGPU_PMU_MS_FEATURE_MASK_FB_TRAINING (1 << 5) | 212 | #define NVGPU_PMU_MS_FEATURE_MASK_FB_TRAINING BIT32(5) |
213 | 213 | ||
214 | #define NVGPU_PMU_MS_FEATURE_MASK_ALL \ | 214 | #define NVGPU_PMU_MS_FEATURE_MASK_ALL \ |
215 | ( \ | 215 | ( \ |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h b/drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h index 1a05ec29..06486006 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h +++ b/drivers/gpu/nvgpu/include/nvgpu/pmuif/nvgpu_gpmu_cmdif.h | |||
@@ -59,7 +59,7 @@ struct nv_pmu_rpc_cmd { | |||
59 | u32 rpc_dmem_ptr; | 59 | u32 rpc_dmem_ptr; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | #define NV_PMU_RPC_CMD_ID 0x80 | 62 | #define NV_PMU_RPC_CMD_ID 0x80U |
63 | 63 | ||
64 | /* Message carrying the result of the RPC execution */ | 64 | /* Message carrying the result of the RPC execution */ |
65 | struct nv_pmu_rpc_msg { | 65 | struct nv_pmu_rpc_msg { |
@@ -79,7 +79,7 @@ struct nv_pmu_rpc_msg { | |||
79 | u32 rpc_dmem_ptr; | 79 | u32 rpc_dmem_ptr; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | #define NV_PMU_RPC_MSG_ID 0x80 | 82 | #define NV_PMU_RPC_MSG_ID 0x80U |
83 | 83 | ||
84 | struct pmu_cmd { | 84 | struct pmu_cmd { |
85 | struct pmu_hdr hdr; | 85 | struct pmu_hdr hdr; |
@@ -116,26 +116,26 @@ struct pmu_msg { | |||
116 | } msg; | 116 | } msg; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | #define PMU_UNIT_REWIND (0x00) | 119 | #define PMU_UNIT_REWIND (0x00U) |
120 | #define PMU_UNIT_PG (0x03) | 120 | #define PMU_UNIT_PG (0x03U) |
121 | #define PMU_UNIT_INIT (0x07) | 121 | #define PMU_UNIT_INIT (0x07U) |
122 | #define PMU_UNIT_ACR (0x0A) | 122 | #define PMU_UNIT_ACR (0x0AU) |
123 | #define PMU_UNIT_PERFMON_T18X (0x11) | 123 | #define PMU_UNIT_PERFMON_T18X (0x11U) |
124 | #define PMU_UNIT_PERFMON (0x12) | 124 | #define PMU_UNIT_PERFMON (0x12U) |
125 | #define PMU_UNIT_PERF (0x13) | 125 | #define PMU_UNIT_PERF (0x13U) |
126 | #define PMU_UNIT_RC (0x1F) | 126 | #define PMU_UNIT_RC (0x1FU) |
127 | #define PMU_UNIT_FECS_MEM_OVERRIDE (0x1E) | 127 | #define PMU_UNIT_FECS_MEM_OVERRIDE (0x1EU) |
128 | #define PMU_UNIT_CLK (0x0D) | 128 | #define PMU_UNIT_CLK (0x0DU) |
129 | #define PMU_UNIT_THERM (0x14) | 129 | #define PMU_UNIT_THERM (0x14U) |
130 | #define PMU_UNIT_PMGR (0x18) | 130 | #define PMU_UNIT_PMGR (0x18U) |
131 | #define PMU_UNIT_VOLT (0x0E) | 131 | #define PMU_UNIT_VOLT (0x0EU) |
132 | 132 | ||
133 | #define PMU_UNIT_END (0x23) | 133 | #define PMU_UNIT_END (0x23U) |
134 | #define PMU_UNIT_INVALID (0xFF) | 134 | #define PMU_UNIT_INVALID (0xFFU) |
135 | 135 | ||
136 | #define PMU_UNIT_TEST_START (0xFE) | 136 | #define PMU_UNIT_TEST_START (0xFEU) |
137 | #define PMU_UNIT_END_SIM (0xFF) | 137 | #define PMU_UNIT_END_SIM (0xFFU) |
138 | #define PMU_UNIT_TEST_END (0xFF) | 138 | #define PMU_UNIT_TEST_END (0xFFU) |
139 | 139 | ||
140 | #define PMU_UNIT_ID_IS_VALID(id) \ | 140 | #define PMU_UNIT_ID_IS_VALID(id) \ |
141 | (((id) < PMU_UNIT_END) || ((id) >= PMU_UNIT_TEST_START)) | 141 | (((id) < PMU_UNIT_END) || ((id) >= PMU_UNIT_TEST_START)) |