On 7/2/24 12:25 AM, Eric Biggers wrote:
From: Eric Biggers <ebiggers@xxxxxxxxxx>
Add support for Flash Memory Protector (FMP), which is the inline
encryption hardware on Exynos and Exynos-based SoCs.
Specifically, add support for the "traditional FMP mode" that works on
many Exynos-based SoCs including gs101. This is the mode that uses
"software keys" and is compatible with the upstream kernel's existing
inline encryption framework in the block and filesystem layers. I plan
to add support for the wrapped key support on gs101 at a later time.
Tested on gs101 (specifically Pixel 6) by running the 'encrypt' group of
xfstests on a filesystem mounted with the 'inlinecrypt' mount option.
Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
---
drivers/ufs/host/ufs-exynos.c | 228 +++++++++++++++++++++++++++++++++-
1 file changed, 222 insertions(+), 6 deletions(-)
diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c
index 88d125d1ee3c..dd545ef7c361 100644
--- a/drivers/ufs/host/ufs-exynos.c
+++ b/drivers/ufs/host/ufs-exynos.c
@@ -6,10 +6,13 @@
* Author: Seungwon Jeon <essuuj@xxxxxxxxx>
* Author: Alim Akhtar <alim.akhtar@xxxxxxxxxxx>
*
*/
+#include <asm/unaligned.h>
+#include <crypto/aes.h>
+#include <linux/arm-smccc.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
@@ -23,16 +26,18 @@
#include <ufs/ufshci.h>
#include <ufs/unipro.h>
#include "ufs-exynos.h"
+#define DATA_UNIT_SIZE 4096
+#define LOG2_DATA_UNIT_SIZE 12
If this series has to be reposted, please consider changing "12" into
"ilog2(DATA_UNIT_SIZE)". I think that the ilog2() macro generates a
constant expression if its argument is a constant.
In case it wouldn't be clear, I'm fine with this patch with or without
that change.
Thanks,
Bart.