public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] tools: Makefile fixes for sysreg generation
@ 2023-10-27  0:54 Oliver Upton
  2023-10-27  0:54 ` [PATCH 1/2] tools headers arm64: Fix references to top srcdir in Makefile Oliver Upton
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Oliver Upton @ 2023-10-27  0:54 UTC (permalink / raw)
  To: kvmarm
  Cc: kvm, Marc Zyngier, James Morse, Suzuki K Poulose, Zenghui Yu,
	Oliver Upton, Nina Schoetterl-Glausch, Aishwarya TCV

Fixing a couple of issues in the Makefile changes required to get sysreg
generation working.

Cc: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Cc: Aishwarya TCV <aishwarya.tcv@arm.com>

Oliver Upton (2):
  tools: arm64: Fix references to top srcdir in Makefile
  KVM: selftests: Avoid using forced target for generating arm64 headers

 tools/arch/arm64/tools/Makefile      | 16 ++++++++--------
 tools/testing/selftests/kvm/Makefile | 11 +++++------
 2 files changed, 13 insertions(+), 14 deletions(-)


base-commit: 54a9ea73527d55ab746d5425e10f3fa748e00e70
-- 
2.42.0.820.g83a721a137-goog


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

* [PATCH 1/2] tools headers arm64: Fix references to top srcdir in Makefile
  2023-10-27  0:54 [PATCH 0/2] tools: Makefile fixes for sysreg generation Oliver Upton
@ 2023-10-27  0:54 ` Oliver Upton
  2023-10-27  0:54 ` [PATCH 2/2] KVM: selftests: Avoid using forced target for generating arm64 headers Oliver Upton
  2023-10-31  0:19 ` [PATCH 0/2] tools: Makefile fixes for sysreg generation Oliver Upton
  2 siblings, 0 replies; 5+ messages in thread
From: Oliver Upton @ 2023-10-27  0:54 UTC (permalink / raw)
  To: kvmarm
  Cc: kvm, Marc Zyngier, James Morse, Suzuki K Poulose, Zenghui Yu,
	Oliver Upton, Aishwarya TCV

Aishwarya reports that KVM selftests for arm64 fail with the following
error:

 | make[4]: Entering directory '/tmp/kci/linux/tools/testing/selftests/kvm'
 | Makefile:270: warning: overriding recipe for target
 | '/tmp/kci/linux/build/kselftest/kvm/get-reg-list'
 | Makefile:265: warning: ignoring old recipe for target
 | '/tmp/kci/linux/build/kselftest/kvm/get-reg-list'
 | make -C ../../../../tools/arch/arm64/tools/
 | make[5]: Entering directory '/tmp/kci/linux/tools/arch/arm64/tools'
 | Makefile:10: ../tools/scripts/Makefile.include: No such file or directory
 | make[5]: *** No rule to make target '../tools/scripts/Makefile.include'.
 |  Stop.

It would appear that this only affects builds from the top-level
Makefile (e.g. make kselftest-all), as $(srctree) is set to ".". Work
around the issue by shadowing the kselftest naming scheme for the source
tree variable.

Reported-by: Aishwarya TCV <aishwarya.tcv@arm.com>
Fixes: 0359c946b131 ("tools headers arm64: Update sysreg.h with kernel sources")
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
---
 tools/arch/arm64/tools/Makefile | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/arch/arm64/tools/Makefile b/tools/arch/arm64/tools/Makefile
index f867e6036c62..7f64b8bb5107 100644
--- a/tools/arch/arm64/tools/Makefile
+++ b/tools/arch/arm64/tools/Makefile
@@ -1,13 +1,13 @@
 # SPDX-License-Identifier: GPL-2.0
 
-ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(CURDIR)))
-srctree := $(patsubst %/,%,$(dir $(srctree)))
-srctree := $(patsubst %/,%,$(dir $(srctree)))
-srctree := $(patsubst %/,%,$(dir $(srctree)))
+ifeq ($(top_srcdir),)
+top_srcdir := $(patsubst %/,%,$(dir $(CURDIR)))
+top_srcdir := $(patsubst %/,%,$(dir $(top_srcdir)))
+top_srcdir := $(patsubst %/,%,$(dir $(top_srcdir)))
+top_srcdir := $(patsubst %/,%,$(dir $(top_srcdir)))
 endif
 
-include $(srctree)/tools/scripts/Makefile.include
+include $(top_srcdir)/tools/scripts/Makefile.include
 
 AWK	?= awk
 MKDIR	?= mkdir
@@ -19,10 +19,10 @@ else
 Q = @
 endif
 
-arm64_tools_dir = $(srctree)/arch/arm64/tools
+arm64_tools_dir = $(top_srcdir)/arch/arm64/tools
 arm64_sysreg_tbl = $(arm64_tools_dir)/sysreg
 arm64_gen_sysreg = $(arm64_tools_dir)/gen-sysreg.awk
-arm64_generated_dir = $(srctree)/tools/arch/arm64/include/generated
+arm64_generated_dir = $(top_srcdir)/tools/arch/arm64/include/generated
 arm64_sysreg_defs = $(arm64_generated_dir)/asm/sysreg-defs.h
 
 all: $(arm64_sysreg_defs)
-- 
2.42.0.820.g83a721a137-goog


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

* [PATCH 2/2] KVM: selftests: Avoid using forced target for generating arm64 headers
  2023-10-27  0:54 [PATCH 0/2] tools: Makefile fixes for sysreg generation Oliver Upton
  2023-10-27  0:54 ` [PATCH 1/2] tools headers arm64: Fix references to top srcdir in Makefile Oliver Upton
@ 2023-10-27  0:54 ` Oliver Upton
  2023-10-30 16:34   ` Nina Schoetterl-Glausch
  2023-10-31  0:19 ` [PATCH 0/2] tools: Makefile fixes for sysreg generation Oliver Upton
  2 siblings, 1 reply; 5+ messages in thread
From: Oliver Upton @ 2023-10-27  0:54 UTC (permalink / raw)
  To: kvmarm
  Cc: kvm, Marc Zyngier, James Morse, Suzuki K Poulose, Zenghui Yu,
	Oliver Upton, Nina Schoetterl-Glausch

The 'prepare' target that generates the arm64 sysreg headers had no
prerequisites, so it wound up forcing a rebuild of all KVM selftests
each invocation. Add a rule for the generated headers and just have
dependents use that for a prerequisite.

Reported-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Fixes: 9697d84cc3b6 ("KVM: selftests: Generate sysreg-defs.h and add to include path")
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
---
 tools/testing/selftests/kvm/Makefile | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index 4f4f6ad025f4..4de096bbf124 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -22,10 +22,8 @@ arm64_tools_dir := $(top_srcdir)/tools/arch/arm64/tools/
 GEN_HDRS := $(top_srcdir)/tools/arch/arm64/include/generated/
 CFLAGS += -I$(GEN_HDRS)
 
-prepare:
+$(GEN_HDRS): $(wildcard $(arm64_tools_dir)/*)
 	$(MAKE) -C $(arm64_tools_dir)
-else
-prepare:
 endif
 
 LIBKVM += lib/assert.c
@@ -276,10 +274,10 @@ EXTRA_CLEAN += $(GEN_HDRS) \
 	       cscope.*
 
 x := $(shell mkdir -p $(sort $(dir $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ))))
-$(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.c prepare
+$(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.c $(GEN_HDRS)
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
-$(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S prepare
+$(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S $(GEN_HDRS)
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
 
 # Compile the string overrides as freestanding to prevent the compiler from
@@ -289,9 +287,10 @@ $(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@
 
 x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
+$(SPLIT_TESTS_OBJS): $(GEN_HDRS)
 $(TEST_GEN_PROGS): $(LIBKVM_OBJS)
 $(TEST_GEN_PROGS_EXTENDED): $(LIBKVM_OBJS)
-$(TEST_GEN_OBJ): prepare
+$(TEST_GEN_OBJ): $(GEN_HDRS)
 
 cscope: include_paths = $(LINUX_TOOL_INCLUDE) $(LINUX_HDR_PATH) include lib ..
 cscope:
-- 
2.42.0.820.g83a721a137-goog


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

* Re: [PATCH 2/2] KVM: selftests: Avoid using forced target for generating arm64 headers
  2023-10-27  0:54 ` [PATCH 2/2] KVM: selftests: Avoid using forced target for generating arm64 headers Oliver Upton
@ 2023-10-30 16:34   ` Nina Schoetterl-Glausch
  0 siblings, 0 replies; 5+ messages in thread
From: Nina Schoetterl-Glausch @ 2023-10-30 16:34 UTC (permalink / raw)
  To: Oliver Upton, kvmarm
  Cc: kvm, Marc Zyngier, James Morse, Suzuki K Poulose, Zenghui Yu

On Fri, 2023-10-27 at 00:54 +0000, Oliver Upton wrote:
> The 'prepare' target that generates the arm64 sysreg headers had no
> prerequisites, so it wound up forcing a rebuild of all KVM selftests
> each invocation. Add a rule for the generated headers and just have
> dependents use that for a prerequisite.
> 
> Reported-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> Fixes: 9697d84cc3b6 ("KVM: selftests: Generate sysreg-defs.h and add to include path")
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>

Tested-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>



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

* Re: [PATCH 0/2] tools: Makefile fixes for sysreg generation
  2023-10-27  0:54 [PATCH 0/2] tools: Makefile fixes for sysreg generation Oliver Upton
  2023-10-27  0:54 ` [PATCH 1/2] tools headers arm64: Fix references to top srcdir in Makefile Oliver Upton
  2023-10-27  0:54 ` [PATCH 2/2] KVM: selftests: Avoid using forced target for generating arm64 headers Oliver Upton
@ 2023-10-31  0:19 ` Oliver Upton
  2 siblings, 0 replies; 5+ messages in thread
From: Oliver Upton @ 2023-10-31  0:19 UTC (permalink / raw)
  To: Oliver Upton, kvmarm
  Cc: Aishwarya TCV, Zenghui Yu, James Morse, kvm,
	Nina Schoetterl-Glausch, Marc Zyngier, Suzuki K Poulose

On Fri, 27 Oct 2023 00:54:37 +0000, Oliver Upton wrote:
> Fixing a couple of issues in the Makefile changes required to get sysreg
> generation working.
> 
> Cc: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> Cc: Aishwarya TCV <aishwarya.tcv@arm.com>
> 
> Oliver Upton (2):
>   tools: arm64: Fix references to top srcdir in Makefile
>   KVM: selftests: Avoid using forced target for generating arm64 headers
> 
> [...]

Applied to kvmarm/next, thanks!

[1/2] tools headers arm64: Fix references to top srcdir in Makefile
      https://git.kernel.org/kvmarm/kvmarm/c/fbb075c11663
[2/2] KVM: selftests: Avoid using forced target for generating arm64 headers
      https://git.kernel.org/kvmarm/kvmarm/c/70c7b704ca72

--
Best,
Oliver

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

end of thread, other threads:[~2023-10-31  0:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-27  0:54 [PATCH 0/2] tools: Makefile fixes for sysreg generation Oliver Upton
2023-10-27  0:54 ` [PATCH 1/2] tools headers arm64: Fix references to top srcdir in Makefile Oliver Upton
2023-10-27  0:54 ` [PATCH 2/2] KVM: selftests: Avoid using forced target for generating arm64 headers Oliver Upton
2023-10-30 16:34   ` Nina Schoetterl-Glausch
2023-10-31  0:19 ` [PATCH 0/2] tools: Makefile fixes for sysreg generation Oliver Upton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox