introduce stub directory to storing empty/stub headers
v4 cover introduce stub directory to storing empty/stub headers
A lot of empty/stub headers should be introduced during the early steps of adding support of new architecture.
An example can be found here:
1. https://lore.kernel.org/xen-devel/[email protected]/
2. https://lore.kernel.org/xen-devel/a92f99e8f697da99d77bfde562a549dbef3760ce.1692816595.git.sanastasio@raptorengineering.com/
As part of the patch series, asm/vm_event.h was moved to the stubs directory because It is the same for ARM, PPC, and RISC-V.
---
Changes in V4:
- add asm-generic support
- update path of vm_event.h from include/asm-generic/asm to include/asm-generic
---
Changes in V3:
- add Acked-by: Stefano Stabellini <[email protected]> for "xen: move arm/include/asm/vm_event.h to asm-generic"
- update SPDX tag.
- move asm/vm_event.h to asm-generic.
- rename stubs dir to asm-generic.
---
Changes in V2:
- change public/domctl.h to public/vm_event.h.
- update commit message of [PATCH v2 2/2] xen: move arm/include/asm/vm_event.h to stubs
Oleksii Kurochko (2):
xen: asm-generic support
xen: move arm/include/asm/vm_event.h to asm-generic
xen/Makefile | 10 +++++- xen/arch/arm/include/asm/Kbuild | 1 + xen/arch/ppc/include/asm/Kbuild | 1 + xen/arch/riscv/include/asm/Kbuild | 1 + xen/arch/x86/include/asm/Kbuild | 1 + xen/include/asm-generic/vm_event.h | 55 ++++++++++++++++++++++++++++++ xen/scripts/Makefile.asm-generic | 23 +++++++++++++ 7 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 xen/arch/arm/include/asm/Kbuild create mode 100644 xen/arch/ppc/include/asm/Kbuild create mode 100644 xen/arch/riscv/include/asm/Kbuild create mode 100644 xen/arch/x86/include/asm/Kbuild create mode 100644 xen/include/asm-generic/vm_event.h create mode 100644 xen/scripts/Makefile.asm-generic
Signature · 1 line
2.41.0
PATCH v4 1/2 xen: asm-generic support
Some headers are shared between individual architectures or are empty. To avoid duplication of these headers, asm-generic is introduced.
With the following patch, an architecture uses generic headers mentioned in the file arch/$(ARCH)/include/asm/Kbuild.
To use a generic header is needed to add to
arch/$(ARCH)/include/asm/Kbuild :
generic-y += <name-of-header-file.h>
For each mentioned header in arch/$(ARCH)/include/asm/Kbuild, kbuild will generate the necessary wrapper in arch/$(ARCH)/include/generated/asm.
---
Changes in V4:
- introduce asm-generic support
- update commit message
---
Changes in V3:
- Rename stubs dir to asm-generic
---
Changes in V2:
- Nothing changed.
--- xen/Makefile | 10 +++++++++- xen/arch/arm/include/asm/Kbuild | 1 + xen/arch/ppc/include/asm/Kbuild | 1 + xen/arch/riscv/include/asm/Kbuild | 1 + xen/arch/x86/include/asm/Kbuild | 1 + xen/scripts/Makefile.asm-generic | 23 +++++++++++++++++++++++ 6 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 xen/arch/arm/include/asm/Kbuild create mode 100644 xen/arch/ppc/include/asm/Kbuild create mode 100644 xen/arch/riscv/include/asm/Kbuild create mode 100644 xen/arch/x86/include/asm/Kbuild create mode 100644 xen/scripts/Makefile.asm-generic
xen/Makefile +9 -1
@@ -438,6 +438,7 @@ ifdef building_out_of_srctree endif CFLAGS += -I$(srctree)/include CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include +CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include/generated # Note that link order matters! ALL_OBJS-y := common/built_in.o
@@ -580,6 +581,7 @@ _clean: rm -f $(TARGET).efi $(TARGET).efi.map $(TARGET).efi.elf $(TARGET).efi.stripped rm -f asm-offsets.s arch/*/include/asm/asm-offsets.h rm -f .banner .allconfig.tmp include/xen/compile.h + rm -rf arch/*/include/generated .PHONY: _distclean _distclean: clean
@@ -589,7 +591,7 @@ $(TARGET).gz: $(TARGET) gzip -n -f -9 < $< > [email protected] mv [email protected] $@ -$(TARGET): outputmakefile FORCE +$(TARGET): outputmakefile asm-generic FORCE $(Q)$(MAKE) $(build)=tools $(Q)$(MAKE) $(build)=. include/xen/compile.h $(Q)$(MAKE) $(build)=include all
@@ -667,6 +669,12 @@ endif # need-sub-make PHONY += FORCE FORCE: +# Support for using generic headers in asm-generic +PHONY += asm-generic +asm-generic: + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + obj=arch/$(SRCARCH)/include/generated/asm + # Declare the contents of the PHONY variable as phony. We keep that # information in a variable so we can use it in if_changed and friends. .PHONY: $(PHONY)
xen/arch/arm/include/asm/Kbuild new file +1 -0
@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-only
xen/arch/ppc/include/asm/Kbuild new file +1 -0
@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-only
xen/arch/riscv/include/asm/Kbuild new file +1 -0
@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-only
xen/arch/x86/include/asm/Kbuild new file +1 -0
@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-only
xen/scripts/Makefile.asm-generic new file +23 -0
@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild +# and for each file listed in this file with generic-y creates +# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/asm) + +kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild +include $(kbuild-file) + +include scripts/Kbuild.include + +# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@ + +all: $(patsubst %, $(obj)/%, $(generic-y)) + +$(obj)/%.h: + $(call cmd,wrap)
Signature · 1 line
2.41.0
Re: [PATCH v4 1/2] xen: asm-generic support
Hi Oleksii,
Quoted 7 lines · Oleksii Kurochko
Some headers are shared between individual architectures or are empty. To avoid duplication of these headers, asm-generic is introduced.
With the following patch, an architecture uses generic headers mentioned in the file arch/$(ARCH)/include/asm/Kbuild.
Kbuild refers to "Kernel build" I guess.
I am ok to keep that name to keep things simpler when compared to Linux scripts but it would be good to mention that in the commit message for future reference.
Quoted 39 lines
To use a generic header is needed to add to
arch/$(ARCH)/include/asm/Kbuild :generic-y += <name-of-header-file.h>For each mentioned header in arch/$(ARCH)/include/asm/Kbuild, kbuild will generate the necessary wrapper in arch/$(ARCH)/include/generated/asm.
Signed-off-by Oleksii Kurochko <[email protected]>---
Changes in V4:
- introduce asm-generic support
- update commit message
---
Changes in V3:
- Rename stubs dir to asm-generic
---
Changes in V2:
- Nothing changed.
---xen/Makefile | 10 +++++++++- xen/arch/arm/include/asm/Kbuild | 1 + xen/arch/ppc/include/asm/Kbuild | 1 + xen/arch/riscv/include/asm/Kbuild | 1 + xen/arch/x86/include/asm/Kbuild | 1 + xen/scripts/Makefile.asm-generic | 23 +++++++++++++++++++++++ 6 files changed, 36 insertions(+), 1 deletion(-)create mode 100644 xen/arch/arm/include/asm/Kbuild create mode 100644 xen/arch/ppc/include/asm/Kbuild create mode 100644 xen/arch/riscv/include/asm/Kbuild create mode 100644 xen/arch/x86/include/asm/Kbuild create mode 100644 xen/scripts/Makefile.asm-generic
xen/Makefile +0
-0@@ -438,6 +438,7 @@ ifdef building_out_of_srctree
Quoted 4 lines
endif
CFLAGS += -I$(srctree)/include
CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include +CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include/generated
Why are we generating files in the source tree ?
Shouldn't we keep it unmodified ?
Quoted 9 lines
# Note that link order matters!
ALL_OBJS-y :=common/built_in.oxen/Makefile +0
-0@@ -580,6 +581,7 @@ _clean:rm -f $(TARGET).efi $(TARGET).efi.map $(TARGET).efi.elf $(TARGET).efi.stripped rm -f asm-offsets.s
arch/*/include/asm/asm-offsets.h
rm -f .banner .allconfig.tmpinclude/xen/compile.h
+ rm -rfarch/*/include/generated
You must use the same as for CFLAGS here so $(srctree) would be needed. (or something else depending on the fix for previous comment)
Quoted 71 lines
.PHONY:
_distclean_distclean: cleanxen/Makefile +0
-0@@ -589,7 +591,7 @@ $(TARGET).gz: $(TARGET)gzip -n -f -9 < $< > [email protected]
mv [email protected] $@-$(TARGET): outputmakefile FORCE
+$(TARGET): outputmakefile asm-generic FORCE
$(Q)$(MAKE) $(build)=tools
$(Q)$(MAKE) $(build)=.include/xen/compile.h
$(Q)$(MAKE) $(build)=include allxen/Makefile +0
-0@@ -667,6 +669,12 @@ endif # need-sub-makePHONY += FORCE
FORCE:xen/Makefile +6
-0+# Support for using generic headers in asm-generic +PHONY += asm-generic +asm-generic: + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + obj=arch/$(SRCARCH)/include/generated/asm +# Declare the contents of the PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends. .PHONY: $(PHONY)xen/arch/arm/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/ppc/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/riscv/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/x86/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/scripts/Makefile.asm-generic new file +13
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild +# and for each file listed in this file with generic-y creates +# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/asm) + +kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild +include $(kbuild-file) + +include scripts/Kbuild.include +
xen/scripts/Makefile.asm-generic line 23
Quoted 10 lines
xen/scripts/Makefile.asm-generic new file +10
-0+# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@ + +all: $(patsubst %, $(obj)/%, $(generic-y)) + +$(obj)/%.h: + $(call cmd,wrap)
In fact i think your files are not generated in the srctree so this will break if you use out of tree compilation.
Cheers
Bertrand
Quoted 3 lines
Signature · 1 line
2.41.0
Re: [PATCH v4 1/2] xen: asm-generic support
Hi Bertrand,
Quoted 9 lines · Bertrand Marquis
Hi Oleksii,
Quoted 7 lines
On 1 Sep 2023, at 18:02, Oleksii Kurochko
<[email protected]> wrote:Some headers are shared between individual architectures or are empty.
To avoid duplication of these headers, asm-generic is introduced.
Quoted 7 lines
Quoted 2 lines
With the following patch, an architecture uses generic headers mentioned in the file arch/$(ARCH)/include/asm/Kbuild.
Kbuildrefers to "Kernel build" I guess.
I am ok to keep that name to keep things simpler when compared to Linux scripts but it would be good to mention that in the commit message for future reference.
Sure. I'll add that Kbuild refers to "Kernel build"
Quoted 35 lines
Quoted 35 lines
To use a generic header is needed to add to
arch/$(ARCH)/include/asm/Kbuild :
generic-y += <name-of-header-file.h>For each mentioned header in arch/$(ARCH)/include/asm/Kbuild, kbuild will generate the necessary wrapper in arch/$(ARCH)/include/generated/asm.
Signed-off-by Oleksii Kurochko <[email protected]>---
Changes in V4:
- introduce asm-generic support
- update commit message
---
Changes in V3:
- Rename stubs dir to asm-generic
---
Changes in V2:
- Nothing changed.
---
xen/Makefile | 10 +++++++++- xen/arch/arm/include/asm/Kbuild | 1 + xen/arch/ppc/include/asm/Kbuild | 1 + xen/arch/riscv/include/asm/Kbuild | 1 + xen/arch/x86/include/asm/Kbuild | 1 + xen/scripts/Makefile.asm-generic | 23 +++++++++++++++++++++++6 files changed, 36 insertions(+), 1 deletion(-)create mode 100644 xen/arch/arm/include/asm/Kbuild create mode 100644 xen/arch/ppc/include/asm/Kbuild create mode 100644 xen/arch/riscv/include/asm/Kbuild create mode 100644 xen/arch/x86/include/asm/Kbuild create mode 100644 xen/scripts/Makefile.asm-generic
Quoted 12 lines
Quoted 9 lines
xen/Makefile +0
-0@@ -438,6 +438,7 @@ ifdef building_out_of_srctreeendif
CFLAGS += -I$(srctree)/include
CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include +CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include/generatedWhy are we generating files in the source tree ?
Shouldn't we keep it unmodified ?
I think you are right.
I got myself confused because I do not use out-of-tree compilation so for me it looked like $(srctree).
It would be better to use $(objtree) instead.
Quoted 15 lines
Quoted 11 lines
# Note that link order matters!
ALL_OBJS-y :=common/built_in.oxen/Makefile +0
-0@@ -580,6 +581,7 @@ _clean:rm -f $(TARGET).efi $(TARGET).efi.map $(TARGET).efi.elf $(TARGET).efi.stripped
rm -f asm-offsets.sarch/*/include/asm/asm-offsets.hrm -f .banner .allconfig.tmpinclude/xen/compile.h
+ rm -rfarch/*/include/generatedYou must use the same as for CFLAGS here so $(srctree) would be needed.
(or something else depending on the fix for previous comment)
Thanks. I'll change to the value mentioned in CFLAGS.
Quoted 85 lines
Quoted 85 lines
.PHONY:
_distclean_distclean: cleanxen/Makefile +0
-0@@ -589,7 +591,7 @@ $(TARGET).gz: $(TARGET)gzip -n -f -9 < $< > [email protected]
mv [email protected] $@-$(TARGET): outputmakefile FORCE
+$(TARGET): outputmakefile asm-generic FORCE
$(Q)$(MAKE) $(build)=tools
$(Q)$(MAKE) $(build)=.include/xen/compile.h
$(Q)$(MAKE) $(build)=include allxen/Makefile +0
-0@@ -667,6 +669,12 @@ endif # need-sub-makePHONY += FORCE
FORCE:xen/Makefile +6
-0+# Support for using generic headers in asm-generic +PHONY += asm-generic +asm-generic: + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + obj=arch/$(SRCARCH)/include/generated/asm +# Declare the contents of the PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends. .PHONY: $(PHONY)xen/arch/arm/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/ppc/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/riscv/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/x86/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/scripts/Makefile.asm-generic new file +7
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild +# and for each file listed in this file with generic-y creates +# a small wrapper file in $(obj)(arch/$(SRCARCH)/include/generated/asm)
xen/scripts/Makefile.asm-generic new file +11
-0+ +kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild +include $(kbuild-file) + +include scripts/Kbuild.include + +# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@
Quoted 8 lines
xen/scripts/Makefile.asm-generic line 23
Quoted 5 lines
xen/scripts/Makefile.asm-generic new file +5
-0+ +all: $(patsubst %, $(obj)/%, $(generic-y)) + +$(obj)/%.h: + $(call cmd,wrap)In fact i think your files are not generated in the srctree so this will break if you use out of tree compilation.
Why not? They will be generated in $obj which equal to obj=arch/$(SRCARCH)/include/generated/asm ( in my case ).
Anyway I think that obj should be equal to what is mentioned in CFLAGS.
~ Oleksii
Re: [PATCH v4 1/2] xen: asm-generic support
Hi Oleksii,
Quoted 69 lines · Oleksii
Hi Bertrand,
Quoted 9 lines · Bertrand Marquis
Hi Oleksii,
Quoted 7 lines
On 1 Sep 2023, at 18:02, Oleksii Kurochko
<[email protected]> wrote:Some headers are shared between individual architectures or are empty.
To avoid duplication of these headers, asm-generic is introduced.Quoted 7 lines
Quoted 2 lines
With the following patch, an architecture uses generic headers mentioned in the file arch/$(ARCH)/include/asm/Kbuild.
Kbuildrefers to "Kernel build" I guess.
I am ok to keep that name to keep things simpler when compared to Linux scripts but it would be good to mention that in the commit message for future reference.Sure. I'll add that
Kbuildrefers to "Kernel build"Quoted 35 lines
Quoted 35 lines
To use a generic header is needed to add to
arch/$(ARCH)/include/asm/Kbuild :generic-y += <name-of-header-file.h>For each mentioned header in arch/$(ARCH)/include/asm/Kbuild, kbuild will generate the necessary wrapper in arch/$(ARCH)/include/generated/asm.
Signed-off-by Oleksii Kurochko <[email protected]>---
Changes in V4:
- introduce asm-generic support
- update commit message
---
Changes in V3:
- Rename stubs dir to asm-generic
---
Changes in V2:
- Nothing changed.
---xen/Makefile | 10 +++++++++- xen/arch/arm/include/asm/Kbuild | 1 + xen/arch/ppc/include/asm/Kbuild | 1 + xen/arch/riscv/include/asm/Kbuild | 1 + xen/arch/x86/include/asm/Kbuild | 1 + xen/scripts/Makefile.asm-generic | 23 +++++++++++++++++++++++ 6 files changed, 36 insertions(+), 1 deletion(-)create mode 100644 xen/arch/arm/include/asm/Kbuild create mode 100644 xen/arch/ppc/include/asm/Kbuild create mode 100644 xen/arch/riscv/include/asm/Kbuild create mode 100644 xen/arch/x86/include/asm/Kbuild create mode 100644 xen/scripts/Makefile.asm-generic
Quoted 12 lines
Quoted 9 lines
xen/Makefile +0
-0@@ -438,6 +438,7 @@ ifdef building_out_of_srctreeendif
CFLAGS += -I$(srctree)/include
CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include +CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include/generatedWhy are we generating files in the source tree ?
Shouldn't we keep it unmodified ?
Quoted 5 lines
I think you are right.
I got myself confused because I do not use out-of-tree compilation so for me it looked like $(srctree).It would be better to use $(objtree) instead.
Ack
Quoted 110 lines
Quoted 15 lines
Quoted 11 lines
# Note that link order matters!
ALL_OBJS-y :=common/built_in.oxen/Makefile +0
-0@@ -580,6 +581,7 @@ _clean:rm -f $(TARGET).efi $(TARGET).efi.map $(TARGET).efi.elf $(TARGET).efi.stripped
rm -f asm-offsets.sarch/*/include/asm/asm-offsets.hrm -f .banner .allconfig.tmpinclude/xen/compile.h
+ rm -rfarch/*/include/generatedYou must use the same as for CFLAGS here so $(srctree) would be needed.
(or something else depending on the fix for previous comment)Thanks. I'll change to the value mentioned in CFLAGS.
Quoted 85 lines
Quoted 85 lines
.PHONY:
_distclean_distclean: cleanxen/Makefile +0
-0@@ -589,7 +591,7 @@ $(TARGET).gz: $(TARGET)gzip -n -f -9 < $< > [email protected]
mv [email protected] $@-$(TARGET): outputmakefile FORCE
+$(TARGET): outputmakefile asm-generic FORCE
$(Q)$(MAKE) $(build)=tools
$(Q)$(MAKE) $(build)=.include/xen/compile.h
$(Q)$(MAKE) $(build)=include allxen/Makefile +0
-0@@ -667,6 +669,12 @@ endif # need-sub-makePHONY += FORCE
FORCE:xen/Makefile +6
-0+# Support for using generic headers in asm-generic +PHONY += asm-generic +asm-generic: + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + obj=arch/$(SRCARCH)/include/generated/asm +# Declare the contents of the PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends. .PHONY: $(PHONY)xen/arch/arm/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/ppc/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/riscv/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/x86/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/scripts/Makefile.asm-generic new file +7
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild +# and for each file listed in this file with generic-y creates +# a small wrapper file in $(obj)(arch/$(SRCARCH)/include/generated/asm)
xen/scripts/Makefile.asm-generic new file +11
-0+ +kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild +include $(kbuild-file) + +include scripts/Kbuild.include + +# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@Quoted 8 lines
xen/scripts/Makefile.asm-generic line 23
Quoted 5 lines
xen/scripts/Makefile.asm-generic new file +5
-0+ +all: $(patsubst %, $(obj)/%, $(generic-y)) + +$(obj)/%.h: + $(call cmd,wrap)In fact i think your files are not generated in the srctree so this will break if you use out of tree compilation.
Quoted 2 lines
Why not? They will be generated in $obj which equal to obj=arch/$(SRCARCH)/include/generated/asm ( in my case ).
Right they are generated in the build tree but if it is not the same as srctree it will not work due to CFLAGS.
Quoted 2 lines
Anyway I think that obj should be equal to what is mentioned in CFLAGS.
We generate other files like asm-offsets.h and it could in fact be that both srctree and build tree are already in include path.
There is in makefile a rule already removing asm-offsets.h which is generated and this one does not use a prefix so we should follow this standard in fact.
So we should not use any prefix (srctree or obj) i think.
@anthony: any suggestion here ?
Bertrand
Quoted 2 lines
~ Oleksii
Re: [PATCH v4 1/2] xen: asm-generic support
Quoted 208 lines · Bertrand Marquis
Hi Oleksii,
Quoted 71 lines
On 5 Sep 2023, at 15:37, Oleksii <[email protected]> wrote:
Hi Bertrand,
Quoted 10 lines · Bertrand Marquis
Hi Oleksii,
Quoted 8 lines
On 1 Sep 2023, at 18:02, Oleksii Kurochko
<[email protected]> wrote:Some headers are shared between individual architectures or are empty.
To avoid duplication of these headers, asm-generic is introduced.Quoted 7 lines
Quoted 2 lines
With the following patch, an architecture uses generic headers mentioned in the file arch/$(ARCH)/include/asm/Kbuild.
Kbuildrefers to "Kernel build" I guess.
I am ok to keep that name to keep things simpler when compared to Linux scripts but it would be good to mention that in the commit message for future reference.Sure. I'll add that
Kbuildrefers to "Kernel build"Quoted 35 lines
Quoted 35 lines
To use a generic header is needed to add to
arch/$(ARCH)/include/asm/Kbuild :
generic-y += <name-of-header-file.h>For each mentioned header in arch/$(ARCH)/include/asm/Kbuild, kbuild will generate the necessary wrapper in arch/$(ARCH)/include/generated/asm.
Signed-off-by Oleksii Kurochko <[email protected]>---
Changes in V4:
- introduce asm-generic support
- update commit message
---
Changes in V3:
- Rename stubs dir to asm-generic
---
Changes in V2:
- Nothing changed.
---
xen/Makefile | 10 +++++++++- xen/arch/arm/include/asm/Kbuild | 1 + xen/arch/ppc/include/asm/Kbuild | 1 + xen/arch/riscv/include/asm/Kbuild | 1 + xen/arch/x86/include/asm/Kbuild | 1 + xen/scripts/Makefile.asm-generic | 23 +++++++++++++++++++++++6 files changed, 36 insertions(+), 1 deletion(-)create mode 100644 xen/arch/arm/include/asm/Kbuild create mode 100644 xen/arch/ppc/include/asm/Kbuild create mode 100644 xen/arch/riscv/include/asm/Kbuild create mode 100644 xen/arch/x86/include/asm/Kbuild create mode 100644 xen/scripts/Makefile.asm-generic
Quoted 12 lines
Quoted 9 lines
xen/Makefile +0
-0@@ -438,6 +438,7 @@ ifdef building_out_of_srctreeendif
CFLAGS += -I$(srctree)/include
CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include +CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include/generatedWhy are we generating files in the source tree ?
Shouldn't we keep it unmodified ?Quoted 6 lines
I think you are right.
I got myself confused because I do not use out-of-tree compilation so
for me it looked like $(srctree).It would be better to use $(objtree) instead.
Ack
Quoted 112 lines
Quoted 15 lines
Quoted 11 lines
# Note that link order matters!
ALL_OBJS-y :=common/built_in.oxen/Makefile +0
-0@@ -580,6 +581,7 @@ _clean:rm -f $(TARGET).efi $(TARGET).efi.map $(TARGET).efi.elf $(TARGET).efi.stripped
rm -f asm-offsets.sarch/*/include/asm/asm-offsets.hrm -f .banner .allconfig.tmpinclude/xen/compile.h
+ rm -rfarch/*/include/generatedYou must use the same as for CFLAGS here so $(srctree) would be needed.
(or something else depending on the fix for previous comment)Thanks. I'll change to the value mentioned in CFLAGS.
Quoted 87 lines
Quoted 87 lines
.PHONY:
_distclean_distclean: cleanxen/Makefile +0
-0@@ -589,7 +591,7 @@ $(TARGET).gz: $(TARGET)gzip -n -f -9 < $< > [email protected]
mv [email protected] $@-$(TARGET): outputmakefile FORCE
+$(TARGET): outputmakefile asm-generic FORCE
$(Q)$(MAKE) $(build)=tools
$(Q)$(MAKE) $(build)=.include/xen/compile.h
$(Q)$(MAKE) $(build)=include allxen/Makefile +0
-0@@ -667,6 +669,12 @@ endif # need-sub-makePHONY += FORCE
FORCE:xen/Makefile +6
-0+# Support for using generic headers in asm-generic +PHONY += asm-generic +asm-generic: + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + obj=arch/$(SRCARCH)/include/generated/asm +# Declare the contents of the PHONY variable as phony. We keep that
# information in a variable so we can use it in if_changed and friends. .PHONY: $(PHONY)xen/arch/arm/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/ppc/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/riscv/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/arch/x86/include/asm/Kbuild new file +1
-0@@ -0,0 +1 @@ +# SPDX-License-Identifier: GPL-2.0-onlyxen/scripts/Makefile.asm-generic new file +5
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the filearch/$(SRCARCH)/include/asm/Kbuild
xen/scripts/Makefile.asm-generic new file +2
-0+# and for each file listed in this file with generic-y creates +# a small wrapper file in $(obj)(arch/$(SRCARCH)/include/generated/asm)
xen/scripts/Makefile.asm-generic new file +12
-0+ +kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild +include $(kbuild-file) + +include scripts/Kbuild.include + +# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@ +Quoted 8 lines
xen/scripts/Makefile.asm-generic line 23
Quoted 4 lines
xen/scripts/Makefile.asm-generic new file +4
-0+all: $(patsubst %, $(obj)/%, $(generic-y)) + +$(obj)/%.h: + $(call cmd,wrap)In fact i think your files are not generated in the srctree so this
will break if you use out of tree compilation.Quoted 2 lines
Why not? They will be generated in $obj which equal to obj=arch/$(SRCARCH)/include/generated/asm ( in my case ).
Right they are generated in the build tree but if it is not the same as srctree it will not work due to CFLAGS.
Quoted 3 lines
Anyway I think that obj should be equal to what is mentioned in CFLAGS.
We generate other files like
asm-offsets.hand it could in fact be that
both srctree and build tree are already in include path.
Quoted 6 lines
There is in makefile a rule already removing
asm-offsets.hwhich is generated
and this one does not use a prefix so we should follow this standard in fact.So we should not use any prefix (srctree or obj) i think.
I think you are right. Lets avoid usage of srctree/obj.
~ Oleksii
Re: [PATCH v4 1/2] xen: asm-generic support
In reply to Bertrand MarquisHello Bertrand
Quoted 26 lines · Bertrand Marquis
Quoted 26 lines
xen/scripts/Makefile.asm-generic new file +7
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild +# and for each file listed in this file with generic-y creates +# a small wrapper file in $(obj)(arch/$(SRCARCH)/include/generated/asm)
xen/scripts/Makefile.asm-generic new file +11
-0+ +kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild +include $(kbuild-file) + +include scripts/Kbuild.include + +# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@
Quoted 8 lines
xen/scripts/Makefile.asm-generic line 23
Quoted 5 lines
xen/scripts/Makefile.asm-generic new file +5
-0+ +all: $(patsubst %, $(obj)/%, $(generic-y)) + +$(obj)/%.h: + $(call cmd,wrap)In fact i think your files are not generated in the srctree so this will break if you use out of tree compilation.
I checked that and in both cases it generated in correct place.
First case:
$ CONTAINER_NO_PULL=1 CONTAINER=riscv64 ./automation/scripts/containerize make XEN_TARGET_ARCH=riscv64 -C xen build
$ ls -la xen/arch/riscv/include/generated/asm/vm_event.h -rw-r--r--. 1 ok ok 34 вер 6 14:32 xen/arch/riscv/include/generated/asm/vm_event.h
Second case: ( out-of-tree )
$ CONTAINER_NO_PULL=1 CONTAINER=riscv64 ./automation/scripts/containerize make O=xen_build XEN_TARGET_ARCH=riscv64 -C xen build V=1
$ ls -la xen/xen_build/arch/riscv/include/generated/asm/vm_event.h -rw-r--r--. 1 ok ok 34 вер 6 14:34 xen/xen_build/arch/riscv/include/generated/asm/vm_event.h
Could you please clarify if there's somithing I might have overlooked?
~ Oleksii
Re: [PATCH v4 1/2] xen: asm-generic support
Hi Oleksii,
Quoted 55 lines · Oleksii
Hello Bertrand
Quoted 26 lines · Bertrand Marquis
Quoted 26 lines
xen/scripts/Makefile.asm-generic new file +7
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild +# and for each file listed in this file with generic-y creates +# a small wrapper file in $(obj)(arch/$(SRCARCH)/include/generated/asm)
xen/scripts/Makefile.asm-generic new file +11
-0+ +kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild +include $(kbuild-file) + +include scripts/Kbuild.include + +# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@Quoted 8 lines
xen/scripts/Makefile.asm-generic line 23
Quoted 5 lines
xen/scripts/Makefile.asm-generic new file +5
-0+ +all: $(patsubst %, $(obj)/%, $(generic-y)) + +$(obj)/%.h: + $(call cmd,wrap)In fact i think your files are not generated in the srctree so this will break if you use out of tree compilation.
I checked that and in both cases it generated in correct place.
First case:
$ CONTAINER_NO_PULL=1 CONTAINER=riscv64 ./automation/scripts/containerize make XEN_TARGET_ARCH=riscv64 -C xen build$ ls -la xen/arch/riscv/include/generated/asm/vm_event.h -rw-r--r--. 1 ok ok 34 вер 6 14:32 xen/arch/riscv/include/generated/asm/vm_event.hSecond case: ( out-of-tree )
$ CONTAINER_NO_PULL=1 CONTAINER=riscv64 ./automation/scripts/containerize make O=xen_build XEN_TARGET_ARCH=riscv64 -C xen build V=1
Quoted 5 lines
$ ls -la xen/xen_build/arch/riscv/include/generated/asm/vm_event.h -rw-r--r--. 1 ok ok 34 вер 6 14:34 xen/xen_build/arch/riscv/include/generated/asm/vm_event.hCould you please clarify if there's somithing I might have overlooked?
No I do not think you did.
So obj is empty I would guess.
Anyway you just need to make sure that CFLAGS is coherent with what you generate. So if you generate in $(obj) you need to make sure you use the same in CFLAGS i would say.
@anthony: any advice here ?
Cheers
Bertrand
Quoted 5 lines
~ Oleksii
Re: [PATCH v4 1/2] xen: asm-generic support
Quoted 38 lines · Bertrand Marquis
Quoted 30 lines · Oleksii
Quoted 4 lines · Bertrand Marquis
Quoted 4 lines
xen/scripts/Makefile.asm-generic new file +0
-0Quoted 8 lines
xen/scripts/Makefile.asm-generic line 23
Quoted 5 lines
xen/scripts/Makefile.asm-generic new file +3
-0+ +$(obj)/%.h: + $(call cmd,wrap)In fact i think your files are not generated in the srctree so this will break if you use out of tree compilation.
I checked that and in both cases it generated in correct place.
First case:
$ CONTAINER_NO_PULL=1 CONTAINER=riscv64 ./automation/scripts/containerize make XEN_TARGET_ARCH=riscv64 -C xen build$ ls -la xen/arch/riscv/include/generated/asm/vm_event.h -rw-r--r--. 1 ok ok 34 вер 6 14:32 xen/arch/riscv/include/generated/asm/vm_event.hSecond case: ( out-of-tree )
$ CONTAINER_NO_PULL=1 CONTAINER=riscv64 ./automation/scripts/containerize make O=xen_build XEN_TARGET_ARCH=riscv64 -C xen build V=1Quoted 5 lines
$ ls -la xen/xen_build/arch/riscv/include/generated/asm/vm_event.h -rw-r--r--. 1 ok ok 34 вер 6 14:34 xen/xen_build/arch/riscv/include/generated/asm/vm_event.hCould you please clarify if there's somithing I might have overlooked?
No I do not think you did.
Quoted 5 lines
So obj is empty I would guess.
Anyway you just need to make sure that CFLAGS is coherent with what you generate. So if you generate in $(obj) you need to make sure you use the same in CFLAGS i would say.@anthony: any advice here ?
The use of $(obj) looks fine here. $(obj) is temporary and set for a single subdirectory. $(obj) is set by whatever is calling "Makefile.asm-generic", or "Rules.mk" is other cases.
In this patch, you can see $(obj) been set in "xen/Makefile":
$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic obj=arch/$(SRCARCH)/include/generated/asm
Another thing to know, make runs from the build directory, so in Oleksii second case, make is running in "xen/xen_build", so $(obj) point to a directory within the build directory.
For the CFLAGS, we can use $(objtree) (even if it is just "."), which always point to the top directory of the build tree.
I hope that clarifies things.
Cheers,
Signature · 1 line
Anthony PERARD
Re: [PATCH v4 1/2] xen: asm-generic support
In reply to Oleksii Kurochkoxen/scripts/Makefile.asm-generic line 1
Quoted 4 lines · Oleksii Kurochko
xen/scripts/Makefile.asm-generic new file +1
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0
While this is what the Linux file presently says, you still want to add "-only", which is merely the newer name for the same thing.
Quoted 12 lines
xen/scripts/Makefile.asm-generic new file +12
-0+# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild +# and for each file listed in this file with generic-y creates +# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/asm) + +kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild +include $(kbuild-file) + +include scripts/Kbuild.include +
xen/scripts/Makefile.asm-generic line 23
Quoted 10 lines
xen/scripts/Makefile.asm-generic new file +10
-0+# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@ + +all: $(patsubst %, $(obj)/%, $(generic-y)) + +$(obj)/%.h: + $(call cmd,wrap)
You've removed quite a bit of functionality, comparing with the Linux original. May I ask why that is? What they have all makes sense to me, and looks to be useful down the road.
Jan
Re: [PATCH v4 1/2] xen: asm-generic support
Quoted 30 lines · Jan Beulich
xen/scripts/Makefile.asm-generic line 1
Quoted 4 lines · Oleksii Kurochko
xen/scripts/Makefile.asm-generic new file +1
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0While this is what the Linux file presently says, you still want to add
"-only", which is merely the newer name for the same thing.Quoted 20 lines
xen/scripts/Makefile.asm-generic new file +6
-0+# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild +# and for each file listed in this file with generic-y creates +# a small wrapper file in $(obj)(arch/$(SRCARCH)/include/generated/asm)
xen/scripts/Makefile.asm-generic new file +13
-0+ +kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild +include $(kbuild-file) + +include scripts/Kbuild.include + +# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@ + +all: $(patsubst %, $(obj)/%, $(generic-y))
Quoted 8 lines
Quoted 3 lines
+
+$(obj)/%.h:
+ $(call cmd,wrap)You've removed quite a bit of functionality, comparing with the Linux original. May I ask why that is? What they have all makes sense to me,
and looks to be useful down the road.
I decided to take only minimum needed now but if you think it would be better to use the latest Linux's Makefile.asm-generic then I will update it in the next patch version.
~ Oleksii
Re: [PATCH v4 1/2] xen: asm-generic support
Quoted 39 lines · Oleksii
Quoted 30 lines · Jan Beulich
xen/scripts/Makefile.asm-generic line 1
Quoted 4 lines · Oleksii Kurochko
xen/scripts/Makefile.asm-generic new file +1
-0@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0While this is what the Linux file presently says, you still want to add
"-only", which is merely the newer name for the same thing.Quoted 20 lines
xen/scripts/Makefile.asm-generic new file +6
-0+# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild +# and for each file listed in this file with generic-y creates +# a small wrapper file in $(obj)(arch/$(SRCARCH)/include/generated/asm)
xen/scripts/Makefile.asm-generic new file +13
-0+ +kbuild-file := $(srctree)/arch/$(SRCARCH)/include/asm/Kbuild +include $(kbuild-file) + +include scripts/Kbuild.include + +# Create output directory if not already present +_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) + +quiet_cmd_wrap = WRAP $@ +cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@ + +all: $(patsubst %, $(obj)/%, $(generic-y))Quoted 8 lines
Quoted 3 lines
+
+$(obj)/%.h:
+ $(call cmd,wrap)You've removed quite a bit of functionality, comparing with the Linux original. May I ask why that is? What they have all makes sense to me,
and looks to be useful down the road.
Quoted 3 lines
I decided to take only minimum needed now but if you think it would be better to use the latest Linux's Makefile.asm-generic then I will update it in the next patch version.
Unless there are things getting in the way, I indeed think it would be better to take the whole thing largely verbatim (a few edits are unavoidable afaict).
Jan
Re: [PATCH v4 1/2] xen: asm-generic support
Quoted 6 lines · Jan Beulich
Quoted 5 lines · Oleksii
Quoted 4 lines · Jan Beulich
You've removed quite a bit of functionality, comparing with the Linux original. May I ask why that is? What they have all makes sense to me,
and looks to be useful down the road.
Quoted 7 lines
Quoted 3 lines
I decided to take only minimum needed now but if you think it would be better to use the latest Linux's Makefile.asm-generic then I will update it in the next patch version.
Unless there are things getting in the way, I indeed think it would be better to take the whole thing largely verbatim (a few edits are unavoidable afaict).
Yes, I think it would be useful as well to take most of the file from Linux. At least, this would include the "$(unwanted)" variable, which is used to remove old wrapper when an header is removed from "generic-y". But instead of the "-include $(kbuild-file)", could you include "$(src)/Makefile" instead like we do in "Rules.mk"? We don't have $(kbuild-file) macro anyway, and I don't see the point in using files name "Kbuild" when "Makefile" works and is enough.
Thanks,
Signature · 1 line
Anthony PERARD
Re: [PATCH v4 1/2] xen: asm-generic support
Quoted 19 lines · Anthony PERARD
Quoted 13 lines · Jan Beulich
Quoted 11 lines · Oleksii
Quoted 6 lines · Jan Beulich
You've removed quite a bit of functionality, comparing with the Linux
original. May I ask why that is? What they have all makes sense to
me,
and looks to be useful down the road.I decided to take only minimum needed now but if you think it would be
better to use the latest Linux's Makefile.asm-generic then I will update it in the next patch version.Quoted 4 lines
Unless there are things getting in the way, I indeed think it would be
better to take the whole thing largely verbatim (a few edits are unavoidable afaict).
Quoted 10 lines
Yes, I think it would be useful as well to take most of the file from Linux. At least, this would include the "$(unwanted)" variable, which is
used to remove old wrapper when an header is removed from "generic- y".
But instead of the "-include $(kbuild-file)", could you include "$(src)/Makefile" instead like we do in "Rules.mk"? We don't have $(kbuild-file) macro anyway, and I don't see the point in using files name "Kbuild" when "Makefile" works and is enough.
Thank you for your feedback.
I'll take into account your suggestions in the next patch version.
~ Oleksii
Re: [PATCH v4 1/2] xen: asm-generic support
In reply to Oleksii Kurochkoxen/Makefile endif # need-sub-make · line 676
Quoted 13 lines · Oleksii Kurochko
xen/Makefile +5
-0@@ -667,6 +669,12 @@ endif # need-sub-make PHONY += FORCE FORCE: +# Support for using generic headers in asm-generic +PHONY += asm-generic +asm-generic: + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + obj=arch/$(SRCARCH)/include/generated/asm
Could you introduce a $(asm-generic) macro in Kbuild.include like we already have for $(build) and $(clean)? As I think it would be nicer to have
$(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm
in the main makefile.
Also, could you move the rule "asm-generic" within the "!config-build" part of the Makefile? Somewhere around the rule for $(TARGET), maybe just after the rule "_distclean".
Cheers,
Signature · 1 line
Anthony PERARD
Re: [PATCH v4 1/2] xen: asm-generic support
Quoted 23 lines · Anthony PERARD
xen/Makefile endif # need-sub-make · line 676
Quoted 13 lines · Oleksii Kurochko
xen/Makefile +0
-0@@ -667,6 +669,12 @@ endif # need-sub-makePHONY += FORCE
FORCE:xen/Makefile +5
-0+# Support for using generic headers in asm-generic +PHONY += asm-generic +asm-generic: + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ + obj=arch/$(SRCARCH)/include/generated/asmCould you introduce a $(asm-generic) macro in Kbuild.include like we already have for $(build) and $(clean)? As I think it would be nicer to
have
$(Q)$(MAKE) $(asm- generic)=arch/$(SRCARCH)/include/generated/asm
in the main makefile.
Quoted 5 lines
Also, could you move the rule "asm-generic" within the "!config- build"
part of theMakefile? Somewhere around the rule for $(TARGET), maybe just after the rule "_distclean".
I pushed a new patch version tomorrow. I'll rework it based on your comments here.
~ Oleksii
PATCH v4 2/2 xen: move arm/include/asm/vm_event.h to asm-generic
In reply to Oleksii Kurochkoasm/vm_event.h is common for ARM and RISC-V so it will be moved to asm-generic dir.
Original asm/vm_event.h from ARM was updated:
* use SPDX-License-Identifier.
* update comment messages of stubs.
* update #ifdef.
* change public/domctl.h to public/vm_event.h.
---
Changes in V4:
- update path of vm_event.h from include/asm-generic/asm to include/asm-generic
---
Changes in V3:
- add Acked-by: Stefano Stabellini <[email protected]> for "xen: move arm/include/asm/vm_event.h to asm-generic"
- update SPDX tag.
- move asm/vm_event.h to asm-generic.
---
Changes in V2:
- change public/domctl.h to public/vm_event.h.
- update commit message of [PATCH v2 2/2] xen: move arm/include/asm/vm_event.h to stubs
--- xen/include/asm-generic/vm_event.h | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 xen/include/asm-generic/vm_event.h
xen/include/asm-generic/vm_event.h new file +55 -0
@@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* vm_event.h: stubs for architecture specific vm_event handling routines +* +* Copyright (c) 2015 Tamas K Lengyel ([email protected]) +*/ + +#ifndef __ASM_GENERIC_VM_EVENT_H__ +#define __ASM_GENERIC_VM_EVENT_H__ + +#include <xen/sched.h> +#include <public/vm_event.h> + +static inline int vm_event_init_domain (struct domain *d) +{ +/* Nothing to do. */ +return 0 ; +} + +static inline void vm_event_cleanup_domain (struct domain *d) +{ +memset (&d->monitor,0 ,sizeof (d->monitor)); +} + +static inline void vm_event_toggle_singlestep (struct domain *d,struct vcpu *v, +vm_event_response_t *rsp) +{ +/* Nothing to do. */ +} + +static inline +void vm_event_register_write_resume (struct vcpu *v,vm_event_response_t *rsp) +{ +/* Nothing to do. */ +} + +static inline +void vm_event_emulate_check (struct vcpu *v,vm_event_response_t *rsp) +{ +/* Nothing to do. */ +} + +static inline +void vm_event_sync_event (struct vcpu *v,bool value) +{ +/* Nothing to do. */ +} + +static inline +void vm_event_reset_vmtrace (struct vcpu *v) +{ +/* Nothing to do. */ +} + +#endif /* __ASM_GENERIC_VM_EVENT_H__ */
Signature · 1 line
2.41.0
Re: [PATCH v4 2/2] xen: move arm/include/asm/vm_event.h to asm-generic
The change which adds generic-y += vm_event.h to ARM's Kbuild was lost during creation of the patch. Should be added in the next patch version
Quoted 99 lines · On Fri, Sep 1, 2023, 18:02 Oleksii Kurochko <[email protected]> wrote:
asm/vm_event.his common for ARM and RISC-V so it will be moved to asm-generic dir.Original
asm/vm_event.hfrom ARM was updated:
* use SPDX-License-Identifier.
* update comment messages of stubs.
* update #ifdef.
* changepublic/domctl.htopublic/vm_event.h.Signed-off-by Oleksii Kurochko <[email protected]>---
Changes in V4:
- update path ofvm_event.hfrominclude/asm-generic/asmtoinclude/asm-generic
---
Changes in V3:
- add Acked-by: Stefano Stabellini <[email protected]> for "xen:
movearm/include/asm/vm_event.hto asm-generic"
- update SPDX tag.
- moveasm/vm_event.hto asm-generic.
---
Changes in V2:
- changepublic/domctl.htopublic/vm_event.h.
- update commit message of [PATCH v2 2/2] xen: movearm/include/asm/vm_event.hto stubs--- xen/include/asm-generic/vm_event.h | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 xen/include/asm-generic/vm_event.hxen/include/asm-generic/vm_event.h new file +25
-0@@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* vm_event.h: stubs for architecture specific vm_event handling routines +* +* Copyright (c) 2015 Tamas K Lengyel ([email protected]) +*/ + +#ifndef __ASM_GENERIC_VM_EVENT_H__ +#define __ASM_GENERIC_VM_EVENT_H__ + +#include <xen/sched.h> +#include <public/vm_event.h> + +static inline int vm_event_init_domain (struct domain *d) +{ +/* Nothing to do. */ +return 0 ; +} + +static inline void vm_event_cleanup_domain (struct domain *d) +{ +memset (&d->monitor,0 ,sizeof (d->monitor)); +} + +static inline void vm_event_toggle_singlestep(struct domain *d, structvcpu *v,
xen/include/asm-generic/vm_event.h new file +7
-0+ vm_event_response_t *rsp) +{ +/* Nothing to do. */ +} + +static inline +void vm_event_register_write_resume(struct vcpu *v, vm_event_response_t*rsp)
xen/include/asm-generic/vm_event.h new file +23
-1+{ +/* Nothing to do. */ +} + +static inline +void vm_event_emulate_check (struct vcpu *v,vm_event_response_t *rsp) +{ +/* Nothing to do. */ +} + +static inline +void vm_event_sync_event (struct vcpu *v,bool value) +{ +/* Nothing to do. */ +} + +static inline +void vm_event_reset_vmtrace (struct vcpu *v) +{ +/* Nothing to do. */ +} + +#endif /* __ASM_GENERIC_VM_EVENT_H__ */ --2.41.0
Re: [PATCH v4 2/2] xen: move arm/include/asm/vm_event.h to asm-generic
Quoted 2 lines · Oleksii Kurochko
The change which adds generic-y +=
vm_event.hto ARM'sKbuildwas lost during creation of the patch. Should be added in the next patch version
Which I guess is an indication that ...
Quoted 6 lines
Quoted 3 lines · On Fri, Sep 1, 2023, 18:02 Oleksii Kurochko <[email protected]> wrote:
asm/vm_event.his common for ARM and RISC-V so it will be moved to asm-generic dir.
Quoted 8 lines
Quoted 8 lines
Original
asm/vm_event.hfrom ARM was updated:
* use SPDX-License-Identifier.
* update comment messages of stubs.
* update #ifdef.
* changepublic/domctl.htopublic/vm_event.h.Signed-off-by Oleksii Kurochko <[email protected]>
... any earlier acks would better have been dropped.
Jan
Re: [PATCH v4 2/2] xen: move arm/include/asm/vm_event.h to asm-generic
Quoted 22 lines · Jan Beulich
Quoted 4 lines · Oleksii Kurochko
The change which adds generic-y +=
vm_event.hto ARM'sKbuildwas lost
during creation of the patch. Should be added in the next patch versionWhich I guess is an indication that ...
Quoted 14 lines
Quoted 10 lines · On Fri, Sep 1, 2023, 18:02 Oleksii Kurochko <[email protected]> wrote:
asm/vm_event.his common for ARM and RISC-V so it will be moved to
asm-generic dir.Original
asm/vm_event.hfrom ARM was updated:
* use SPDX-License-Identifier.
* update comment messages of stubs.
* update #ifdef.
* changepublic/domctl.htopublic/vm_event.h.
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Signed-off-by Oleksii Kurochko <[email protected]>... any earlier acks would better have been dropped.
You are right. I will remove acked-by in the next patch series version.
~ Oleksii
Re: [PATCH v4 2/2] xen: move arm/include/asm/vm_event.h to asm-generic
In reply to Oleksii KurochkoQuoted 23 lines · Oleksii Kurochko
asm/vm_event.his common for ARM and RISC-V so it will be moved to asm-generic dir.Original
asm/vm_event.hfrom ARM was updated:
* use SPDX-License-Identifier.
* update comment messages of stubs.
* update #ifdef.
* changepublic/domctl.htopublic/vm_event.h.Signed-off-by Oleksii Kurochko <[email protected]>---
Changes in V4:
- update path ofvm_event.hfrominclude/asm-generic/asmtoinclude/asm-generic
---
Changes in V3:
- add Acked-by: Stefano Stabellini <[email protected]> for "xen: movearm/include/asm/vm_event.hto asm-generic"
- update SPDX tag.
- moveasm/vm_event.hto asm-generic.
---
Changes in V2:
- changepublic/domctl.htopublic/vm_event.h.
- update commit message of [PATCH v2 2/2] xen: movearm/include/asm/vm_event.hto stubs
Quoted 4 lines
--- xen/include/asm-generic/vm_event.h | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 xen/include/asm-generic/vm_event.h
But that's not "move" anymore, as the Arm header isn't being deleted.
Jan
Re: [PATCH v4 2/2] xen: move arm/include/asm/vm_event.h to asm-generic
Quoted 33 lines · Jan Beulich
Quoted 29 lines · Oleksii Kurochko
asm/vm_event.his common for ARM and RISC-V so it will be moved to asm-generic dir.Original
asm/vm_event.hfrom ARM was updated:
* use SPDX-License-Identifier.
* update comment messages of stubs.
* update #ifdef.
* changepublic/domctl.htopublic/vm_event.h.Signed-off-by Oleksii Kurochko <[email protected]>---
Changes in V4:
- update path ofvm_event.hfrominclude/asm-generic/asmtoinclude/asm-generic
---
Changes in V3:
- add Acked-by: Stefano Stabellini <[email protected]> for "xen: movearm/include/asm/vm_event.hto asm-generic"
- update SPDX tag.
- moveasm/vm_event.hto asm-generic.
---
Changes in V2:
- changepublic/domctl.htopublic/vm_event.h.
- update commit message of [PATCH v2 2/2] xen: movearm/include/asm/vm_event.hto stubs
---
xen/include/asm-generic/vm_event.h | 55
++++++++++++++++++++++++++++++Quoted 2 lines
1 file changed, 55 insertions(+)create mode 100644
xen/include/asm-generic/vm_event.h
Quoted 1 line
But that's not "move" anymore, as the Arm header isn't being deleted.
Yes, it is correct.
But I think we still have to remove it as this is not any sense to have the same file for ARM, PPC and RISC-V.