@@ -357,13 +357,22 @@ static int safexcel_hw_setup_cdesc_rings(struct safexcel_crypto_priv *priv)
357
357
static int safexcel_hw_setup_rdesc_rings (struct safexcel_crypto_priv * priv )
358
358
{
359
359
u32 hdw , rd_size_rnd , val ;
360
- int i ;
361
-
362
- hdw = readl (EIP197_HIA_AIC_G (priv ) + EIP197_HIA_OPTIONS );
363
- hdw &= GENMASK (27 , 25 );
364
- hdw >>= 25 ;
360
+ int i , rd_fetch_cnt ;
365
361
366
- rd_size_rnd = (priv -> config .rd_size + (BIT (hdw ) - 1 )) >> hdw ;
362
+ /* determine number of RD's we can fetch into the FIFO as one block */
363
+ rd_size_rnd = (EIP197_RD64_FETCH_SIZE +
364
+ BIT (priv -> hwconfig .hwdataw ) - 1 ) >>
365
+ priv -> hwconfig .hwdataw ;
366
+ if (priv -> flags & SAFEXCEL_HW_EIP197 ) {
367
+ /* EIP197: try to fetch enough in 1 go to keep all pipes busy */
368
+ rd_fetch_cnt = (1 << priv -> hwconfig .hwrfsize ) / rd_size_rnd ;
369
+ rd_fetch_cnt = min_t (uint , rd_fetch_cnt ,
370
+ (priv -> config .pes * EIP197_FETCH_DEPTH ));
371
+ } else {
372
+ /* for the EIP97, just fetch all that fits minus 1 */
373
+ rd_fetch_cnt = ((1 << priv -> hwconfig .hwrfsize ) /
374
+ rd_size_rnd ) - 1 ;
375
+ }
367
376
368
377
for (i = 0 ; i < priv -> config .rings ; i ++ ) {
369
378
/* ring base address */
@@ -376,8 +385,8 @@ static int safexcel_hw_setup_rdesc_rings(struct safexcel_crypto_priv *priv)
376
385
priv -> config .rd_size ,
377
386
EIP197_HIA_RDR (priv , i ) + EIP197_HIA_xDR_DESC_SIZE );
378
387
379
- writel (((EIP197_FETCH_COUNT * (rd_size_rnd << hdw )) << 16 ) |
380
- (EIP197_FETCH_COUNT * priv -> config .rd_offset ),
388
+ writel (((rd_fetch_cnt * (rd_size_rnd << hdw )) << 16 ) |
389
+ (rd_fetch_cnt * priv -> config .rd_offset ),
381
390
EIP197_HIA_RDR (priv , i ) + EIP197_HIA_xDR_CFG );
382
391
383
392
/* Configure DMA tx control */
@@ -1244,23 +1253,29 @@ static int safexcel_probe_generic(void *pdev,
1244
1253
priv -> hwconfig .hwcfsize = ((hiaopt >> EIP197_CFSIZE_OFFSET ) &
1245
1254
EIP197_CFSIZE_MASK ) +
1246
1255
EIP197_CFSIZE_ADJUST ;
1256
+ priv -> hwconfig .hwrfsize = ((hiaopt >> EIP197_RFSIZE_OFFSET ) &
1257
+ EIP197_RFSIZE_MASK ) +
1258
+ EIP197_RFSIZE_ADJUST ;
1247
1259
} else {
1248
1260
/* EIP97 */
1249
1261
priv -> hwconfig .hwdataw = (hiaopt >> EIP197_HWDATAW_OFFSET ) &
1250
1262
EIP97_HWDATAW_MASK ;
1251
1263
priv -> hwconfig .hwcfsize = (hiaopt >> EIP97_CFSIZE_OFFSET ) &
1252
1264
EIP97_CFSIZE_MASK ;
1265
+ priv -> hwconfig .hwrfsize = (hiaopt >> EIP97_RFSIZE_OFFSET ) &
1266
+ EIP97_RFSIZE_MASK ;
1253
1267
}
1254
1268
1255
1269
/* Get supported algorithms from EIP96 transform engine */
1256
1270
priv -> hwconfig .algo_flags = readl (EIP197_PE (priv ) +
1257
1271
EIP197_PE_EIP96_OPTIONS (0 ));
1258
1272
1259
1273
/* Print single info line describing what we just detected */
1260
- dev_info (priv -> dev , "EIP%d:%x(%d)-HIA:%x(%d,%d),PE:%x,alg:%08x\n" , peid ,
1261
- priv -> hwconfig .hwver , hwctg , priv -> hwconfig .hiaver ,
1274
+ dev_info (priv -> dev , "EIP%d:%x(%d)-HIA:%x(%d,%d,%d ),PE:%x,alg:%08x\n" ,
1275
+ peid , priv -> hwconfig .hwver , hwctg , priv -> hwconfig .hiaver ,
1262
1276
priv -> hwconfig .hwdataw , priv -> hwconfig .hwcfsize ,
1263
- priv -> hwconfig .pever , priv -> hwconfig .algo_flags );
1277
+ priv -> hwconfig .hwrfsize , priv -> hwconfig .pever ,
1278
+ priv -> hwconfig .algo_flags );
1264
1279
1265
1280
safexcel_configure (priv );
1266
1281
0 commit comments