Skip to content

Commit 8c9478a

Browse files
arndbherbertx
authored andcommitted
crypto: qat - reduce stack size with KASAN
Passing the register value by reference here leads a large amount of stack being used when CONFIG_KASAN is enabled: drivers/crypto/qat/qat_common/qat_hal.c: In function 'qat_hal_exec_micro_inst.constprop': drivers/crypto/qat/qat_common/qat_hal.c:963:1: error: the frame size of 1792 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] Changing the register-read function to return the value instead reduces the stack size to around 800 bytes, most of which is for the 'savuwords' array. The function now no longer returns an error code, but nothing ever evaluated that anyway. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 3a2d4fb commit 8c9478a

1 file changed

Lines changed: 67 additions & 66 deletions

File tree

‎drivers/crypto/qat/qat_common/qat_hal.c‎

Lines changed: 67 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,19 @@ void qat_hal_set_live_ctx(struct icp_qat_fw_loader_handle *handle,
117117

118118
#define CSR_RETRY_TIMES 500
119119
static int qat_hal_rd_ae_csr(struct icp_qat_fw_loader_handle *handle,
120-
unsigned char ae, unsigned int csr,
121-
unsigned int *value)
120+
unsigned char ae, unsigned int csr)
122121
{
123122
unsigned int iterations = CSR_RETRY_TIMES;
123+
int value;
124124

125125
do {
126-
*value = GET_AE_CSR(handle, ae, csr);
126+
value = GET_AE_CSR(handle, ae, csr);
127127
if (!(GET_AE_CSR(handle, ae, LOCAL_CSR_STATUS) & LCS_STATUS))
128-
return 0;
128+
return value;
129129
} while (iterations--);
130130

131131
pr_err("QAT: Read CSR timeout\n");
132-
return -EFAULT;
132+
return 0;
133133
}
134134

135135
static int qat_hal_wr_ae_csr(struct icp_qat_fw_loader_handle *handle,
@@ -154,9 +154,9 @@ static void qat_hal_get_wakeup_event(struct icp_qat_fw_loader_handle *handle,
154154
{
155155
unsigned int cur_ctx;
156156

157-
qat_hal_rd_ae_csr(handle, ae, CSR_CTX_POINTER, &cur_ctx);
157+
cur_ctx = qat_hal_rd_ae_csr(handle, ae, CSR_CTX_POINTER);
158158
qat_hal_wr_ae_csr(handle, ae, CSR_CTX_POINTER, ctx);
159-
qat_hal_rd_ae_csr(handle, ae, CTX_WAKEUP_EVENTS_INDIRECT, events);
159+
*events = qat_hal_rd_ae_csr(handle, ae, CTX_WAKEUP_EVENTS_INDIRECT);
160160
qat_hal_wr_ae_csr(handle, ae, CSR_CTX_POINTER, cur_ctx);
161161
}
162162

@@ -169,13 +169,13 @@ static int qat_hal_wait_cycles(struct icp_qat_fw_loader_handle *handle,
169169
int times = MAX_RETRY_TIMES;
170170
int elapsed_cycles = 0;
171171

172-
qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT, &base_cnt);
172+
base_cnt = qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT);
173173
base_cnt &= 0xffff;
174174
while ((int)cycles > elapsed_cycles && times--) {
175175
if (chk_inactive)
176-
qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS, &csr);
176+
csr = qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS);
177177

178-
qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT, &cur_cnt);
178+
cur_cnt = qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT);
179179
cur_cnt &= 0xffff;
180180
elapsed_cycles = cur_cnt - base_cnt;
181181

@@ -207,7 +207,7 @@ int qat_hal_set_ae_ctx_mode(struct icp_qat_fw_loader_handle *handle,
207207
}
208208

