[PATCH 3/4] hab: habv4: align config/state at 64 byte boundary

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Sep 21 02:56:48 PDT 2023


We do manual cache maintenance for &config and &state, because they are
passed as arguments to a secure monitor call. Before the SMC, they are
flushed and afterwards, they are invalidated, but still, we should keep
data we do manual cache maintenance for separate from usual local
variables. Do this by using the new __dma_aligned attribute.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/hab/habv4.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index 38f464fbf978..bbceb0e985b6 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -12,6 +12,7 @@
 #include <init.h>
 #include <types.h>
 #include <mmu.h>
+#include <dma.h>
 #include <zero_page.h>
 #include <linux/sizes.h>
 #include <linux/arm-smccc.h>
@@ -547,8 +548,8 @@ static int habv4_get_status(const struct habv4_rvt *rvt)
 	uint32_t len;
 	int i;
 	enum hab_status status;
-	enum hab_config config = 0x0;
-	enum habv4_state state = 0x0;
+	__dma_aligned enum hab_config config = 0x0;
+	__dma_aligned enum habv4_state state = 0x0;
 
 	if (rvt->header.tag != HAB_TAG_RVT) {
 		pr_err("ERROR - RVT not found!\n");
-- 
2.39.2




More information about the barebox mailing list