Skip to contentSkip to conversation

target/xtensa: improvements for core-specific files

PATCH In review Max Filippov 3 participants 10 messages Mar 22, 2018 – Mar 23, 2018

lore
Share & tools
lore
#0 lore raw

cover target/xtensa: improvements for core-specific files

Hello,

this series adds .inc. to the names of non-top level xtensa core-specific files and fixes script import_core.sh so that it does it automatically. It also adds a fixup to the script that changes #include <xtensa-isa.h> to #include "xtensa-isa.h".

Max Filippov (3):
target/xtensa: add .inc. to non-top level source file names target/xtensa/import_core.sh: fix names of non-top level files target/xtensa/import_core.sh: fix #include <xtensa-isa.h>

 target/xtensa/core-dc232b.c                                      | 4 ++--
 target/xtensa/core-dc232b/{gdb-config.c => gdb-config.inc.c}     | 0
 .../core-dc232b/{xtensa-modules.c => xtensa-modules.inc.c}       | 0
 target/xtensa/core-dc233c.c                                      | 4 ++--
 target/xtensa/core-dc233c/{gdb-config.c => gdb-config.inc.c}     | 0
 .../core-dc233c/{xtensa-modules.c => xtensa-modules.inc.c}       | 0
 target/xtensa/core-de212.c                                       | 4 ++--
 target/xtensa/core-de212/{gdb-config.c => gdb-config.inc.c}      | 0
 .../xtensa/core-de212/{xtensa-modules.c => xtensa-modules.inc.c} | 0
 target/xtensa/core-fsf.c                                         | 2 +-
 .../xtensa/core-fsf/{xtensa-modules.c => xtensa-modules.inc.c}   | 0
 target/xtensa/core-sample_controller.c                           | 4 ++--
 .../core-sample_controller/{gdb-config.c => gdb-config.inc.c}    | 0
 .../{xtensa-modules.c => xtensa-modules.inc.c}                   | 0
 target/xtensa/import_core.sh                                     | 9 +++++----
 15 files changed, 14 insertions(+), 13 deletions(-)
 rename target/xtensa/core-dc232b/{gdb-config.c => gdb-config.inc.c} (100%)
 rename target/xtensa/core-dc232b/{xtensa-modules.c => xtensa-modules.inc.c} (100%)
 rename target/xtensa/core-dc233c/{gdb-config.c => gdb-config.inc.c} (100%)
 rename target/xtensa/core-dc233c/{xtensa-modules.c => xtensa-modules.inc.c} (100%)
 rename target/xtensa/core-de212/{gdb-config.c => gdb-config.inc.c} (100%)
 rename target/xtensa/core-de212/{xtensa-modules.c => xtensa-modules.inc.c} (100%)
 rename target/xtensa/core-fsf/{xtensa-modules.c => xtensa-modules.inc.c} (100%)
 rename target/xtensa/core-sample_controller/{gdb-config.c => gdb-config.inc.c} (100%)
 rename target/xtensa/core-sample_controller/{xtensa-modules.c => xtensa-modules.inc.c} (100%)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 target/xtensa: add .inc. to non-top level source file names

Fix definitions of existing cores and core importing script.

