Some cleanup patches
cover Some cleanup patches
This patch series should be applied on top of Janosch's patch series ([kvm-unit-tests PATCH v2 1/7] s390x: Cleanup flat.lds).
Marc Hartmayer (9):
.gitignore: ignore s390x/comm.key file s390x/Makefile: simplify %.hdr target rules s390x/Makefile: fix *.gbin target dependencies s390x/Makefile: refactor CPPFLAGS s390x/Makefile: remove unused include path
s390x: define a macro for the stack frame size
s390x: use C pre-processor for linker script generation
s390x: use STACK_FRAME_SIZE macro in linker scripts lib/linux/const.h: test for __ASSEMBLER__ as well
.gitignore | 2 ++
lib/linux/const.h | 2 +-
lib/s390x/asm-offsets.c | 1 +
s390x/Makefile | 20 +++++++++++---------
s390x/cstart64.S | 2 +-
s390x/{flat.lds => flat.lds.S} | 4 +++-
s390x/snippets/asm/{flat.lds => flat.lds.S} | 0
s390x/snippets/c/{flat.lds => flat.lds.S} | 6 ++++--
8 files changed, 23 insertions(+), 14 deletions(-)
rename s390x/{flat.lds => flat.lds.S} (93%)
rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%)
rename s390x/snippets/c/{flat.lds => flat.lds.S} (88%)Signature · 1 line
2.34.1
PATCH 1/9 .gitignore: ignore `s390x/comm.key` file
Ignore the Secure Execution Customer Communication Key file.
--- .gitignore | 1 + 1 file changed, 1 insertion(+)
.gitignore +1 -0
@@ -28,5 +28,6 @@ cscope.* /s390x/*.bin /s390x/snippets/*/*.gbin /efi-tests/* +/s390x/comm.key /s390x/snippets/*/*.hdr /s390x/snippets/*/*.*obj
Signature · 1 line
2.34.1
Re: [kvm-unit-tests PATCH 1/9] .gitignore: ignore `s390x/comm.key` file
Quoted 1 line · Marc Hartmayer
Ignore the Secure Execution Customer Communication Key file.
PATCH 2/9 s390x/Makefile: simplify `%.hdr` target rules
In reply to Marc HartmayerMerge the two Makefile target rules $(SNIPPET_DIR)/asm/%.hdr and $(SNIPPET_DIR)/c/%.hdr into one target rule.
--- s390x/Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
s390x/Makefile +1 -4
@@ -145,10 +145,7 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@ -$(SNIPPET_DIR)/asm/%.hdr: $(SNIPPET_DIR)/asm/%.gbin $(HOST_KEY_DOCUMENT) - $(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@ - -$(SNIPPET_DIR)/c/%.hdr: $(SNIPPET_DIR)/c/%.gbin $(HOST_KEY_DOCUMENT) +%.hdr: %.gbin $(HOST_KEY_DOCUMENT) $(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@ .SECONDARY:
Signature · 1 line
2.34.1
Re: [kvm-unit-tests PATCH 2/9] s390x/Makefile: simplify `%.hdr` target rules
Quoted 2 lines · Marc Hartmayer
Merge the two
Makefiletarget rules$(SNIPPET_DIR)/asm/%.hdrand$(SNIPPET_DIR)/c/%.hdrinto one target rule.
Should have thought of that myself after adding the linker script for assembly snippets...
Quoted 22 lines
Signed-off-by Marc Hartmayer <[email protected]>--- s390x/Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)s390x/Makefile +1
-4@@ -145,10 +145,7 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@ -$(SNIPPET_DIR)/asm/%.hdr: $(SNIPPET_DIR)/asm/%.gbin $(HOST_KEY_DOCUMENT) - $(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@ - -$(SNIPPET_DIR)/c/%.hdr: $(SNIPPET_DIR)/c/%.gbin $(HOST_KEY_DOCUMENT) +%.hdr: %.gbin $(HOST_KEY_DOCUMENT) $(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@ .SECONDARY:
PATCH 3/9 s390x/Makefile: fix `*.gbin` target dependencies
In reply to Marc HartmayerIf the linker scripts change, then the .gbin binaries must be rebuilt.
--- s390x/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
s390x/Makefile +2 -2
@@ -135,12 +135,12 @@ $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) $(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets) $(CC) $(CFLAGS) -c -nostdlib -o $@ $< -$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o +$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SRCDIR)/s390x/snippets/asm/flat.lds $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/asm/flat.lds $< $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@ -$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) +$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDIR)/s390x/snippets/c/flat.lds $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $< $(snippet_lib) $(FLATLIBS) $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@
Signature · 1 line
2.34.1
Re: [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies
Quoted 3 lines · On Mon, 16 Jan 2023 18:57:51 +0100 Marc Hartmayer <[email protected]>…
If the linker scripts change, then the .gbin binaries must be rebuilt.
Signed-off-by Marc Hartmayer <[email protected]>
I think this should be merged into the previous patch
Quoted 23 lines
--- s390x/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)s390x/Makefile +2
-2@@ -135,12 +135,12 @@ $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) $(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets) $(CC) $(CFLAGS) -c -nostdlib -o $@ $< -$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o +$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SRCDIR)/s390x/snippets/asm/flat.lds $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/asm/flat.lds $< $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@ -$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) +$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDIR)/s390x/snippets/c/flat.lds $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $< $(snippet_lib) $(FLATLIBS) $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@
Re: [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies
In reply to Marc HartmayerQuoted 12 lines · Marc Hartmayer
If the linker scripts change, then the .gbin binaries must be rebuilt.
Signed-off-by Marc Hartmayer <[email protected]>--- s390x/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)s390x/Makefile +0
-0
s390x/Makefile $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) · line 138
Quoted 5 lines
s390x/Makefile +1
-1@@ -135,12 +135,12 @@ $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) $(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets) $(CC) $(CFLAGS) -c -nostdlib -o $@ $< -$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o +$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SRCDIR)/s390x/snippets/asm/flat.lds
Any reason why you didn't use the shorter:
$(SNIPPET_DIR)/asm/flat.lds ?
Quoted 9 lines
s390x/Makefile +1
-1$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/asm/flat.lds $< $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@ -$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) +$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDIR)/s390x/snippets/c/flat.lds $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $< $(snippet_lib) $(FLATLIBS) $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@
Re: [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies
Quoted 16 lines · Janosch Frank
Quoted 15 lines · Marc Hartmayer
If the linker scripts change, then the .gbin binaries must be rebuilt.
Signed-off-by Marc Hartmayer <[email protected]>--- s390x/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)s390x/Makefile +0
-0@@ -135,12 +135,12 @@ $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) $(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets) $(CC) $(CFLAGS) -c -nostdlib -o $@ $<
Quoted 5 lines
s390x/Makefile $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) · line 138
Quoted 2 lines
s390x/Makefile +1
-1-$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o +$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SRCDIR)/s390x/snippets/asm/flat.ldsAny reason why you didn't use the shorter:
$(SNIPPET_DIR)/asm/flat.lds ?
No - it was just copied from the rule without thinking further :)
Quoted 12 lines
Quoted 11 lines
s390x/Makefile +1
-1$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/asm/flat.lds $< $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@ -$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) +$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDIR)/s390x/snippets/c/flat.lds $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $< $(snippet_lib) $(FLATLIBS) $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@
Signature · 8 lines
Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
PATCH 4/9 s390x/Makefile: refactor CPPFLAGS
In reply to Marc HartmayerThis change makes it easier to reuse them.
--- s390x/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
s390x/Makefile +4 -1
@@ -63,9 +63,12 @@ test_cases: $(tests) test_cases_binary: $(tests_binary) test_cases_pv: $(tests_pv_binary) +INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x lib +CPPFLAGS = $(addprefix -I,$(INCLUDE_PATHS)) + CFLAGS += -std=gnu99 CFLAGS += -ffreestanding -CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/s390x -I lib +CFLAGS += $(CPPFLAGS) CFLAGS += -O2 CFLAGS += -march=zEC12 CFLAGS += -mbackchain
Signature · 1 line
2.34.1
PATCH 5/9 s390x/Makefile: remove unused include path
In reply to Marc Hartmayerlib seems to be unused therefore let's remove it.
--- s390x/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/Makefile +1 -1
@@ -63,7 +63,7 @@ test_cases: $(tests) test_cases_binary: $(tests_binary) test_cases_pv: $(tests_pv_binary) -INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x lib +INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x CPPFLAGS = $(addprefix -I,$(INCLUDE_PATHS)) CFLAGS += -std=gnu99
Signature · 1 line
2.34.1
Re: [kvm-unit-tests PATCH 5/9] s390x/Makefile: remove unused include path
Quoted 3 lines · On Mon, 16 Jan 2023 18:57:53 +0100 Marc Hartmayer <[email protected]>…
libseems to be unused therefore let's remove it.Signed-off-by Marc Hartmayer <[email protected]>
this definitely needs to be merged into the previous patch
Quoted 17 lines
--- s390x/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)s390x/Makefile +1
-1@@ -63,7 +63,7 @@ test_cases: $(tests) test_cases_binary: $(tests_binary) test_cases_pv: $(tests_pv_binary) -INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x lib +INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x CPPFLAGS = $(addprefix -I,$(INCLUDE_PATHS)) CFLAGS += -std=gnu99
PATCH 6/9 s390x: define a macro for the stack frame size
In reply to Marc HartmayerDefine and use a macro for the stack frame size.
--- lib/s390x/asm-offsets.c | 1 + s390x/cstart64.S | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
lib/s390x/asm-offsets.c +1 -0
@@ -87,6 +87,7 @@ int main(void)OFFSET (STACK_FRAME_INT_GRS0 , stack_frame_int, grs0);OFFSET (STACK_FRAME_INT_GRS1 , stack_frame_int, grs1);DEFINE (STACK_FRAME_INT_SIZE ,sizeof (struct stack_frame_int )); +DEFINE (STACK_FRAME_SIZE ,sizeof (struct stack_frame ));return 0 ; }
s390x/cstart64.S +1 -1
@@ -38,7 +38,7 @@ start: /* setup stack */ larl %r15, stackptr /* Clear first stack frame */ - xc 0(160,%r15), 0(%r15) + xc 0(STACK_FRAME_SIZE,%r15), 0(%r15) /* setup initial PSW mask + control registers*/ larl %r1, initial_psw lpswe 0(%r1)
Signature · 1 line
2.34.1
Re: [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size
Quoted 1 line · Marc Hartmayer
Define and use a macro for the stack frame size.
There are two more instances in s390x/macros.S and there might be some in s390x/gs.c.
Quoted 12 lines
Signed-off-by Marc Hartmayer <[email protected]>--- lib/s390x/asm-offsets.c | 1 + s390x/cstart64.S | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)lib/s390x/asm-offsets.c +0
-0
lib/s390x/asm-offsets.c int main(void) · line 90
Quoted 4 lines
lib/s390x/asm-offsets.c +1
-0@@ -87,6 +87,7 @@ int main(void)OFFSET (STACK_FRAME_INT_GRS0 , stack_frame_int, grs0);OFFSET (STACK_FRAME_INT_GRS1 , stack_frame_int, grs1);DEFINE (STACK_FRAME_INT_SIZE ,sizeof (struct stack_frame_int )); +DEFINE (STACK_FRAME_SIZE ,sizeof (struct stack_frame ));
I'm wondering why we didn't do this when Pierre introduced the int stacks...
Quoted 16 lines
lib/s390x/asm-offsets.c +0
-0return 0 ; }s390x/cstart64.S +1
-1@@ -38,7 +38,7 @@ start: /* setup stack */ larl %r15, stackptr /* Clear first stack frame */ - xc 0(160,%r15), 0(%r15) + xc 0(STACK_FRAME_SIZE,%r15), 0(%r15) /* setup initial PSW mask + control registers*/ larl %r1, initial_psw lpswe 0(%r1)
Re: [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size
Quoted 5 lines · Janosch Frank
Quoted 1 line · Marc Hartmayer
Define and use a macro for the stack frame size.
There are two more instances in
s390x/macros.Sand there might be some ins390x/gs.c.
Thanks, will change them.
Quoted 37 lines
Quoted 13 lines
Signed-off-by Marc Hartmayer <[email protected]>--- lib/s390x/asm-offsets.c | 1 + s390x/cstart64.S | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)lib/s390x/asm-offsets.c +0
-0lib/s390x/asm-offsets.c int main(void) · line 90
Quoted 4 lines
lib/s390x/asm-offsets.c +1
-0@@ -87,6 +87,7 @@ int main(void)OFFSET (STACK_FRAME_INT_GRS0 , stack_frame_int, grs0);OFFSET (STACK_FRAME_INT_GRS1 , stack_frame_int, grs1);DEFINE (STACK_FRAME_INT_SIZE ,sizeof (struct stack_frame_int )); +DEFINE (STACK_FRAME_SIZE ,sizeof (struct stack_frame ));I'm wondering why we didn't do this when Pierre introduced the int stacks...
Quoted 16 lines
lib/s390x/asm-offsets.c +0
-0return 0 ; }s390x/cstart64.S +1
-1@@ -38,7 +38,7 @@ start: /* setup stack */ larl %r15, stackptr /* Clear first stack frame */ - xc 0(160,%r15), 0(%r15) + xc 0(STACK_FRAME_SIZE,%r15), 0(%r15) /* setup initial PSW mask + control registers*/ larl %r1, initial_psw lpswe 0(%r1)
Signature · 8 lines
Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
PATCH 7/9 s390x: use C pre-processor for linker script generation
In reply to Marc HartmayerUse the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts" *.lds.S.
---
.gitignore | 1 +
s390x/Makefile | 6 ++++--
s390x/{flat.lds => flat.lds.S} | 0
s390x/snippets/asm/{flat.lds => flat.lds.S} | 0
s390x/snippets/c/{flat.lds => flat.lds.S} | 0
5 files changed, 5 insertions(+), 2 deletions(-)
rename s390x/{flat.lds => flat.lds.S} (100%)
rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%)
rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%).gitignore +1 -0
@@ -31,3 +31,4 @@ cscope.* /s390x/comm.key /s390x/snippets/*/*.hdr /s390x/snippets/*/*.*obj +/s390x/**/*.lds
s390x/Makefile +4 -2
@@ -76,7 +76,7 @@ CFLAGS += -fno-delete-null-pointer-checks LDFLAGS += -nostdlib -Wl,--build-id=none # We want to keep intermediate files -.PRECIOUS: %.o +.PRECIOUS: %.o %.lds asm-offsets = lib/$(ARCH)/asm-offsets.h include $(SRCDIR)/scripts/asm-offsets.mak
@@ -159,6 +159,8 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDI %.hdr.obj: %.hdr $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ +%.lds: %.lds.S + $(CPP) $(autodepend-flags) $(CPPFLAGS) -P -C -o $@ $< .SECONDEXPANSION: %.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o
@@ -211,7 +213,7 @@ $(snippet_asmlib): $$(patsubst %.o,%.S,$$@) $(asm-offsets) arch_clean: asm_offsets_clean - $(RM) $(TEST_DIR)/*.{o,elf,bin} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) + $(RM) $(TEST_DIR)/*.{o,elf,bin,lds} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr,lds} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) generated-files = $(asm-offsets) $(tests:.elf=.o) $(asmlib) $(cflatobjs): $(generated-files)
s390x/flat.lds.S renamed from s390x/flat.lds +0 -0
s390x/snippets/asm/flat.lds.S renamed from s390x/snippets/asm/flat.lds +0 -0
s390x/snippets/c/flat.lds.S renamed from s390x/snippets/c/flat.lds +0 -0
Signature · 1 line
2.34.1
Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
Quoted 2 lines · On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <[email protected]>…
Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts"
*.lds.S.
please explain that the original .lds scripts are being renamed to .lds.S, and that the .lds are now generated.
Quoted 18 lines
Signed-off-by Marc Hartmayer <[email protected]>--- .gitignore | 1 + s390x/Makefile | 6 ++++-- s390x/{flat.lds => flat.lds.S} | 0 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 s390x/snippets/c/{flat.lds => flat.lds.S} | 0 5 files changed, 5 insertions(+), 2 deletions(-) rename s390x/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%).gitignore +0
-0
.gitignore cscope.* · line 34
Quoted 4 lines
.gitignore +1
-0@@ -31,3 +31,4 @@ cscope.* /s390x/comm.key /s390x/snippets/*/*.hdr /s390x/snippets/*/*.*obj +/s390x/**/*.lds
why ** ?
Quoted 43 lines
s390x/Makefile +4
-2@@ -76,7 +76,7 @@ CFLAGS += -fno-delete-null-pointer-checks LDFLAGS += -nostdlib -Wl,--build-id=none # We want to keep intermediate files -.PRECIOUS: %.o +.PRECIOUS: %.o %.lds asm-offsets = lib/$(ARCH)/asm-offsets.h include $(SRCDIR)/scripts/asm-offsets.mak@@ -159,6 +159,8 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDI %.hdr.obj: %.hdr $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ +%.lds: %.lds.S + $(CPP) $(autodepend-flags) $(CPPFLAGS) -P -C -o $@ $< .SECONDEXPANSION: %.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o@@ -211,7 +213,7 @@ $(snippet_asmlib): $$(patsubst %.o,%.S,$$@) $(asm-offsets) arch_clean: asm_offsets_clean - $(RM) $(TEST_DIR)/*.{o,elf,bin} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) + $(RM) $(TEST_DIR)/*.{o,elf,bin,lds} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr,lds} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) generated-files = $(asm-offsets) $(tests:.elf=.o) $(asmlib) $(cflatobjs): $(generated-files)s390x/flat.lds.S renamed from s390x/flat.lds +0
-0s390x/snippets/asm/flat.lds.S renamed from s390x/snippets/asm/flat.lds +0
-0s390x/snippets/c/flat.lds.S renamed from s390x/snippets/c/flat.lds +0
-0
Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
Quoted 8 lines · Claudio Imbrenda
Quoted 2 lines · On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <[email protected]>…
Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts"
*.lds.S.please explain that the original .lds scripts are being renamed to
.lds.S, and that the .lds are now generated.
Okay.
Quoted 14 lines
Quoted 14 lines
Signed-off-by Marc Hartmayer <[email protected]>--- .gitignore | 1 + s390x/Makefile | 6 ++++-- s390x/{flat.lds => flat.lds.S} | 0 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 s390x/snippets/c/{flat.lds => flat.lds.S} | 0 5 files changed, 5 insertions(+), 2 deletions(-) rename s390x/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)
Quoted 11 lines
.gitignore cscope.* · line 34
Quoted 9 lines
.gitignore +1
-0@@ -31,3 +31,4 @@ cscope.* /s390x/comm.key /s390x/snippets/*/*.hdr /s390x/snippets/*/*.*obj +/s390x/**/*.ldswhy ** ?
Because all of our linker scripts are generated now:
s390x/snippets/(c|asm)/*.lds
and
s390x/*.lds
[…snip]
Signature · 8 lines
Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
Quoted 41 lines · On Tue, 17 Jan 2023 10:43:01 +0100 Marc Hartmayer <[email protected]>…
Quoted 8 lines · Claudio Imbrenda
Quoted 2 lines · On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <[email protected]>…
Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts"
*.lds.S.please explain that the original .lds scripts are being renamed to
.lds.S, and that the .lds are now generated.Okay.
Quoted 14 lines
Quoted 14 lines
Signed-off-by Marc Hartmayer <[email protected]>--- .gitignore | 1 + s390x/Makefile | 6 ++++-- s390x/{flat.lds => flat.lds.S} | 0 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 s390x/snippets/c/{flat.lds => flat.lds.S} | 0 5 files changed, 5 insertions(+), 2 deletions(-) rename s390x/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)Quoted 11 lines
.gitignore cscope.* · line 34
Quoted 9 lines
.gitignore +1
-0@@ -31,3 +31,4 @@ cscope.* /s390x/comm.key /s390x/snippets/*/*.hdr /s390x/snippets/*/*.*obj +/s390x/**/*.ldswhy ** ?
Because all of our linker scripts are generated now:
Quoted 8 lines
s390x/snippets/(c|asm)/*.lds
and
s390x/*.lds
[…snip]
I still don't understand why ** instead of just * ?
Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
Quoted 46 lines · Claudio Imbrenda
Quoted 43 lines · On Tue, 17 Jan 2023 10:43:01 +0100 Marc Hartmayer <[email protected]>…
Quoted 8 lines · Claudio Imbrenda
Quoted 2 lines · On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <[email protected]>…
Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts"
*.lds.S.please explain that the original .lds scripts are being renamed to
.lds.S, and that the .lds are now generated.Okay.
Quoted 14 lines
Quoted 14 lines
Signed-off-by Marc Hartmayer <[email protected]>--- .gitignore | 1 + s390x/Makefile | 6 ++++-- s390x/{flat.lds => flat.lds.S} | 0 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 s390x/snippets/c/{flat.lds => flat.lds.S} | 0 5 files changed, 5 insertions(+), 2 deletions(-) rename s390x/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)Quoted 11 lines
.gitignore cscope.* · line 34
Quoted 9 lines
.gitignore +1
-0@@ -31,3 +31,4 @@ cscope.* /s390x/comm.key /s390x/snippets/*/*.hdr /s390x/snippets/*/*.*obj +/s390x/**/*.ldswhy ** ?
Because all of our linker scripts are generated now:
s390x/snippets/(c|asm)/*.lds
Quoted 8 lines
Quoted 6 lines
and
s390x/*.lds
[…snip]
I still don't understand why ** instead of just * ?
“A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.” [1]
[1] https://git-scm.com/docs/gitignore
Signature · 8 lines
Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
In reply to Marc HartmayerQuoted 41 lines · On Tue, 17 Jan 2023 10:43:01 +0100 Marc Hartmayer <[email protected]>…
Quoted 8 lines · Claudio Imbrenda
Quoted 2 lines · On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <[email protected]>…
Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts"
*.lds.S.please explain that the original .lds scripts are being renamed to
.lds.S, and that the .lds are now generated.Okay.
Quoted 14 lines
Quoted 14 lines
Signed-off-by Marc Hartmayer <[email protected]>--- .gitignore | 1 + s390x/Makefile | 6 ++++-- s390x/{flat.lds => flat.lds.S} | 0 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 s390x/snippets/c/{flat.lds => flat.lds.S} | 0 5 files changed, 5 insertions(+), 2 deletions(-) rename s390x/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)Quoted 11 lines
.gitignore cscope.* · line 34
Quoted 9 lines
.gitignore +1
-0@@ -31,3 +31,4 @@ cscope.* /s390x/comm.key /s390x/snippets/*/*.hdr /s390x/snippets/*/*.*obj +/s390x/**/*.ldswhy ** ?
Because all of our linker scripts are generated now:
Quoted 8 lines
s390x/snippets/(c|asm)/*.lds
and
s390x/*.lds
[…snip]
ok so I thought ** was a typo and you meant either * or */*, but it turns out ** is actual a special glob syntax in gitignore
ignore my comments regarding ** :)
PATCH 8/9 s390x: use STACK_FRAME_SIZE macro in linker scripts
In reply to Marc HartmayerUse the STACK_FRAME_SIZE macro instead of a hard-coded value of 160.
--- s390x/flat.lds.S | 4 +++- s390x/snippets/c/flat.lds.S | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-)
s390x/flat.lds.S +3 -1
@@ -1,3 +1,5 @@ +#include <asm/asm-offsets.h> + SECTIONS { .lowcore : {
@@ -44,6 +46,6 @@ SECTIONS /* * stackptr set with initial stack frame preallocated */ - stackptr = . - 160; + stackptr = . - STACK_FRAME_SIZE; stacktop = .; }
s390x/snippets/c/flat.lds.S +4 -2
@@ -1,3 +1,5 @@ +#include <asm/asm-offsets.h> + SECTIONS { .lowcore : {
@@ -18,9 +20,9 @@ SECTIONS . = 0x4000; /* * The stack grows down from 0x4000 to 0x2000, we pre-allocoate - * a frame via the -160. + * a frame via the -STACK_FRAME_SIZE. */ - stackptr = . - 160; + stackptr = . - STACK_FRAME_SIZE; stacktop = .; /* Start text 0x4000 */ .text : {
Signature · 1 line
2.34.1
Re: [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts
Quoted 3 lines · On Mon, 16 Jan 2023 18:57:56 +0100 Marc Hartmayer <[email protected]>…
Use the
STACK_FRAME_SIZEmacro instead of a hard-coded value of 160.Signed-off-by Marc Hartmayer <[email protected]>
merge patch 6 into this one
Quoted 45 lines
--- s390x/flat.lds.S | 4 +++- s390x/snippets/c/flat.lds.S | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-)s390x/flat.lds.S +3
-1@@ -1,3 +1,5 @@ +#include <asm/asm-offsets.h> + SECTIONS { .lowcore : {@@ -44,6 +46,6 @@ SECTIONS /* * stackptr set with initial stack frame preallocated */ - stackptr = . - 160; + stackptr = . - STACK_FRAME_SIZE; stacktop = .; }s390x/snippets/c/flat.lds.S +4
-2@@ -1,3 +1,5 @@ +#include <asm/asm-offsets.h> + SECTIONS { .lowcore : {@@ -18,9 +20,9 @@ SECTIONS . = 0x4000; /* * The stack grows down from 0x4000 to 0x2000, we pre-allocoate - * a frame via the -160. + * a frame via the -STACK_FRAME_SIZE. */ - stackptr = . - 160; + stackptr = . - STACK_FRAME_SIZE; stacktop = .; /* Start text 0x4000 */ .text : {
Re: [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts
In reply to Marc HartmayerQuoted 19 lines · Marc Hartmayer
Use the
STACK_FRAME_SIZEmacro instead of a hard-coded value of 160.Signed-off-by Marc Hartmayer <[email protected]>--- s390x/flat.lds.S | 4 +++- s390x/snippets/c/flat.lds.S | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-)s390x/flat.lds.S +2
-0@@ -1,3 +1,5 @@ +#include <asm/asm-offsets.h> + SECTIONS { .lowcore : {
s390x/flat.lds.S SECTIONS · line 49
Quoted 5 lines
s390x/flat.lds.S +1
-1@@ -44,6 +46,6 @@ SECTIONS /* * stackptr set with initial stack frame preallocated */ - stackptr = . - 160; + stackptr = . - STACK_FRAME_SIZE;
One small fix: After this change the ‘$(asm-offsets)‘ dependency has to be added to to %.lds target rule in the Makefile.
[…snip]
Signature · 8 lines
Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
PATCH 9/9 lib/linux/const.h: test for `__ASSEMBLER__` as well
In reply to Marc HartmayerThe macro __ASSEMBLER__ is defined with value 1 when preprocessing assembly language using gcc. [1] For s390x, we're using the preprocessor for generating our linker scripts out of assembly file and therefore we need this change.
[1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
--- lib/linux/const.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/linux/const.h +1 -1
@@ -12,7 +12,7 @@* leave it unchanged in asm. */ -#ifdef __ASSEMBLY__ +#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)#define _AC (X ,Y ) X#define _AT (T ,X ) X#else
Signature · 1 line
2.34.1
Re: [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well
Quoted 8 lines · On Mon, 16 Jan 2023 18:57:57 +0100 Marc Hartmayer <[email protected]>…
The macro
__ASSEMBLER__is defined with value 1 when preprocessing assembly language using gcc. [1] For s390x, we're using the preprocessor for generating our linker scripts out of assembly file and therefore we need this change.[1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
Signed-off-by Marc Hartmayer <[email protected]>
is this patch really needed? if so, why is it at the end of the series?
Quoted 17 lines
--- lib/linux/const.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/linux/const.h +1
-1@@ -12,7 +12,7 @@* leave it unchanged in asm. */ -#ifdef __ASSEMBLY__ +#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)#define _AC (X ,Y ) X#define _AT (T ,X ) X#else
Re: [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well
Quoted 8 lines · Claudio Imbrenda
Quoted 5 lines · On Mon, 16 Jan 2023 18:57:57 +0100 Marc Hartmayer <[email protected]>…
The macro
__ASSEMBLER__is defined with value 1 when preprocessing assembly language using gcc. [1] For s390x, we're using the preprocessor for generating our linker scripts out of assembly file and therefore we need this change.
Quoted 6 lines
Quoted 3 lines
[1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
Signed-off-by Marc Hartmayer <[email protected]>is this patch really needed? if so, why is it at the end of the series?
It was needed for some other patches… and for upcoming patches it is (probably) required since otherwise we cannot use macros using the _AC macro. So yep, it could be removed for now - and this was exactly the reason why I put it at the end of the series.
Thanks for the feedback!
Quoted 19 lines
Quoted 18 lines
--- lib/linux/const.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/linux/const.h +1
-1@@ -12,7 +12,7 @@* leave it unchanged in asm. */ -#ifdef __ASSEMBLY__ +#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)#define _AC (X ,Y ) X#define _AT (T ,X ) X#else
Signature · 8 lines
Kind regards / Beste Grüße Marc Hartmayer IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
Re: [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well
Quoted 17 lines · On Tue, 17 Jan 2023 10:39:58 +0100 Marc Hartmayer <[email protected]>…
Quoted 8 lines · Claudio Imbrenda
Quoted 5 lines · On Mon, 16 Jan 2023 18:57:57 +0100 Marc Hartmayer <[email protected]>…
The macro
__ASSEMBLER__is defined with value 1 when preprocessing assembly language using gcc. [1] For s390x, we're using the preprocessor for generating our linker scripts out of assembly file and therefore we need this change.Quoted 6 lines
Quoted 3 lines
[1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html
Signed-off-by Marc Hartmayer <[email protected]>is this patch really needed? if so, why is it at the end of the series?
Quoted 6 lines
It was needed for some other patches… and for upcoming patches it is (probably) required since otherwise we cannot use macros using the
_ACmacro. So yep, it could be removed for now - and this was exactly the reason why I put it at the end of the series.Thanks for the feedback!
I don't see a problem adding this even if it's not used right now, but in that case I want to know why you want to add it now :)
Just explain clearly in the patch description that this will be useful in the future and why :)
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
--- lib/linux/const.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/linux/const.h +1
-1@@ -12,7 +12,7 @@* leave it unchanged in asm. */ -#ifdef __ASSEMBLY__ +#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)#define _AC (X ,Y ) X#define _AT (T ,X ) X#else