Skip to content

Commit

Permalink
drivers: caam: Fix alignment fault caused by caam_desc_pop()
Browse files Browse the repository at this point in the history
Size of each JR Output ring entry is of 12 bytes for CAAM
using address pointer size as 64 bit. The descriptor address
pointer thus lies at 32 bit boundary in second output ring entry.
64 bit access of descriptor pointer at 32 bit boundary generates
alignment fault. To fix this,  descriptor address pointer should
be accessed as two 32 bit operations.

 regression_1004 Test User Crypt TA

E/TC:04 00
E/TC:04 00 Core data-abort at address 0xfc09774c (alignment fault)
E/TC:04 00  esr 0x96000021  ttbr0 0x20000fc0d0080   ttbr1 0x00000000   cidr 0x0
E/TC:04 00  cpu OP-TEE#4          cpsr 0x200001c4
E/TC:04 00  x0  00000000fc09774c x1  00000000fc096f80
E/TC:04 00  x2  0000000000000000 x3  0000008000020000
E/TC:04 00  x4  0000000000000003 x5  000000000000ca90
E/TC:04 00  x6  0000000000000000 x7  0000000000000020
E/TC:04 00  x8  00000000fc094418 x9  00000000d36adb98
E/TC:04 00  x10 0000000041001900 x11 00000000ab12a911
E/TC:04 00  x12 0000000032e4d24d x13 00000000e1b6489b
E/TC:04 00  x14 0000000000000000 x15 0000000000000000
E/TC:04 00  x16 00000000fc0ddba8 x17 0000000000000000
E/TC:04 00  x18 0000000000000000 x19 0000000000000000
E/TC:04 00  x20 000000000000270f x21 00000000fc075000
E/TC:04 00  x22 0000000000000000 x23 00000000fc09774c
E/TC:04 00  x24 00000000fc096f80 x25 0000000000000000
E/TC:04 00  x26 0000000000000001 x27 00000000fc06b000
E/TC:04 00  x28 0000000000000000 x29 00000000fc0dd970
E/TC:04 00  x30 00000000fc0193f4 elr 00000000fc01a04c
E/TC:04 00  sp_el0 00000000fc0dd970
E/TC:04 00 TEE load address @ 0xfc000000
E/TC:04 00 Call stack:
E/TC:04 00  0x00000000fc01a04c
E/TC:04 00  0x00000000fc019690
E/TC:04 00  0x00000000fc01e884
E/TC:04 00  0x00000000fc01ec30
E/TC:04 00  0x00000000fc018a74
E/TC:04 00  0x00000000fc030e18
E/TC:04 00  0x00000000fc02f5d8
E/TC:04 00  0x00000000fc02d6f8
E/TC:04 00  0x00000000fc02fde8
E/TC:04 00  0x00000000fc02d9e8
E/TC:04 00  0x00000000fc02dcb4
E/TC:04 00  0x00000000fc031bc8
E/TC:04 00  0x00000000fc032408
E/TC:04 00  0x00000000fc005370
E/TC:04 00  0x00000000fc022298
E/TC:04 00  0x00000000fc0059e4
E/TC:04 00  0x00000000fc020d5c
E/TC:04 00  0x00000000fc026bd8
E/TC:04 00  0x00000000fc0115e8
E/TC:04 00  0x00000000fc007a64
E/TC:04 00  0x00000000fc0039e0

Signed-off-by: Ruchika Gupta <ruchika.gupta@nxp.com>
  • Loading branch information
Ruchika Gupta committed Apr 22, 2020
1 parent f3fb4e2 commit 16727bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/drivers/crypto/caam/caam_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ void caam_desc_push(struct caam_inring_entry *in_entry, paddr_t paddr)

paddr_t caam_desc_pop(struct caam_outring_entry *out_entry)
{
const uint32_t *a32 = (const uint32_t *)(&out_entry->desc);
#ifdef CFG_CAAM_BIG_ENDIAN
return get_be64(&out_entry->desc);
return SHIFT_U64(get_be32(&a32[0]), 32) | get_be32(&a32[1]);
#else
return get_le64(&out_entry->desc);
return SHIFT_U64(a32[1], 32) | a32[0];
#endif /* CFG_CAAM_BIG_ENDIAN */
}

#else /* CFG_CAAM_64BIT */
void caam_desc_push(struct caam_inring_entry *in_entry, paddr_t paddr)
{
Expand Down

0 comments on commit 16727bc

Please sign in to comment.