All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH 0/9] Some cleanup patches
@ 2023-01-16 17:57 Marc Hartmayer
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 1/9] .gitignore: ignore `s390x/comm.key` file Marc Hartmayer
                   ` (8 more replies)
  0 siblings, 9 replies; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-16 17:57 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

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%)

-- 
2.34.1


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

* [kvm-unit-tests PATCH 1/9] .gitignore: ignore `s390x/comm.key` file
  2023-01-16 17:57 [kvm-unit-tests PATCH 0/9] Some cleanup patches Marc Hartmayer
@ 2023-01-16 17:57 ` Marc Hartmayer
  2023-01-18  8:10   ` Janosch Frank
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 2/9] s390x/Makefile: simplify `%.hdr` target rules Marc Hartmayer
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-16 17:57 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

Ignore the Secure Execution Customer Communication Key file.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 33529b65a7e3..601822d67325 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,5 +28,6 @@ cscope.*
 /s390x/*.bin
 /s390x/snippets/*/*.gbin
 /efi-tests/*
+/s390x/comm.key
 /s390x/snippets/*/*.hdr
 /s390x/snippets/*/*.*obj
-- 
2.34.1


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

* [kvm-unit-tests PATCH 2/9] s390x/Makefile: simplify `%.hdr` target rules
  2023-01-16 17:57 [kvm-unit-tests PATCH 0/9] Some cleanup patches Marc Hartmayer
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 1/9] .gitignore: ignore `s390x/comm.key` file Marc Hartmayer
@ 2023-01-16 17:57 ` Marc Hartmayer
  2023-01-18  8:14   ` Janosch Frank
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies Marc Hartmayer
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-16 17:57 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

Merge the two Makefile target rules `$(SNIPPET_DIR)/asm/%.hdr` and
`$(SNIPPET_DIR)/c/%.hdr` into one target rule.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 s390x/Makefile | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/s390x/Makefile b/s390x/Makefile
index 97a616111680..660ff06f1e7c 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -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:
-- 
2.34.1


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

* [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies
  2023-01-16 17:57 [kvm-unit-tests PATCH 0/9] Some cleanup patches Marc Hartmayer
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 1/9] .gitignore: ignore `s390x/comm.key` file Marc Hartmayer
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 2/9] s390x/Makefile: simplify `%.hdr` target rules Marc Hartmayer
@ 2023-01-16 17:57 ` Marc Hartmayer
  2023-01-16 18:20   ` Claudio Imbrenda
  2023-01-18  8:19   ` Janosch Frank
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 4/9] s390x/Makefile: refactor CPPFLAGS Marc Hartmayer
                   ` (5 subsequent siblings)
  8 siblings, 2 replies; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-16 17:57 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

If the linker scripts change, then the .gbin binaries must be rebuilt.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 s390x/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/s390x/Makefile b/s390x/Makefile
index 660ff06f1e7c..b6bf2ed99afd 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -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' $@
-- 
2.34.1


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

* [kvm-unit-tests PATCH 4/9] s390x/Makefile: refactor CPPFLAGS
  2023-01-16 17:57 [kvm-unit-tests PATCH 0/9] Some cleanup patches Marc Hartmayer
                   ` (2 preceding siblings ...)
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies Marc Hartmayer
@ 2023-01-16 17:57 ` Marc Hartmayer
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 5/9] s390x/Makefile: remove unused include path Marc Hartmayer
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-16 17:57 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

This change makes it easier to reuse them.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 s390x/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/s390x/Makefile b/s390x/Makefile
index b6bf2ed99afd..032524373593 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -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
-- 
2.34.1


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

* [kvm-unit-tests PATCH 5/9] s390x/Makefile: remove unused include path
  2023-01-16 17:57 [kvm-unit-tests PATCH 0/9] Some cleanup patches Marc Hartmayer
                   ` (3 preceding siblings ...)
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 4/9] s390x/Makefile: refactor CPPFLAGS Marc Hartmayer
@ 2023-01-16 17:57 ` Marc Hartmayer
  2023-01-16 18:20   ` Claudio Imbrenda
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size Marc Hartmayer
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-16 17:57 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

`lib` seems to be unused therefore let's remove it.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 s390x/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/s390x/Makefile b/s390x/Makefile
index 032524373593..31f6db11213d 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -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
-- 
2.34.1


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

