Since commit d877f8fd0f09 ("arm: provide a function for boards init code to
modify MMU virtual-physical map"), the mmu_set_region_dcache_behaviour_phys
parameters need to be aligned on MMU_SECTION_SIZE to avoid unpredictable
behavior (alignment was done previously done in the function
mmu_set_region_dcache_behaviour_phys).

CC: Etienne Carriere <[email protected]>
Fixes: 240720e9052f ("firmware: scmi: mailbox/smt agent device")
Signed-off-by: Patrick Delaunay <[email protected]>
---

 drivers/firmware/scmi/smt.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/scmi/smt.c b/drivers/firmware/scmi/smt.c
index d25478796a..b88e228dc8 100644
--- a/drivers/firmware/scmi/smt.c
+++ b/drivers/firmware/scmi/smt.c
@@ -53,9 +53,12 @@ int scmi_dt_get_smt_buffer(struct udevice *dev, struct 
scmi_smt *smt)
                return -ENOMEM;
 
 #ifdef CONFIG_ARM
-       if (dcache_status())
-               mmu_set_region_dcache_behaviour((uintptr_t)smt->buf,
-                                               smt->size, DCACHE_OFF);
+       if (dcache_status()) {
+               uintptr_t start = ALIGN_DOWN((uintptr_t)smt->buf, 
MMU_SECTION_SIZE);
+               size_t size = ALIGN((uintptr_t)smt->buf - start + smt->size, 
MMU_SECTION_SIZE);
+
+               mmu_set_region_dcache_behaviour(start, size, DCACHE_OFF);
+    }
 #endif
 
        return 0;
-- 
2.17.1

Reply via email to