qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] target/xtensa: use background MPU map from overlay
@ 2019-12-12 23:23 Max Filippov
  2019-12-12 23:23 ` [PATCH 1/2] target/xtensa: import xtensa/config/core-isa.h Max Filippov
  2019-12-12 23:23 ` [PATCH 2/2] target/xtensa: use MPU background map from core configuration Max Filippov
  0 siblings, 2 replies; 3+ messages in thread
From: Max Filippov @ 2019-12-12 23:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Filippov

Hello,

this series changes target/xtensa/import_core.sh script to import one
more header from the configuration overlay: the one with default address
space map for the core and uses information in this header to generate
background MPU map.

Max Filippov (2):
  target/xtensa: import xtensa/config/core-isa.h
  target/xtensa: use MPU background map from core configuration

 target/xtensa/import_core.sh |  6 ++++--
 target/xtensa/overlay_tool.h | 15 ++++++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] target/xtensa: import xtensa/config/core-isa.h
  2019-12-12 23:23 [PATCH 0/2] target/xtensa: use background MPU map from overlay Max Filippov
@ 2019-12-12 23:23 ` Max Filippov
  2019-12-12 23:23 ` [PATCH 2/2] target/xtensa: use MPU background map from core configuration Max Filippov
  1 sibling, 0 replies; 3+ messages in thread
From: Max Filippov @ 2019-12-12 23:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Filippov

Import core-isa.h from its canonical place in the configuration overlay.
Drop --xform option from the tar command line.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 target/xtensa/import_core.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/xtensa/import_core.sh b/target/xtensa/import_core.sh
index e4a2e39f6353..97c3219debf0 100755
--- a/target/xtensa/import_core.sh
+++ b/target/xtensa/import_core.sh
@@ -19,8 +19,8 @@ exit
 
 [ $# -ge 3 ] && FREQ="$3"
 mkdir -p "$TARGET"
-tar -xf "$OVERLAY" -C "$TARGET" --strip-components=1 \
-    --xform='s/core/core-isa/' config/core.h
+tar -xf "$OVERLAY" -C "$TARGET" --strip-components=2 \
+    xtensa/config/core-isa.h
 tar -xf "$OVERLAY" -O gdb/xtensa-config.c | \
     sed -n '1,/*\//p;/XTREG/,/XTREG_END/p' > "$TARGET"/gdb-config.inc.c
 #
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] target/xtensa: use MPU background map from core configuration
  2019-12-12 23:23 [PATCH 0/2] target/xtensa: use background MPU map from overlay Max Filippov
  2019-12-12 23:23 ` [PATCH 1/2] target/xtensa: import xtensa/config/core-isa.h Max Filippov
@ 2019-12-12 23:23 ` Max Filippov
  1 sibling, 0 replies; 3+ messages in thread
From: Max Filippov @ 2019-12-12 23:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Filippov

Configuration overlay may define MPU background map. Import
core-matmap.h from the overlay and use XCHAL_MPU_BACKGROUND_MAP macro
if it's defined.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 target/xtensa/import_core.sh |  4 +++-
 target/xtensa/overlay_tool.h | 15 ++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/target/xtensa/import_core.sh b/target/xtensa/import_core.sh
index 97c3219debf0..8f844cf9e2a6 100755
--- a/target/xtensa/import_core.sh
+++ b/target/xtensa/import_core.sh
@@ -20,7 +20,8 @@ exit
 [ $# -ge 3 ] && FREQ="$3"
 mkdir -p "$TARGET"
 tar -xf "$OVERLAY" -C "$TARGET" --strip-components=2 \
-    xtensa/config/core-isa.h
+    xtensa/config/core-isa.h \
+    xtensa/config/core-matmap.h
 tar -xf "$OVERLAY" -O gdb/xtensa-config.c | \
     sed -n '1,/*\//p;/XTREG/,/XTREG_END/p' > "$TARGET"/gdb-config.inc.c
 #
@@ -44,6 +45,7 @@ cat <<EOF > "${TARGET}.c"
 #include "qemu/host-utils.h"
 
 #include "core-$NAME/core-isa.h"
+#include "core-$NAME/core-matmap.h"
 #include "overlay_tool.h"
 
 #define xtensa_modules xtensa_modules_$NAME
diff --git a/target/xtensa/overlay_tool.h b/target/xtensa/overlay_tool.h
index f0cc33adfe05..cab532095c9e 100644
--- a/target/xtensa/overlay_tool.h
+++ b/target/xtensa/overlay_tool.h
@@ -373,15 +373,28 @@
 #elif XCHAL_HAVE_MPU
 
 #ifndef XTENSA_MPU_BG_MAP
+#ifdef XCHAL_MPU_BACKGROUND_MAP
+#define XCHAL_MPU_BGMAP(s, vaddr_start, vaddr_last, rights, memtype, x...) \
+    { .vaddr = (vaddr_start), .attr = ((rights) << 8) | ((memtype) << 12), },
+
+#define XTENSA_MPU_BG_MAP (xtensa_mpu_entry []){\
+    XCHAL_MPU_BACKGROUND_MAP(0) \
+}
+
+#define XTENSA_MPU_BG_MAP_ENTRIES XCHAL_MPU_BACKGROUND_ENTRIES
+#else
 #define XTENSA_MPU_BG_MAP (xtensa_mpu_entry []){\
     { .vaddr = 0, .attr = 0x00006700, }, \
 }
+
+#define XTENSA_MPU_BG_MAP_ENTRIES 1
+#endif
 #endif
 
 #define TLB_SECTION \
     .mpu_align = XCHAL_MPU_ALIGN, \
     .n_mpu_fg_segments = XCHAL_MPU_ENTRIES, \
-    .n_mpu_bg_segments = 1, \
+    .n_mpu_bg_segments = XTENSA_MPU_BG_MAP_ENTRIES, \
     .mpu_bg = XTENSA_MPU_BG_MAP
 
 #ifndef XCHAL_SYSROM0_PADDR
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-12 23:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-12 23:23 [PATCH 0/2] target/xtensa: use background MPU map from overlay Max Filippov
2019-12-12 23:23 ` [PATCH 1/2] target/xtensa: import xtensa/config/core-isa.h Max Filippov
2019-12-12 23:23 ` [PATCH 2/2] target/xtensa: use MPU background map from core configuration Max Filippov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).