* [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size
  2023-01-16 17:57 [kvm-unit-tests PATCH 0/9] Some cleanup patches Marc Hartmayer
                   ` (4 preceding siblings ...)
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 5/9] s390x/Makefile: remove unused include path Marc Hartmayer
@ 2023-01-16 17:57 ` Marc Hartmayer
  2023-01-18  8:27   ` Janosch Frank
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation Marc Hartmayer
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-16 17:57 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

Define and use a macro for the stack frame size.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 lib/s390x/asm-offsets.c | 1 +
 s390x/cstart64.S        | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/s390x/asm-offsets.c b/lib/s390x/asm-offsets.c
index f612f3277a95..188dd2e51181 100644
--- a/lib/s390x/asm-offsets.c
+++ b/lib/s390x/asm-offsets.c
@@ -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;
 }
diff --git a/s390x/cstart64.S b/s390x/cstart64.S
index 6f83da2a6c0a..468ace3ea4df 100644
--- a/s390x/cstart64.S
+++ b/s390x/cstart64.S
@@ -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)
-- 
2.34.1


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

* [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
  2023-01-16 17:57 [kvm-unit-tests PATCH 0/9] Some cleanup patches Marc Hartmayer
                   ` (5 preceding siblings ...)
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size Marc Hartmayer
@ 2023-01-16 17:57 ` Marc Hartmayer
  2023-01-16 18:22   ` Claudio Imbrenda
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts Marc Hartmayer
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well Marc Hartmayer
  8 siblings, 1 reply; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-16 17:57 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

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`.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 .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%)

diff --git a/.gitignore b/.gitignore
index 601822d67325..29f352c5ceb6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,3 +31,4 @@ cscope.*
 /s390x/comm.key
 /s390x/snippets/*/*.hdr
 /s390x/snippets/*/*.*obj
+/s390x/**/*.lds
diff --git a/s390x/Makefile b/s390x/Makefile
index 31f6db11213d..45493160cdf8 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -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)
diff --git a/s390x/flat.lds b/s390x/flat.lds.S
similarity index 100%
rename from s390x/flat.lds
rename to s390x/flat.lds.S
diff --git a/s390x/snippets/asm/flat.lds b/s390x/snippets/asm/flat.lds.S
similarity index 100%
rename from s390x/snippets/asm/flat.lds
rename to s390x/snippets/asm/flat.lds.S
diff --git a/s390x/snippets/c/flat.lds b/s390x/snippets/c/flat.lds.S
similarity index 100%
rename from s390x/snippets/c/flat.lds
rename to s390x/snippets/c/flat.lds.S
-- 
2.34.1


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

* [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts
  2023-01-16 17:57 [kvm-unit-tests PATCH 0/9] Some cleanup patches Marc Hartmayer
                   ` (6 preceding siblings ...)
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation Marc Hartmayer
@ 2023-01-16 17:57 ` Marc Hartmayer
  2023-01-16 18:23   ` Claudio Imbrenda
  2023-01-18  9:10   ` Marc Hartmayer
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well Marc Hartmayer
  8 siblings, 2 replies; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-16 17:57 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

Use the `STACK_FRAME_SIZE` macro instead of a hard-coded value of 160.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 s390x/flat.lds.S            | 4 +++-
 s390x/snippets/c/flat.lds.S | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/s390x/flat.lds.S b/s390x/flat.lds.S
index 952f6cd457ed..0cb7e383cc76 100644
--- a/s390x/flat.lds.S
+++ b/s390x/flat.lds.S
@@ -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 = .;
 }
diff --git a/s390x/snippets/c/flat.lds.S b/s390x/snippets/c/flat.lds.S
index 9e5eb66bec23..468b5f1eebe8 100644
--- a/s390x/snippets/c/flat.lds.S
+++ b/s390x/snippets/c/flat.lds.S
@@ -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 : {
-- 
2.34.1


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

* [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well
  2023-01-16 17:57 [kvm-unit-tests PATCH 0/9] Some cleanup patches Marc Hartmayer
                   ` (7 preceding siblings ...)
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts Marc Hartmayer
@ 2023-01-16 17:57 ` Marc Hartmayer
  2023-01-16 18:25   ` Claudio Imbrenda
  8 siblings, 1 reply; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-16 17:57 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

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 <mhartmay@linux.ibm.com>
---
 lib/linux/const.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/linux/const.h b/lib/linux/const.h
index c872bfd25e13..be114dc4a553 100644
--- a/lib/linux/const.h
+++ b/lib/linux/const.h
@@ -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
-- 
2.34.1


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

* Re: [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies Marc Hartmayer
@ 2023-01-16 18:20   ` Claudio Imbrenda
  2023-01-18  8:19   ` Janosch Frank
  1 sibling, 0 replies; 28+ messages in thread
From: Claudio Imbrenda @ 2023-01-16 18:20 UTC (permalink / raw)
  To: Marc Hartmayer
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On Mon, 16 Jan 2023 18:57:51 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> If the linker scripts change, then the .gbin binaries must be rebuilt.
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>

I think this should be merged into the previous patch

> ---
>  s390x/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/s390x/Makefile b/s390x/Makefile
> index 660ff06f1e7c..b6bf2ed99afd 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -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' $@


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

* Re: [kvm-unit-tests PATCH 5/9] s390x/Makefile: remove unused include path
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 5/9] s390x/Makefile: remove unused include path Marc Hartmayer
@ 2023-01-16 18:20   ` Claudio Imbrenda
  0 siblings, 0 replies; 28+ messages in thread
From: Claudio Imbrenda @ 2023-01-16 18:20 UTC (permalink / raw)
  To: Marc Hartmayer
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On Mon, 16 Jan 2023 18:57:53 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> `lib` seems to be unused therefore let's remove it.
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>

this definitely needs to be merged into the previous patch

> ---
>  s390x/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/s390x/Makefile b/s390x/Makefile
> index 032524373593..31f6db11213d 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -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


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

* Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation Marc Hartmayer
@ 2023-01-16 18:22   ` Claudio Imbrenda
  2023-01-17  9:43     ` Marc Hartmayer
  0 siblings, 1 reply; 28+ messages in thread
From: Claudio Imbrenda @ 2023-01-16 18:22 UTC (permalink / raw)
  To: Marc Hartmayer
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On Mon, 16 Jan 2023 18:57:55 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> 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.

> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>  .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%)
> 
> diff --git a/.gitignore b/.gitignore
> index 601822d67325..29f352c5ceb6 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -31,3 +31,4 @@ cscope.*
>  /s390x/comm.key
>  /s390x/snippets/*/*.hdr
>  /s390x/snippets/*/*.*obj
> +/s390x/**/*.lds

why ** ?

> diff --git a/s390x/Makefile b/s390x/Makefile
> index 31f6db11213d..45493160cdf8 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -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)
> diff --git a/s390x/flat.lds b/s390x/flat.lds.S
> similarity index 100%
> rename from s390x/flat.lds
> rename to s390x/flat.lds.S
> diff --git a/s390x/snippets/asm/flat.lds b/s390x/snippets/asm/flat.lds.S
> similarity index 100%
> rename from s390x/snippets/asm/flat.lds
> rename to s390x/snippets/asm/flat.lds.S
> diff --git a/s390x/snippets/c/flat.lds b/s390x/snippets/c/flat.lds.S
> similarity index 100%
> rename from s390x/snippets/c/flat.lds
> rename to s390x/snippets/c/flat.lds.S


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

* Re: [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts Marc Hartmayer
@ 2023-01-16 18:23   ` Claudio Imbrenda
  2023-01-18  9:10   ` Marc Hartmayer
  1 sibling, 0 replies; 28+ messages in thread
From: Claudio Imbrenda @ 2023-01-16 18:23 UTC (permalink / raw)
  To: Marc Hartmayer
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On Mon, 16 Jan 2023 18:57:56 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> Use the `STACK_FRAME_SIZE` macro instead of a hard-coded value of 160.
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>

merge patch 6 into this one

> ---
>  s390x/flat.lds.S            | 4 +++-
>  s390x/snippets/c/flat.lds.S | 6 ++++--
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/s390x/flat.lds.S b/s390x/flat.lds.S
> index 952f6cd457ed..0cb7e383cc76 100644
> --- a/s390x/flat.lds.S
> +++ b/s390x/flat.lds.S
> @@ -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 = .;
>  }
> diff --git a/s390x/snippets/c/flat.lds.S b/s390x/snippets/c/flat.lds.S
> index 9e5eb66bec23..468b5f1eebe8 100644
> --- a/s390x/snippets/c/flat.lds.S
> +++ b/s390x/snippets/c/flat.lds.S
> @@ -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 : {


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

* Re: [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well Marc Hartmayer
@ 2023-01-16 18:25   ` Claudio Imbrenda
  2023-01-17  9:39     ` Marc Hartmayer
  0 siblings, 1 reply; 28+ messages in thread
From: Claudio Imbrenda @ 2023-01-16 18:25 UTC (permalink / raw)
  To: Marc Hartmayer
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On Mon, 16 Jan 2023 18:57:57 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> 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 <mhartmay@linux.ibm.com>

is this patch really needed? if so, why is it at the end of the series?

> ---
>  lib/linux/const.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/linux/const.h b/lib/linux/const.h
> index c872bfd25e13..be114dc4a553 100644
> --- a/lib/linux/const.h
> +++ b/lib/linux/const.h
> @@ -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


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

* Re: [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well
  2023-01-16 18:25   ` Claudio Imbrenda
@ 2023-01-17  9:39     ` Marc Hartmayer
  2023-01-17 10:28       ` Claudio Imbrenda
  0 siblings, 1 reply; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-17  9:39 UTC (permalink / raw)
  To: Claudio Imbrenda
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

Claudio Imbrenda <imbrenda@linux.ibm.com> writes:

> On Mon, 16 Jan 2023 18:57:57 +0100
> Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
>
>> 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 <mhartmay@linux.ibm.com>
>
> 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!

>
>> ---
>>  lib/linux/const.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/lib/linux/const.h b/lib/linux/const.h
>> index c872bfd25e13..be114dc4a553 100644
>> --- a/lib/linux/const.h
>> +++ b/lib/linux/const.h
>> @@ -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
>
-- 
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

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

* Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
  2023-01-16 18:22   ` Claudio Imbrenda
@ 2023-01-17  9:43     ` Marc Hartmayer
  2023-01-17 10:24       ` Claudio Imbrenda
  2023-01-17 11:21       ` Claudio Imbrenda
  0 siblings, 2 replies; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-17  9:43 UTC (permalink / raw)
  To: Claudio Imbrenda
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

Claudio Imbrenda <imbrenda@linux.ibm.com> writes:

> On Mon, 16 Jan 2023 18:57:55 +0100
> Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
>
>> 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.

>
>> 
>> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
>> ---
>>  .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%)
>> 
>> diff --git a/.gitignore b/.gitignore
>> index 601822d67325..29f352c5ceb6 100644
>> --- a/.gitignore
>> +++ b/.gitignore
>> @@ -31,3 +31,4 @@ cscope.*
>>  /s390x/comm.key
>>  /s390x/snippets/*/*.hdr
>>  /s390x/snippets/*/*.*obj
>> +/s390x/**/*.lds
>
> why ** ?

Because all of our linker scripts are generated now:

s390x/snippets/(c|asm)/*.lds

and

s390x/*.lds

[…snip]

-- 
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

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

* Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
  2023-01-17  9:43     ` Marc Hartmayer
@ 2023-01-17 10:24       ` Claudio Imbrenda
  2023-01-17 11:19         ` Marc Hartmayer
  2023-01-17 11:21       ` Claudio Imbrenda
  1 sibling, 1 reply; 28+ messages in thread
From: Claudio Imbrenda @ 2023-01-17 10:24 UTC (permalink / raw)
  To: Marc Hartmayer
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On Tue, 17 Jan 2023 10:43:01 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> Claudio Imbrenda <imbrenda@linux.ibm.com> writes:
> 
> > On Mon, 16 Jan 2023 18:57:55 +0100
> > Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
> >  
> >> 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.
> 
> >  
> >> 
> >> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> >> ---
> >>  .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%)
> >> 
> >> diff --git a/.gitignore b/.gitignore
> >> index 601822d67325..29f352c5ceb6 100644
> >> --- a/.gitignore
> >> +++ b/.gitignore
> >> @@ -31,3 +31,4 @@ cscope.*
> >>  /s390x/comm.key
> >>  /s390x/snippets/*/*.hdr
> >>  /s390x/snippets/*/*.*obj
> >> +/s390x/**/*.lds  
> >
> > why ** ?  
> 
> Because all of our linker scripts are generated now:
> 
> s390x/snippets/(c|asm)/*.lds
> 
> and
> 
> s390x/*.lds
> 
> […snip]
> 

I still don't understand why ** instead of just * ?

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

* Re: [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well
  2023-01-17  9:39     ` Marc Hartmayer
@ 2023-01-17 10:28       ` Claudio Imbrenda
  0 siblings, 0 replies; 28+ messages in thread
From: Claudio Imbrenda @ 2023-01-17 10:28 UTC (permalink / raw)
  To: Marc Hartmayer
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On Tue, 17 Jan 2023 10:39:58 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> Claudio Imbrenda <imbrenda@linux.ibm.com> writes:
> 
> > On Mon, 16 Jan 2023 18:57:57 +0100
> > Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
> >  
> >> 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 <mhartmay@linux.ibm.com>  
> >
> > 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!

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 :)

> 
> >  
> >> ---
> >>  lib/linux/const.h | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/lib/linux/const.h b/lib/linux/const.h
> >> index c872bfd25e13..be114dc4a553 100644
> >> --- a/lib/linux/const.h
> >> +++ b/lib/linux/const.h
> >> @@ -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  
> >  


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

* Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
  2023-01-17 10:24       ` Claudio Imbrenda
@ 2023-01-17 11:19         ` Marc Hartmayer
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-17 11:19 UTC (permalink / raw)
  To: Claudio Imbrenda
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

Claudio Imbrenda <imbrenda@linux.ibm.com> writes:

> On Tue, 17 Jan 2023 10:43:01 +0100
> Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
>
>> Claudio Imbrenda <imbrenda@linux.ibm.com> writes:
>> 
>> > On Mon, 16 Jan 2023 18:57:55 +0100
>> > Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
>> >  
>> >> 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.
>> 
>> >  
>> >> 
>> >> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
>> >> ---
>> >>  .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%)
>> >> 
>> >> diff --git a/.gitignore b/.gitignore
>> >> index 601822d67325..29f352c5ceb6 100644
>> >> --- a/.gitignore
>> >> +++ b/.gitignore
>> >> @@ -31,3 +31,4 @@ cscope.*
>> >>  /s390x/comm.key
>> >>  /s390x/snippets/*/*.hdr
>> >>  /s390x/snippets/*/*.*obj
>> >> +/s390x/**/*.lds  
>> >
>> > why ** ?  
>> 
>> Because all of our linker scripts are generated now:
>> 
>> s390x/snippets/(c|asm)/*.lds
>> 
>> 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

-- 
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

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

* Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation
  2023-01-17  9:43     ` Marc Hartmayer
  2023-01-17 10:24       ` Claudio Imbrenda
@ 2023-01-17 11:21       ` Claudio Imbrenda
  1 sibling, 0 replies; 28+ messages in thread
From: Claudio Imbrenda @ 2023-01-17 11:21 UTC (permalink / raw)
  To: Marc Hartmayer
  Cc: kvm, Janosch Frank, David Hildenbrand, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On Tue, 17 Jan 2023 10:43:01 +0100
Marc Hartmayer <mhartmay@linux.ibm.com> wrote:

> Claudio Imbrenda <imbrenda@linux.ibm.com> writes:
> 
> > On Mon, 16 Jan 2023 18:57:55 +0100
> > Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
> >  
> >> 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.
> 
> >  
> >> 
> >> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> >> ---
> >>  .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%)
> >> 
> >> diff --git a/.gitignore b/.gitignore
> >> index 601822d67325..29f352c5ceb6 100644
> >> --- a/.gitignore
> >> +++ b/.gitignore
> >> @@ -31,3 +31,4 @@ cscope.*
> >>  /s390x/comm.key
> >>  /s390x/snippets/*/*.hdr
> >>  /s390x/snippets/*/*.*obj
> >> +/s390x/**/*.lds  
> >
> > why ** ?  
> 
> Because all of our linker scripts are generated now:
> 
> 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 ** :)


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

