MLK-17253-2: crypto: caam: Use correct memory function for Secure Memory

The Secure Memory is a hardware memory whose address was retrieved using
of_iomap, hence the memory manipulation shall use the set of functions:
memset_io/memcpy_fromio/memcpy_toio in order to works correctly.

Not using these functions can result in kernel panic.

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
This commit is contained in:
Franck LENORMAND 2018-02-05 10:54:56 +01:00 committed by Leonard Crestez
parent bb87424812
commit 308796dfae

View File

@ -506,7 +506,7 @@ int slot_dealloc(struct device *dev, u32 unit, u32 slot)
if (ksdata->slot[slot].allocated == 1) {
/* Forcibly overwrite the data from the keystore */
memset(ksdata->base_address + slot * smpriv->slot_size, 0,
memset_io(ksdata->base_address + slot * smpriv->slot_size, 0,
smpriv->slot_size);
ksdata->slot[slot].allocated = 0;
@ -803,8 +803,7 @@ int sm_keystore_slot_load(struct device *dev, u32 unit, u32 slot,
slot_location = smpriv->slot_get_address(dev, unit, slot);
for (i = 0; i < key_length; i++)
slot_location[i] = key_data[i];
memcpy_toio(slot_location, key_data, key_length);
retval = 0;
@ -832,7 +831,7 @@ int sm_keystore_slot_read(struct device *dev, u32 unit, u32 slot,
goto out;
}
memcpy(key_data, slot_addr, key_length);
memcpy_fromio(key_data, slot_addr, key_length);
retval = 0;
out: