Skip to content

Commit 94cebd9

Browse files
horiagherbertx
authored andcommitted
crypto: caam - add Queue Interface v2 error codes
Add support to translate error codes returned by QI v2, i.e. Queue Interface present on DataPath Acceleration Architecture v2 (DPAA2). Signed-off-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent f9cb74f commit 94cebd9

3 files changed

Lines changed: 79 additions & 4 deletions

File tree

‎drivers/crypto/caam/error.c‎

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,54 @@ static const struct {
108108
{ 0xF1, "3GPP HFN matches or exceeds the Threshold" },
109109
};
110110

111+
static const struct {
112+
u8 value;
113+
const char *error_text;
114+
} qi_error_list[] = {
115+
{ 0x1F, "Job terminated by FQ or ICID flush" },
116+
{ 0x20, "FD format error"},
117+
{ 0x21, "FD command format error"},
118+
{ 0x23, "FL format error"},
119+
{ 0x25, "CRJD specified in FD, but not enabled in FLC"},
120+
{ 0x30, "Max. buffer size too small"},
121+
{ 0x31, "DHR exceeds max. buffer size (allocate mode, S/G format)"},
122+
{ 0x32, "SGT exceeds max. buffer size (allocate mode, S/G format"},
123+
{ 0x33, "Size over/underflow (allocate mode)"},
124+
{ 0x34, "Size over/underflow (reuse mode)"},
125+
{ 0x35, "Length exceeds max. short length (allocate mode, S/G/ format)"},
126+
{ 0x36, "Memory footprint exceeds max. value (allocate mode, S/G/ format)"},
127+
{ 0x41, "SBC frame format not supported (allocate mode)"},
128+
{ 0x42, "Pool 0 invalid / pool 1 size < pool 0 size (allocate mode)"},
129+
{ 0x43, "Annotation output enabled but ASAR = 0 (allocate mode)"},
130+
{ 0x44, "Unsupported or reserved frame format or SGHR = 1 (reuse mode)"},
131+
{ 0x45, "DHR correction underflow (reuse mode, single buffer format)"},
132+
{ 0x46, "Annotation length exceeds offset (reuse mode)"},
133+
{ 0x48, "Annotation output enabled but ASA limited by ASAR (reuse mode)"},
134+
{ 0x49, "Data offset correction exceeds input frame data length (reuse mode)"},
135+
{ 0x4B, "Annotation output enabled but ASA cannote be expanded (frame list)"},
136+
{ 0x51, "Unsupported IF reuse mode"},
137+
{ 0x52, "Unsupported FL use mode"},
138+
{ 0x53, "Unsupported RJD use mode"},
139+
{ 0x54, "Unsupported inline descriptor use mode"},
140+
{ 0xC0, "Table buffer pool 0 depletion"},
141+
{ 0xC1, "Table buffer pool 1 depletion"},
142+
{ 0xC2, "Data buffer pool 0 depletion, no OF allocated"},
143+
{ 0xC3, "Data buffer pool 1 depletion, no OF allocated"},
144+
{ 0xC4, "Data buffer pool 0 depletion, partial OF allocated"},
145+
{ 0xC5, "Data buffer pool 1 depletion, partial OF allocated"},
146+
{ 0xD0, "FLC read error"},
147+
{ 0xD1, "FL read error"},
148+
{ 0xD2, "FL write error"},
149+
{ 0xD3, "OF SGT write error"},
150+
{ 0xD4, "PTA read error"},
151+
{ 0xD5, "PTA write error"},
152+
{ 0xD6, "OF SGT F-bit write error"},
153+
{ 0xD7, "ASA write error"},
154+
{ 0xE1, "FLC[ICR]=0 ICID error"},
155+
{ 0xE2, "FLC[ICR]=1 ICID error"},
156+
{ 0xE4, "source of ICID flush not trusted (BDI = 0)"},
157+
};
158+
111159
static const char * const cha_id_list[] = {
112160
"",
113161
"AES",
@@ -236,6 +284,27 @@ static void report_deco_status(struct device *jrdev, const u32 status,
236284
status, error, idx_str, idx, err_str, err_err_code);
237285
}
238286