---
 target/xtensa/core-dc232b.c                                           | 4 ++--
 target/xtensa/core-dc232b/{gdb-config.c => gdb-config.inc.c}          | 0
 target/xtensa/core-dc232b/{xtensa-modules.c => xtensa-modules.inc.c}  | 0
 target/xtensa/core-dc233c.c                                           | 4 ++--
 target/xtensa/core-dc233c/{gdb-config.c => gdb-config.inc.c}          | 0
 target/xtensa/core-dc233c/{xtensa-modules.c => xtensa-modules.inc.c}  | 0
 target/xtensa/core-de212.c                                            | 4 ++--
 target/xtensa/core-de212/{gdb-config.c => gdb-config.inc.c}           | 0
 target/xtensa/core-de212/{xtensa-modules.c => xtensa-modules.inc.c}   | 0
 target/xtensa/core-fsf.c                                              | 2 +-
 target/xtensa/core-fsf/{xtensa-modules.c => xtensa-modules.inc.c}     | 0
 target/xtensa/core-sample_controller.c                                | 4 ++--
 .../xtensa/core-sample_controller/{gdb-config.c => gdb-config.inc.c}  | 0
 .../core-sample_controller/{xtensa-modules.c => xtensa-modules.inc.c} | 0
 14 files changed, 9 insertions(+), 9 deletions(-)
 rename target/xtensa/core-dc232b/{gdb-config.c => gdb-config.inc.c} (100%)
 rename target/xtensa/core-dc232b/{xtensa-modules.c => xtensa-modules.inc.c} (100%)
 rename target/xtensa/core-dc233c/{gdb-config.c => gdb-config.inc.c} (100%)
 rename target/xtensa/core-dc233c/{xtensa-modules.c => xtensa-modules.inc.c} (100%)
 rename target/xtensa/core-de212/{gdb-config.c => gdb-config.inc.c} (100%)
 rename target/xtensa/core-de212/{xtensa-modules.c => xtensa-modules.inc.c} (100%)
 rename target/xtensa/core-fsf/{xtensa-modules.c => xtensa-modules.inc.c} (100%)
 rename target/xtensa/core-sample_controller/{gdb-config.c => gdb-config.inc.c} (100%)
 rename target/xtensa/core-sample_controller/{xtensa-modules.c => xtensa-modules.inc.c} (100%)
target/xtensa/core-dc232b.c +2 -2
index fe80582df465..aa07018af4e7 100644
@@ -35,7 +35,7 @@
 #include "overlay_tool.h"
 
 #define xtensa_modules xtensa_modules_dc232b