* Re: [kvm-unit-tests PATCH 1/9] .gitignore: ignore `s390x/comm.key` file
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 1/9] .gitignore: ignore `s390x/comm.key` file Marc Hartmayer
@ 2023-01-18  8:10   ` Janosch Frank
  0 siblings, 0 replies; 28+ messages in thread
From: Janosch Frank @ 2023-01-18  8:10 UTC (permalink / raw)
  To: Marc Hartmayer, kvm
  Cc: David Hildenbrand, Claudio Imbrenda, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On 1/16/23 18:57, Marc Hartmayer wrote:
> Ignore the Secure Execution Customer Communication Key file.

Reviewed-by: Janosch Frank <frankja@linux.ibm.com>

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

* Re: [kvm-unit-tests PATCH 2/9] s390x/Makefile: simplify `%.hdr` target rules
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 2/9] s390x/Makefile: simplify `%.hdr` target rules Marc Hartmayer
@ 2023-01-18  8:14   ` Janosch Frank
  0 siblings, 0 replies; 28+ messages in thread
From: Janosch Frank @ 2023-01-18  8:14 UTC (permalink / raw)
  To: Marc Hartmayer, kvm
  Cc: David Hildenbrand, Claudio Imbrenda, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On 1/16/23 18:57, Marc Hartmayer wrote:
