Skip to content

Commit dcd2d5f

Browse files
Chenghai Huangherbertx
authored andcommitted
crypto: hisilicon/zip - enable literal length in stream mode compression
In stream mode, the hardware needs to combine the length of the previous literal to calculate the length of the current literal. Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 9228fac commit dcd2d5f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/crypto/hisilicon/zip/zip_main.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@
117117
/* zip comp high performance */
118118
#define HZIP_HIGH_PERF_OFFSET 0x301208
119119

120+
#define HZIP_LIT_LEN_EN_OFFSET 0x301204
121+
#define HZIP_LIT_LEN_EN_EN BIT(4)
122+
120123
enum {
121124
HZIP_HIGH_COMP_RATE,
122125
HZIP_HIGH_COMP_PERF,
@@ -454,6 +457,20 @@ bool hisi_zip_alg_support(struct hisi_qm *qm, u32 alg)
454457
return false;
455458
}
456459

460+
static void hisi_zip_literal_set(struct hisi_qm *qm)
461+
{
462+
u32 val;
463+
464+
if (qm->ver < QM_HW_V3)
465+
return;
466+
467+
val = readl_relaxed(qm->io_base + HZIP_LIT_LEN_EN_OFFSET);
468+
val &= ~HZIP_LIT_LEN_EN_EN;
469+
470+
/* enable literal length in stream mode compression */
471+
writel(val, qm->io_base + HZIP_LIT_LEN_EN_OFFSET);
472+
}
473+
457474
static void hisi_zip_set_high_perf(struct hisi_qm *qm)
458475
{
459476
u32 val;
@@ -617,6 +634,7 @@ static int hisi_zip_set_user_domain_and_cache(struct hisi_qm *qm)
617634
FIELD_PREP(CQC_CACHE_WB_THRD, 1), base + QM_CACHE_CTL);
618635

619636
hisi_zip_set_high_perf(qm);
637+
hisi_zip_literal_set(qm);
620638
hisi_zip_enable_clock_gate(qm);
621639

622640
ret = hisi_dae_set_user_domain(qm);

0 commit comments

Comments
 (0)