-#include "core-dc232b/xtensa-modules.c"
+#include "core-dc232b/xtensa-modules.inc.c"
 
 static XtensaConfig dc232b __attribute__((unused)) = {
     .name = "dc232b",
@@ -43,7 +43,7 @@ static XtensaConfig dc232b __attribute__((unused)) = {
         .num_regs = 120,
         .num_core_regs = 52,
         .reg = {
-#include "core-dc232b/gdb-config.c"
+#include "core-dc232b/gdb-config.inc.c"
         }
     },
     .isa_internal = &xtensa_modules,
target/xtensa/core-dc232b/gdb-config.inc.c renamed from target/xtensa/core-dc232b/gdb-config.c +0 -0
similarity index 100%
rename from target/xtensa/core-dc232b/gdb-config.c
rename to target/xtensa/core-dc232b/gdb-config.inc.c
target/xtensa/core-dc232b/xtensa-modules.inc.c renamed from target/xtensa/core-dc232b/xtensa-modules.c +0 -0
similarity index 100%
rename from target/xtensa/core-dc232b/xtensa-modules.c
rename to target/xtensa/core-dc232b/xtensa-modules.inc.c
target/xtensa/core-dc233c.c +2 -2
index 00301c28a2e8..8296e6fa109a 100644
@@ -36,7 +36,7 @@
 #include "overlay_tool.h"
 
 #define xtensa_modules xtensa_modules_dc233c
-#include "core-dc233c/xtensa-modules.c"
+#include "core-dc233c/xtensa-modules.inc.c"
 
 static XtensaConfig dc233c __attribute__((unused)) = {
     .name = "dc233c",
@@ -44,7 +44,7 @@ static XtensaConfig dc233c __attribute__((unused)) = {
         .num_regs = 121,
         .num_core_regs = 52,
         .reg = {
-#include "core-dc233c/gdb-config.c"
+#include "core-dc233c/gdb-config.inc.c"
         }
     },
     .isa_internal = &xtensa_modules,
target/xtensa/core-dc233c/gdb-config.inc.c renamed from target/xtensa/core-dc233c/gdb-config.c +0 -0
similarity index 100%
rename from target/xtensa/core-dc233c/gdb-config.c
rename to target/xtensa/core-dc233c/gdb-config.inc.c
target/xtensa/core-dc233c/xtensa-modules.inc.c renamed from target/xtensa/core-dc233c/xtensa-modules.c +0 -0
similarity index 100%
rename from target/xtensa/core-dc233c/xtensa-modules.c
rename to target/xtensa/core-dc233c/xtensa-modules.inc.c
target/xtensa/core-de212.c +2 -2
index 466a467f7fa0..53775a97fae0 100644
@@ -36,13 +36,13 @@
 #include "overlay_tool.h"
 
 #define xtensa_modules xtensa_modules_de212
-#include "core-de212/xtensa-modules.c"
+#include "core-de212/xtensa-modules.inc.c"
 
 static XtensaConfig de212 __attribute__((unused)) = {
     .name = "de212",
     .gdb_regmap = {
         .reg = {
-#include "core-de212/gdb-config.c"
+#include "core-de212/gdb-config.inc.c"
         }
     },
     .isa_internal = &xtensa_modules,
target/xtensa/core-de212/gdb-config.inc.c renamed from target/xtensa/core-de212/gdb-config.c +0 -0
similarity index 100%
rename from target/xtensa/core-de212/gdb-config.c
rename to target/xtensa/core-de212/gdb-config.inc.c
target/xtensa/core-de212/xtensa-modules.inc.c renamed from target/xtensa/core-de212/xtensa-modules.c +0 -0
similarity index 100%
rename from target/xtensa/core-de212/xtensa-modules.c
rename to target/xtensa/core-de212/xtensa-modules.inc.c
target/xtensa/core-fsf.c +1 -1
index f41de9a1aa05..01932bdc8b15 100644
@@ -36,7 +36,7 @@
 #include "overlay_tool.h"
 
 #define xtensa_modules xtensa_modules_fsf
-#include "core-fsf/xtensa-modules.c"
+#include "core-fsf/xtensa-modules.inc.c"
 
 static XtensaConfig fsf __attribute__((unused)) = {
     .name = "fsf",
target/xtensa/core-fsf/xtensa-modules.inc.c renamed from target/xtensa/core-fsf/xtensa-modules.c +0 -0
similarity index 100%
rename from target/xtensa/core-fsf/xtensa-modules.c
rename to target/xtensa/core-fsf/xtensa-modules.inc.c
target/xtensa/core-sample_controller.c +2 -2
index 879e853a9224..c622335ca5a2 100644
@@ -36,13 +36,13 @@
 #include "overlay_tool.h"
 
 #define xtensa_modules xtensa_modules_sample_controller
-#include "core-sample_controller/xtensa-modules.c"
+#include "core-sample_controller/xtensa-modules.inc.c"
 
 static XtensaConfig sample_controller __attribute__((unused)) = {
     .name = "sample_controller",
     .gdb_regmap = {
         .reg = {
-#include "core-sample_controller/gdb-config.c"
+#include "core-sample_controller/gdb-config.inc.c"
         }
     },
     .isa_internal = &xtensa_modules,
target/xtensa/core-sample_controller/gdb-config.inc.c renamed from target/xtensa/core-sample_controller/gdb-config.c +0 -0
similarity index 100%
rename from target/xtensa/core-sample_controller/gdb-config.c
rename to target/xtensa/core-sample_controller/gdb-config.inc.c
target/xtensa/core-sample_controller/xtensa-modules.inc.c renamed from target/xtensa/core-sample_controller/xtensa-modules.c +0 -0
similarity index 100%
rename from target/xtensa/core-sample_controller/xtensa-modules.c
rename to target/xtensa/core-sample_controller/xtensa-modules.inc.c
Signature · 1 line
2.11.0
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] target/xtensa: add .inc. to non-top level source file names

Quoted 1 line · Max Filippov

Fix definitions of existing cores and core importing script.

This mentions the script...

Quoted 18 lines
---
  target/xtensa/core-dc232b.c                                           | 4 ++--
  target/xtensa/core-dc232b/{gdb-config.c => gdb-config.inc.c}          | 0
  target/xtensa/core-dc232b/{xtensa-modules.c => xtensa-modules.inc.c}  | 0
  target/xtensa/core-dc233c.c                                           | 4 ++--
  target/xtensa/core-dc233c/{gdb-config.c => gdb-config.inc.c}          | 0
  target/xtensa/core-dc233c/{xtensa-modules.c => xtensa-modules.inc.c}  | 0
  target/xtensa/core-de212.c                                            | 4 ++--
  target/xtensa/core-de212/{gdb-config.c => gdb-config.inc.c}           | 0
  target/xtensa/core-de212/{xtensa-modules.c => xtensa-modules.inc.c}   | 0
  target/xtensa/core-fsf.c                                              | 2 +-
  target/xtensa/core-fsf/{xtensa-modules.c => xtensa-modules.inc.c}     | 0
  target/xtensa/core-sample_controller.c                                | 4 ++--
  .../xtensa/core-sample_controller/{gdb-config.c => gdb-config.inc.c}  | 0
  .../core-sample_controller/{xtensa-modules.c => xtensa-modules.inc.c} | 0
  14 files changed, 9 insertions(+), 9 deletions(-)

...but only touches .c files.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#3 lore raw

Re: [Qemu-devel] [PATCH 1/3] target/xtensa: add .inc. to non-top level source file names

Quoted 6 lines · Eric Blake
Quoted 2 lines · Max Filippov

Fix definitions of existing cores and core importing script.

This mentions the script...
...but only touches .c files.

Yeah, I initially did it in a single patch, but then split it into two. Will merge
them back as suggested.

Signature · 2 lines
Thanks.
-- Max
#4 lore raw

Re: [Qemu-devel] [PATCH 1/3] target/xtensa: add .inc. to non-top level source file names

Quoted 12 lines · Max Filippov
Quoted 6 lines · Eric Blake
Quoted 2 lines · Max Filippov

Fix definitions of existing cores and core importing script.

This mentions the script...
...but only touches .c files.

Yeah, I initially did it in a single patch, but then split it into two. Will merge
them back as suggested.

squashed with #2 (import_core.sh):

#5 lore raw

PATCH 2/3 target/xtensa/import_core.sh: fix names of non-top level files

In reply to Max Filippov

Add .inc. to the names of files imported from configuration overlay in the import_core.sh script to follow the rule of naming non-top level source files.

---
 target/xtensa/import_core.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
target/xtensa/import_core.sh +4 -4
index 32255eea9b1b..58a42987d853 100755
@@ -22,7 +22,7 @@ mkdir -p "$TARGET"
 tar -xf "$OVERLAY" -C "$TARGET" --strip-components=1 \
     --xform='s/core/core-isa/' config/core.h
 tar -xf "$OVERLAY" -O gdb/xtensa-config.c | \
-    sed -n '1,/*\//p;/XTREG/,/XTREG_END/p' > "$TARGET"/gdb-config.c
+    sed -n '1,/*\//p;/XTREG/,/XTREG_END/p' > "$TARGET"/gdb-config.inc.c
 #
 # Fix up known issues in the xtensa-modules.c
 #
@@ -33,7 +33,7 @@ tar -xf "$OVERLAY" -O binutils/xtensa-modules.c | \
         -e '/^uint32 \*bypass_entry(int i)/,/}/d' \
         -e '/^#include "ansidecl.h"/d' \
         -e '/^Slot_[a-zA-Z0-9_]\+_decode (const xtensa_insnbuf insn)/,/^}/s/^  return 0;$/  return XTENSA_UNDEFINED;/' \
-    > "$TARGET"/xtensa-modules.c
+    > "$TARGET"/xtensa-modules.inc.c
 
 cat <<EOF > "${TARGET}.c"
 #include "qemu/osdep.h"
@@ -47,13 +47,13 @@ cat <<EOF > "${TARGET}.c"
 #include "overlay_tool.h"
 
 #define xtensa_modules xtensa_modules_$NAME
-#include "core-$NAME/xtensa-modules.c"
+#include "core-$NAME/xtensa-modules.inc.c"
 
 static XtensaConfig $NAME __attribute__((unused)) = {
     .name = "$NAME",
     .gdb_regmap = {
         .reg = {
-#include "core-$NAME/gdb-config.c"
+#include "core-$NAME/gdb-config.inc.c"
         }
     },
     .isa_internal = &xtensa_modules,
Signature · 1 line
2.11.0
#6 lore raw

Re: [Qemu-devel] [PATCH 2/3] target/xtensa/import_core.sh: fix names of non-top level files

Quoted 8 lines · Max Filippov

Add .inc. to the names of files imported from configuration overlay in the import_core.sh script to follow the rule of naming non-top level source files.

---
  target/xtensa/import_core.sh | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)

I'd squash this with 1/3 (otherwise, you have a one patch gap where the generator doesn't match the current tree contents, which may confuse someone doing a bisect).

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#7 lore raw

PATCH 3/3 target/xtensa/import_core.sh: fix #include <xtensa-isa.h>

In reply to Max Filippov

Change #include <xtensa-isa.h> to #include "xtensa-isa.h" in imported files to make references to local files consistent.

---
 target/xtensa/import_core.sh | 1 +
 1 file changed, 1 insertion(+)
target/xtensa/import_core.sh +1 -0
index 58a42987d853..af6c6104792d 100755
@@ -33,6 +33,7 @@ tar -xf "$OVERLAY" -O binutils/xtensa-modules.c | \
         -e '/^uint32 \*bypass_entry(int i)/,/}/d' \
         -e '/^#include "ansidecl.h"/d' \
         -e '/^Slot_[a-zA-Z0-9_]\+_decode (const xtensa_insnbuf insn)/,/^}/s/^  return 0;$/  return XTENSA_UNDEFINED;/' \
+        -e 's/#include <xtensa-isa.h>/#include "xtensa-isa.h"/' \
     > "$TARGET"/xtensa-modules.inc.c
 
 cat <<EOF > "${TARGET}.c"
Signature · 1 line
2.11.0
Reviewed-by on v1 3/3
#8 lore raw

Re: [Qemu-devel] [PATCH 3/3] target/xtensa/import_core.sh: fix #include <xtensa-isa.h>

Quoted 4 lines · Max Filippov

Change #include <xtensa-isa.h> to #include "xtensa-isa.h" in imported files to make references to local files consistent.

Quoted 17 lines
---
 target/xtensa/import_core.sh | 1 +
 1 file changed, 1 insertion(+)
target/xtensa/import_core.sh +1 -0
index 58a42987d853..af6c6104792d 100755
@@ -33,6 +33,7 @@ tar -xf "$OVERLAY" -O binutils/xtensa-modules.c | \
         -e '/^uint32 \*bypass_entry(int i)/,/}/d' \
         -e '/^#include "ansidecl.h"/d' \
         -e '/^Slot_[a-zA-Z0-9_]\+_decode (const xtensa_insnbuf insn)/,/^}/s/^  return 0;$/  return XTENSA_UNDEFINED;/' \
+        -e 's/#include <xtensa-isa.h>/#include "xtensa-isa.h"/' \
     > "$TARGET"/xtensa-modules.inc.c
 
 cat <<EOF > "${TARGET}.c"
Reviewed-by on the v1 series
#9 lore raw
In reply to Max Filippov
Quoted 11 lines · Max Filippov

Hello,

this series adds .inc. to the names of non-top level xtensa core-specific files and fixes script import_core.sh so that it does it automatically. It also adds a fixup to the script that changes #include <xtensa-isa.h> to #include "xtensa-isa.h".

Max Filippov (3):
target/xtensa: add .inc. to non-top level source file names target/xtensa/import_core.sh: fix names of non-top level files target/xtensa/import_core.sh: fix #include <xtensa-isa.h>

Simple enough. I don't know if it qualifies as a bug fix, so up to you as maintainer whether you feel comfortable enough getting it into 2.12. See my per-patch comments about possibly merging 1 and 2; but for the series,

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org