Hi there,
I met a P4080 SEC 4.0 issue which made me very confused. I'd be very appretiated if anyone could help.
The SEC 4.0 driver I used was downloaded from the Freescale web site and I just added some interface files in the attached "sec_interface.c" file to fit driver into our firmware. Files in the driver are not touched. The operationg system is vxWorks 6.8.
My usage of SEC 4.0 is very simple:-
- Enqueue a request to SEC job queue to do Kasumi ciphering
- Wait until the operation is done, then dequeue the ciphering result.
The above steps are implemented in one function called "kasumi_f8" which is in the attached "sec_interface.c" file. This function could be called by two simultaneously running tasks on two different CPU cores very frequently. Sometimes, the ciphering operation is never done and kasumi_f8 will enter dead loop intermittently. After some investigation, it turns out that the ISTAR of the job queue indicates that the JRE bit is set and ERR_TYPE is 0b1000 which means "Removed too many jobs".
Then I wrote a function below to check the error and try to do the recover. This function is called at the beginning of "kasumi_f8", and count the times of recovering. It seems that this function recovers the SEC several times successfully, and I never met the issue after running the test for more than 24 hours.
However, I could not understand what caused the SEC error. Does anyone encounter the same issue?
Regards,
Zhou Kui
#define ISTAR_JRE_BITMAP 0x2
#define ISTAR_HALT_BITMAP 0xC
t_Error SEC_JQ_Check_Recover(t_Handle h_SecJq)
{
uint32_t orsfr_val;
t_SecJq* p_SecJq = (t_SecJq*)h_SecJq;
SANITY_CHECK_EXIT(p_SecJq,E_INVALID_HANDLE);
SANITY_CHECK_EXIT(p_SecJq->p_DriverParam==NULL,E_INVALID_STATE);
if (GET_UINT32(p_SecJq->p_MemMap->jq.istar) & ISTAR_JRE_BITMAP)
{
/* JRE is set, Job Ring Error. Flush the Job Queue */
WRITE_UINT32(p_SecJq->p_MemMap->jq.cmdr,1);
/* Check if the Flush is completed */
while ((GET_UINT32(p_SecJq->p_MemMap->jq.istar) & ISTAR_HALT_BITMAP)
== 0x4)
{
/* Not completed, need to empty the job queue to keep the flush
* running until it completes. */
orsfr_val = GET_UINT32(p_SecJq->p_MemMap->jq.orsfr);
if (orsfr_val != 0)
WRITE_UINT32(p_SecJq->p_MemMap->jq.orjrr, orsfr_val);
}
/* Check if the Flush is completed again */
if ((GET_UINT32(p_SecJq->p_MemMap->jq.istar) & ISTAR_HALT_BITMAP)
!= 0x8)
/* Fatal error, we don't know what to do */
{
return E_JRE_NOT_RECOVERED;
}
/* Empty the job queue if there is any completed job left */
orsfr_val = GET_UINT32(p_SecJq->p_MemMap->jq.orsfr);
if (orsfr_val != 0)
WRITE_UINT32(p_SecJq->p_MemMap->jq.orjrr, orsfr_val);
/* Resume the job queue, and clear the error bits */
WRITE_UINT32(p_SecJq->p_MemMap->jq.istar, 0xa);
return E_JRE_RECOVERED;
}
else
return E_OK;
}
kuizhou wrote:Hi there,
The SEC 4.0 driver I used was downloaded from the Freescale web site . The operationg system is vxWorks 6.8.
Hello Kuizhou.
I'm afraid I can't offer any insight yet into your posted question as I'm just beginning my use of SEC 4.0 in a P4080.
I'd like to ask where did you obtain the SEC 4.0 driver you mentioned in your original post? I have the Freescale_SDK but I think the driver you reference isn't in the SDK I'm trying to use.
If possible, can you please supply a reference link or file name of the SEC 4.0 driver that you downloaded.
Thanks for any assistance you can supply.
Regards,
Rick.