how to use caam

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to use caam

1,342 Views
shuaiqing_wang
Contributor I

Hi,

I am wang shuaiqing from HiRain company. We are using the imx8qxp and imx8qm board.

Now, I am trying to use jobring3 of CAAM  in optee in linux os.

After I give my inputing decsriptor to jobring3, the CAAM_ORSFR3 register is set immidiately,

and the output buffer is always 0.

could you check the log below and tell me the reason??

D/TC:0 run_job:186 CAAM_IRJAR3=0, CAAM_ORSFR3=0, CAAM_ORJRR3=0
D/TC:0 run_job:189 CAAM_IRJAR3=1, CAAM_ORSFR3=1, CAAM_ORJRR3=0
I/TC: caam is processing
I/TC:
D/TC:0 run_job:198 CAAM_IRJAR3=1, CAAM_ORSFR3=1, CAAM_ORJRR3=0
D/TC:0 run_job:200 out[0]=0
I/TC: g_rings->out[0]=0, g_rings->out[1]=0
D/TC:0 dump_error:53 desc[0]: 0xb0800006
D/TC:0 dump_error:53 desc[1]: 0x8443000d
D/TC:0 dump_error:53 desc[2]: 0x24140400
D/TC:0 dump_error:53 desc[3]: 0xfe08d800
D/TC:0 dump_error:53 desc[4]: 0x54200020
D/TC:0 dump_error:53 desc[5]: 0xfe08dc20
E/TC:0 assertion 'g_rings->out[0] == job_pa' failed at core/arch/arm/pta/hwcrypto/caam.c:207 <run_job>
E/TC:0 Panic at core/kernel/assert.c:28 <_assert_break>

0 Kudos
2 Replies

1,137 Views
igorpadykov
NXP Employee
NXP Employee

Hi 帅卿 王 

for CAAM usage may be useful to check AN12554

Demo Application to Generate Red/Black Blobs Using CAAM and Encrypt/Decrypt Data

sources:  demo-caam-blobs - imx_sec_apps - i.MX Security Application Examples 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,138 Views
shuaiqing_wang
Contributor I

Hi igorpadykov

Sorry to reply so late, because of some urgent things.

According to your doc and code, my TA in optee can call CAAM successfully.

But CAAM always returns 0x40000216 (DMA error).

Could you check the code and log and tell me more about this error??

code:
g_job->dsc[0] = 0xB0800008;
g_job->dsc[1] = 0x14400010;
g_job->dsc[2] = kmod_pa; // kmod_pa is from normal ram, not SECURE RAM
g_job->dsc[3] = 0xF0000000 | (0x0000ffff & (size));
g_job->dsc[4] = plain_pa; // kmod_pa is from normal ram, not SECURE RAM
g_job->dsc[5] = 0xF8000000 | (0x0000ffff & (size + CAAM_KB_HEADER_LEN));
g_job->dsc[6] = blob_pa; // kmod_pa is from normal ram, not SECURE RAM
g_job->dsc[7] = 0x870D0000;
g_job->dsc_used = 8;

run_job(g_job);

log:
D/TC:0 run_job:180 CAAM_IRJAR3=1, CAAM_ORSFR3=0, CAAM_ORJRR3=1
D/TC:0 run_job:184 CAAM_IRJAR3=1, CAAM_ORSFR3=0, CAAM_ORJRR3=1
D/TC:0 run_job:189 CAAM_IRJAR3=1, CAAM_ORSFR3=1, CAAM_ORJRR3=1
D/TC:0 run_job:194 .
D/TC:0 run_job:207 CAAM_IRJAR3=1, CAAM_ORSFR3=0, CAAM_ORJRR3=1
E/TC:0 caam_gen_blob_pa:364 job failed (0x40000716)
E/TC:0 blob_test:204 gen blob err

THANK YOU

0 Kudos