lib: utils/regmap: Mark syscon region as shared read-write
authorAnup Patel <apatel@ventanamicro.com>
Thu, 7 Sep 2023 11:49:47 +0000 (17:19 +0530)
committerAnup Patel <anup@brainfault.org>
Sun, 24 Sep 2023 11:44:26 +0000 (17:14 +0530)
The syscon region used by OpenSBI should be marked as a shared
read-write region between M-mode and SU-mode.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
lib/utils/regmap/fdt_regmap_syscon.c

index 29263ddd3556c420e19a202d018641c51e89dcf1..d87b6e0926e0812a231dfbdf004463183250ee5d 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <libfdt.h>
+#include <sbi/riscv_asm.h>
 #include <sbi/riscv_io.h>
 #include <sbi/sbi_byteorder.h>
 #include <sbi/sbi_error.h>
@@ -240,6 +241,12 @@ static int regmap_syscon_init(void *fdt, int nodeoff, u32 phandle,
                goto fail_free_syscon;
        }
 
+       rc = sbi_domain_root_add_memrange(addr, size, PAGE_SIZE,
+                               (SBI_DOMAIN_MEMREGION_MMIO |
+                                SBI_DOMAIN_MEMREGION_SHARED_SURW_MRW));
+       if (rc)
+               goto fail_free_syscon;
+
        rc = regmap_add(&srm->rmap);
        if (rc)
                goto fail_free_syscon;