Skip to contentSkip to conversation

introduce stub directory to storing empty/stub headers

PATCH New Oleksii Kurochko 1 participant 3 messages Sep 7, 2023

lore
Share & tools
lore
#0 lore raw

v7 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 V7:
- update warning message in Makefile.asm-generic
- add Reviewed-by: Anthony PERARD <[email protected]> for patch 1
- add Acked-by: Jan Beulich <[email protected]> for patch 1
- update header guards in asm-generic/vm_event.h.
- add Acked-by: Tamas K Lengyel <[email protected]> for patch 2
---
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
#1 lore raw

PATCH v7 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 V7:
- update warning message in Makefile.asm-generic
- add Reviewed-by: Anthony PERARD <[email protected]>
- add Acked-by: Jan Beulich <[email protected]>
---
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
index 50273adb8d..287166f8fc 100644
@@ -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
index f57e5a596c..2dc5e3526d 100644
@@ -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
index 785a32c32e..c2bd8498e1 100644
@@ -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
#2 lore raw

PATCH v7 2/2 xen: move arm/include/asm/vm_event.h to asm-generic

In reply to Oleksii Kurochko

asm/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 V7:
- update guards in asm-generic/vm_event.h.
- add Acked-by: Tamas K Lengyel <[email protected]>
---
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
new file mode 100644
index 0000000000..821addb0bf
@@ -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