287+
static void report_qi_status(struct device *qidev, const u32 status,
288+
const char *error)
289+
{
290+
u8 err_id = status & JRSTA_QIERR_ERROR_MASK;
291+
const char *err_str = "unidentified error value 0x";
292+
char err_err_code[3] = { 0 };
293+
int i;
294+
295+
for (i = 0; i < ARRAY_SIZE(qi_error_list); i++)
296+
if (qi_error_list[i].value == err_id)
297+
break;
298+
299+
if (i != ARRAY_SIZE(qi_error_list) && qi_error_list[i].error_text)
300+
err_str = qi_error_list[i].error_text;
301+
else
302+
snprintf(err_err_code, sizeof(err_err_code), "%02x", err_id);
303+
304+
dev_err(qidev, "%08x: %s: %s%s\n",
305+
status, error, err_str, err_err_code);
306+
}
307+
239308
static void report_jr_status(struct device *jrdev, const u32 status,
240309
const char *error)
241310
{
@@ -250,7 +319,7 @@ static void report_cond_code_status(struct device *jrdev, const u32 status,
250319
status, error, __func__);
251320
}
252321

253-
void caam_jr_strstatus(struct device *jrdev, u32 status)
322+
void caam_strstatus(struct device *jrdev, u32 status, bool qi_v2)
254323
{
255324
static const struct stat_src {
256325
void (*report_ssed)(struct device *jrdev, const u32 status,
@@ -262,7 +331,7 @@ void caam_jr_strstatus(struct device *jrdev, u32 status)
262331
{ report_ccb_status, "CCB" },
263332
{ report_jump_status, "Jump" },
264333
{ report_deco_status, "DECO" },
265-
{ NULL, "Queue Manager Interface" },
334+
{ report_qi_status, "Queue Manager Interface" },
266335
{ report_jr_status, "Job Ring" },
267336
{ report_cond_code_status, "Condition Code" },
268337
{ NULL, NULL },
@@ -288,4 +357,4 @@ void caam_jr_strstatus(struct device *jrdev, u32 status)
288357
else
289358
dev_err(jrdev, "%d: unknown error source\n", ssrc);
290359
}
291-
EXPORT_SYMBOL(caam_jr_strstatus);
360+
EXPORT_SYMBOL(caam_strstatus);

‎drivers/crypto/caam/error.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
#ifndef CAAM_ERROR_H
99
#define CAAM_ERROR_H
1010
#define CAAM_ERROR_STR_MAX 302
11-
void caam_jr_strstatus(struct device *jrdev, u32 status);
11+
12+
void caam_strstatus(struct device *dev, u32 status, bool qi_v2);
13+
14+
#define caam_jr_strstatus(jrdev, status) caam_strstatus(jrdev, status, false)
15+
#define caam_qi2_strstatus(qidev, status) caam_strstatus(qidev, status, true)
1216

1317
void caam_dump_sg(const char *level, const char *prefix_str, int prefix_type,
1418
int rowsize, int groupsize, struct scatterlist *sg,

‎drivers/crypto/caam/regs.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,8 @@ struct caam_job_ring {
633633
#define JRSTA_DECOERR_INVSIGN 0x86
634634
#define JRSTA_DECOERR_DSASIGN 0x87
635635

636+
#define JRSTA_QIERR_ERROR_MASK 0x00ff
637+
636638
#define JRSTA_CCBERR_JUMP 0x08000000
637639
#define JRSTA_CCBERR_INDEX_MASK 0xff00
638640
#define JRSTA_CCBERR_INDEX_SHIFT 8

0 commit comments

Comments
 (0)