introduce stub directory to storing empty/stub headers
v6 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 V6:
- introduce $(asm-generic) macro in Kbuild.include.
- move "asm-generic" after the rule "__distclean".
- update the commit message.
---
Changes in V5:
- Update SPDX license.
- Remove code related to UML in Makefile.asm-generic.
- Include $(src)/Makefile instead of $(kbuild-file).
- Update comment message in Makefile.asm-generic.
- Update .gitignore.
- Update path to generated headers in CFLAGS.
- Use the latest version of Linux's Makefile.asm-generic.
- Introduce asm-generic's vm_event.h.
- Switch ARM to use asm-generic/vm_event.h.
---
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
.gitignore | 1 + xen/Makefile | 9 +++- xen/arch/arm/include/asm/Makefile | 2 + xen/arch/arm/include/asm/vm_event.h | 66 ----------------------------- xen/include/asm-generic/vm_event.h | 55 ++++++++++++++++++++++++ xen/scripts/Kbuild.include | 6 +++ xen/scripts/Makefile.asm-generic | 53 +++++++++++++++++++++++ 7 files changed, 125 insertions(+), 67 deletions(-) create mode 100644 xen/arch/arm/include/asm/Makefile delete mode 100644 xen/arch/arm/include/asm/vm_event.h 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 v6 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/Makefile
To use a generic header is needed to add to
arch/$(ARCH)/include/asm/Makefile :
generic-y += <name-of-header-file.h>
For each mentioned header in arch/$(ARCH)/include/asm/Makefile, the necessary wrapper in arch/$(ARCH)/include/generated/asm will be generated.
As the base Makefile.asm-generic from Linux kernel was taken. ( 06c2afb862f9da8 "Linux 6.5-rc1" ).
---
Changes in V6:
- introduce $(asm-generic) macro in Kbuild.include.
- move "asm-generic" after the rule "__distclean".
---
Changes in V5:
- Update the commit message
- Update SPDX license in Makefile.
- Remove code related to UML
- Include $(src)/Makefile instead of $(kbuild-file)
- Update comment message in Makefile.asm-generic
- Update .gitignore
- Update path to generated headers in CFLAGS.
- Use the latest version of Linux's Makefile.asm-generic
---
Changes in V4:
- introduce asm-generic support
- update commit message
---
Changes in V3:
- Rename stubs dir to asm-generic
---
Changes in V2:
- Nothing changed.
--- .gitignore | 1 + xen/Makefile | 9 +++++- xen/scripts/Kbuild.include | 6 ++++ xen/scripts/Makefile.asm-generic | 53 ++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 xen/scripts/Makefile.asm-generic
.gitignore +1 -0
@@ -267,6 +267,7 @@ xen/arch/*/efi/efi.h xen/arch/*/efi/pe.c xen/arch/*/efi/runtime.c xen/arch/*/include/asm/asm-offsets.h +xen/arch/*/include/generated xen/build-dir-cppcheck/ xen/common/config_data.S xen/common/config.gz
xen/Makefile +8 -1
@@ -438,6 +438,7 @@ ifdef building_out_of_srctree endif CFLAGS += -I$(srctree)/include CFLAGS += -I$(srctree)/arch/$(SRCARCH)/include +CFLAGS += -I$(objtree)/arch/$(SRCARCH)/include/generated # Note that link order matters! ALL_OBJS-y := common/built_in.o
@@ -580,16 +581,22 @@ _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 $(objtree)/arch/*/include/generated .PHONY: _distclean _distclean: clean rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out GTAGS GPATH GRTAGS GSYMS .config source +# Support for using generic headers in asm-generic +PHONY += asm-generic +asm-generic: + $(Q)$(MAKE) $(asm-generic)=arch/$(SRCARCH)/include/generated/asm + $(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
xen/scripts/Kbuild.include +6 -0
@@ -91,6 +91,12 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || e clang-ifversion = $(shell [ $(CONFIG_CLANG_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4)) +### +# Shorthand for $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic obj +# Usage: +# $(Q)$(MAKE) $(asm-generic)=dir +asm-generic := -f $(srctree)/scripts/Makefile.asm-generic obj + ### # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= # Usage:
xen/scripts/Makefile.asm-generic new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.41.0
Re: [PATCH v6 1/2] xen: asm-generic support
Quoted 17 lines · Oleksii Kurochko
xen/scripts/Makefile.asm-generic new file +11
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0-only +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Makefile +# and for each file listed in this file with generic-y creates +# a small wrapper file in arch/$(SRCARCH)/include/generated/asm. + +PHONY := all +all: +
xen/scripts/Makefile.asm-generic line 21
Quoted 10 lines
xen/scripts/Makefile.asm-generic new file +10
-0+src := $(subst /generated,,$(obj)) + +include $(srctree)/scripts/Kbuild.include +-include $(src)/Makefile + +redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y)) +redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f))) +redundant := $(sort $(redundant)) +$(if $(redundant),\ + $(warning redundant generic-y found in $(src)/Kbuild: $(redundant)))
This warning would need to say "$(src)/Makefile" now instead of Kbuild.
Beside this, patch looks fine to me:
Thanks,
Signature · 1 line
Anthony PERARD
Re: [PATCH v6 1/2] xen: asm-generic support
Quoted 27 lines · Anthony PERARD
Quoted 26 lines · Oleksii Kurochko
xen/scripts/Makefile.asm-generic new file +5
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0-only +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the filearch/$(SRCARCH)/include/asm/Makefile
xen/scripts/Makefile.asm-generic new file +13
-0+# and for each file listed in this file with generic-y creates +# a small wrapper file in arch/$(SRCARCH)/include/generated/asm. + +PHONY := all +all: + +src := $(subst /generated,,$(obj)) + +include $(srctree)/scripts/Kbuild.include +-include $(src)/Makefile + +redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y)) +redundant += $(foreach f, $(generic-y), $(if $(wildcard
Quoted 8 lines
Quoted 5 lines
$(srctree)/$(src)/$(f)),$(f)))
+redundant := $(sort $(redundant))
+$(if $(redundant),\
+ $(warning redundant generic-y found in $(src)/Kbuild:
$(redundant)))This warning would need to say "$(src)/Makefile" now instead of
Kbuild.
Thanks. Missed that.
Quoted 6 lines
Beside this, patch looks fine to me:
Reviewed-by Anthony PERARD <[email protected]>Thanks,
~ Oleksii
Re: [PATCH v6 1/2] xen: asm-generic support
In reply to Oleksii KurochkoQuoted 8 lines · Oleksii Kurochko
xen/scripts/Makefile.asm-generic new file +5
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0-only +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the file arch/$(SRCARCH)/include/asm/Makefile
xen/scripts/Makefile.asm-generic line 15
Quoted 10 lines
xen/scripts/Makefile.asm-generic new file +10
-0+# and for each file listed in this file with generic-y creates +# a small wrapper file in arch/$(SRCARCH)/include/generated/asm. + +PHONY := all +all: + +src := $(subst /generated,,$(obj)) + +include $(srctree)/scripts/Kbuild.include +-include $(src)/Makefile
With the definition of src above, is this correct for out-of-tree builds? You want to reference the Makefile in the source tree, ...
xen/scripts/Makefile.asm-generic line 18
Quoted 2 lines
xen/scripts/Makefile.asm-generic new file +2
-0+redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y)) +redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f)))
... much like $(srctree) is used here (and similarly again further down).
Jan
Re: [PATCH v6 1/2] xen: asm-generic support
Quoted 15 lines · Jan Beulich
Quoted 14 lines · Oleksii Kurochko
xen/scripts/Makefile.asm-generic new file +5
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0-only +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the filearch/$(SRCARCH)/include/asm/Makefile
xen/scripts/Makefile.asm-generic new file +5
-0+# and for each file listed in this file with generic-y creates +# a small wrapper file in arch/$(SRCARCH)/include/generated/asm. + +PHONY := all +all:
Quoted 8 lines
xen/scripts/Makefile.asm-generic line 15
Quoted 5 lines
xen/scripts/Makefile.asm-generic new file +5
-0+ +src := $(subst /generated,,$(obj)) + +include $(srctree)/scripts/Kbuild.include +-include $(src)/MakefileWith the definition of src above, is this correct for out-of-tree builds?
Logically you are right and I think it would be better to use $(srctree)/$src but it works for out-of-tree builds too.
$ CONTAINER_NO_PULL=1 CONTAINER=riscv64 ./automation/scripts/containerize make O=xen-build V=2 XEN_TARGET_ARCH=riscv64 -C xen build
$ ls -la xen/xen-build/arch/riscv/include/generated/asm/vm_event.h -rw-r--r--. 1 ok ok 34 вер 7 16:27 xen/xen- build/arch/riscv/include/generated/asm/vm_event.h
Quoted 9 lines
You want to reference the
Makefilein the source tree, ...Quoted 3 lines
xen/scripts/Makefile.asm-generic new file +2
-0+redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y)) +redundant += $(foreach f, $(generic-y), $(if $(wildcard$(srctree)/$(src)/$(f)),$(f)))
... much like $(srctree) is used here (and similarly again further down).
~ Oleksii
Jan Beulich
Acked-byRe: [PATCH v6 1/2] xen: asm-generic support
Quoted 27 lines · Oleksii
Quoted 15 lines · Jan Beulich
Quoted 14 lines · Oleksii Kurochko
xen/scripts/Makefile.asm-generic new file +5
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0-only +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the filearch/$(SRCARCH)/include/asm/Makefile
xen/scripts/Makefile.asm-generic new file +5
-0+# and for each file listed in this file with generic-y creates +# a small wrapper file in arch/$(SRCARCH)/include/generated/asm. + +PHONY := all +all:Quoted 8 lines
xen/scripts/Makefile.asm-generic line 15
Quoted 5 lines
xen/scripts/Makefile.asm-generic new file +5
-0+ +src := $(subst /generated,,$(obj)) + +include $(srctree)/scripts/Kbuild.include +-include $(src)/MakefileWith the definition of src above, is this correct for out-of-tree builds?
Logically you are right and I think it would be better to use $(srctree)/$src but it works for out-of-tree builds too.
Quoted 7 lines
$ CONTAINER_NO_PULL=1 CONTAINER=riscv64 ./automation/scripts/containerize make O=xen-build V=2 XEN_TARGET_ARCH=riscv64 -C xen build$ ls -la xen/xen-build/arch/riscv/include/generated/asm/vm_event.h -rw-r--r--. 1 ok ok 34 вер 7 16:27 xen/xen- build/arch/riscv/include/generated/asm/vm_event.h
Oh, right, aiui because of VPATH being set to $(srctree), and therefore in the absence of a Makefile in $(objtree)/$(src)/ it'll go look for one in $(srctree)/$(src)/. Never mind then:
Jan
Re: [PATCH v6 1/2] xen: asm-generic support
Quoted 37 lines · Jan Beulich
Quoted 28 lines · Oleksii
Quoted 16 lines · Jan Beulich
Quoted 15 lines · Oleksii Kurochko
xen/scripts/Makefile.asm-generic new file +5
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0-only +# include/asm-generic contains a lot of files that are used +# verbatim by several architectures. +# +# This Makefile reads the filearch/$(SRCARCH)/include/asm/Makefile
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 inarch/$(SRCARCH)/include/generated/asm.
xen/scripts/Makefile.asm-generic new file +3
-0+ +PHONY := all +all:Quoted 8 lines
xen/scripts/Makefile.asm-generic line 15
Quoted 5 lines
xen/scripts/Makefile.asm-generic new file +5
-0+ +src := $(subst /generated,,$(obj)) + +include $(srctree)/scripts/Kbuild.include +-include $(src)/MakefileWith the definition of src above, is this correct for out-of-tree builds?
Logically you are right and I think it would be better to use $(srctree)/$src but it works for out-of-tree builds too.
Quoted 7 lines
$ CONTAINER_NO_PULL=1 CONTAINER=riscv64 ./automation/scripts/containerize make O=xen-build V=2 XEN_TARGET_ARCH=riscv64 -C xen build$ ls -la xen/xen-build/arch/riscv/include/generated/asm/vm_event.h -rw-r--r--. 1 ok ok 34 вер 7 16:27 xen/xen- build/arch/riscv/include/generated/asm/vm_event.h
Quoted 6 lines
Oh, right, aiui because of VPATH being set to $(srctree), and therefore
in the absence of aMakefilein $(objtree)/$(src)/ it'll go look for one in $(srctree)/$(src)/. Never mind then:Acked-by Jan Beulich <[email protected]>
Thanks for explanation.
~ Oleksii
PATCH v6 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
* instead of "include <public/domctl.h>" -> "public/vm_event.h"
As vm_event.h was moved to asm-generic then it is needed to create Makefile in arm/include/asm/ and add generated-y += vm_event.h to it.
---
Changes in V6:
- update the commit message.
---
Changes in V5:
- Update the commit message
- Remove Acked-by:...
- Switch ARM to use asm-generic/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/arch/arm/include/asm/Makefile | 2 + xen/arch/arm/include/asm/vm_event.h | 66 ----------------------------- xen/include/asm-generic/vm_event.h | 55 ++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 66 deletions(-) create mode 100644 xen/arch/arm/include/asm/Makefile delete mode 100644 xen/arch/arm/include/asm/vm_event.h create mode 100644 xen/include/asm-generic/vm_event.h
xen/arch/arm/include/asm/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +generic-y += vm_event.h
xen/arch/arm/include/asm/vm_event.h deleted +0 -66
66 lines not on this page · raw message
xen/include/asm-generic/vm_event.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.41.0
Re: [PATCH v6 2/2] xen: move arm/include/asm/vm_event.h to asm-generic
xen/include/asm-generic/vm_event.h line 5
Quoted 8 lines · Oleksii Kurochko
xen/include/asm-generic/vm_event.h new file +5
-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])
Tamas is the maintainer of these files (no matter where they live), so please make sure to Cc him in order to get his ack.
xen/include/asm-generic/vm_event.h line 9
Quoted 4 lines
xen/include/asm-generic/vm_event.h new file +4
-0+*/ + +#ifndef __ASM_STUB_VM_EVENT_H__ +#define __ASM_STUB_VM_EVENT_H__
Nit: s/STUB/GENERIC/ ?
Jan
Re: [PATCH v6 2/2] xen: move arm/include/asm/vm_event.h to asm-generic
Quoted 14 lines · Jan Beulich
Quoted 9 lines · Oleksii Kurochko
xen/include/asm-generic/vm_event.h new file +3
-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])Tamas is the maintainer of these files (no matter where they live), so
please make sure to Cc him in order to get his ack.
Thanks. I'll add him to CC.
Quoted 7 lines
xen/include/asm-generic/vm_event.h line 9
Quoted 5 lines
+ */
xen/include/asm-generic/vm_event.h new file +3
-0+ +#ifndef __ASM_STUB_VM_EVENT_H__ +#define __ASM_STUB_VM_EVENT_H__Nit: s/STUB/GENERIC/ ?
Yeah, it should be generic. I'll update that. Thanks.
~ Oleksii
A message that is not in the archive (sent off-list or not yet received): CABfawhk00MNJ4nyzfDyoJq9w=3TyHzwDXOosXrOD-n-nrZRnig@mail.gmail.com
Re: [PATCH v6 2/2] xen: move arm/include/asm/vm_event.h to asm-generic
Quoted 20 lines · Tamas K Lengyel
Quoted 18 lines · Oleksii
Quoted 16 lines · Jan Beulich
Quoted 10 lines · Oleksii Kurochko
xen/include/asm-generic/vm_event.h new file +3
-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])Tamas is the maintainer of these files (no matter where they live),
so
please make sure to Cc him in order to get his ack.
Quoted 3 lines
Quoted 1 line
Thanks. I'll add him to CC.
Sent ack on v5 of the patch.
Thank you.
~ Oleksii