209209
/* Sets the accelaration engine context mode to either four or eight */
210-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &csr);
210+
csr = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
211211
csr = IGNORE_W1C_MASK & csr;
212212
new_csr = (mode == 4) ?
213213
SET_BIT(csr, CE_INUSE_CONTEXTS_BITPOS) :
@@ -221,7 +221,7 @@ int qat_hal_set_ae_nn_mode(struct icp_qat_fw_loader_handle *handle,
221221
{
222222
unsigned int csr, new_csr;
223223

224-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &csr);
224+
csr = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
225225
csr &= IGNORE_W1C_MASK;
226226

227227
new_csr = (mode) ?
@@ -240,7 +240,7 @@ int qat_hal_set_ae_lm_mode(struct icp_qat_fw_loader_handle *handle,
240240
{
241241
unsigned int csr, new_csr;
242242

243-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &csr);
243+
csr = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
244244
csr &= IGNORE_W1C_MASK;
245245
switch (lm_type) {
246246
case ICP_LMEM0:
@@ -328,7 +328,7 @@ static void qat_hal_wr_indr_csr(struct icp_qat_fw_loader_handle *handle,
328328
{
329329
unsigned int ctx, cur_ctx;
330330

331-
qat_hal_rd_ae_csr(handle, ae, CSR_CTX_POINTER, &cur_ctx);
331+
cur_ctx = qat_hal_rd_ae_csr(handle, ae, CSR_CTX_POINTER);
332332

333333
for (ctx = 0; ctx < ICP_QAT_UCLO_MAX_CTX; ctx++) {
334334
if (!(ctx_mask & (1 << ctx)))
@@ -340,16 +340,18 @@ static void qat_hal_wr_indr_csr(struct icp_qat_fw_loader_handle *handle,
340340
qat_hal_wr_ae_csr(handle, ae, CSR_CTX_POINTER, cur_ctx);
341341
}
342342

343-
static void qat_hal_rd_indr_csr(struct icp_qat_fw_loader_handle *handle,
343+
static unsigned int qat_hal_rd_indr_csr(struct icp_qat_fw_loader_handle *handle,
344344
unsigned char ae, unsigned char ctx,
345-
unsigned int ae_csr, unsigned int *csr_val)
345+
unsigned int ae_csr)
346346
{
347-
unsigned int cur_ctx;
347+
unsigned int cur_ctx, csr_val;
348348

349-
qat_hal_rd_ae_csr(handle, ae, CSR_CTX_POINTER, &cur_ctx);
349+
cur_ctx = qat_hal_rd_ae_csr(handle, ae, CSR_CTX_POINTER);
350350
qat_hal_wr_ae_csr(handle, ae, CSR_CTX_POINTER, ctx);
351-
qat_hal_rd_ae_csr(handle, ae, ae_csr, csr_val);
351+
csr_val = qat_hal_rd_ae_csr(handle, ae, ae_csr);
352352
qat_hal_wr_ae_csr(handle, ae, CSR_CTX_POINTER, cur_ctx);
353+
354+
return csr_val;
353355
}
354356

355357
static void qat_hal_put_sig_event(struct icp_qat_fw_loader_handle *handle,
@@ -358,7 +360,7 @@ static void qat_hal_put_sig_event(struct icp_qat_fw_loader_handle *handle,
358360
{
359361
unsigned int ctx, cur_ctx;
360362

361-
qat_hal_rd_ae_csr(handle, ae, CSR_CTX_POINTER, &cur_ctx);
363+
cur_ctx = qat_hal_rd_ae_csr(handle, ae, CSR_CTX_POINTER);
362364
for (ctx = 0; ctx < ICP_QAT_UCLO_MAX_CTX; ctx++) {
363365
if (!(ctx_mask & (1 << ctx)))
364366
continue;
@@ -374,7 +376,7 @@ static void qat_hal_put_wakeup_event(struct icp_qat_fw_loader_handle *handle,
374376
{
375377
unsigned int ctx, cur_ctx;
376378

377-
qat_hal_rd_ae_csr(handle, ae, CSR_CTX_POINTER, &cur_ctx);
379+
cur_ctx = qat_hal_rd_ae_csr(handle, ae, CSR_CTX_POINTER);
378380
for (ctx = 0; ctx < ICP_QAT_UCLO_MAX_CTX; ctx++) {
379381
if (!(ctx_mask & (1 << ctx)))
380382
continue;
@@ -392,13 +394,11 @@ static int qat_hal_check_ae_alive(struct icp_qat_fw_loader_handle *handle)
392394
int times = MAX_RETRY_TIMES;
393395

394396
for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) {
395-
qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT,
396-
(unsigned int *)&base_cnt);
397+
base_cnt = qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT);
397398
base_cnt &= 0xffff;
398399

399400
do {
400-
qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT,
401-
(unsigned int *)&cur_cnt);
401+
cur_cnt = qat_hal_rd_ae_csr(handle, ae, PROFILE_COUNT);
402402
cur_cnt &= 0xffff;
403403
} while (times-- && (cur_cnt == base_cnt));
404404

@@ -416,8 +416,8 @@ int qat_hal_check_ae_active(struct icp_qat_fw_loader_handle *handle,
416416
{
417417
unsigned int enable = 0, active = 0;
418418

419-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &enable);
420-
qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS, &active);
419+
enable = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
420+
active = qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS);
421421
if ((enable & (0xff << CE_ENABLE_BITPOS)) ||
422422
(active & (1 << ACS_ABO_BITPOS)))
423423
return 1;
@@ -540,7 +540,7 @@ static void qat_hal_disable_ctx(struct icp_qat_fw_loader_handle *handle,
540540
{
541541
unsigned int ctx;
542542

543-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &ctx);
543+
ctx = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
544544
ctx &= IGNORE_W1C_MASK &
545545
(~((ctx_mask & ICP_QAT_UCLO_AE_ALL_CTX) << CE_ENABLE_BITPOS));
546546
qat_hal_wr_ae_csr(handle, ae, CTX_ENABLES, ctx);
@@ -583,7 +583,7 @@ void qat_hal_wr_uwords(struct icp_qat_fw_loader_handle *handle,
583583
unsigned int ustore_addr;
584584
unsigned int i;
585585

586-
qat_hal_rd_ae_csr(handle, ae, USTORE_ADDRESS, &ustore_addr);
586+
ustore_addr = qat_hal_rd_ae_csr(handle, ae, USTORE_ADDRESS);
587587
uaddr |= UA_ECS;
588588
qat_hal_wr_ae_csr(handle, ae, USTORE_ADDRESS, uaddr);
589589
for (i = 0; i < words_num; i++) {
@@ -604,7 +604,7 @@ static void qat_hal_enable_ctx(struct icp_qat_fw_loader_handle *handle,
604604
{
605605
unsigned int ctx;
606606

607-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &ctx);
607+
ctx = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
608608
ctx &= IGNORE_W1C_MASK;
609609
ctx_mask &= (ctx & CE_INUSE_CONTEXTS) ? 0x55 : 0xFF;
610610
ctx |= (ctx_mask << CE_ENABLE_BITPOS);
@@ -636,10 +636,10 @@ static int qat_hal_clear_gpr(struct icp_qat_fw_loader_handle *handle)
636636
int ret = 0;
637637

638638
for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) {
639-
qat_hal_rd_ae_csr(handle, ae, AE_MISC_CONTROL, &csr_val);
639+
csr_val = qat_hal_rd_ae_csr(handle, ae, AE_MISC_CONTROL);
640640
csr_val &= ~(1 << MMC_SHARE_CS_BITPOS);
641641
qat_hal_wr_ae_csr(handle, ae, AE_MISC_CONTROL, csr_val);
642-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &csr_val);
642+
csr_val = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
643643
csr_val &= IGNORE_W1C_MASK;
644644
csr_val |= CE_NN_MODE;
645645
qat_hal_wr_ae_csr(handle, ae, CTX_ENABLES, csr_val);
@@ -648,7 +648,7 @@ static int qat_hal_clear_gpr(struct icp_qat_fw_loader_handle *handle)
648648
qat_hal_wr_indr_csr(handle, ae, ctx_mask, CTX_STS_INDIRECT,
649649
handle->hal_handle->upc_mask &
650650
INIT_PC_VALUE);
651-
qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS, &savctx);
651+
savctx = qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS);
652652
qat_hal_wr_ae_csr(handle, ae, ACTIVE_CTX_STATUS, 0);
653653
qat_hal_put_wakeup_event(handle, ae, ctx_mask, XCWE_VOLUNTARY);
654654
qat_hal_wr_indr_csr(handle, ae, ctx_mask,
@@ -760,7 +760,7 @@ int qat_hal_init(struct adf_accel_dev *accel_dev)
760760
for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) {
761761
unsigned int csr_val = 0;
762762

763-
qat_hal_rd_ae_csr(handle, ae, SIGNATURE_ENABLE, &csr_val);
763+
csr_val = qat_hal_rd_ae_csr(handle, ae, SIGNATURE_ENABLE);
764764
csr_val |= 0x1;
765765
qat_hal_wr_ae_csr(handle, ae, SIGNATURE_ENABLE, csr_val);
766766
}
@@ -826,16 +826,16 @@ static void qat_hal_get_uwords(struct icp_qat_fw_loader_handle *handle,
826826
unsigned int i, uwrd_lo, uwrd_hi;
827827
unsigned int ustore_addr, misc_control;
828828

829-
qat_hal_rd_ae_csr(handle, ae, AE_MISC_CONTROL, &misc_control);
829+
misc_control = qat_hal_rd_ae_csr(handle, ae, AE_MISC_CONTROL);
830830
qat_hal_wr_ae_csr(handle, ae, AE_MISC_CONTROL,
831831
misc_control & 0xfffffffb);
832-
qat_hal_rd_ae_csr(handle, ae, USTORE_ADDRESS, &ustore_addr);
832+
ustore_addr = qat_hal_rd_ae_csr(handle, ae, USTORE_ADDRESS);
833833
uaddr |= UA_ECS;
834834
for (i = 0; i < words_num; i++) {
835835
qat_hal_wr_ae_csr(handle, ae, USTORE_ADDRESS, uaddr);
836836
uaddr++;
837-
qat_hal_rd_ae_csr(handle, ae, USTORE_DATA_LOWER, &uwrd_lo);
838-
qat_hal_rd_ae_csr(handle, ae, USTORE_DATA_UPPER, &uwrd_hi);
837+
uwrd_lo = qat_hal_rd_ae_csr(handle, ae, USTORE_DATA_LOWER);
838+
uwrd_hi = qat_hal_rd_ae_csr(handle, ae, USTORE_DATA_UPPER);
839839
uword[i] = uwrd_hi;
840840
uword[i] = (uword[i] << 0x20) | uwrd_lo;
841841
}
@@ -849,7 +849,7 @@ void qat_hal_wr_umem(struct icp_qat_fw_loader_handle *handle,
849849
{
850850
unsigned int i, ustore_addr;
851851

852-
qat_hal_rd_ae_csr(handle, ae, USTORE_ADDRESS, &ustore_addr);
852+
ustore_addr = qat_hal_rd_ae_csr(handle, ae, USTORE_ADDRESS);
853853
uaddr |= UA_ECS;
854854
qat_hal_wr_ae_csr(handle, ae, USTORE_ADDRESS, uaddr);
855855
for (i = 0; i < words_num; i++) {
@@ -890,26 +890,27 @@ static int qat_hal_exec_micro_inst(struct icp_qat_fw_loader_handle *handle,
890890
return -EINVAL;
891891
}
892892
/* save current context */
893-
qat_hal_rd_indr_csr(handle, ae, ctx, LM_ADDR_0_INDIRECT, &ind_lm_addr0);
894-
qat_hal_rd_indr_csr(handle, ae, ctx, LM_ADDR_1_INDIRECT, &ind_lm_addr1);
895-
qat_hal_rd_indr_csr(handle, ae, ctx, INDIRECT_LM_ADDR_0_BYTE_INDEX,
896-
&ind_lm_addr_byte0);
897-
qat_hal_rd_indr_csr(handle, ae, ctx, INDIRECT_LM_ADDR_1_BYTE_INDEX,
898-
&ind_lm_addr_byte1);
893+
ind_lm_addr0 = qat_hal_rd_indr_csr(handle, ae, ctx, LM_ADDR_0_INDIRECT);
894+
ind_lm_addr1 = qat_hal_rd_indr_csr(handle, ae, ctx, LM_ADDR_1_INDIRECT);
895+
ind_lm_addr_byte0 = qat_hal_rd_indr_csr(handle, ae, ctx,
896+
INDIRECT_LM_ADDR_0_BYTE_INDEX);
897+
ind_lm_addr_byte1 = qat_hal_rd_indr_csr(handle, ae, ctx,
898+
INDIRECT_LM_ADDR_1_BYTE_INDEX);
899899
if (inst_num <= MAX_EXEC_INST)
900900
qat_hal_get_uwords(handle, ae, 0, inst_num, savuwords);
901901
qat_hal_get_wakeup_event(handle, ae, ctx, &wakeup_events);
902-
qat_hal_rd_indr_csr(handle, ae, ctx, CTX_STS_INDIRECT, &savpc);
902+
savpc = qat_hal_rd_indr_csr(handle, ae, ctx, CTX_STS_INDIRECT);
903903
savpc = (savpc & handle->hal_handle->upc_mask) >> 0;
904-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &ctx_enables);
904+
ctx_enables = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
905905
ctx_enables &= IGNORE_W1C_MASK;
906-
qat_hal_rd_ae_csr(handle, ae, CC_ENABLE, &savcc);
907-
qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS, &savctx);
908-
qat_hal_rd_ae_csr(handle, ae, CTX_ARB_CNTL, &ctxarb_ctl);
909-
qat_hal_rd_indr_csr(handle, ae, ctx, FUTURE_COUNT_SIGNAL_INDIRECT,
910-
&ind_cnt_sig);
911-
qat_hal_rd_indr_csr(handle, ae, ctx, CTX_SIG_EVENTS_INDIRECT, &ind_sig);
912-
qat_hal_rd_ae_csr(handle, ae, CTX_SIG_EVENTS_ACTIVE, &act_sig);
906+
savcc = qat_hal_rd_ae_csr(handle, ae, CC_ENABLE);
907+
savctx = qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS);
908+
ctxarb_ctl = qat_hal_rd_ae_csr(handle, ae, CTX_ARB_CNTL);
909+
ind_cnt_sig = qat_hal_rd_indr_csr(handle, ae, ctx,
910+
FUTURE_COUNT_SIGNAL_INDIRECT);
911+
ind_sig = qat_hal_rd_indr_csr(handle, ae, ctx,
912+
CTX_SIG_EVENTS_INDIRECT);
913+
act_sig = qat_hal_rd_ae_csr(handle, ae, CTX_SIG_EVENTS_ACTIVE);
913914
/* execute micro codes */
914915
qat_hal_wr_ae_csr(handle, ae, CTX_ENABLES, ctx_enables);
915916
qat_hal_wr_uwords(handle, ae, 0, inst_num, micro_inst);
@@ -927,8 +928,8 @@ static int qat_hal_exec_micro_inst(struct icp_qat_fw_loader_handle *handle,
927928
if (endpc) {
928929
unsigned int ctx_status;
929930

930-
qat_hal_rd_indr_csr(handle, ae, ctx, CTX_STS_INDIRECT,
931-
&ctx_status);
931+
ctx_status = qat_hal_rd_indr_csr(handle, ae, ctx,
932+
CTX_STS_INDIRECT);
932933
*endpc = ctx_status & handle->hal_handle->upc_mask;
933934
}
934935
/* retore to saved context */
@@ -938,7 +939,7 @@ static int qat_hal_exec_micro_inst(struct icp_qat_fw_loader_handle *handle,
938939
qat_hal_put_wakeup_event(handle, ae, (1 << ctx), wakeup_events);
939940
qat_hal_wr_indr_csr(handle, ae, (1 << ctx), CTX_STS_INDIRECT,
940941
handle->hal_handle->upc_mask & savpc);
941-
qat_hal_rd_ae_csr(handle, ae, AE_MISC_CONTROL, &csr_val);
942+
csr_val = qat_hal_rd_ae_csr(handle, ae, AE_MISC_CONTROL);
942943
newcsr_val = CLR_BIT(csr_val, MMC_SHARE_CS_BITPOS);
943944
qat_hal_wr_ae_csr(handle, ae, AE_MISC_CONTROL, newcsr_val);
944945
qat_hal_wr_ae_csr(handle, ae, CC_ENABLE, savcc);
@@ -986,16 +987,16 @@ static int qat_hal_rd_rel_reg(struct icp_qat_fw_loader_handle *handle,
986987
insts = (uint64_t)0xA030000000ull | ((reg_addr & 0x3ff) << 10);
987988
break;
988989
}
989-
qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS, &savctx);
990-
qat_hal_rd_ae_csr(handle, ae, CTX_ARB_CNTL, &ctxarb_cntl);
991-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &ctx_enables);
990+
savctx = qat_hal_rd_ae_csr(handle, ae, ACTIVE_CTX_STATUS);
991+
ctxarb_cntl = qat_hal_rd_ae_csr(handle, ae, CTX_ARB_CNTL);
992+
ctx_enables = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
992993
ctx_enables &= IGNORE_W1C_MASK;
993994
if (ctx != (savctx & ACS_ACNO))
994995
qat_hal_wr_ae_csr(handle, ae, ACTIVE_CTX_STATUS,
995996
ctx & ACS_ACNO);
996997
qat_hal_get_uwords(handle, ae, 0, 1, &savuword);
997998
qat_hal_wr_ae_csr(handle, ae, CTX_ENABLES, ctx_enables);
998-
qat_hal_rd_ae_csr(handle, ae, USTORE_ADDRESS, &ustore_addr);
999+
ustore_addr = qat_hal_rd_ae_csr(handle, ae, USTORE_ADDRESS);
9991000
uaddr = UA_ECS;
10001001
qat_hal_wr_ae_csr(handle, ae, USTORE_ADDRESS, uaddr);
10011002
insts = qat_hal_set_uword_ecc(insts);
@@ -1011,7 +1012,7 @@ static int qat_hal_rd_rel_reg(struct icp_qat_fw_loader_handle *handle,
10111012
* the instruction should have been executed
10121013
* prior to clearing the ECS in putUwords
10131014
*/
1014-
qat_hal_rd_ae_csr(handle, ae, ALU_OUT, data);
1015+
*data = qat_hal_rd_ae_csr(handle, ae, ALU_OUT);
10151016
qat_hal_wr_ae_csr(handle, ae, USTORE_ADDRESS, ustore_addr);
10161017
qat_hal_wr_uwords(handle, ae, 0, 1, &savuword);
10171018
if (ctx != (savctx & ACS_ACNO))
@@ -1188,7 +1189,7 @@ static int qat_hal_put_rel_rd_xfer(struct icp_qat_fw_loader_handle *handle,
11881189
unsigned short mask;
11891190
unsigned short dr_offset = 0x10;
11901191

1191-
status = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &ctx_enables);
1192+
status = ctx_enables = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
11921193
if (CE_INUSE_CONTEXTS & ctx_enables) {
11931194
if (ctx & 0x1) {
11941195
pr_err("QAT: bad 4-ctx mode,ctx=0x%x\n", ctx);
@@ -1238,7 +1239,7 @@ static int qat_hal_put_rel_wr_xfer(struct icp_qat_fw_loader_handle *handle,
12381239
const int num_inst = ARRAY_SIZE(micro_inst), code_off = 1;
12391240
const unsigned short gprnum = 0, dly = num_inst * 0x5;
12401241

1241-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &ctx_enables);
1242+
ctx_enables = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
12421243
if (CE_INUSE_CONTEXTS & ctx_enables) {
12431244
if (ctx & 0x1) {
12441245
pr_err("QAT: 4-ctx mode,ctx=0x%x\n", ctx);
@@ -1282,7 +1283,7 @@ static int qat_hal_put_rel_nn(struct icp_qat_fw_loader_handle *handle,
12821283
unsigned int ctx_enables;
12831284
int stat = 0;
12841285

1285-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &ctx_enables);
1286+
ctx_enables = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
12861287
ctx_enables &= IGNORE_W1C_MASK;
12871288
qat_hal_wr_ae_csr(handle, ae, CTX_ENABLES, ctx_enables | CE_NN_MODE);
12881289

@@ -1299,7 +1300,7 @@ static int qat_hal_convert_abs_to_rel(struct icp_qat_fw_loader_handle
12991300
{
13001301
unsigned int ctx_enables;
13011302

1302-
qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES, &ctx_enables);
1303+
ctx_enables = qat_hal_rd_ae_csr(handle, ae, CTX_ENABLES);
13031304
if (ctx_enables & CE_INUSE_CONTEXTS) {
13041305
/* 4-ctx mode */
13051306
*relreg = absreg_num & 0x1F;

0 commit comments

Comments
 (0)