[PATCH master 01/23] habv4: use DMA-capable memory for getting event from BootROM

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 23 23:40:36 PDT 2024


We pass the buffer to the BootROM and we aren't sure yet whether this
requires us to do cache maintenance[1].

Anyhow, it's a tiny bit better to at least have cache line alignment for
data exchanged with TF-A and the BootROM, so do that.

[1]: https://lists.trustedfirmware.org/archives/list/tf-a@lists.trustedfirmware.org/message/D3PIAW7G2B3JQIH5BGMUZZKHPGNMXUUT/

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

diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index a1d823ed2512..0f5618116e22 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>
@@ -581,7 +582,7 @@ static uint8_t *hab_get_event(const struct habv4_rvt *rvt, int index, size_t *le
 	if (err != HAB_STATUS_SUCCESS)
 		return NULL;
 
-	buf = malloc(*len);
+	buf = dma_alloc(*len);
 	if (!buf)
 		return NULL;
 
-- 
2.39.2




More information about the barebox mailing list