> Merge the two Makefile target rules `$(SNIPPET_DIR)/asm/%.hdr` and
> `$(SNIPPET_DIR)/c/%.hdr` into one target rule.

Should have thought of that myself after adding the linker script for 
assembly snippets...


Reviewed-by: Janosch Frank <frankja@linux.ibm.com>

> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>   s390x/Makefile | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/s390x/Makefile b/s390x/Makefile
> index 97a616111680..660ff06f1e7c 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -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:


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

* Re: [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies Marc Hartmayer
  2023-01-16 18:20   ` Claudio Imbrenda
@ 2023-01-18  8:19   ` Janosch Frank
  2023-01-18  8:37     ` Marc Hartmayer
  1 sibling, 1 reply; 28+ messages in thread
From: Janosch Frank @ 2023-01-18  8:19 UTC (permalink / raw)
  To: Marc Hartmayer, kvm
  Cc: David Hildenbrand, Claudio Imbrenda, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On 1/16/23 18:57, Marc Hartmayer wrote:
> If the linker scripts change, then the .gbin binaries must be rebuilt.
> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>   s390x/Makefile | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/s390x/Makefile b/s390x/Makefile
> index 660ff06f1e7c..b6bf2ed99afd 100644
> --- a/s390x/Makefile
> +++ b/s390x/Makefile
> @@ -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 ?


>   	$(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' $@


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

* Re: [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size Marc Hartmayer
@ 2023-01-18  8:27   ` Janosch Frank
  2023-01-18  9:04     ` Marc Hartmayer
  0 siblings, 1 reply; 28+ messages in thread
From: Janosch Frank @ 2023-01-18  8:27 UTC (permalink / raw)
  To: Marc Hartmayer, kvm
  Cc: David Hildenbrand, Claudio Imbrenda, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

On 1/16/23 18:57, Marc Hartmayer wrote:
> 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.

> 
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>   lib/s390x/asm-offsets.c | 1 +
>   s390x/cstart64.S        | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/asm-offsets.c b/lib/s390x/asm-offsets.c
> index f612f3277a95..188dd2e51181 100644
> --- a/lib/s390x/asm-offsets.c
> +++ b/lib/s390x/asm-offsets.c
> @@ -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...

>   
>   	return 0;
>   }
> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
> index 6f83da2a6c0a..468ace3ea4df 100644
> --- a/s390x/cstart64.S
> +++ b/s390x/cstart64.S
> @@ -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)


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

* Re: [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies
  2023-01-18  8:19   ` Janosch Frank
@ 2023-01-18  8:37     ` Marc Hartmayer
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-18  8:37 UTC (permalink / raw)
  To: Janosch Frank, kvm
  Cc: David Hildenbrand, Claudio Imbrenda, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

Janosch Frank <frankja@linux.ibm.com> writes:

> On 1/16/23 18:57, Marc Hartmayer wrote:
>> If the linker scripts change, then the .gbin binaries must be rebuilt.
>> 
>> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
>> ---
>>   s390x/Makefile | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/s390x/Makefile b/s390x/Makefile
>> index 660ff06f1e7c..b6bf2ed99afd 100644
>> --- a/s390x/Makefile
>> +++ b/s390x/Makefile
>> @@ -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 ?

No - it was just copied from the rule without thinking further :)

>
>
>>   	$(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' $@
>
-- 
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

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

* Re: [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size
  2023-01-18  8:27   ` Janosch Frank
@ 2023-01-18  9:04     ` Marc Hartmayer
  0 siblings, 0 replies; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-18  9:04 UTC (permalink / raw)
  To: Janosch Frank, kvm
  Cc: David Hildenbrand, Claudio Imbrenda, Nina Schoetterl-Glausch,
	Nico Boehr, Thomas Huth

Janosch Frank <frankja@linux.ibm.com> writes:

> On 1/16/23 18:57, Marc Hartmayer wrote:
>> 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.

Thanks, will change them.

>
>> 
>> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
>> ---
>>   lib/s390x/asm-offsets.c | 1 +
>>   s390x/cstart64.S        | 2 +-
>>   2 files changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/lib/s390x/asm-offsets.c b/lib/s390x/asm-offsets.c
>> index f612f3277a95..188dd2e51181 100644
>> --- a/lib/s390x/asm-offsets.c
>> +++ b/lib/s390x/asm-offsets.c
>> @@ -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...
>
>>   
>>   	return 0;
>>   }
>> diff --git a/s390x/cstart64.S b/s390x/cstart64.S
>> index 6f83da2a6c0a..468ace3ea4df 100644
>> --- a/s390x/cstart64.S
>> +++ b/s390x/cstart64.S
>> @@ -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)
>
-- 
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

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

* Re: [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts
  2023-01-16 17:57 ` [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts Marc Hartmayer
  2023-01-16 18:23   ` Claudio Imbrenda
@ 2023-01-18  9:10   ` Marc Hartmayer
  1 sibling, 0 replies; 28+ messages in thread
From: Marc Hartmayer @ 2023-01-18  9:10 UTC (permalink / raw)
  To: kvm
  Cc: Janosch Frank, David Hildenbrand, Claudio Imbrenda,
	Nina Schoetterl-Glausch, Nico Boehr, Thomas Huth

Marc Hartmayer <mhartmay@linux.ibm.com> writes:

> Use the `STACK_FRAME_SIZE` macro instead of a hard-coded value of 160.
>
> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> ---
>  s390x/flat.lds.S            | 4 +++-
>  s390x/snippets/c/flat.lds.S | 6 ++++--
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/s390x/flat.lds.S b/s390x/flat.lds.S
> index 952f6cd457ed..0cb7e383cc76 100644
> --- a/s390x/flat.lds.S
> +++ b/s390x/flat.lds.S
> @@ -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;

One small fix: After this change the ‘$(asm-offsets)‘ dependency has to
be added to to %.lds target rule in the Makefile.

[…snip]

-- 
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

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

end of thread, other threads:[~2023-01-18 10:05 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16 17:57 [kvm-unit-tests PATCH 0/9] Some cleanup patches Marc Hartmayer
2023-01-16 17:57 ` [kvm-unit-tests PATCH 1/9] .gitignore: ignore `s390x/comm.key` file Marc Hartmayer
2023-01-18  8:10   ` Janosch Frank
2023-01-16 17:57 ` [kvm-unit-tests PATCH 2/9] s390x/Makefile: simplify `%.hdr` target rules Marc Hartmayer
2023-01-18  8:14   ` Janosch Frank
2023-01-16 17:57 ` [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies Marc Hartmayer
2023-01-16 18:20   ` Claudio Imbrenda
2023-01-18  8:19   ` Janosch Frank
2023-01-18  8:37     ` Marc Hartmayer
2023-01-16 17:57 ` [kvm-unit-tests PATCH 4/9] s390x/Makefile: refactor CPPFLAGS Marc Hartmayer
2023-01-16 17:57 ` [kvm-unit-tests PATCH 5/9] s390x/Makefile: remove unused include path Marc Hartmayer
2023-01-16 18:20   ` Claudio Imbrenda
2023-01-16 17:57 ` [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size Marc Hartmayer
2023-01-18  8:27   ` Janosch Frank
2023-01-18  9:04     ` Marc Hartmayer
2023-01-16 17:57 ` [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation Marc Hartmayer
2023-01-16 18:22   ` Claudio Imbrenda
2023-01-17  9:43     ` Marc Hartmayer
2023-01-17 10:24       ` Claudio Imbrenda
2023-01-17 11:19         ` Marc Hartmayer
2023-01-17 11:21       ` Claudio Imbrenda
2023-01-16 17:57 ` [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts Marc Hartmayer
2023-01-16 18:23   ` Claudio Imbrenda
2023-01-18  9:10   ` Marc Hartmayer
2023-01-16 17:57 ` [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well Marc Hartmayer
2023-01-16 18:25   ` Claudio Imbrenda
2023-01-17  9:39     ` Marc Hartmayer
2023-01-17 10:28       ` Claudio Imbrenda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.