Skip to contentSkip to conversation

xen: Build system improvements, now with out-of-tree build!

PATCH Superseded Anthony PERARD 4 participants 110 messages Nov 25, 2021 – Jan 21, 2022

Subsystems (5)

v8 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v8 cover xen: Build system improvements, now with out-of-tree build!

Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-system-xen-v8

v8:
Mostly rework of v7. With many patch already applied.
Some detail changes that are spread through many patches:
- make cloc recipe should now work throughout the series, update of it is done in 3 patches.
- new patch "build: fix enforce unique symbols for recent clang version" to fix an issue with clang.
- introducing $(srctree) and $(objtree) earlier
- introducing $(srcdir) as shortcut for $(srctree)/$(src)
- introduce usage of -iquote instead of -I in some cases
More detail change log can be found in patches notes.

Also this v8 present a work-in-progress of the ability to do out-of-tree build without setting VPATH. This is presented as an alternative to force use of out-of-tree build. As the last patch show, it allows to build the xen-shim without the linkfarm and we don't need to make any other changes to any thing that build xen (osstest, distribution packages, xen.git, ..., and developers finger macros). The patches are only there as WIP / RFC as they were some concern about the usefulness and extra changes needed. We can decide whether those changes are good or if this is too much and we should force out-of-tree build for the hypervisor.

v7:
Out-of-tree build!

This mean many more patches. Everything after patch 27 is new.

There's a few new patch before that, but otherwise are rework of v6.

Hi,

I have work toward building Xen (the hypervisor) with Linux's build system, Kbuild.

The main reason for that is to be able to have out-of-tree build. It's annoying when a build fail because of the pvshim. Other benefit is a much faster rebuild, and make clean doesn't take ages, and better dependencies to figure out what needs to be rebuild.

Cheers,

Anthony PERARD (47):
build: factorise generation of the linker scripts
xen: move include/asm-* to arch/*/include/asm
build: generate "include/xen/compile.h" with if_changed
build: set XEN_BUILD_EFI earlier
build: adjust $(TARGET).efi creation in arch/arm
build: avoid re-executing the main Makefile by introducing build.mk
build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile
build: prepare to always invoke $(MAKE) from xen/, use $(obj)
build: rework test/livepatch/Makefile
build: rework cloc recipe
build: fix enforce unique symbols for recent clang version
build: build everything from the root dir, use obj=$subdir
build: introduce if_changed_deps
build: rename __LINKER__ to LINKER_SCRIPT
build: hook kconfig into xen build system xen/tools/kconfig: fix build with -Wdeclaration-after-statement
build: remove KBUILD_ specific from Makefile.host
build: handle always-y and hostprogs-always-y
build: start building the tools with the main makefiles
build: add headers path to CFLAGS once for all archs
build: generate x86's asm-macros.h with filechk
build: clean-up "clean" rules of duplication
build: rework "clean" to clean from the root dir
build: use main rune to build host binary x86's mkelf32 and mkreloc
build: rework coverage and ubsan CFLAGS handling build,x86: remove the need for build32.mk
build: grab common EFI source files in arch specific dir
build: replace $(BASEDIR) by $(objtree)
build: replace $(BASEDIR) and use $(srctree)
build: rework "headers*.chk" prerequisite in include/
build: specify source tree in include/ for prerequisite
build: shuffle main Makefile
build: adding out-of-tree support to the xen build
build: add %.E targets
RFC, no-VPATH: Kconfig: tell where Kconfig files are
RFC, no-VPATH: Kconfig: only ready auto.conf from objtree RFC, no-VPATH: build: remove --include-dir option from MAKEFLAGS WIP, no-VPATH: rework Makefile.host
RFC, no-VPATH: x86/boot: workaround gcc including the wrong file RFC, no-VPATH: prepend $(srctree) to source prerequisite WIP, no-VPATH: build object from generated C files
RFC, no-VPATH: workaround includes in xsm/flask
WIP, no-VPATH: build object from generated assembly source file WIP, no-VPATH: build object from S source to be in build_in.o WIP, no-VPATH: build xen, out-of-tree!
RFC, no-VPATH: remove check for clean source tree for out-of-tree
builds
WIP: no more link farming for xen-shim

 .gitignore                                    |   6 +-
 MAINTAINERS                                   |  37 +-
 tools/firmware/xen-dir/Makefile               |  71 +--
 tools/include/Makefile                        |   2 +-
 tools/misc/xen-access.c                       |   4 +-
 tools/tests/vhpet/Makefile                    |   2 +-
 xen/Kconfig                                   |   4 +-
 xen/Makefile                                  | 367 +++++++++-------
 xen/Rules.mk                                  | 256 +++++++----
 xen/arch/arm/Makefile                         |  59 +--
 xen/arch/arm/README.LinuxPrimitives           |  10 +-
 xen/arch/arm/arch.mk                          |   4 +-
 xen/arch/arm/arm32/head.S                     |   2 +-
 xen/arch/arm/arm64/head.S                     |   2 +-
 xen/arch/arm/efi/Makefile                     |   4 +-
 .../asm-arm => arch/arm/include/asm}/acpi.h   |   0
 .../arm/include/asm}/alternative.h            |   0
 .../asm-arm => arch/arm/include/asm}/altp2m.h |   0
 .../arm/include/asm}/arm32/atomic.h           |   0
 .../arm/include/asm}/arm32/bitops.h           |   0
 .../arm/include/asm}/arm32/bug.h              |   0
 .../arm/include/asm}/arm32/cmpxchg.h          |   0
 .../arm/include/asm}/arm32/flushtlb.h         |   0
 .../arm/include/asm}/arm32/insn.h             |   0
 .../arm/include/asm}/arm32/io.h               |   0
 .../arm/include/asm}/arm32/macros.h           |   0
 .../arm/include/asm}/arm32/mm.h               |   0
 .../arm/include/asm}/arm32/page.h             |   0
 .../arm/include/asm}/arm32/processor.h        |   0
 .../arm/include/asm}/arm32/sysregs.h          |   0
 .../arm/include/asm}/arm32/system.h           |   0
 .../arm/include/asm}/arm32/traps.h            |   0
 .../arm/include/asm}/arm32/vfp.h              |   0
 .../arm/include/asm}/arm64/atomic.h           |   0
 .../arm/include/asm}/arm64/bitops.h           |   0
 .../arm/include/asm}/arm64/brk.h              |   0
 .../arm/include/asm}/arm64/bug.h              |   0
 .../arm/include/asm}/arm64/cmpxchg.h          |   0
 .../arm/include/asm}/arm64/cpufeature.h       |   0
 .../arm/include/asm}/arm64/efibind.h          |   0
 .../arm/include/asm}/arm64/flushtlb.h         |   0
 .../arm/include/asm}/arm64/hsr.h              |   0
 .../arm/include/asm}/arm64/insn.h             |   0
 .../arm/include/asm}/arm64/io.h               |   0
 .../arm/include/asm}/arm64/macros.h           |   0
 .../arm/include/asm}/arm64/mm.h               |   0
 .../arm/include/asm}/arm64/page.h             |   0
 .../arm/include/asm}/arm64/processor.h        |   0
 .../arm/include/asm}/arm64/sysregs.h          |   0
 .../arm/include/asm}/arm64/system.h           |   0
 .../arm/include/asm}/arm64/traps.h            |   0
 .../arm/include/asm}/arm64/vfp.h              |   0
 .../arm/include/asm}/asm_defns.h              |   0
 .../asm-arm => arch/arm/include/asm}/atomic.h |   0
 .../asm-arm => arch/arm/include/asm}/bitops.h |   0
 .../asm-arm => arch/arm/include/asm}/bug.h    |   0
 .../arm/include/asm}/byteorder.h              |   0
 .../asm-arm => arch/arm/include/asm}/cache.h  |   0
 .../arm/include/asm}/cadence-uart.h           |   0
 .../asm-arm => arch/arm/include/asm}/config.h |   2 +-
 .../asm-arm => arch/arm/include/asm}/cpregs.h |   0
 .../arm/include/asm}/cpuerrata.h              |   0
 .../arm/include/asm}/cpufeature.h             |   0
 .../arm/include/asm}/current.h                |   0
 .../arm/include/asm}/debugger.h               |   0
 .../asm-arm => arch/arm/include/asm}/delay.h  |   0
 .../asm-arm => arch/arm/include/asm}/desc.h   |   0
 .../asm-arm => arch/arm/include/asm}/device.h |   0
 .../asm-arm => arch/arm/include/asm}/div64.h  |   0
 .../asm-arm => arch/arm/include/asm}/domain.h |   0
 .../arm/include/asm}/domain_build.h           |   0
 .../arm/include/asm}/early_printk.h           |   0
 .../arm/include/asm}/efibind.h                |   0
 .../asm-arm => arch/arm/include/asm}/elf.h    |   0
 .../asm-arm => arch/arm/include/asm}/event.h  |   0
 .../arm/include/asm}/exynos4210-uart.h        |   0
 .../arm/include/asm}/flushtlb.h               |   0
 .../asm-arm => arch/arm/include/asm}/gic.h    |   0
 .../arm/include/asm}/gic_v3_defs.h            |   0
 .../arm/include/asm}/gic_v3_its.h             |   0
 .../arm/include/asm}/grant_table.h            |   0
 .../arm/include/asm}/guest_access.h           |   0
 .../arm/include/asm}/guest_atomics.h          |   0
 .../arm/include/asm}/guest_walk.h             |   0
 .../arm/include/asm}/hardirq.h                |   0
 .../asm-arm => arch/arm/include/asm}/hsr.h    |   0
 .../arm/include/asm}/hypercall.h              |   0
 .../asm-arm => arch/arm/include/asm}/init.h   |   0
 .../asm-arm => arch/arm/include/asm}/insn.h   |   0
 .../asm-arm => arch/arm/include/asm}/io.h     |   0
 .../asm-arm => arch/arm/include/asm}/iocap.h  |   0
 .../asm-arm => arch/arm/include/asm}/iommu.h  |   0
 .../arm/include/asm}/iommu_fwspec.h           |   0
 .../asm-arm => arch/arm/include/asm}/ioreq.h  |   0
 .../asm-arm => arch/arm/include/asm}/irq.h    |   0
 .../asm-arm => arch/arm/include/asm}/kernel.h |   0
 .../arm/include/asm}/livepatch.h              |   0
 .../asm-arm => arch/arm/include/asm}/lpae.h   |   0
 .../asm-arm => arch/arm/include/asm}/macros.h |   0
 .../arm/include/asm}/mem_access.h             |   0
 .../asm-arm => arch/arm/include/asm}/mm.h     |   0
 .../asm-arm => arch/arm/include/asm}/mmio.h   |   0
 .../arm/include/asm}/monitor.h                |   0
 .../arm/include/asm}/new_vgic.h               |   0
 .../asm-arm => arch/arm/include/asm}/nospec.h |   0
 .../asm-arm => arch/arm/include/asm}/numa.h   |   0
 .../asm-arm => arch/arm/include/asm}/p2m.h    |   0
 .../arm/include/asm}/page-bits.h              |   0
 .../asm-arm => arch/arm/include/asm}/page.h   |   0
 .../asm-arm => arch/arm/include/asm}/paging.h |   0
 .../asm-arm => arch/arm/include/asm}/pci.h    |   0
 .../asm-arm => arch/arm/include/asm}/percpu.h |   0
 .../asm-arm => arch/arm/include/asm}/perfc.h  |   0
 .../arm/include/asm}/perfc_defn.h             |   0
 .../arm/include/asm}/pl011-uart.h             |   0
 .../arm/include/asm}/platform.h               |   0
 .../arm/include/asm}/platforms/exynos5.h      |   0
 .../arm/include/asm}/platforms/midway.h       |   0
 .../arm/include/asm}/platforms/omap5.h        |   0
 .../arm/include/asm}/platforms/vexpress.h     |   0
 .../asm}/platforms/xilinx-zynqmp-eemi.h       |   0
 .../arm/include/asm}/processor.h              |   0
 .../arm/include/asm}/procinfo.h               |   0
 .../asm-arm => arch/arm/include/asm}/psci.h   |   0
 .../asm-arm => arch/arm/include/asm}/random.h |   0
 .../asm-arm => arch/arm/include/asm}/regs.h   |   0
 .../arm/include/asm}/scif-uart.h              |   0
 .../asm-arm => arch/arm/include/asm}/setup.h  |   0
 .../arm/include/asm}/short-desc.h             |   0
 .../asm-arm => arch/arm/include/asm}/smccc.h  |   0
 .../asm-arm => arch/arm/include/asm}/smp.h    |   0
 .../arm/include/asm}/softirq.h                |   0
 .../arm/include/asm}/spinlock.h               |   0
 .../asm-arm => arch/arm/include/asm}/string.h |   0
 .../arm/include/asm}/sysregs.h                |   0
 .../asm-arm => arch/arm/include/asm}/system.h |   0
 .../arm/include/asm}/tee/optee_msg.h          |   0
 .../arm/include/asm}/tee/optee_rpc_cmd.h      |   0
 .../arm/include/asm}/tee/optee_smc.h          |   0
 .../arm/include/asm}/tee/tee.h                |   0
 .../asm-arm => arch/arm/include/asm}/time.h   |   0
 .../asm-arm => arch/arm/include/asm}/trace.h  |   0
 .../asm-arm => arch/arm/include/asm}/traps.h  |   0
 .../asm-arm => arch/arm/include/asm}/types.h  |   0
 .../asm-arm => arch/arm/include/asm}/vfp.h    |   0
 .../arm/include/asm}/vgic-emul.h              |   0
 .../asm-arm => arch/arm/include/asm}/vgic.h   |   0
 .../arm/include/asm}/vm_event.h               |   0
 .../asm-arm => arch/arm/include/asm}/vpl011.h |   0
 .../asm-arm => arch/arm/include/asm}/vpsci.h  |   0
 .../asm-arm => arch/arm/include/asm}/vreg.h   |   0
 .../asm-arm => arch/arm/include/asm}/vtimer.h |   0
 .../arm/include/asm}/xenoprof.h               |   0
 xen/arch/arm/smpboot.c                        |   2 +-
 xen/arch/arm/vpsci.c                          |   2 +-
 xen/arch/riscv/arch.mk                        |   1 -
 .../riscv/include/asm}/config.h               |   0
 xen/arch/x86/Makefile                         | 204 ++++-----
 xen/arch/x86/Rules.mk                         |   4 +-
 xen/arch/x86/arch.mk                          |  54 ++-
 xen/arch/x86/boot/Makefile                    |  62 ++-
 xen/arch/x86/boot/build32.mk                  |  40 --
 xen/arch/x86/boot/head.S                      |   4 +-
 xen/arch/x86/efi/Makefile                     |  11 +-
 .../asm-x86 => arch/x86/include/asm}/acpi.h   |   0
 .../x86/include/asm}/alternative-asm.h        |   0
 .../x86/include/asm}/alternative.h            |   0
 .../asm-x86 => arch/x86/include/asm}/altp2m.h |   0
 .../asm-x86 => arch/x86/include/asm}/amd.h    |   0
 .../asm-x86 => arch/x86/include/asm}/apic.h   |   0
 .../x86/include/asm}/apicdef.h                |   0
 .../x86/include/asm}/asm-defns.h              |   0
 .../x86/include/asm}/asm_defns.h              |   0
 .../asm-x86 => arch/x86/include/asm}/atomic.h |   0
 .../asm-x86 => arch/x86/include/asm}/bitops.h |   0
 .../asm-x86 => arch/x86/include/asm}/bug.h    |   0
 .../x86/include/asm}/byteorder.h              |   0
 .../x86/include/asm}/bzimage.h                |   0
 .../asm-x86 => arch/x86/include/asm}/cache.h  |   0
 .../asm-x86 => arch/x86/include/asm}/compat.h |   0
 .../asm-x86 => arch/x86/include/asm}/config.h |   0
 .../x86/include/asm}/cpufeature.h             |   0
 .../x86/include/asm}/cpufeatures.h            |   0
 .../x86/include/asm}/cpufeatureset.h          |   0
 .../asm-x86 => arch/x86/include/asm}/cpuid.h  |   0
 .../x86/include/asm}/cpuidle.h                |   0
 .../x86/include/asm}/current.h                |   2 +-
 .../x86/include/asm}/debugger.h               |   0
 .../x86/include/asm}/debugreg.h               |   0
 .../asm-x86 => arch/x86/include/asm}/delay.h  |   0
 .../asm-x86 => arch/x86/include/asm}/desc.h   |   0
 .../asm-x86 => arch/x86/include/asm}/device.h |   0
 .../asm-x86 => arch/x86/include/asm}/div64.h  |   0
 .../x86/include/asm}/dom0_build.h             |   0
 .../asm-x86 => arch/x86/include/asm}/domain.h |   2 +-
 .../asm-x86 => arch/x86/include/asm}/e820.h   |   0
 .../asm-x86 => arch/x86/include/asm}/edd.h    |   0
 .../x86/include/asm}/efibind.h                |   0
 .../asm-x86 => arch/x86/include/asm}/elf.h    |   0
 .../asm-x86 => arch/x86/include/asm}/event.h  |   0
 .../asm-x86 => arch/x86/include/asm}/fixmap.h |   0
 .../x86/include/asm}/flushtlb.h               |   0
 .../x86/include/asm}/genapic.h                |   0
 .../x86/include/asm}/grant_table.h            |   0
 .../asm-x86 => arch/x86/include/asm}/guest.h  |   0
 .../x86/include/asm}/guest/hyperv-hcall.h     |   0
 .../x86/include/asm}/guest/hyperv-tlfs.h      |   0
 .../x86/include/asm}/guest/hyperv.h           |   0
 .../x86/include/asm}/guest/hypervisor.h       |   0
 .../x86/include/asm}/guest/pvh-boot.h         |   0
 .../x86/include/asm}/guest/xen-hcall.h        |   0
 .../x86/include/asm}/guest/xen.h              |   0
 .../x86/include/asm}/guest_access.h           |   0
 .../x86/include/asm}/guest_atomics.h          |   0
 .../x86/include/asm}/guest_pt.h               |   0
 .../asm-x86 => arch/x86/include/asm}/hap.h    |   0
 .../x86/include/asm}/hardirq.h                |   0
 .../asm-x86 => arch/x86/include/asm}/hpet.h   |   0
 .../x86/include/asm}/hvm/asid.h               |   0
 .../x86/include/asm}/hvm/cacheattr.h          |   0
 .../x86/include/asm}/hvm/domain.h             |   0
 .../x86/include/asm}/hvm/emulate.h            |   0
 .../x86/include/asm}/hvm/grant_table.h        |   0
 .../x86/include/asm}/hvm/guest_access.h       |   0
 .../x86/include/asm}/hvm/hvm.h                |   0
 .../asm-x86 => arch/x86/include/asm}/hvm/io.h |   0
 .../x86/include/asm}/hvm/ioreq.h              |   0
 .../x86/include/asm}/hvm/irq.h                |   0
 .../x86/include/asm}/hvm/monitor.h            |   0
 .../x86/include/asm}/hvm/nestedhvm.h          |   0
 .../x86/include/asm}/hvm/save.h               |   0
 .../x86/include/asm}/hvm/support.h            |   0
 .../x86/include/asm}/hvm/svm/asid.h           |   0
 .../x86/include/asm}/hvm/svm/emulate.h        |   0
 .../x86/include/asm}/hvm/svm/intr.h           |   0
 .../x86/include/asm}/hvm/svm/nestedsvm.h      |   0
 .../x86/include/asm}/hvm/svm/svm.h            |   0
 .../x86/include/asm}/hvm/svm/svmdebug.h       |   0
 .../x86/include/asm}/hvm/svm/vmcb.h           |   0
 .../x86/include/asm}/hvm/trace.h              |   0
 .../x86/include/asm}/hvm/vcpu.h               |   0
 .../x86/include/asm}/hvm/vioapic.h            |   0
 .../x86/include/asm}/hvm/viridian.h           |   0
 .../x86/include/asm}/hvm/vlapic.h             |   0
 .../x86/include/asm}/hvm/vm_event.h           |   0
 .../x86/include/asm}/hvm/vmx/vmcs.h           |   0
 .../x86/include/asm}/hvm/vmx/vmx.h            |   0
 .../x86/include/asm}/hvm/vmx/vvmx.h           |   0
 .../x86/include/asm}/hvm/vpic.h               |   0
 .../x86/include/asm}/hvm/vpt.h                |   0
 .../x86/include/asm}/hypercall.h              |   0
 .../asm-x86 => arch/x86/include/asm}/i387.h   |   0
 .../asm-x86 => arch/x86/include/asm}/init.h   |   0
 .../x86/include/asm}/invpcid.h                |   0
 .../asm-x86 => arch/x86/include/asm}/io.h     |   0
 .../x86/include/asm}/io_apic.h                |   0
 .../asm-x86 => arch/x86/include/asm}/iocap.h  |   0
 .../asm-x86 => arch/x86/include/asm}/iommu.h  |   0
 .../asm-x86 => arch/x86/include/asm}/ioreq.h  |   0
 .../asm-x86 => arch/x86/include/asm}/irq.h    |   0
 .../asm-x86 => arch/x86/include/asm}/ldt.h    |   0
 .../x86/include/asm}/livepatch.h              |   0
 .../x86/include/asm}/mach-default/bios_ebda.h |   0
 .../x86/include/asm}/mach-default/io_ports.h  |   0
 .../include/asm}/mach-default/irq_vectors.h   |   0
 .../include/asm}/mach-default/mach_mpparse.h  |   0
 .../include/asm}/mach-default/mach_mpspec.h   |   0
 .../x86/include/asm}/mach-generic/mach_apic.h |   0
 .../include/asm}/mach-generic/mach_mpparse.h  |   0
 .../x86/include/asm}/machine_kexec.h          |   0
 .../x86/include/asm}/mc146818rtc.h            |   0
 .../asm-x86 => arch/x86/include/asm}/mce.h    |   0
 .../x86/include/asm}/mem_access.h             |   0
 .../x86/include/asm}/mem_paging.h             |   0
 .../x86/include/asm}/mem_sharing.h            |   0
 .../x86/include/asm}/microcode.h              |   0
 .../asm-x86 => arch/x86/include/asm}/mm.h     |   0
 .../x86/include/asm}/monitor.h                |   0
 .../asm-x86 => arch/x86/include/asm}/mpspec.h |   0
 .../x86/include/asm}/mpspec_def.h             |   0
 .../asm-x86 => arch/x86/include/asm}/msi.h    |   0
 .../x86/include/asm}/msr-index.h              |   0
 .../asm-x86 => arch/x86/include/asm}/msr.h    |   0
 .../asm-x86 => arch/x86/include/asm}/mtrr.h   |   0
 .../x86/include/asm}/multicall.h              |   0
 .../asm-x86 => arch/x86/include/asm}/mwait.h  |   0
 .../asm-x86 => arch/x86/include/asm}/nmi.h    |   0
 .../asm-x86 => arch/x86/include/asm}/nops.h   |   0
 .../asm-x86 => arch/x86/include/asm}/nospec.h |   0
 .../asm-x86 => arch/x86/include/asm}/numa.h   |   0
 .../asm-x86 => arch/x86/include/asm}/p2m.h    |   0
 .../x86/include/asm}/page-bits.h              |   0
 .../asm-x86 => arch/x86/include/asm}/page.h   |   0
 .../asm-x86 => arch/x86/include/asm}/paging.h |   0
 .../asm-x86 => arch/x86/include/asm}/pci.h    |   0
 .../asm-x86 => arch/x86/include/asm}/percpu.h |   0
 .../asm-x86 => arch/x86/include/asm}/perfc.h  |   0
 .../x86/include/asm}/perfc_defn.h             |   0
 .../x86/include/asm}/processor.h              |   0
 .../asm-x86 => arch/x86/include/asm}/psr.h    |   0
 .../x86/include/asm}/pv/domain.h              |   0
 .../x86/include/asm}/pv/grant_table.h         |   0
 .../asm-x86 => arch/x86/include/asm}/pv/mm.h  |   0
 .../x86/include/asm}/pv/shim.h                |   0
 .../x86/include/asm}/pv/trace.h               |   0
 .../x86/include/asm}/pv/traps.h               |   0
 .../asm-x86 => arch/x86/include/asm}/random.h |   0
 .../asm-x86 => arch/x86/include/asm}/regs.h   |   0
 .../asm-x86 => arch/x86/include/asm}/setup.h  |   0
 .../asm-x86 => arch/x86/include/asm}/shadow.h |   0
 .../asm-x86 => arch/x86/include/asm}/shared.h |   0
 .../asm-x86 => arch/x86/include/asm}/smp.h    |   0
 .../x86/include/asm}/softirq.h                |   0
 .../x86/include/asm}/spec_ctrl.h              |   0
 .../x86/include/asm}/spec_ctrl_asm.h          |   0
 .../x86/include/asm}/spinlock.h               |   0
 .../asm-x86 => arch/x86/include/asm}/string.h |   0
 .../asm-x86 => arch/x86/include/asm}/system.h |   0
 .../asm-x86 => arch/x86/include/asm}/tboot.h  |   0
 .../asm-x86 => arch/x86/include/asm}/time.h   |   0
 .../asm-x86 => arch/x86/include/asm}/trace.h  |   0
 .../asm-x86 => arch/x86/include/asm}/traps.h  |   0
 .../asm-x86 => arch/x86/include/asm}/types.h  |   0
 .../x86/include/asm}/uaccess.h                |   0
 .../x86/include/asm}/unaligned.h              |   0
 .../x86/include/asm}/vm_event.h               |   0
 .../asm-x86 => arch/x86/include/asm}/vpmu.h   |   0
 .../x86/include/asm}/x86-defns.h              |   0
 .../x86/include/asm}/x86-vendors.h            |   0
 .../x86/include/asm}/x86_64/efibind.h         |   0
 .../x86/include/asm}/x86_64/elf.h             |   0
 .../x86/include/asm}/x86_64/page.h            |   0
 .../x86/include/asm}/x86_64/regs.h            |   0
 .../x86/include/asm}/x86_64/system.h          |   0
 .../x86/include/asm}/x86_64/uaccess.h         |   0
 .../x86/include/asm}/x86_emulate.h            |   2 +-
 .../x86/include/asm}/xenoprof.h               |   0
 .../asm-x86 => arch/x86/include/asm}/xstate.h |   0
 xen/build.mk                                  |  96 +++++
 xen/common/Makefile                           |  15 +-
 xen/common/efi/efi_common.mk                  |  16 +
 xen/common/efi/runtime.c                      |   2 +-
 xen/common/libelf/Makefile                    |   4 +-
 xen/common/libfdt/Makefile                    |   8 +-
 xen/common/page_alloc.c                       |   2 +-
 xen/include/Makefile                          |  74 ++--
 xen/include/xen/acpi.h                        |   5 +-
 xen/include/xen/bitmap.h                      |   2 +-
 xen/scripts/Kbuild.include                    |  69 ++-
 xen/scripts/Kconfig.include                   |   2 +-
 xen/scripts/Makefile.clean                    |  32 +-
 xen/{tools/kconfig => scripts}/Makefile.host  |  69 +--
 xen/test/Makefile                             |   7 +-
 xen/test/livepatch/Makefile                   | 213 ++++-----
 xen/tools/Makefile                            |  14 +-
 xen/tools/fixdep.c                            | 404 ++++++++++++++++++
 xen/tools/kconfig/Makefile                    |  15 +-
 xen/tools/kconfig/Makefile.kconfig            | 106 -----
 xen/tools/kconfig/confdata.c                  |  12 +-
 xen/xsm/flask/Makefile                        |  43 +-
 xen/xsm/flask/include/avc.h                   |   4 +-
 xen/xsm/flask/include/avc_ss.h                |   2 +-
 xen/xsm/flask/include/objsec.h                |   2 +-
 xen/xsm/flask/include/security.h              |   2 +-
 xen/xsm/flask/policy/mkaccess_vector.sh       |   7 +-
 xen/xsm/flask/ss/Makefile                     |   3 +-
 366 files changed, 1494 insertions(+), 958 deletions(-)
 rename xen/{include/asm-arm => arch/arm/include/asm}/acpi.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/alternative.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/altp2m.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/atomic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/bitops.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/bug.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/cmpxchg.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/flushtlb.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/insn.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/io.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/macros.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/mm.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/page.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/processor.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/sysregs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/system.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/traps.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/vfp.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/atomic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/bitops.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/brk.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/bug.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/cmpxchg.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/cpufeature.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/efibind.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/flushtlb.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/hsr.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/insn.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/io.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/macros.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/mm.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/page.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/processor.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/sysregs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/system.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/traps.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/vfp.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/asm_defns.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/atomic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/bitops.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/bug.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/byteorder.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/cache.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/cadence-uart.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/config.h (99%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/cpregs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/cpuerrata.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/cpufeature.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/current.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/debugger.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/delay.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/desc.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/device.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/div64.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/domain.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/domain_build.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/early_printk.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/efibind.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/elf.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/event.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/exynos4210-uart.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/flushtlb.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/gic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/gic_v3_defs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/gic_v3_its.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/grant_table.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/guest_access.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/guest_atomics.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/guest_walk.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/hardirq.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/hsr.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/hypercall.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/init.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/insn.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/io.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/iocap.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/iommu.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/iommu_fwspec.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/ioreq.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/irq.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/kernel.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/livepatch.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/lpae.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/macros.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/mem_access.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/mm.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/mmio.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/monitor.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/new_vgic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/nospec.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/numa.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/p2m.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/page-bits.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/page.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/paging.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/pci.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/percpu.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/perfc.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/perfc_defn.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/pl011-uart.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platform.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platforms/exynos5.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platforms/midway.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platforms/omap5.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platforms/vexpress.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platforms/xilinx-zynqmp-eemi.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/processor.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/procinfo.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/psci.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/random.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/regs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/scif-uart.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/setup.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/short-desc.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/smccc.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/smp.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/softirq.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/spinlock.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/string.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/sysregs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/system.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/tee/optee_msg.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/tee/optee_rpc_cmd.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/tee/optee_smc.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/tee/tee.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/time.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/trace.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/traps.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/types.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vfp.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vgic-emul.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vgic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vm_event.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vpl011.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vpsci.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vreg.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vtimer.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/xenoprof.h (100%)
 rename xen/{include/asm-riscv => arch/riscv/include/asm}/config.h (100%)
 delete mode 100644 xen/arch/x86/boot/build32.mk
 rename xen/{include/asm-x86 => arch/x86/include/asm}/acpi.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/alternative-asm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/alternative.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/altp2m.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/amd.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/apic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/apicdef.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/asm-defns.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/asm_defns.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/atomic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/bitops.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/bug.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/byteorder.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/bzimage.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cache.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/compat.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/config.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cpufeature.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cpufeatures.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cpufeatureset.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cpuid.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cpuidle.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/current.h (99%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/debugger.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/debugreg.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/delay.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/desc.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/device.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/div64.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/dom0_build.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/domain.h (99%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/e820.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/edd.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/efibind.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/elf.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/event.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/fixmap.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/flushtlb.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/genapic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/grant_table.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/hyperv-hcall.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/hyperv-tlfs.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/hyperv.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/hypervisor.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/pvh-boot.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/xen-hcall.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/xen.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest_access.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest_atomics.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest_pt.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hap.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hardirq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hpet.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/asid.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/cacheattr.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/domain.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/emulate.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/grant_table.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/guest_access.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/hvm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/io.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/ioreq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/irq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/monitor.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/nestedhvm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/save.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/support.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/asid.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/emulate.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/intr.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/nestedsvm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/svm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/svmdebug.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/vmcb.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/trace.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vcpu.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vioapic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/viridian.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vlapic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vm_event.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vmx/vmcs.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vmx/vmx.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vmx/vvmx.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vpic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vpt.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hypercall.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/i387.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/init.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/invpcid.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/io.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/io_apic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/iocap.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/iommu.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/ioreq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/irq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/ldt.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/livepatch.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-default/bios_ebda.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-default/io_ports.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-default/irq_vectors.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-default/mach_mpparse.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-default/mach_mpspec.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-generic/mach_apic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-generic/mach_mpparse.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/machine_kexec.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mc146818rtc.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mce.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mem_access.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mem_paging.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mem_sharing.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/microcode.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/monitor.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mpspec.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mpspec_def.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/msi.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/msr-index.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/msr.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mtrr.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/multicall.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mwait.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/nmi.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/nops.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/nospec.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/numa.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/p2m.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/page-bits.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/page.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/paging.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pci.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/percpu.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/perfc.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/perfc_defn.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/processor.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/psr.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/domain.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/grant_table.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/mm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/shim.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/trace.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/traps.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/random.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/regs.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/setup.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/shadow.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/shared.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/smp.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/softirq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/spec_ctrl.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/spec_ctrl_asm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/spinlock.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/string.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/system.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/tboot.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/time.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/trace.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/traps.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/types.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/uaccess.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/unaligned.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/vm_event.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/vpmu.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86-defns.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86-vendors.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/efibind.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/elf.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/page.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/regs.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/system.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/uaccess.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_emulate.h (89%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/xenoprof.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/xstate.h (100%)
 create mode 100644 xen/build.mk
 create mode 100644 xen/common/efi/efi_common.mk
 rename xen/{tools/kconfig => scripts}/Makefile.host (74%)
 create mode 100644 xen/tools/fixdep.c
 delete mode 100644 xen/tools/kconfig/Makefile.kconfig
Signature · 1 line
Anthony PERARD
#1 lore raw

PATCH v8 1/47 build: factorise generation of the linker scripts

In Arm and X86 makefile, generating the linker script is the same, so we can simply have both call the same macro.

We need to add *.lds files into extra-y so that Rules.mk can find the .*.cmd dependency file and load it.

Change made to the command line:
- Use cpp_flags macro which simply filter -Wa,% options from $(a_flags).
- Added -D__LINKER__ even it is only used by Arm's lds.

---

Notes:
v6:
- CPP already used instead of CC -E
- -Ui386 already removed
- cpp_flags is now a macro
- rebased

v5:
- rename cc_lds_S to cpp_lds_S as the binary runned is now CPP
- Use new cpp_flags instead of the open-coded filter of a_flags.

v4:
- fix rebuild by adding FORCE as dependency
- Use $(CPP)
- remove -Ui386
- avoid using "define" for cmd_cc_lds_S, as adding '; \' on each line is still mandatory for if_changed (or cmd) macro to work.

 xen/Rules.mk          | 4 ++++
 xen/arch/arm/Makefile | 6 ++++--
 xen/arch/x86/Makefile | 6 ++++--
 3 files changed, 12 insertions(+), 4 deletions(-)
xen/Rules.mk +4 -0
index 5e0699e58b2b..d21930a7bf71 100644
@@ -238,6 +238,10 @@ cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
 %.s: %.S FORCE
 	$(call if_changed,cpp_s_S)
 
+# Linker scripts, .lds.S -> .lds
+quiet_cmd_cpp_lds_S = LDS     $@
+cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -D__LINKER__ -MQ $@ -o $@ $<
+
 # Add intermediate targets:
 # When building objects with specific suffix patterns, add intermediate
 # targets that the final targets are derived from.
xen/arch/arm/Makefile +4 -2
index 07f634508eee..a3a497bafe89 100644
@@ -67,6 +67,8 @@ obj-y += vsmc.o
 obj-y += vpsci.o
 obj-y += vuart.o
 
+extra-y += xen.lds
+
 #obj-bin-y += ....o
 
 ifneq ($(CONFIG_DTB_FILE),"")
@@ -132,8 +134,8 @@ $(TARGET)-syms: prelink.o xen.lds
 .PHONY: include
 include:
 
-xen.lds: xen.lds.S
-	$(CPP) -P $(a_flags) -D__LINKER__ -MQ $@ -o $@ $<
+xen.lds: xen.lds.S FORCE
+	$(call if_changed,cpp_lds_S)
 
 dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 
xen/arch/x86/Makefile +4 -2
index 69b6cfaded25..669e16e72690 100644
@@ -78,6 +78,7 @@ obj-y += sysctl.o
 endif
 
 extra-y += asm-macros.i
+extra-y += xen.lds
 
 ifneq ($(CONFIG_HVM),y)
 x86_emulate.o: CFLAGS-y += -Wno-unused-label
@@ -238,6 +239,7 @@ endif
 note_file_option ?= $(note_file)
 
 ifeq ($(XEN_BUILD_PE),y)
+extra-y += efi.lds
 $(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
 ifeq ($(CONFIG_DEBUG_INFO),y)
 	$(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug info from $(@F)"
@@ -290,8 +292,8 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
 	$(call move-if-changed,[email protected],$@)
 
 efi.lds: AFLAGS-y += -DEFI
-xen.lds efi.lds: xen.lds.S
-	$(CPP) -P $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
+xen.lds efi.lds: xen.lds.S FORCE
+	$(call if_changed,cpp_lds_S)
 
 boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
Signature · 1 line
Anthony PERARD
#2 lore raw

Re: [XEN PATCH v8 01/47] build: factorise generation of the linker scripts

Hi Anthony,

Quoted 66 lines · Anthony PERARD

In Arm and X86 makefile, generating the linker script is the same, so we can simply have both call the same macro.

We need to add *.lds files into extra-y so that Rules.mk can find the .*.cmd dependency file and load it.

Change made to the command line:
- Use cpp_flags macro which simply filter -Wa,% options from $(a_flags).
- Added -D__LINKER__ even it is only used by Arm's lds.

---

Notes:
v6:
- CPP already used instead of CC -E
- -Ui386 already removed
- cpp_flags is now a macro
- rebased

v5:
- rename cc_lds_S to cpp_lds_S as the binary runned is now CPP
- Use new cpp_flags instead of the open-coded filter of a_flags.

v4:
- fix rebuild by adding FORCE as dependency
- Use $(CPP)
- remove -Ui386
- avoid using "define" for cmd_cc_lds_S, as adding '; \' on each line is still mandatory for if_changed (or cmd) macro to work.

  xen/Rules.mk          | 4 ++++
  xen/arch/arm/Makefile | 6 ++++--
  xen/arch/x86/Makefile | 6 ++++--
  3 files changed, 12 insertions(+), 4 deletions(-)
xen/Rules.mk +4 -0
index 5e0699e58b2b..d21930a7bf71 100644
@@ -238,6 +238,10 @@ cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
  %.s: %.S FORCE
  	$(call if_changed,cpp_s_S)
 
+# Linker scripts, .lds.S -> .lds
+quiet_cmd_cpp_lds_S = LDS     $@
+cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -D__LINKER__ -MQ $@ -o $@ $<
+
  # Add intermediate targets:
  # When building objects with specific suffix patterns, add intermediate
  # targets that the final targets are derived from.
xen/arch/arm/Makefile +2 -0
index 07f634508eee..a3a497bafe89 100644
@@ -67,6 +67,8 @@ obj-y += vsmc.o
  obj-y += vpsci.o
  obj-y += vuart.o
 
+extra-y += xen.lds
+
  #obj-bin-y += ....o
 
  ifneq ($(CONFIG_DTB_FILE),"")

xen/arch/arm/Makefile $(TARGET)-syms: prelink.o xen.lds · line 137

Quoted 6 lines
xen/arch/arm/Makefile +1 -2
@@ -132,8 +134,8 @@ $(TARGET)-syms: prelink.o xen.lds
  .PHONY: include
  include:
 
-xen.lds: xen.lds.S
-	$(CPP) -P $(a_flags) -D__LINKER__ -MQ $@ -o $@ $<
+xen.lds: xen.lds.S FORCE

Sorry, I haven't really followed the build system rework. Could you explain why it is necessary to add FORCE?

Quoted 25 lines
xen/arch/arm/Makefile +1 -0
+	$(call if_changed,cpp_lds_S)
 
  dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 
xen/arch/x86/Makefile +2 -0
index 69b6cfaded25..669e16e72690 100644
@@ -78,6 +78,7 @@ obj-y += sysctl.o
  endif
 
  extra-y += asm-macros.i
+extra-y += xen.lds
 
  ifneq ($(CONFIG_HVM),y)
  x86_emulate.o: CFLAGS-y += -Wno-unused-label
@@ -238,6 +239,7 @@ endif
  note_file_option ?= $(note_file)
 
  ifeq ($(XEN_BUILD_PE),y)
+extra-y += efi.lds
  $(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
  ifeq ($(CONFIG_DEBUG_INFO),y)
  	$(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug info from $(@F)"

xen/arch/x86/Makefile $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile · line 299

Quoted 10 lines
xen/arch/x86/Makefile +2 -2
@@ -290,8 +292,8 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
  	$(call move-if-changed,[email protected],$@)
 
  efi.lds: AFLAGS-y += -DEFI
-xen.lds efi.lds: xen.lds.S
-	$(CPP) -P $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
+xen.lds efi.lds: xen.lds.S FORCE
+	$(call if_changed,cpp_lds_S)
 
  boot/mkelf32: boot/mkelf32.c
  	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<

Cheers,

Signature · 1 line
Julien Grall
#3 lore raw

Re: [XEN PATCH v8 01/47] build: factorise generation of the linker scripts

Quoted 7 lines · Julien Grall
Quoted 5 lines · Anthony PERARD
xen/Rules.mk +4 -0
+# Linker scripts, .lds.S -> .lds
+quiet_cmd_cpp_lds_S = LDS     $@
+cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -D__LINKER__ -MQ $@ -o $@ $<
+
Quoted 6 lines

xen/arch/arm/Makefile $(TARGET)-syms: prelink.o xen.lds · line 138

Quoted 3 lines
xen/arch/arm/Makefile +2 -0
+xen.lds: xen.lds.S FORCE
+	$(call if_changed,cpp_lds_S)

Sorry, I haven't really followed the build system rework. Could you explain why it is necessary to add FORCE?

This new rules make use of a new macro "if_changed", and we need to execute this new macro every time, even if the source file hasn't been modified.

if_changed, in addition to checking if the source is newer than the target that make does, also compare the command line used to generate the target. If the command line have changed, the macro update the target.

The command line to execute is stored in "cmd_$1" variables, in this case "cmd_cpp_lds_S". The macro if_changed store the command line in the file ".${target-name}.cmd".

So, every time the macro if_changed is used, we need to tell make to always execute the recipe, thus FORCE.

Cheers,

Signature · 1 line
Anthony PERARD
Acked-by
#4 lore raw

Re: [XEN PATCH v8 01/47] build: factorise generation of the linker scripts

Hi,

Quoted 15 lines · Anthony PERARD
Quoted 7 lines · Julien Grall
Quoted 5 lines · Anthony PERARD
xen/Rules.mk +4 -0
+# Linker scripts, .lds.S -> .lds
+quiet_cmd_cpp_lds_S = LDS     $@
+cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -D__LINKER__ -MQ $@ -o $@ $<
+
Quoted 6 lines

xen/arch/arm/Makefile $(TARGET)-syms: prelink.o xen.lds · line 138

Quoted 3 lines
xen/arch/arm/Makefile +2 -0
+xen.lds: xen.lds.S FORCE
+	$(call if_changed,cpp_lds_S)

Sorry, I haven't really followed the build system rework. Could you explain why it is necessary to add FORCE?

Quoted 8 lines

This new rules make use of a new macro "if_changed", and we need to execute this new macro every time, even if the source file hasn't been modified.

if_changed, in addition to checking if the source is newer than the target that make does, also compare the command line used to generate the target. If the command line have changed, the macro update the target.

Ah, that's the part I was missing. Thanks for the clarification! With that:

Cheers,

Signature · 1 line
Julien Grall
#5 lore raw

PATCH v8 2/47 xen: move include/asm-* to arch/*/include/asm

In reply to Anthony PERARD

This avoid the need to create the symbolic link "include/asm".

Whenever a comment refer to an "asm" headers, this patch avoid spelling the arch when not needed to avoid some code churn.

One unrelated change is to sort entries in MAINTAINERS for "INTEL(R) VT FOR X86 (VT-X)"

---

Notes:
v8:
- in tools/include/Makefile, write ln -s $dir/asm xen/ instead of ln -s $dir/asm xen/asm.
- in common/page_alloc.c, fix comment specify the full location of the arch specific numa.h header (instead of just asm/numa.h).

v7:
- fix MAINTAINERS entry for arch-riscv
- move to arch/*/include/asm instead
- In most comment refering to an asm headers, avoid spelling the arch name when not needed.
That doesn't work "common/efi/runtime.c" as the description of Xen's stack is only in x86's "asm/current.h" and not in arm's "asm/current.h".
- sort entries in MAINTAINERS for "INTEL(R) VT FOR X86 (VT-X)"

 .gitignore                                    |  5 +--
 MAINTAINERS                                   | 37 +++++++++----------
 tools/include/Makefile                        |  2 +-
 tools/misc/xen-access.c                       |  4 +-
 tools/tests/vhpet/Makefile                    |  2 +-
 xen/Makefile                                  | 13 +++----
 xen/arch/arm/README.LinuxPrimitives           | 10 ++---
 xen/arch/arm/arch.mk                          |  1 +
 xen/arch/arm/arm32/head.S                     |  2 +-
 xen/arch/arm/arm64/head.S                     |  2 +-
 .../asm-arm => arch/arm/include/asm}/acpi.h   |  0
 .../arm/include/asm}/alternative.h            |  0
 .../asm-arm => arch/arm/include/asm}/altp2m.h |  0
 .../arm/include/asm}/arm32/atomic.h           |  0
 .../arm/include/asm}/arm32/bitops.h           |  0
 .../arm/include/asm}/arm32/bug.h              |  0
 .../arm/include/asm}/arm32/cmpxchg.h          |  0
 .../arm/include/asm}/arm32/flushtlb.h         |  0
 .../arm/include/asm}/arm32/insn.h             |  0
 .../arm/include/asm}/arm32/io.h               |  0
 .../arm/include/asm}/arm32/macros.h           |  0
 .../arm/include/asm}/arm32/mm.h               |  0
 .../arm/include/asm}/arm32/page.h             |  0
 .../arm/include/asm}/arm32/processor.h        |  0
 .../arm/include/asm}/arm32/sysregs.h          |  0
 .../arm/include/asm}/arm32/system.h           |  0
 .../arm/include/asm}/arm32/traps.h            |  0
 .../arm/include/asm}/arm32/vfp.h              |  0
 .../arm/include/asm}/arm64/atomic.h           |  0
 .../arm/include/asm}/arm64/bitops.h           |  0
 .../arm/include/asm}/arm64/brk.h              |  0
 .../arm/include/asm}/arm64/bug.h              |  0
 .../arm/include/asm}/arm64/cmpxchg.h          |  0
 .../arm/include/asm}/arm64/cpufeature.h       |  0
 .../arm/include/asm}/arm64/efibind.h          |  0
 .../arm/include/asm}/arm64/flushtlb.h         |  0
 .../arm/include/asm}/arm64/hsr.h              |  0
 .../arm/include/asm}/arm64/insn.h             |  0
 .../arm/include/asm}/arm64/io.h               |  0
 .../arm/include/asm}/arm64/macros.h           |  0
 .../arm/include/asm}/arm64/mm.h               |  0
 .../arm/include/asm}/arm64/page.h             |  0
 .../arm/include/asm}/arm64/processor.h        |  0
 .../arm/include/asm}/arm64/sysregs.h          |  0
 .../arm/include/asm}/arm64/system.h           |  0
 .../arm/include/asm}/arm64/traps.h            |  0
 .../arm/include/asm}/arm64/vfp.h              |  0
 .../arm/include/asm}/asm_defns.h              |  0
 .../asm-arm => arch/arm/include/asm}/atomic.h |  0
 .../asm-arm => arch/arm/include/asm}/bitops.h |  0
 .../asm-arm => arch/arm/include/asm}/bug.h    |  0
 .../arm/include/asm}/byteorder.h              |  0
 .../asm-arm => arch/arm/include/asm}/cache.h  |  0
 .../arm/include/asm}/cadence-uart.h           |  0
 .../asm-arm => arch/arm/include/asm}/config.h |  0
 .../asm-arm => arch/arm/include/asm}/cpregs.h |  0
 .../arm/include/asm}/cpuerrata.h              |  0
 .../arm/include/asm}/cpufeature.h             |  0
 .../arm/include/asm}/current.h                |  0
 .../arm/include/asm}/debugger.h               |  0
 .../asm-arm => arch/arm/include/asm}/delay.h  |  0
 .../asm-arm => arch/arm/include/asm}/desc.h   |  0
 .../asm-arm => arch/arm/include/asm}/device.h |  0
 .../asm-arm => arch/arm/include/asm}/div64.h  |  0
 .../asm-arm => arch/arm/include/asm}/domain.h |  0
 .../arm/include/asm}/domain_build.h           |  0
 .../arm/include/asm}/early_printk.h           |  0
 .../arm/include/asm}/efibind.h                |  0
 .../asm-arm => arch/arm/include/asm}/elf.h    |  0
 .../asm-arm => arch/arm/include/asm}/event.h  |  0
 .../arm/include/asm}/exynos4210-uart.h        |  0
 .../arm/include/asm}/flushtlb.h               |  0
 .../asm-arm => arch/arm/include/asm}/gic.h    |  0
 .../arm/include/asm}/gic_v3_defs.h            |  0
 .../arm/include/asm}/gic_v3_its.h             |  0
 .../arm/include/asm}/grant_table.h            |  0
 .../arm/include/asm}/guest_access.h           |  0
 .../arm/include/asm}/guest_atomics.h          |  0
 .../arm/include/asm}/guest_walk.h             |  0
 .../arm/include/asm}/hardirq.h                |  0
 .../asm-arm => arch/arm/include/asm}/hsr.h    |  0
 .../arm/include/asm}/hypercall.h              |  0
 .../asm-arm => arch/arm/include/asm}/init.h   |  0
 .../asm-arm => arch/arm/include/asm}/insn.h   |  0
 .../asm-arm => arch/arm/include/asm}/io.h     |  0
 .../asm-arm => arch/arm/include/asm}/iocap.h  |  0
 .../asm-arm => arch/arm/include/asm}/iommu.h  |  0
 .../arm/include/asm}/iommu_fwspec.h           |  0
 .../asm-arm => arch/arm/include/asm}/ioreq.h  |  0
 .../asm-arm => arch/arm/include/asm}/irq.h    |  0
 .../asm-arm => arch/arm/include/asm}/kernel.h |  0
 .../arm/include/asm}/livepatch.h              |  0
 .../asm-arm => arch/arm/include/asm}/lpae.h   |  0
 .../asm-arm => arch/arm/include/asm}/macros.h |  0
 .../arm/include/asm}/mem_access.h             |  0
 .../asm-arm => arch/arm/include/asm}/mm.h     |  0
 .../asm-arm => arch/arm/include/asm}/mmio.h   |  0
 .../arm/include/asm}/monitor.h                |  0
 .../arm/include/asm}/new_vgic.h               |  0
 .../asm-arm => arch/arm/include/asm}/nospec.h |  0
 .../asm-arm => arch/arm/include/asm}/numa.h   |  0
 .../asm-arm => arch/arm/include/asm}/p2m.h    |  0
 .../arm/include/asm}/page-bits.h              |  0
 .../asm-arm => arch/arm/include/asm}/page.h   |  0
 .../asm-arm => arch/arm/include/asm}/paging.h |  0
 .../asm-arm => arch/arm/include/asm}/pci.h    |  0
 .../asm-arm => arch/arm/include/asm}/percpu.h |  0
 .../asm-arm => arch/arm/include/asm}/perfc.h  |  0
 .../arm/include/asm}/perfc_defn.h             |  0
 .../arm/include/asm}/pl011-uart.h             |  0
 .../arm/include/asm}/platform.h               |  0
 .../arm/include/asm}/platforms/exynos5.h      |  0
 .../arm/include/asm}/platforms/midway.h       |  0
 .../arm/include/asm}/platforms/omap5.h        |  0
 .../arm/include/asm}/platforms/vexpress.h     |  0
 .../asm}/platforms/xilinx-zynqmp-eemi.h       |  0
 .../arm/include/asm}/processor.h              |  0
 .../arm/include/asm}/procinfo.h               |  0
 .../asm-arm => arch/arm/include/asm}/psci.h   |  0
 .../asm-arm => arch/arm/include/asm}/random.h |  0
 .../asm-arm => arch/arm/include/asm}/regs.h   |  0
 .../arm/include/asm}/scif-uart.h              |  0
 .../asm-arm => arch/arm/include/asm}/setup.h  |  0
 .../arm/include/asm}/short-desc.h             |  0
 .../asm-arm => arch/arm/include/asm}/smccc.h  |  0
 .../asm-arm => arch/arm/include/asm}/smp.h    |  0
 .../arm/include/asm}/softirq.h                |  0
 .../arm/include/asm}/spinlock.h               |  0
 .../asm-arm => arch/arm/include/asm}/string.h |  0
 .../arm/include/asm}/sysregs.h                |  0
 .../asm-arm => arch/arm/include/asm}/system.h |  0
 .../arm/include/asm}/tee/optee_msg.h          |  0
 .../arm/include/asm}/tee/optee_rpc_cmd.h      |  0
 .../arm/include/asm}/tee/optee_smc.h          |  0
 .../arm/include/asm}/tee/tee.h                |  0
 .../asm-arm => arch/arm/include/asm}/time.h   |  0
 .../asm-arm => arch/arm/include/asm}/trace.h  |  0
 .../asm-arm => arch/arm/include/asm}/traps.h  |  0
 .../asm-arm => arch/arm/include/asm}/types.h  |  0
 .../asm-arm => arch/arm/include/asm}/vfp.h    |  0
 .../arm/include/asm}/vgic-emul.h              |  0
 .../asm-arm => arch/arm/include/asm}/vgic.h   |  0
 .../arm/include/asm}/vm_event.h               |  0
 .../asm-arm => arch/arm/include/asm}/vpl011.h |  0
 .../asm-arm => arch/arm/include/asm}/vpsci.h  |  0
 .../asm-arm => arch/arm/include/asm}/vreg.h   |  0
 .../asm-arm => arch/arm/include/asm}/vtimer.h |  0
 .../arm/include/asm}/xenoprof.h               |  0
 xen/arch/arm/smpboot.c                        |  2 +-
 xen/arch/arm/vpsci.c                          |  2 +-
 xen/arch/riscv/arch.mk                        |  1 +
 .../riscv/include/asm}/config.h               |  0
 xen/arch/x86/Makefile                         |  6 +--
 xen/arch/x86/arch.mk                          |  5 ++-
 .../asm-x86 => arch/x86/include/asm}/acpi.h   |  0
 .../x86/include/asm}/alternative-asm.h        |  0
 .../x86/include/asm}/alternative.h            |  0
 .../asm-x86 => arch/x86/include/asm}/altp2m.h |  0
 .../asm-x86 => arch/x86/include/asm}/amd.h    |  0
 .../asm-x86 => arch/x86/include/asm}/apic.h   |  0
 .../x86/include/asm}/apicdef.h                |  0
 .../x86/include/asm}/asm-defns.h              |  0
 .../x86/include/asm}/asm_defns.h              |  0
 .../asm-x86 => arch/x86/include/asm}/atomic.h |  0
 .../asm-x86 => arch/x86/include/asm}/bitops.h |  0
 .../asm-x86 => arch/x86/include/asm}/bug.h    |  0
 .../x86/include/asm}/byteorder.h              |  0
 .../x86/include/asm}/bzimage.h                |  0
 .../asm-x86 => arch/x86/include/asm}/cache.h  |  0
 .../asm-x86 => arch/x86/include/asm}/compat.h |  0
 .../asm-x86 => arch/x86/include/asm}/config.h |  0
 .../x86/include/asm}/cpufeature.h             |  0
 .../x86/include/asm}/cpufeatures.h            |  0
 .../x86/include/asm}/cpufeatureset.h          |  0
 .../asm-x86 => arch/x86/include/asm}/cpuid.h  |  0
 .../x86/include/asm}/cpuidle.h                |  0
 .../x86/include/asm}/current.h                |  2 +-
 .../x86/include/asm}/debugger.h               |  0
 .../x86/include/asm}/debugreg.h               |  0
 .../asm-x86 => arch/x86/include/asm}/delay.h  |  0
 .../asm-x86 => arch/x86/include/asm}/desc.h   |  0
 .../asm-x86 => arch/x86/include/asm}/device.h |  0
 .../asm-x86 => arch/x86/include/asm}/div64.h  |  0
 .../x86/include/asm}/dom0_build.h             |  0
 .../asm-x86 => arch/x86/include/asm}/domain.h |  2 +-
 .../asm-x86 => arch/x86/include/asm}/e820.h   |  0
 .../asm-x86 => arch/x86/include/asm}/edd.h    |  0
 .../x86/include/asm}/efibind.h                |  0
 .../asm-x86 => arch/x86/include/asm}/elf.h    |  0
 .../asm-x86 => arch/x86/include/asm}/event.h  |  0
 .../asm-x86 => arch/x86/include/asm}/fixmap.h |  0
 .../x86/include/asm}/flushtlb.h               |  0
 .../x86/include/asm}/genapic.h                |  0
 .../x86/include/asm}/grant_table.h            |  0
 .../asm-x86 => arch/x86/include/asm}/guest.h  |  0
 .../x86/include/asm}/guest/hyperv-hcall.h     |  0
 .../x86/include/asm}/guest/hyperv-tlfs.h      |  0
 .../x86/include/asm}/guest/hyperv.h           |  0
 .../x86/include/asm}/guest/hypervisor.h       |  0
 .../x86/include/asm}/guest/pvh-boot.h         |  0
 .../x86/include/asm}/guest/xen-hcall.h        |  0
 .../x86/include/asm}/guest/xen.h              |  0
 .../x86/include/asm}/guest_access.h           |  0
 .../x86/include/asm}/guest_atomics.h          |  0
 .../x86/include/asm}/guest_pt.h               |  0
 .../asm-x86 => arch/x86/include/asm}/hap.h    |  0
 .../x86/include/asm}/hardirq.h                |  0
 .../asm-x86 => arch/x86/include/asm}/hpet.h   |  0
 .../x86/include/asm}/hvm/asid.h               |  0
 .../x86/include/asm}/hvm/cacheattr.h          |  0
 .../x86/include/asm}/hvm/domain.h             |  0
 .../x86/include/asm}/hvm/emulate.h            |  0
 .../x86/include/asm}/hvm/grant_table.h        |  0
 .../x86/include/asm}/hvm/guest_access.h       |  0
 .../x86/include/asm}/hvm/hvm.h                |  0
 .../asm-x86 => arch/x86/include/asm}/hvm/io.h |  0
 .../x86/include/asm}/hvm/ioreq.h              |  0
 .../x86/include/asm}/hvm/irq.h                |  0
 .../x86/include/asm}/hvm/monitor.h            |  0
 .../x86/include/asm}/hvm/nestedhvm.h          |  0
 .../x86/include/asm}/hvm/save.h               |  0
 .../x86/include/asm}/hvm/support.h            |  0
 .../x86/include/asm}/hvm/svm/asid.h           |  0
 .../x86/include/asm}/hvm/svm/emulate.h        |  0
 .../x86/include/asm}/hvm/svm/intr.h           |  0
 .../x86/include/asm}/hvm/svm/nestedsvm.h      |  0
 .../x86/include/asm}/hvm/svm/svm.h            |  0
 .../x86/include/asm}/hvm/svm/svmdebug.h       |  0
 .../x86/include/asm}/hvm/svm/vmcb.h           |  0
 .../x86/include/asm}/hvm/trace.h              |  0
 .../x86/include/asm}/hvm/vcpu.h               |  0
 .../x86/include/asm}/hvm/vioapic.h            |  0
 .../x86/include/asm}/hvm/viridian.h           |  0
 .../x86/include/asm}/hvm/vlapic.h             |  0
 .../x86/include/asm}/hvm/vm_event.h           |  0
 .../x86/include/asm}/hvm/vmx/vmcs.h           |  0
 .../x86/include/asm}/hvm/vmx/vmx.h            |  0
 .../x86/include/asm}/hvm/vmx/vvmx.h           |  0
 .../x86/include/asm}/hvm/vpic.h               |  0
 .../x86/include/asm}/hvm/vpt.h                |  0
 .../x86/include/asm}/hypercall.h              |  0
 .../asm-x86 => arch/x86/include/asm}/i387.h   |  0
 .../asm-x86 => arch/x86/include/asm}/init.h   |  0
 .../x86/include/asm}/invpcid.h                |  0
 .../asm-x86 => arch/x86/include/asm}/io.h     |  0
 .../x86/include/asm}/io_apic.h                |  0
 .../asm-x86 => arch/x86/include/asm}/iocap.h  |  0
 .../asm-x86 => arch/x86/include/asm}/iommu.h  |  0
 .../asm-x86 => arch/x86/include/asm}/ioreq.h  |  0
 .../asm-x86 => arch/x86/include/asm}/irq.h    |  0
 .../asm-x86 => arch/x86/include/asm}/ldt.h    |  0
 .../x86/include/asm}/livepatch.h              |  0
 .../x86/include/asm}/mach-default/bios_ebda.h |  0
 .../x86/include/asm}/mach-default/io_ports.h  |  0
 .../include/asm}/mach-default/irq_vectors.h   |  0
 .../include/asm}/mach-default/mach_mpparse.h  |  0
 .../include/asm}/mach-default/mach_mpspec.h   |  0
 .../x86/include/asm}/mach-generic/mach_apic.h |  0
 .../include/asm}/mach-generic/mach_mpparse.h  |  0
 .../x86/include/asm}/machine_kexec.h          |  0
 .../x86/include/asm}/mc146818rtc.h            |  0
 .../asm-x86 => arch/x86/include/asm}/mce.h    |  0
 .../x86/include/asm}/mem_access.h             |  0
 .../x86/include/asm}/mem_paging.h             |  0
 .../x86/include/asm}/mem_sharing.h            |  0
 .../x86/include/asm}/microcode.h              |  0
 .../asm-x86 => arch/x86/include/asm}/mm.h     |  0
 .../x86/include/asm}/monitor.h                |  0
 .../asm-x86 => arch/x86/include/asm}/mpspec.h |  0
 .../x86/include/asm}/mpspec_def.h             |  0
 .../asm-x86 => arch/x86/include/asm}/msi.h    |  0
 .../x86/include/asm}/msr-index.h              |  0
 .../asm-x86 => arch/x86/include/asm}/msr.h    |  0
 .../asm-x86 => arch/x86/include/asm}/mtrr.h   |  0
 .../x86/include/asm}/multicall.h              |  0
 .../asm-x86 => arch/x86/include/asm}/mwait.h  |  0
 .../asm-x86 => arch/x86/include/asm}/nmi.h    |  0
 .../asm-x86 => arch/x86/include/asm}/nops.h   |  0
 .../asm-x86 => arch/x86/include/asm}/nospec.h |  0
 .../asm-x86 => arch/x86/include/asm}/numa.h   |  0
 .../asm-x86 => arch/x86/include/asm}/p2m.h    |  0
 .../x86/include/asm}/page-bits.h              |  0
 .../asm-x86 => arch/x86/include/asm}/page.h   |  0
 .../asm-x86 => arch/x86/include/asm}/paging.h |  0
 .../asm-x86 => arch/x86/include/asm}/pci.h    |  0
 .../asm-x86 => arch/x86/include/asm}/percpu.h |  0
 .../asm-x86 => arch/x86/include/asm}/perfc.h  |  0
 .../x86/include/asm}/perfc_defn.h             |  0
 .../x86/include/asm}/processor.h              |  0
 .../asm-x86 => arch/x86/include/asm}/psr.h    |  0
 .../x86/include/asm}/pv/domain.h              |  0
 .../x86/include/asm}/pv/grant_table.h         |  0
 .../asm-x86 => arch/x86/include/asm}/pv/mm.h  |  0
 .../x86/include/asm}/pv/shim.h                |  0
 .../x86/include/asm}/pv/trace.h               |  0
 .../x86/include/asm}/pv/traps.h               |  0
 .../asm-x86 => arch/x86/include/asm}/random.h |  0
 .../asm-x86 => arch/x86/include/asm}/regs.h   |  0
 .../asm-x86 => arch/x86/include/asm}/setup.h  |  0
 .../asm-x86 => arch/x86/include/asm}/shadow.h |  0
 .../asm-x86 => arch/x86/include/asm}/shared.h |  0
 .../asm-x86 => arch/x86/include/asm}/smp.h    |  0
 .../x86/include/asm}/softirq.h                |  0
 .../x86/include/asm}/spec_ctrl.h              |  0
 .../x86/include/asm}/spec_ctrl_asm.h          |  0
 .../x86/include/asm}/spinlock.h               |  0
 .../asm-x86 => arch/x86/include/asm}/string.h |  0
 .../asm-x86 => arch/x86/include/asm}/system.h |  0
 .../asm-x86 => arch/x86/include/asm}/tboot.h  |  0
 .../asm-x86 => arch/x86/include/asm}/time.h   |  0
 .../asm-x86 => arch/x86/include/asm}/trace.h  |  0
 .../asm-x86 => arch/x86/include/asm}/traps.h  |  0
 .../asm-x86 => arch/x86/include/asm}/types.h  |  0
 .../x86/include/asm}/uaccess.h                |  0
 .../x86/include/asm}/unaligned.h              |  0
 .../x86/include/asm}/vm_event.h               |  0
 .../asm-x86 => arch/x86/include/asm}/vpmu.h   |  0
 .../x86/include/asm}/x86-defns.h              |  0
 .../x86/include/asm}/x86-vendors.h            |  0
 .../x86/include/asm}/x86_64/efibind.h         |  0
 .../x86/include/asm}/x86_64/elf.h             |  0
 .../x86/include/asm}/x86_64/page.h            |  0
 .../x86/include/asm}/x86_64/regs.h            |  0
 .../x86/include/asm}/x86_64/system.h          |  0
 .../x86/include/asm}/x86_64/uaccess.h         |  0
 .../x86/include/asm}/x86_emulate.h            |  2 +-
 .../x86/include/asm}/xenoprof.h               |  0
 .../asm-x86 => arch/x86/include/asm}/xstate.h |  0
 xen/common/efi/runtime.c                      |  2 +-
 xen/common/page_alloc.c                       |  2 +-
 xen/include/xen/acpi.h                        |  5 ++-
 xen/include/xen/bitmap.h                      |  2 +-
 332 files changed, 55 insertions(+), 56 deletions(-)
 rename xen/{include/asm-arm => arch/arm/include/asm}/acpi.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/alternative.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/altp2m.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/atomic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/bitops.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/bug.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/cmpxchg.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/flushtlb.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/insn.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/io.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/macros.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/mm.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/page.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/processor.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/sysregs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/system.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/traps.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm32/vfp.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/atomic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/bitops.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/brk.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/bug.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/cmpxchg.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/cpufeature.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/efibind.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/flushtlb.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/hsr.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/insn.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/io.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/macros.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/mm.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/page.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/processor.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/sysregs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/system.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/traps.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/arm64/vfp.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/asm_defns.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/atomic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/bitops.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/bug.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/byteorder.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/cache.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/cadence-uart.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/config.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/cpregs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/cpuerrata.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/cpufeature.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/current.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/debugger.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/delay.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/desc.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/device.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/div64.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/domain.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/domain_build.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/early_printk.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/efibind.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/elf.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/event.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/exynos4210-uart.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/flushtlb.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/gic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/gic_v3_defs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/gic_v3_its.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/grant_table.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/guest_access.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/guest_atomics.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/guest_walk.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/hardirq.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/hsr.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/hypercall.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/init.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/insn.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/io.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/iocap.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/iommu.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/iommu_fwspec.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/ioreq.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/irq.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/kernel.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/livepatch.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/lpae.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/macros.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/mem_access.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/mm.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/mmio.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/monitor.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/new_vgic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/nospec.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/numa.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/p2m.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/page-bits.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/page.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/paging.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/pci.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/percpu.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/perfc.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/perfc_defn.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/pl011-uart.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platform.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platforms/exynos5.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platforms/midway.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platforms/omap5.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platforms/vexpress.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/platforms/xilinx-zynqmp-eemi.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/processor.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/procinfo.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/psci.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/random.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/regs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/scif-uart.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/setup.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/short-desc.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/smccc.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/smp.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/softirq.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/spinlock.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/string.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/sysregs.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/system.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/tee/optee_msg.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/tee/optee_rpc_cmd.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/tee/optee_smc.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/tee/tee.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/time.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/trace.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/traps.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/types.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vfp.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vgic-emul.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vgic.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vm_event.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vpl011.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vpsci.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vreg.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/vtimer.h (100%)
 rename xen/{include/asm-arm => arch/arm/include/asm}/xenoprof.h (100%)
 rename xen/{include/asm-riscv => arch/riscv/include/asm}/config.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/acpi.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/alternative-asm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/alternative.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/altp2m.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/amd.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/apic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/apicdef.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/asm-defns.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/asm_defns.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/atomic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/bitops.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/bug.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/byteorder.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/bzimage.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cache.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/compat.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/config.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cpufeature.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cpufeatures.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cpufeatureset.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cpuid.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/cpuidle.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/current.h (99%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/debugger.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/debugreg.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/delay.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/desc.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/device.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/div64.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/dom0_build.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/domain.h (99%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/e820.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/edd.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/efibind.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/elf.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/event.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/fixmap.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/flushtlb.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/genapic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/grant_table.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/hyperv-hcall.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/hyperv-tlfs.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/hyperv.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/hypervisor.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/pvh-boot.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/xen-hcall.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest/xen.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest_access.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest_atomics.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/guest_pt.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hap.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hardirq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hpet.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/asid.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/cacheattr.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/domain.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/emulate.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/grant_table.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/guest_access.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/hvm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/io.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/ioreq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/irq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/monitor.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/nestedhvm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/save.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/support.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/asid.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/emulate.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/intr.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/nestedsvm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/svm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/svmdebug.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/svm/vmcb.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/trace.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vcpu.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vioapic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/viridian.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vlapic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vm_event.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vmx/vmcs.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vmx/vmx.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vmx/vvmx.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vpic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hvm/vpt.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/hypercall.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/i387.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/init.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/invpcid.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/io.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/io_apic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/iocap.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/iommu.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/ioreq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/irq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/ldt.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/livepatch.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-default/bios_ebda.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-default/io_ports.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-default/irq_vectors.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-default/mach_mpparse.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-default/mach_mpspec.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-generic/mach_apic.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mach-generic/mach_mpparse.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/machine_kexec.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mc146818rtc.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mce.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mem_access.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mem_paging.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mem_sharing.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/microcode.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/monitor.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mpspec.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mpspec_def.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/msi.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/msr-index.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/msr.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mtrr.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/multicall.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/mwait.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/nmi.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/nops.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/nospec.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/numa.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/p2m.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/page-bits.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/page.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/paging.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pci.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/percpu.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/perfc.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/perfc_defn.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/processor.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/psr.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/domain.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/grant_table.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/mm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/shim.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/trace.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/pv/traps.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/random.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/regs.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/setup.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/shadow.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/shared.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/smp.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/softirq.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/spec_ctrl.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/spec_ctrl_asm.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/spinlock.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/string.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/system.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/tboot.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/time.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/trace.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/traps.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/types.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/uaccess.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/unaligned.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/vm_event.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/vpmu.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86-defns.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86-vendors.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/efibind.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/elf.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/page.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/regs.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/system.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_64/uaccess.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/x86_emulate.h (89%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/xenoprof.h (100%)
 rename xen/{include/asm-x86 => arch/x86/include/asm}/xstate.h (100%)
.gitignore +2 -3
index 9513506dd948..841ba1c0a84c 100644
@@ -316,6 +316,7 @@ xen/arch/x86/boot/*.lnk
 xen/arch/x86/efi.lds
 xen/arch/x86/efi/check.efi
 xen/arch/x86/efi/mkreloc
+xen/arch/x86/include/asm/asm-macros.h
 xen/arch/*/xen.lds
 xen/arch/*/efi/boot.c
 xen/arch/*/efi/compat.c
@@ -323,12 +324,10 @@ xen/arch/*/efi/ebmalloc.c
 xen/arch/*/efi/efi.h
 xen/arch/*/efi/pe.c
 xen/arch/*/efi/runtime.c
+xen/arch/*/include/asm/asm-offsets.h
 xen/common/config_data.S
 xen/common/config.gz
 xen/include/headers*.chk
-xen/include/asm
-xen/include/asm-*/asm-offsets.h
-xen/include/asm-x86/asm-macros.h
 xen/include/compat/*
 xen/include/config/
 xen/include/generated/
MAINTAINERS +17 -20
index f67f70aed398..3f6ff32c05cd 100644
@@ -246,7 +246,6 @@ F:	xen/drivers/char/omap-uart.c
 F:	xen/drivers/char/pl011.c
 F:	xen/drivers/char/scif-uart.c
 F:	xen/drivers/passthrough/arm/
-F:	xen/include/asm-arm/
 F:	xen/include/public/arch-arm/
 F:	xen/include/public/arch-arm.h
 
@@ -292,10 +291,10 @@ EFI
 M:	Jan Beulich <[email protected]>
 S:	Supported
 F:	xen/arch/x86/efi/
+F:	xen/arch/x86/include/asm/efi*.h
+F:	xen/arch/x86/include/asm/x86_*/efi*.h
 F:	xen/common/efi/
 F:	xen/include/efi/
-F:	xen/include/asm-x86/efi*.h
-F:	xen/include/asm-x86/x86_*/efi*.h
 
 GDBSX DEBUGGER
 M:	Elena Ufimtseva <[email protected]>
@@ -321,8 +320,8 @@ F:	xen/include/xen/hypfs.h
 INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
 R:	Lukasz Hawrylko <[email protected]>
 S:	Odd Fixes
+F:	xen/arch/x86/include/asm/tboot.h
 F:	xen/arch/x86/tboot.c
-F:	xen/include/asm-x86/tboot.h
 
 INTEL(R) VT FOR DIRECTED I/O (VT-D)
 M:	Kevin Tian <[email protected]>
@@ -333,10 +332,10 @@ INTEL(R) VT FOR X86 (VT-X)
 M:	Jun Nakajima <[email protected]>
 M:	Kevin Tian <[email protected]>
 S:	Supported
+F:	xen/arch/x86/cpu/vpmu_intel.c
 F:	xen/arch/x86/hvm/vmx/
+F:	xen/arch/x86/include/asm/hvm/vmx/
 F:	xen/arch/x86/mm/p2m-ept.c
-F:	xen/include/asm-x86/hvm/vmx/
-F:	xen/arch/x86/cpu/vpmu_intel.c
 
 IOMMU VENDOR INDEPENDENT CODE
 M:	Jan Beulich <[email protected]>
@@ -412,10 +411,10 @@ M:	Ross Lagerwall <[email protected]>
 S:	Supported
 F:	docs/misc/livepatch.pandoc
 F:	tools/misc/xen-livepatch.c
+F:	xen/arch/*/include/asm/livepatch.h
 F:	xen/arch/*/livepatch*
 F:	xen/arch/*/*/livepatch*
 F:	xen/common/livepatch*
-F:	xen/include/asm-*/livepatch.h
 F:	xen/include/xen/livepatch*
 F:	xen/test/livepatch/*
 
@@ -485,7 +484,6 @@ R:	Connor Davis <[email protected]>
 S:	Supported
 F:	config/riscv64.mk
 F:	xen/arch/riscv/
-F:	xen/include/asm-riscv/
 
 RTDS SCHEDULER
 M:	Dario Faggioli <[email protected]>
@@ -514,8 +512,8 @@ F:	stubdom/
 TEE MEDIATORS
 M:	Volodymyr Babchuk <[email protected]>
 S:	Supported
+F:	xen/arch/arm/include/asm/tee
 F:	xen/arch/arm/tee/
-F:	xen/include/asm-arm/tee
 
 TOOLSTACK
 M:	Ian Jackson <[email protected]>
@@ -543,6 +541,8 @@ F:	tools/misc/xen-access.c
 F:	xen/arch/*/monitor.c
 F:	xen/arch/*/vm_event.c
 F:	xen/arch/arm/mem_access.c
+F:	xen/arch/x86/include/asm/hvm/monitor.h
+F:	xen/arch/x86/include/asm/hvm/vm_event.h
 F:	xen/arch/x86/mm/mem_access.c
 F:	xen/arch/x86/hvm/monitor.c
 F:	xen/arch/x86/hvm/vm_event.c
@@ -552,8 +552,6 @@ F:	xen/common/vm_event.c
 F:	xen/include/*/mem_access.h
 F:	xen/include/*/monitor.h
 F:	xen/include/*/vm_event.h
-F:	xen/include/asm-x86/hvm/monitor.h
-F:	xen/include/asm-x86/hvm/vm_event.h
 
 VPCI
 M:	Roger Pau Monné <[email protected]>
@@ -579,7 +577,6 @@ R:	Wei Liu <[email protected]>
 S:	Supported
 L:	[email protected]
 F:	xen/arch/x86/
-F:	xen/include/asm-x86/
 F:	xen/include/public/arch-x86/
 F:	xen/include/xen/lib/x86
 F:	xen/lib/x86
@@ -599,10 +596,10 @@ F:	xen/arch/x86/hvm/emulate.c
 F:	xen/arch/x86/hvm/intercept.c
 F:	xen/arch/x86/hvm/io.c
 F:	xen/arch/x86/hvm/ioreq.c
-F:	xen/include/asm-x86/hvm/emulate.h
-F:	xen/include/asm-x86/hvm/io.h
-F:	xen/include/asm-x86/hvm/ioreq.h
-F:	xen/include/asm-x86/ioreq.h
+F:	xen/arch/x86/include/asm/hvm/emulate.h
+F:	xen/arch/x86/include/asm/hvm/io.h
+F:	xen/arch/x86/include/asm/hvm/ioreq.h
+F:	xen/arch/x86/include/asm/ioreq.h
 
 X86 MEMORY MANAGEMENT
 M:	Jan Beulich <[email protected]>
@@ -634,10 +631,10 @@ M:	Wei Liu <[email protected]>
 S:	Supported
 F:	xen/arch/x86/guest/hyperv/
 F:	xen/arch/x86/hvm/viridian/
-F:	xen/include/asm-x86/guest/hyperv.h
-F:	xen/include/asm-x86/guest/hyperv-hcall.h
-F:	xen/include/asm-x86/guest/hyperv-tlfs.h
-F:	xen/include/asm-x86/hvm/viridian.h
+F:	xen/arch/x86/include/asm/guest/hyperv.h
+F:	xen/arch/x86/include/asm/guest/hyperv-hcall.h
+F:	xen/arch/x86/include/asm/guest/hyperv-tlfs.h
+F:	xen/arch/x86/include/asm/hvm/viridian.h
 
 XENSTORE
 M:	Ian Jackson <[email protected]>
tools/include/Makefile +1 -1
index 42605d46b937..d7b51006e032 100644
@@ -30,7 +30,7 @@ xen-dir:
 	ln -s $(XEN_ROOT)/xen/include/acpi/platform acpi/
 	ln -s $(XEN_ROOT)/xen/include/acpi/ac*.h acpi/
 ifeq ($(CONFIG_X86),y)
-	ln -s $(XEN_ROOT)/xen/include/asm-x86 xen/asm
+	ln -s $(XEN_ROOT)/xen/arch/x86/include/asm xen/
 	mkdir -p xen/lib/x86
 	ln -s $(filter-out %autogen.h,$(wildcard $(XEN_ROOT)/xen/include/xen/lib/x86/*.h)) xen/lib/x86/
 	ln -s $(XEN_ROOT)/xen/include/xen/lib/x86/Makefile xen/lib/x86/
tools/misc/xen-access.c +2 -2
index 4bbef0bd2e10..0731c20b8355 100644
@@ -56,11 +56,11 @@
 #define ERROR(a, b...) fprintf(stderr, a "\n", ## b)
 #define PERROR(a, b...) fprintf(stderr, a ": %s\n", ## b, strerror(errno))
 
-/* From xen/include/asm-x86/processor.h */
+/* From xen/arch/x86/include/asm/processor.h */
 #define X86_TRAP_DEBUG  1
 #define X86_TRAP_INT3   3
 
-/* From xen/include/asm-x86/x86-defns.h */
+/* From xen/arch/x86/include/asm/x86-defns.h */
 #define X86_CR4_PGE        0x00000080 /* enable global pages */
 
 typedef struct vm_event {
tools/tests/vhpet/Makefile +1 -1
index cb88dd01c5f8..2d56ffdfd9c5 100644
@@ -32,7 +32,7 @@ distclean: clean
 .PHONY: install
 install:
 
-hpet.h: $(XEN_ROOT)/xen/include/asm-x86/hpet.h
+hpet.h: $(XEN_ROOT)/xen/arch/x86/include/asm/hpet.h
 	cp $< $@
 
 hpet.c: $(XEN_ROOT)/xen/arch/x86/hvm/hpet.c
xen/Makefile +6 -7
index 1fd48af7ae82..b2a63edca1eb 100644
@@ -166,7 +166,7 @@ ifeq ($(TARGET_ARCH),x86)
 t1 = $(call as-insn,$(CC),".L0: .L1: .skip (.L1 - .L0)",,-no-integrated-as)
 
 # Check whether clang asm()-s support .include.
-t2 = $(call as-insn,$(CC) -I$(BASEDIR)/include,".include \"asm-x86/asm-defns.h\"",,-no-integrated-as)
+t2 = $(call as-insn,$(CC) -I$(BASEDIR)/arch/x86/include,".include \"asm/asm-defns.h\"",,-no-integrated-as)
 
 # Check whether clang keeps .macro-s between asm()-s:
 # https://bugs.llvm.org/show_bug.cgi?id=36110
@@ -382,7 +382,7 @@ _clean: delete-unfresh-files
 		-o -name ".*.o.tmp" -o -name "*~" -o -name "core" \
 		-o -name "*.gcno" -o -name ".*.cmd" -o -name "lib.a" \) -exec rm -f {} \;
 	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map *~ core
-	rm -f asm-offsets.s include/asm-*/asm-offsets.h
+	rm -f asm-offsets.s arch/*/include/asm/asm-offsets.h
 	rm -f .banner .allconfig.tmp
 
 .PHONY: _distclean
@@ -396,7 +396,6 @@ $(TARGET).gz: $(TARGET)
 $(TARGET): delete-unfresh-files
 	$(MAKE) -C tools
 	$(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
-	[ -e include/asm ] || ln -sf asm-$(TARGET_ARCH) include/asm
 	[ -e arch/$(TARGET_ARCH)/efi ] && for f in $$(cd common/efi; echo *.[ch]); \
 		do test -r arch/$(TARGET_ARCH)/efi/$$f || \
 		   ln -nsf ../../../common/efi/$$f arch/$(TARGET_ARCH)/efi/; \
@@ -404,7 +403,7 @@ $(TARGET): delete-unfresh-files
 		true
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C include
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) include
-	$(MAKE) -f $(BASEDIR)/Rules.mk include/asm-$(TARGET_ARCH)/asm-offsets.h
+	$(MAKE) -f $(BASEDIR)/Rules.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
 
 # drivers/char/console.o contains static banner/compile info. Blow it away.
@@ -450,7 +449,7 @@ asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o [email protected] -MQ $@ $<
 	$(call move-if-changed,[email protected],$@)
 
-include/asm-$(TARGET_ARCH)/asm-offsets.h: asm-offsets.s
+arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
 	@(set -e; \
 	  echo "/*"; \
 	  echo " * DO NOT MODIFY."; \
@@ -468,8 +467,8 @@ include/asm-$(TARGET_ARCH)/asm-offsets.h: asm-offsets.s
 
 SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
 define all_sources
-    ( find include/asm-$(TARGET_ARCH) -name '*.h' -print; \
-      find include -name 'asm-*' -prune -o -name '*.h' -print; \
+    ( find arch/$(TARGET_ARCH)/include -name '*.h' -print; \
+      find include -name '*.h' -print; \
       find $(SUBDIRS) -name '*.[chS]' -print )
 endef
 
xen/arch/arm/README.LinuxPrimitives +5 -5
index 664a9f89ed27..1d53e6a898da 100644
@@ -8,19 +8,19 @@ arm64:
 
 bitops: last sync @ v3.16-rc6 (last commit: 8715466b6027)
 
-linux/arch/arm64/include/asm/bitops.h   xen/include/asm-arm/arm64/bitops.h
+linux/arch/arm64/include/asm/bitops.h   xen/arch/arm/include/asm/arm64/bitops.h
 
 ---------------------------------------------------------------------
 
 cmpxchg: last sync @ v3.16-rc6 (last commit: e1dfda9ced9b)
 
-linux/arch/arm64/include/asm/cmpxchg.h  xen/include/asm-arm/arm64/cmpxchg.h
+linux/arch/arm64/include/asm/cmpxchg.h  xen/arch/arm/include/asm/arm64/cmpxchg.h
 
 ---------------------------------------------------------------------
 
 atomics: last sync @ v3.16-rc6 (last commit: 8715466b6027)
 
-linux/arch/arm64/include/asm/atomic.h   xen/include/asm-arm/arm64/atomic.h
+linux/arch/arm64/include/asm/atomic.h   xen/arch/arm/include/asm/arm64/atomic.h
 
 The following functions were taken from Linux:
     atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(),
@@ -76,13 +76,13 @@ diff -u ../linux/arch/arm/lib/findbit.S xen/arch/arm/arm32/lib/findbit.S
 
 cmpxchg: last sync @ v3.16-rc6 (last commit: c32ffce0f66e)
 
-linux/arch/arm/include/asm/cmpxchg.h    xen/include/asm-arm/arm32/cmpxchg.h
+linux/arch/arm/include/asm/cmpxchg.h    xen/arch/arm/include/asm/arm32/cmpxchg.h
 
 ---------------------------------------------------------------------
 
 atomics: last sync @ v3.16-rc6 (last commit: 030d0178bdbd)
 
-linux/arch/arm/include/asm/atomic.h     xen/include/asm-arm/arm32/atomic.h
+linux/arch/arm/include/asm/atomic.h     xen/arch/arm/include/asm/arm32/atomic.h
 
 The following functions were taken from Linux:
     atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(),
xen/arch/arm/arch.mk +1 -0
index 6a2982059486..c3ac443b3788 100644
@@ -2,6 +2,7 @@
 # arm-specific definitions
 
 CFLAGS += -I$(BASEDIR)/include
+CFLAGS += -I$(BASEDIR)/arch/$(TARGET_ARCH)/include
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
xen/arch/arm/arm32/head.S +1 -1
index 7178865f48c3..b5912d381b98 100644
@@ -599,7 +599,7 @@ remove_identity_mapping:
         strd  r2, r3, [r0, r1]
 
 identity_mapping_removed:
-        /* See asm-arm/arm32/flushtlb.h for the explanation of the sequence. */
+        /* See asm/arm32/flushtlb.h for the explanation of the sequence. */
         dsb   nshst
         mcr   CP32(r0, TLBIALLH)
         dsb   nsh
xen/arch/arm/arm64/head.S +1 -1
index aa1f88c76498..51b00ab0bea6 100644
@@ -737,7 +737,7 @@ remove_identity_mapping:
         str   xzr, [x0, x1, lsl #3]
 
 identity_mapping_removed:
-        /* See asm-arm/arm64/flushtlb.h for the explanation of the sequence. */
+        /* See asm/arm64/flushtlb.h for the explanation of the sequence. */
         dsb   nshst
         tlbi  alle2
         dsb   nsh
xen/arch/arm/include/asm/acpi.h renamed from xen/include/asm-arm/acpi.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/acpi.h
rename to xen/arch/arm/include/asm/acpi.h
xen/arch/arm/include/asm/alternative.h renamed from xen/include/asm-arm/alternative.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/alternative.h
rename to xen/arch/arm/include/asm/alternative.h
xen/arch/arm/include/asm/altp2m.h renamed from xen/include/asm-arm/altp2m.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/altp2m.h
rename to xen/arch/arm/include/asm/altp2m.h
xen/arch/arm/include/asm/arm32/atomic.h renamed from xen/include/asm-arm/arm32/atomic.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/atomic.h
rename to xen/arch/arm/include/asm/arm32/atomic.h
xen/arch/arm/include/asm/arm32/bitops.h renamed from xen/include/asm-arm/arm32/bitops.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/bitops.h
rename to xen/arch/arm/include/asm/arm32/bitops.h
xen/arch/arm/include/asm/arm32/bug.h renamed from xen/include/asm-arm/arm32/bug.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/bug.h
rename to xen/arch/arm/include/asm/arm32/bug.h
xen/arch/arm/include/asm/arm32/cmpxchg.h renamed from xen/include/asm-arm/arm32/cmpxchg.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/cmpxchg.h
rename to xen/arch/arm/include/asm/arm32/cmpxchg.h
xen/arch/arm/include/asm/arm32/flushtlb.h renamed from xen/include/asm-arm/arm32/flushtlb.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/flushtlb.h
rename to xen/arch/arm/include/asm/arm32/flushtlb.h
xen/arch/arm/include/asm/arm32/insn.h renamed from xen/include/asm-arm/arm32/insn.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/insn.h
rename to xen/arch/arm/include/asm/arm32/insn.h
xen/arch/arm/include/asm/arm32/io.h renamed from xen/include/asm-arm/arm32/io.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/io.h
rename to xen/arch/arm/include/asm/arm32/io.h
xen/arch/arm/include/asm/arm32/macros.h renamed from xen/include/asm-arm/arm32/macros.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/macros.h
rename to xen/arch/arm/include/asm/arm32/macros.h
xen/arch/arm/include/asm/arm32/mm.h renamed from xen/include/asm-arm/arm32/mm.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/mm.h
rename to xen/arch/arm/include/asm/arm32/mm.h
xen/arch/arm/include/asm/arm32/page.h renamed from xen/include/asm-arm/arm32/page.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/page.h
rename to xen/arch/arm/include/asm/arm32/page.h
xen/arch/arm/include/asm/arm32/processor.h renamed from xen/include/asm-arm/arm32/processor.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/processor.h
rename to xen/arch/arm/include/asm/arm32/processor.h
xen/arch/arm/include/asm/arm32/sysregs.h renamed from xen/include/asm-arm/arm32/sysregs.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/sysregs.h
rename to xen/arch/arm/include/asm/arm32/sysregs.h
xen/arch/arm/include/asm/arm32/system.h renamed from xen/include/asm-arm/arm32/system.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/system.h
rename to xen/arch/arm/include/asm/arm32/system.h
xen/arch/arm/include/asm/arm32/traps.h renamed from xen/include/asm-arm/arm32/traps.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/traps.h
rename to xen/arch/arm/include/asm/arm32/traps.h
xen/arch/arm/include/asm/arm32/vfp.h renamed from xen/include/asm-arm/arm32/vfp.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm32/vfp.h
rename to xen/arch/arm/include/asm/arm32/vfp.h
xen/arch/arm/include/asm/arm64/atomic.h renamed from xen/include/asm-arm/arm64/atomic.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/atomic.h
rename to xen/arch/arm/include/asm/arm64/atomic.h
xen/arch/arm/include/asm/arm64/bitops.h renamed from xen/include/asm-arm/arm64/bitops.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/bitops.h
rename to xen/arch/arm/include/asm/arm64/bitops.h
xen/arch/arm/include/asm/arm64/brk.h renamed from xen/include/asm-arm/arm64/brk.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/brk.h
rename to xen/arch/arm/include/asm/arm64/brk.h
xen/arch/arm/include/asm/arm64/bug.h renamed from xen/include/asm-arm/arm64/bug.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/bug.h
rename to xen/arch/arm/include/asm/arm64/bug.h
xen/arch/arm/include/asm/arm64/cmpxchg.h renamed from xen/include/asm-arm/arm64/cmpxchg.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/cmpxchg.h
rename to xen/arch/arm/include/asm/arm64/cmpxchg.h
xen/arch/arm/include/asm/arm64/cpufeature.h renamed from xen/include/asm-arm/arm64/cpufeature.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/cpufeature.h
rename to xen/arch/arm/include/asm/arm64/cpufeature.h
xen/arch/arm/include/asm/arm64/efibind.h renamed from xen/include/asm-arm/arm64/efibind.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/efibind.h
rename to xen/arch/arm/include/asm/arm64/efibind.h
xen/arch/arm/include/asm/arm64/flushtlb.h renamed from xen/include/asm-arm/arm64/flushtlb.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/flushtlb.h
rename to xen/arch/arm/include/asm/arm64/flushtlb.h
xen/arch/arm/include/asm/arm64/hsr.h renamed from xen/include/asm-arm/arm64/hsr.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/hsr.h
rename to xen/arch/arm/include/asm/arm64/hsr.h
xen/arch/arm/include/asm/arm64/insn.h renamed from xen/include/asm-arm/arm64/insn.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/insn.h
rename to xen/arch/arm/include/asm/arm64/insn.h
xen/arch/arm/include/asm/arm64/io.h renamed from xen/include/asm-arm/arm64/io.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/io.h
rename to xen/arch/arm/include/asm/arm64/io.h
xen/arch/arm/include/asm/arm64/macros.h renamed from xen/include/asm-arm/arm64/macros.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/macros.h
rename to xen/arch/arm/include/asm/arm64/macros.h
xen/arch/arm/include/asm/arm64/mm.h renamed from xen/include/asm-arm/arm64/mm.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/mm.h
rename to xen/arch/arm/include/asm/arm64/mm.h
xen/arch/arm/include/asm/arm64/page.h renamed from xen/include/asm-arm/arm64/page.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/page.h
rename to xen/arch/arm/include/asm/arm64/page.h
xen/arch/arm/include/asm/arm64/processor.h renamed from xen/include/asm-arm/arm64/processor.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/processor.h
rename to xen/arch/arm/include/asm/arm64/processor.h
xen/arch/arm/include/asm/arm64/sysregs.h renamed from xen/include/asm-arm/arm64/sysregs.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/sysregs.h
rename to xen/arch/arm/include/asm/arm64/sysregs.h
xen/arch/arm/include/asm/arm64/system.h renamed from xen/include/asm-arm/arm64/system.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/system.h
rename to xen/arch/arm/include/asm/arm64/system.h
xen/arch/arm/include/asm/arm64/traps.h renamed from xen/include/asm-arm/arm64/traps.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/traps.h
rename to xen/arch/arm/include/asm/arm64/traps.h
xen/arch/arm/include/asm/arm64/vfp.h renamed from xen/include/asm-arm/arm64/vfp.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/arm64/vfp.h
rename to xen/arch/arm/include/asm/arm64/vfp.h
xen/arch/arm/include/asm/asm_defns.h renamed from xen/include/asm-arm/asm_defns.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/asm_defns.h
rename to xen/arch/arm/include/asm/asm_defns.h
xen/arch/arm/include/asm/atomic.h renamed from xen/include/asm-arm/atomic.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/atomic.h
rename to xen/arch/arm/include/asm/atomic.h
xen/arch/arm/include/asm/bitops.h renamed from xen/include/asm-arm/bitops.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/bitops.h
rename to xen/arch/arm/include/asm/bitops.h
xen/arch/arm/include/asm/bug.h renamed from xen/include/asm-arm/bug.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/bug.h
rename to xen/arch/arm/include/asm/bug.h
xen/arch/arm/include/asm/byteorder.h renamed from xen/include/asm-arm/byteorder.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/byteorder.h
rename to xen/arch/arm/include/asm/byteorder.h
xen/arch/arm/include/asm/cache.h renamed from xen/include/asm-arm/cache.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/cache.h
rename to xen/arch/arm/include/asm/cache.h
xen/arch/arm/include/asm/cadence-uart.h renamed from xen/include/asm-arm/cadence-uart.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/cadence-uart.h
rename to xen/arch/arm/include/asm/cadence-uart.h
xen/arch/arm/include/asm/config.h renamed from xen/include/asm-arm/config.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/config.h
rename to xen/arch/arm/include/asm/config.h
xen/arch/arm/include/asm/cpregs.h renamed from xen/include/asm-arm/cpregs.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/cpregs.h
rename to xen/arch/arm/include/asm/cpregs.h
xen/arch/arm/include/asm/cpuerrata.h renamed from xen/include/asm-arm/cpuerrata.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/cpuerrata.h
rename to xen/arch/arm/include/asm/cpuerrata.h
xen/arch/arm/include/asm/cpufeature.h renamed from xen/include/asm-arm/cpufeature.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/cpufeature.h
rename to xen/arch/arm/include/asm/cpufeature.h
xen/arch/arm/include/asm/current.h renamed from xen/include/asm-arm/current.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/current.h
rename to xen/arch/arm/include/asm/current.h
xen/arch/arm/include/asm/debugger.h renamed from xen/include/asm-arm/debugger.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/debugger.h
rename to xen/arch/arm/include/asm/debugger.h
xen/arch/arm/include/asm/delay.h renamed from xen/include/asm-arm/delay.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/delay.h
rename to xen/arch/arm/include/asm/delay.h
xen/arch/arm/include/asm/desc.h renamed from xen/include/asm-arm/desc.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/desc.h
rename to xen/arch/arm/include/asm/desc.h
xen/arch/arm/include/asm/device.h renamed from xen/include/asm-arm/device.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/device.h
rename to xen/arch/arm/include/asm/device.h
xen/arch/arm/include/asm/div64.h renamed from xen/include/asm-arm/div64.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/div64.h
rename to xen/arch/arm/include/asm/div64.h
xen/arch/arm/include/asm/domain.h renamed from xen/include/asm-arm/domain.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/domain.h
rename to xen/arch/arm/include/asm/domain.h
xen/arch/arm/include/asm/domain_build.h renamed from xen/include/asm-arm/domain_build.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/domain_build.h
rename to xen/arch/arm/include/asm/domain_build.h
xen/arch/arm/include/asm/early_printk.h renamed from xen/include/asm-arm/early_printk.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/early_printk.h
rename to xen/arch/arm/include/asm/early_printk.h
xen/arch/arm/include/asm/efibind.h renamed from xen/include/asm-arm/efibind.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/efibind.h
rename to xen/arch/arm/include/asm/efibind.h
xen/arch/arm/include/asm/elf.h renamed from xen/include/asm-arm/elf.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/elf.h
rename to xen/arch/arm/include/asm/elf.h
xen/arch/arm/include/asm/event.h renamed from xen/include/asm-arm/event.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/event.h
rename to xen/arch/arm/include/asm/event.h
xen/arch/arm/include/asm/exynos4210-uart.h renamed from xen/include/asm-arm/exynos4210-uart.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/exynos4210-uart.h
rename to xen/arch/arm/include/asm/exynos4210-uart.h
xen/arch/arm/include/asm/flushtlb.h renamed from xen/include/asm-arm/flushtlb.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/flushtlb.h
rename to xen/arch/arm/include/asm/flushtlb.h
xen/arch/arm/include/asm/gic.h renamed from xen/include/asm-arm/gic.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/gic.h
rename to xen/arch/arm/include/asm/gic.h
xen/arch/arm/include/asm/gic_v3_defs.h renamed from xen/include/asm-arm/gic_v3_defs.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/gic_v3_defs.h
rename to xen/arch/arm/include/asm/gic_v3_defs.h
xen/arch/arm/include/asm/gic_v3_its.h renamed from xen/include/asm-arm/gic_v3_its.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/gic_v3_its.h
rename to xen/arch/arm/include/asm/gic_v3_its.h
xen/arch/arm/include/asm/grant_table.h renamed from xen/include/asm-arm/grant_table.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/grant_table.h
rename to xen/arch/arm/include/asm/grant_table.h
xen/arch/arm/include/asm/guest_access.h renamed from xen/include/asm-arm/guest_access.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/guest_access.h
rename to xen/arch/arm/include/asm/guest_access.h
xen/arch/arm/include/asm/guest_atomics.h renamed from xen/include/asm-arm/guest_atomics.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/guest_atomics.h
rename to xen/arch/arm/include/asm/guest_atomics.h
xen/arch/arm/include/asm/guest_walk.h renamed from xen/include/asm-arm/guest_walk.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/guest_walk.h
rename to xen/arch/arm/include/asm/guest_walk.h
xen/arch/arm/include/asm/hardirq.h renamed from xen/include/asm-arm/hardirq.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/hardirq.h
rename to xen/arch/arm/include/asm/hardirq.h
xen/arch/arm/include/asm/hsr.h renamed from xen/include/asm-arm/hsr.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/hsr.h
rename to xen/arch/arm/include/asm/hsr.h
xen/arch/arm/include/asm/hypercall.h renamed from xen/include/asm-arm/hypercall.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/hypercall.h
rename to xen/arch/arm/include/asm/hypercall.h
xen/arch/arm/include/asm/init.h renamed from xen/include/asm-arm/init.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/init.h
rename to xen/arch/arm/include/asm/init.h
xen/arch/arm/include/asm/insn.h renamed from xen/include/asm-arm/insn.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/insn.h
rename to xen/arch/arm/include/asm/insn.h
xen/arch/arm/include/asm/io.h renamed from xen/include/asm-arm/io.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/io.h
rename to xen/arch/arm/include/asm/io.h
xen/arch/arm/include/asm/iocap.h renamed from xen/include/asm-arm/iocap.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/iocap.h
rename to xen/arch/arm/include/asm/iocap.h
xen/arch/arm/include/asm/iommu.h renamed from xen/include/asm-arm/iommu.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/iommu.h
rename to xen/arch/arm/include/asm/iommu.h
xen/arch/arm/include/asm/iommu_fwspec.h renamed from xen/include/asm-arm/iommu_fwspec.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/iommu_fwspec.h
rename to xen/arch/arm/include/asm/iommu_fwspec.h
xen/arch/arm/include/asm/ioreq.h renamed from xen/include/asm-arm/ioreq.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/ioreq.h
rename to xen/arch/arm/include/asm/ioreq.h
xen/arch/arm/include/asm/irq.h renamed from xen/include/asm-arm/irq.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/irq.h
rename to xen/arch/arm/include/asm/irq.h
xen/arch/arm/include/asm/kernel.h renamed from xen/include/asm-arm/kernel.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/kernel.h
rename to xen/arch/arm/include/asm/kernel.h
xen/arch/arm/include/asm/livepatch.h renamed from xen/include/asm-arm/livepatch.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/livepatch.h
rename to xen/arch/arm/include/asm/livepatch.h
xen/arch/arm/include/asm/lpae.h renamed from xen/include/asm-arm/lpae.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/lpae.h
rename to xen/arch/arm/include/asm/lpae.h
xen/arch/arm/include/asm/macros.h renamed from xen/include/asm-arm/macros.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/macros.h
rename to xen/arch/arm/include/asm/macros.h
xen/arch/arm/include/asm/mem_access.h renamed from xen/include/asm-arm/mem_access.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/mem_access.h
rename to xen/arch/arm/include/asm/mem_access.h
xen/arch/arm/include/asm/mm.h renamed from xen/include/asm-arm/mm.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/mm.h
rename to xen/arch/arm/include/asm/mm.h
xen/arch/arm/include/asm/mmio.h renamed from xen/include/asm-arm/mmio.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/mmio.h
rename to xen/arch/arm/include/asm/mmio.h
xen/arch/arm/include/asm/monitor.h renamed from xen/include/asm-arm/monitor.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/monitor.h
rename to xen/arch/arm/include/asm/monitor.h
xen/arch/arm/include/asm/new_vgic.h renamed from xen/include/asm-arm/new_vgic.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/new_vgic.h
rename to xen/arch/arm/include/asm/new_vgic.h
xen/arch/arm/include/asm/nospec.h renamed from xen/include/asm-arm/nospec.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/nospec.h
rename to xen/arch/arm/include/asm/nospec.h
xen/arch/arm/include/asm/numa.h renamed from xen/include/asm-arm/numa.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/numa.h
rename to xen/arch/arm/include/asm/numa.h
xen/arch/arm/include/asm/p2m.h renamed from xen/include/asm-arm/p2m.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/p2m.h
rename to xen/arch/arm/include/asm/p2m.h
xen/arch/arm/include/asm/page-bits.h renamed from xen/include/asm-arm/page-bits.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/page-bits.h
rename to xen/arch/arm/include/asm/page-bits.h
xen/arch/arm/include/asm/page.h renamed from xen/include/asm-arm/page.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/page.h
rename to xen/arch/arm/include/asm/page.h
xen/arch/arm/include/asm/paging.h renamed from xen/include/asm-arm/paging.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/paging.h
rename to xen/arch/arm/include/asm/paging.h
xen/arch/arm/include/asm/pci.h renamed from xen/include/asm-arm/pci.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/pci.h
rename to xen/arch/arm/include/asm/pci.h
xen/arch/arm/include/asm/percpu.h renamed from xen/include/asm-arm/percpu.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/percpu.h
rename to xen/arch/arm/include/asm/percpu.h
xen/arch/arm/include/asm/perfc.h renamed from xen/include/asm-arm/perfc.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/perfc.h
rename to xen/arch/arm/include/asm/perfc.h
xen/arch/arm/include/asm/perfc_defn.h renamed from xen/include/asm-arm/perfc_defn.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/perfc_defn.h
rename to xen/arch/arm/include/asm/perfc_defn.h
xen/arch/arm/include/asm/pl011-uart.h renamed from xen/include/asm-arm/pl011-uart.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/pl011-uart.h
rename to xen/arch/arm/include/asm/pl011-uart.h
xen/arch/arm/include/asm/platform.h renamed from xen/include/asm-arm/platform.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/platform.h
rename to xen/arch/arm/include/asm/platform.h
xen/arch/arm/include/asm/platforms/exynos5.h renamed from xen/include/asm-arm/platforms/exynos5.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/platforms/exynos5.h
rename to xen/arch/arm/include/asm/platforms/exynos5.h
xen/arch/arm/include/asm/platforms/midway.h renamed from xen/include/asm-arm/platforms/midway.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/platforms/midway.h
rename to xen/arch/arm/include/asm/platforms/midway.h
xen/arch/arm/include/asm/platforms/omap5.h renamed from xen/include/asm-arm/platforms/omap5.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/platforms/omap5.h
rename to xen/arch/arm/include/asm/platforms/omap5.h
xen/arch/arm/include/asm/platforms/vexpress.h renamed from xen/include/asm-arm/platforms/vexpress.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/platforms/vexpress.h
rename to xen/arch/arm/include/asm/platforms/vexpress.h
xen/arch/arm/include/asm/platforms/xilinx-zynqmp-eemi.h renamed from xen/include/asm-arm/platforms/xilinx-zynqmp-eemi.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/platforms/xilinx-zynqmp-eemi.h
rename to xen/arch/arm/include/asm/platforms/xilinx-zynqmp-eemi.h
xen/arch/arm/include/asm/processor.h renamed from xen/include/asm-arm/processor.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/processor.h
rename to xen/arch/arm/include/asm/processor.h
xen/arch/arm/include/asm/procinfo.h renamed from xen/include/asm-arm/procinfo.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/procinfo.h
rename to xen/arch/arm/include/asm/procinfo.h
xen/arch/arm/include/asm/psci.h renamed from xen/include/asm-arm/psci.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/psci.h
rename to xen/arch/arm/include/asm/psci.h
xen/arch/arm/include/asm/random.h renamed from xen/include/asm-arm/random.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/random.h
rename to xen/arch/arm/include/asm/random.h
xen/arch/arm/include/asm/regs.h renamed from xen/include/asm-arm/regs.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/regs.h
rename to xen/arch/arm/include/asm/regs.h
xen/arch/arm/include/asm/scif-uart.h renamed from xen/include/asm-arm/scif-uart.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/scif-uart.h
rename to xen/arch/arm/include/asm/scif-uart.h
xen/arch/arm/include/asm/setup.h renamed from xen/include/asm-arm/setup.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/setup.h
rename to xen/arch/arm/include/asm/setup.h
xen/arch/arm/include/asm/short-desc.h renamed from xen/include/asm-arm/short-desc.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/short-desc.h
rename to xen/arch/arm/include/asm/short-desc.h
xen/arch/arm/include/asm/smccc.h renamed from xen/include/asm-arm/smccc.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/smccc.h
rename to xen/arch/arm/include/asm/smccc.h
xen/arch/arm/include/asm/smp.h renamed from xen/include/asm-arm/smp.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/smp.h
rename to xen/arch/arm/include/asm/smp.h
xen/arch/arm/include/asm/softirq.h renamed from xen/include/asm-arm/softirq.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/softirq.h
rename to xen/arch/arm/include/asm/softirq.h
xen/arch/arm/include/asm/spinlock.h renamed from xen/include/asm-arm/spinlock.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/spinlock.h
rename to xen/arch/arm/include/asm/spinlock.h
xen/arch/arm/include/asm/string.h renamed from xen/include/asm-arm/string.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/string.h
rename to xen/arch/arm/include/asm/string.h
xen/arch/arm/include/asm/sysregs.h renamed from xen/include/asm-arm/sysregs.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/sysregs.h
rename to xen/arch/arm/include/asm/sysregs.h
xen/arch/arm/include/asm/system.h renamed from xen/include/asm-arm/system.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/system.h
rename to xen/arch/arm/include/asm/system.h
xen/arch/arm/include/asm/tee/optee_msg.h renamed from xen/include/asm-arm/tee/optee_msg.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/tee/optee_msg.h
rename to xen/arch/arm/include/asm/tee/optee_msg.h
xen/arch/arm/include/asm/tee/optee_rpc_cmd.h renamed from xen/include/asm-arm/tee/optee_rpc_cmd.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/tee/optee_rpc_cmd.h
rename to xen/arch/arm/include/asm/tee/optee_rpc_cmd.h
xen/arch/arm/include/asm/tee/optee_smc.h renamed from xen/include/asm-arm/tee/optee_smc.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/tee/optee_smc.h
rename to xen/arch/arm/include/asm/tee/optee_smc.h
xen/arch/arm/include/asm/tee/tee.h renamed from xen/include/asm-arm/tee/tee.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/tee/tee.h
rename to xen/arch/arm/include/asm/tee/tee.h
xen/arch/arm/include/asm/time.h renamed from xen/include/asm-arm/time.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/time.h
rename to xen/arch/arm/include/asm/time.h
xen/arch/arm/include/asm/trace.h renamed from xen/include/asm-arm/trace.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/trace.h
rename to xen/arch/arm/include/asm/trace.h
xen/arch/arm/include/asm/traps.h renamed from xen/include/asm-arm/traps.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/traps.h
rename to xen/arch/arm/include/asm/traps.h
xen/arch/arm/include/asm/types.h renamed from xen/include/asm-arm/types.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/types.h
rename to xen/arch/arm/include/asm/types.h
xen/arch/arm/include/asm/vfp.h renamed from xen/include/asm-arm/vfp.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/vfp.h
rename to xen/arch/arm/include/asm/vfp.h
xen/arch/arm/include/asm/vgic-emul.h renamed from xen/include/asm-arm/vgic-emul.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/vgic-emul.h
rename to xen/arch/arm/include/asm/vgic-emul.h
xen/arch/arm/include/asm/vgic.h renamed from xen/include/asm-arm/vgic.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/vgic.h
rename to xen/arch/arm/include/asm/vgic.h
xen/arch/arm/include/asm/vm_event.h renamed from xen/include/asm-arm/vm_event.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/vm_event.h
rename to xen/arch/arm/include/asm/vm_event.h
xen/arch/arm/include/asm/vpl011.h renamed from xen/include/asm-arm/vpl011.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/vpl011.h
rename to xen/arch/arm/include/asm/vpl011.h
xen/arch/arm/include/asm/vpsci.h renamed from xen/include/asm-arm/vpsci.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/vpsci.h
rename to xen/arch/arm/include/asm/vpsci.h
xen/arch/arm/include/asm/vreg.h renamed from xen/include/asm-arm/vreg.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/vreg.h
rename to xen/arch/arm/include/asm/vreg.h
xen/arch/arm/include/asm/vtimer.h renamed from xen/include/asm-arm/vtimer.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/vtimer.h
rename to xen/arch/arm/include/asm/vtimer.h
xen/arch/arm/include/asm/xenoprof.h renamed from xen/include/asm-arm/xenoprof.h +0 -0
similarity index 100%
rename from xen/include/asm-arm/xenoprof.h
rename to xen/arch/arm/include/asm/xenoprof.h
xen/arch/arm/smpboot.c +1 -1
index 60c0e82fc559..7bfd0a73a7d2 100644
@@ -46,7 +46,7 @@ struct cpuinfo_arm cpu_data[NR_CPUS];
 /* CPU logical map: map xen cpuid to an MPIDR */
 register_t __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID };
 
-/* Fake one node for now. See also include/asm-arm/numa.h */
+/* Fake one node for now. See also asm/numa.h */
 nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 
 /* Xen stack for bringing up the first CPU. */
xen/arch/arm/vpsci.c +1 -1
index c1e250be5967..744d43ec2798 100644
@@ -278,7 +278,7 @@ bool do_vpsci_0_1_call(struct cpu_user_regs *regs, uint32_t fid)
 bool do_vpsci_0_2_call(struct cpu_user_regs *regs, uint32_t fid)
 {
     /*
-     * /!\ VPSCI_NR_FUNCS (in asm-arm/vpsci.h) should be updated when
+     * /!\ VPSCI_NR_FUNCS (in asm/vpsci.h) should be updated when
      * adding/removing a function. SCCC_SMCCC_*_REVISION should be
      * updated once per release.
      */
xen/arch/riscv/arch.mk +1 -0
index 53dadb897591..39ae6ffea94d 100644
@@ -12,3 +12,4 @@ riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
 
 CFLAGS += -march=$(riscv-march-y) -mstrict-align -mcmodel=medany
 CFLAGS += -I$(BASEDIR)/include
+CFLAGS += -I$(BASEDIR)/arch/$(TARGET_ARCH)/include
xen/arch/riscv/include/asm/config.h renamed from xen/include/asm-riscv/config.h +0 -0
similarity index 100%
rename from xen/include/asm-riscv/config.h
rename to xen/arch/riscv/include/asm/config.h
xen/arch/x86/Makefile +3 -3
index 669e16e72690..8db4cb98edbb 100644
@@ -273,11 +273,11 @@ efi/buildid.o efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o
 efi/buildid.o efi/relocs-dummy.o: ;
 
 .PHONY: include
-include: $(BASEDIR)/include/asm-x86/asm-macros.h
+include: $(BASEDIR)/arch/x86/include/asm/asm-macros.h
 
 asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
-$(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
+$(BASEDIR)/arch/x86/include/asm/asm-macros.h: asm-macros.i Makefile
 	echo '#if 0' >[email protected]
 	echo '.if 0' >>[email protected]
 	echo '#endif' >>[email protected]
@@ -304,7 +304,7 @@ efi/mkreloc: efi/mkreloc.c
 .PHONY: clean
 clean::
 	rm -f *.lds *.new boot/*.o boot/*~ boot/core boot/mkelf32
-	rm -f asm-macros.i $(BASEDIR)/include/asm-x86/asm-macros.*
+	rm -f asm-macros.i $(BASEDIR)/arch/x86/include/asm/asm-macros.*
 	rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d $(BASEDIR)/.xen.elf32
 	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc
 	rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin
xen/arch/x86/arch.mk +3 -2
index ce0c1a0e7fb2..eea320e618b9 100644
@@ -4,8 +4,9 @@
 export XEN_IMG_OFFSET := 0x200000
 
 CFLAGS += -I$(BASEDIR)/include
-CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic
-CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default
+CFLAGS += -I$(BASEDIR)/arch/$(TARGET_ARCH)/include
+CFLAGS += -I$(BASEDIR)/arch/x86/include/asm/mach-generic
+CFLAGS += -I$(BASEDIR)/arch/x86/include/asm/mach-default
 CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
 
 # Prevent floating-point variables from creeping into Xen.
xen/arch/x86/include/asm/acpi.h renamed from xen/include/asm-x86/acpi.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/acpi.h
rename to xen/arch/x86/include/asm/acpi.h
xen/arch/x86/include/asm/alternative-asm.h renamed from xen/include/asm-x86/alternative-asm.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/alternative-asm.h
rename to xen/arch/x86/include/asm/alternative-asm.h
xen/arch/x86/include/asm/alternative.h renamed from xen/include/asm-x86/alternative.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/alternative.h
rename to xen/arch/x86/include/asm/alternative.h
xen/arch/x86/include/asm/altp2m.h renamed from xen/include/asm-x86/altp2m.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/altp2m.h
rename to xen/arch/x86/include/asm/altp2m.h
xen/arch/x86/include/asm/amd.h renamed from xen/include/asm-x86/amd.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/amd.h
rename to xen/arch/x86/include/asm/amd.h
xen/arch/x86/include/asm/apic.h renamed from xen/include/asm-x86/apic.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/apic.h
rename to xen/arch/x86/include/asm/apic.h
xen/arch/x86/include/asm/apicdef.h renamed from xen/include/asm-x86/apicdef.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/apicdef.h
rename to xen/arch/x86/include/asm/apicdef.h
xen/arch/x86/include/asm/asm-defns.h renamed from xen/include/asm-x86/asm-defns.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/asm-defns.h
rename to xen/arch/x86/include/asm/asm-defns.h
xen/arch/x86/include/asm/asm_defns.h renamed from xen/include/asm-x86/asm_defns.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/asm_defns.h
rename to xen/arch/x86/include/asm/asm_defns.h
xen/arch/x86/include/asm/atomic.h renamed from xen/include/asm-x86/atomic.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/atomic.h
rename to xen/arch/x86/include/asm/atomic.h
xen/arch/x86/include/asm/bitops.h renamed from xen/include/asm-x86/bitops.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/bitops.h
rename to xen/arch/x86/include/asm/bitops.h
xen/arch/x86/include/asm/bug.h renamed from xen/include/asm-x86/bug.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/bug.h
rename to xen/arch/x86/include/asm/bug.h
xen/arch/x86/include/asm/byteorder.h renamed from xen/include/asm-x86/byteorder.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/byteorder.h
rename to xen/arch/x86/include/asm/byteorder.h
xen/arch/x86/include/asm/bzimage.h renamed from xen/include/asm-x86/bzimage.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/bzimage.h
rename to xen/arch/x86/include/asm/bzimage.h
xen/arch/x86/include/asm/cache.h renamed from xen/include/asm-x86/cache.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/cache.h
rename to xen/arch/x86/include/asm/cache.h
xen/arch/x86/include/asm/compat.h renamed from xen/include/asm-x86/compat.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/compat.h
rename to xen/arch/x86/include/asm/compat.h
xen/arch/x86/include/asm/config.h renamed from xen/include/asm-x86/config.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/config.h
rename to xen/arch/x86/include/asm/config.h
xen/arch/x86/include/asm/cpufeature.h renamed from xen/include/asm-x86/cpufeature.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/cpufeature.h
rename to xen/arch/x86/include/asm/cpufeature.h
xen/arch/x86/include/asm/cpufeatures.h renamed from xen/include/asm-x86/cpufeatures.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/cpufeatures.h
rename to xen/arch/x86/include/asm/cpufeatures.h
xen/arch/x86/include/asm/cpufeatureset.h renamed from xen/include/asm-x86/cpufeatureset.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/cpufeatureset.h
rename to xen/arch/x86/include/asm/cpufeatureset.h
xen/arch/x86/include/asm/cpuid.h renamed from xen/include/asm-x86/cpuid.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/cpuid.h
rename to xen/arch/x86/include/asm/cpuid.h
xen/arch/x86/include/asm/cpuidle.h renamed from xen/include/asm-x86/cpuidle.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/cpuidle.h
rename to xen/arch/x86/include/asm/cpuidle.h
xen/arch/x86/include/asm/current.h renamed from xen/include/asm-x86/current.h +1 -1
similarity index 99%
rename from xen/include/asm-x86/current.h
rename to xen/arch/x86/include/asm/current.h
index a74ad4bc4c44..cfbedc31983f 100644
@@ -53,7 +53,7 @@ struct cpu_info {
     unsigned long xen_cr3;
     unsigned long pv_cr3;
 
-    /* See asm-x86/spec_ctrl_asm.h for usage. */
+    /* See asm/spec_ctrl_asm.h for usage. */
     unsigned int shadow_spec_ctrl;
     uint8_t      xen_spec_ctrl;
     uint8_t      spec_ctrl_flags;
xen/arch/x86/include/asm/debugger.h renamed from xen/include/asm-x86/debugger.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/debugger.h
rename to xen/arch/x86/include/asm/debugger.h
xen/arch/x86/include/asm/debugreg.h renamed from xen/include/asm-x86/debugreg.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/debugreg.h
rename to xen/arch/x86/include/asm/debugreg.h
xen/arch/x86/include/asm/delay.h renamed from xen/include/asm-x86/delay.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/delay.h
rename to xen/arch/x86/include/asm/delay.h
xen/arch/x86/include/asm/desc.h renamed from xen/include/asm-x86/desc.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/desc.h
rename to xen/arch/x86/include/asm/desc.h
xen/arch/x86/include/asm/device.h renamed from xen/include/asm-x86/device.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/device.h
rename to xen/arch/x86/include/asm/device.h
xen/arch/x86/include/asm/div64.h renamed from xen/include/asm-x86/div64.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/div64.h
rename to xen/arch/x86/include/asm/div64.h
xen/arch/x86/include/asm/dom0_build.h renamed from xen/include/asm-x86/dom0_build.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/dom0_build.h
rename to xen/arch/x86/include/asm/dom0_build.h
xen/arch/x86/include/asm/domain.h renamed from xen/include/asm-x86/domain.h +1 -1
similarity index 99%
rename from xen/include/asm-x86/domain.h
rename to xen/arch/x86/include/asm/domain.h
index 92d54de0b9a1..e62e10959801 100644
@@ -384,7 +384,7 @@ struct arch_domain
     struct PITState vpit;
 
     /* TSC management (emulation, pv, scaling, stats) */
-    int tsc_mode;            /* see include/asm-x86/time.h */
+    int tsc_mode;            /* see asm/time.h */
     bool_t vtsc;             /* tsc is emulated (may change after migrate) */
     s_time_t vtsc_last;      /* previous TSC value (guarantee monotonicity) */
     uint64_t vtsc_offset;    /* adjustment for save/restore/migrate */
xen/arch/x86/include/asm/e820.h renamed from xen/include/asm-x86/e820.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/e820.h
rename to xen/arch/x86/include/asm/e820.h
xen/arch/x86/include/asm/edd.h renamed from xen/include/asm-x86/edd.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/edd.h
rename to xen/arch/x86/include/asm/edd.h
xen/arch/x86/include/asm/efibind.h renamed from xen/include/asm-x86/efibind.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/efibind.h
rename to xen/arch/x86/include/asm/efibind.h
xen/arch/x86/include/asm/elf.h renamed from xen/include/asm-x86/elf.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/elf.h
rename to xen/arch/x86/include/asm/elf.h
xen/arch/x86/include/asm/event.h renamed from xen/include/asm-x86/event.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/event.h
rename to xen/arch/x86/include/asm/event.h
xen/arch/x86/include/asm/fixmap.h renamed from xen/include/asm-x86/fixmap.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/fixmap.h
rename to xen/arch/x86/include/asm/fixmap.h
xen/arch/x86/include/asm/flushtlb.h renamed from xen/include/asm-x86/flushtlb.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/flushtlb.h
rename to xen/arch/x86/include/asm/flushtlb.h
xen/arch/x86/include/asm/genapic.h renamed from xen/include/asm-x86/genapic.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/genapic.h
rename to xen/arch/x86/include/asm/genapic.h
xen/arch/x86/include/asm/grant_table.h renamed from xen/include/asm-x86/grant_table.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/grant_table.h
rename to xen/arch/x86/include/asm/grant_table.h
xen/arch/x86/include/asm/guest.h renamed from xen/include/asm-x86/guest.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest.h
rename to xen/arch/x86/include/asm/guest.h
xen/arch/x86/include/asm/guest/hyperv-hcall.h renamed from xen/include/asm-x86/guest/hyperv-hcall.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest/hyperv-hcall.h
rename to xen/arch/x86/include/asm/guest/hyperv-hcall.h
xen/arch/x86/include/asm/guest/hyperv-tlfs.h renamed from xen/include/asm-x86/guest/hyperv-tlfs.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest/hyperv-tlfs.h
rename to xen/arch/x86/include/asm/guest/hyperv-tlfs.h
xen/arch/x86/include/asm/guest/hyperv.h renamed from xen/include/asm-x86/guest/hyperv.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest/hyperv.h
rename to xen/arch/x86/include/asm/guest/hyperv.h
xen/arch/x86/include/asm/guest/hypervisor.h renamed from xen/include/asm-x86/guest/hypervisor.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest/hypervisor.h
rename to xen/arch/x86/include/asm/guest/hypervisor.h
xen/arch/x86/include/asm/guest/pvh-boot.h renamed from xen/include/asm-x86/guest/pvh-boot.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest/pvh-boot.h
rename to xen/arch/x86/include/asm/guest/pvh-boot.h
xen/arch/x86/include/asm/guest/xen-hcall.h renamed from xen/include/asm-x86/guest/xen-hcall.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest/xen-hcall.h
rename to xen/arch/x86/include/asm/guest/xen-hcall.h
xen/arch/x86/include/asm/guest/xen.h renamed from xen/include/asm-x86/guest/xen.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest/xen.h
rename to xen/arch/x86/include/asm/guest/xen.h
xen/arch/x86/include/asm/guest_access.h renamed from xen/include/asm-x86/guest_access.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest_access.h
rename to xen/arch/x86/include/asm/guest_access.h
xen/arch/x86/include/asm/guest_atomics.h renamed from xen/include/asm-x86/guest_atomics.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest_atomics.h
rename to xen/arch/x86/include/asm/guest_atomics.h
xen/arch/x86/include/asm/guest_pt.h renamed from xen/include/asm-x86/guest_pt.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/guest_pt.h
rename to xen/arch/x86/include/asm/guest_pt.h
xen/arch/x86/include/asm/hap.h renamed from xen/include/asm-x86/hap.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hap.h
rename to xen/arch/x86/include/asm/hap.h
xen/arch/x86/include/asm/hardirq.h renamed from xen/include/asm-x86/hardirq.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hardirq.h
rename to xen/arch/x86/include/asm/hardirq.h
xen/arch/x86/include/asm/hpet.h renamed from xen/include/asm-x86/hpet.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hpet.h
rename to xen/arch/x86/include/asm/hpet.h
xen/arch/x86/include/asm/hvm/asid.h renamed from xen/include/asm-x86/hvm/asid.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/asid.h
rename to xen/arch/x86/include/asm/hvm/asid.h
xen/arch/x86/include/asm/hvm/cacheattr.h renamed from xen/include/asm-x86/hvm/cacheattr.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/cacheattr.h
rename to xen/arch/x86/include/asm/hvm/cacheattr.h
xen/arch/x86/include/asm/hvm/domain.h renamed from xen/include/asm-x86/hvm/domain.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/domain.h
rename to xen/arch/x86/include/asm/hvm/domain.h
xen/arch/x86/include/asm/hvm/emulate.h renamed from xen/include/asm-x86/hvm/emulate.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/emulate.h
rename to xen/arch/x86/include/asm/hvm/emulate.h
xen/arch/x86/include/asm/hvm/grant_table.h renamed from xen/include/asm-x86/hvm/grant_table.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/grant_table.h
rename to xen/arch/x86/include/asm/hvm/grant_table.h
xen/arch/x86/include/asm/hvm/guest_access.h renamed from xen/include/asm-x86/hvm/guest_access.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/guest_access.h
rename to xen/arch/x86/include/asm/hvm/guest_access.h
xen/arch/x86/include/asm/hvm/hvm.h renamed from xen/include/asm-x86/hvm/hvm.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/hvm.h
rename to xen/arch/x86/include/asm/hvm/hvm.h
xen/arch/x86/include/asm/hvm/io.h renamed from xen/include/asm-x86/hvm/io.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/io.h
rename to xen/arch/x86/include/asm/hvm/io.h
xen/arch/x86/include/asm/hvm/ioreq.h renamed from xen/include/asm-x86/hvm/ioreq.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/ioreq.h
rename to xen/arch/x86/include/asm/hvm/ioreq.h
xen/arch/x86/include/asm/hvm/irq.h renamed from xen/include/asm-x86/hvm/irq.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/irq.h
rename to xen/arch/x86/include/asm/hvm/irq.h
xen/arch/x86/include/asm/hvm/monitor.h renamed from xen/include/asm-x86/hvm/monitor.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/monitor.h
rename to xen/arch/x86/include/asm/hvm/monitor.h
xen/arch/x86/include/asm/hvm/nestedhvm.h renamed from xen/include/asm-x86/hvm/nestedhvm.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/nestedhvm.h
rename to xen/arch/x86/include/asm/hvm/nestedhvm.h
xen/arch/x86/include/asm/hvm/save.h renamed from xen/include/asm-x86/hvm/save.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/save.h
rename to xen/arch/x86/include/asm/hvm/save.h
xen/arch/x86/include/asm/hvm/support.h renamed from xen/include/asm-x86/hvm/support.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/support.h
rename to xen/arch/x86/include/asm/hvm/support.h
xen/arch/x86/include/asm/hvm/svm/asid.h renamed from xen/include/asm-x86/hvm/svm/asid.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/asid.h
rename to xen/arch/x86/include/asm/hvm/svm/asid.h
xen/arch/x86/include/asm/hvm/svm/emulate.h renamed from xen/include/asm-x86/hvm/svm/emulate.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/emulate.h
rename to xen/arch/x86/include/asm/hvm/svm/emulate.h
xen/arch/x86/include/asm/hvm/svm/intr.h renamed from xen/include/asm-x86/hvm/svm/intr.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/intr.h
rename to xen/arch/x86/include/asm/hvm/svm/intr.h
xen/arch/x86/include/asm/hvm/svm/nestedsvm.h renamed from xen/include/asm-x86/hvm/svm/nestedsvm.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/nestedsvm.h
rename to xen/arch/x86/include/asm/hvm/svm/nestedsvm.h
xen/arch/x86/include/asm/hvm/svm/svm.h renamed from xen/include/asm-x86/hvm/svm/svm.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/svm.h
rename to xen/arch/x86/include/asm/hvm/svm/svm.h
xen/arch/x86/include/asm/hvm/svm/svmdebug.h renamed from xen/include/asm-x86/hvm/svm/svmdebug.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/svmdebug.h
rename to xen/arch/x86/include/asm/hvm/svm/svmdebug.h
xen/arch/x86/include/asm/hvm/svm/vmcb.h renamed from xen/include/asm-x86/hvm/svm/vmcb.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/vmcb.h
rename to xen/arch/x86/include/asm/hvm/svm/vmcb.h
xen/arch/x86/include/asm/hvm/trace.h renamed from xen/include/asm-x86/hvm/trace.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/trace.h
rename to xen/arch/x86/include/asm/hvm/trace.h
xen/arch/x86/include/asm/hvm/vcpu.h renamed from xen/include/asm-x86/hvm/vcpu.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/vcpu.h
rename to xen/arch/x86/include/asm/hvm/vcpu.h
xen/arch/x86/include/asm/hvm/vioapic.h renamed from xen/include/asm-x86/hvm/vioapic.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/vioapic.h
rename to xen/arch/x86/include/asm/hvm/vioapic.h
xen/arch/x86/include/asm/hvm/viridian.h renamed from xen/include/asm-x86/hvm/viridian.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/viridian.h
rename to xen/arch/x86/include/asm/hvm/viridian.h
xen/arch/x86/include/asm/hvm/vlapic.h renamed from xen/include/asm-x86/hvm/vlapic.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/vlapic.h
rename to xen/arch/x86/include/asm/hvm/vlapic.h
xen/arch/x86/include/asm/hvm/vm_event.h renamed from xen/include/asm-x86/hvm/vm_event.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/vm_event.h
rename to xen/arch/x86/include/asm/hvm/vm_event.h
xen/arch/x86/include/asm/hvm/vmx/vmcs.h renamed from xen/include/asm-x86/hvm/vmx/vmcs.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/vmx/vmcs.h
rename to xen/arch/x86/include/asm/hvm/vmx/vmcs.h
xen/arch/x86/include/asm/hvm/vmx/vmx.h renamed from xen/include/asm-x86/hvm/vmx/vmx.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/vmx/vmx.h
rename to xen/arch/x86/include/asm/hvm/vmx/vmx.h
xen/arch/x86/include/asm/hvm/vmx/vvmx.h renamed from xen/include/asm-x86/hvm/vmx/vvmx.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/vmx/vvmx.h
rename to xen/arch/x86/include/asm/hvm/vmx/vvmx.h
xen/arch/x86/include/asm/hvm/vpic.h renamed from xen/include/asm-x86/hvm/vpic.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/vpic.h
rename to xen/arch/x86/include/asm/hvm/vpic.h
xen/arch/x86/include/asm/hvm/vpt.h renamed from xen/include/asm-x86/hvm/vpt.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hvm/vpt.h
rename to xen/arch/x86/include/asm/hvm/vpt.h
xen/arch/x86/include/asm/hypercall.h renamed from xen/include/asm-x86/hypercall.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/hypercall.h
rename to xen/arch/x86/include/asm/hypercall.h
xen/arch/x86/include/asm/i387.h renamed from xen/include/asm-x86/i387.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/i387.h
rename to xen/arch/x86/include/asm/i387.h
xen/arch/x86/include/asm/init.h renamed from xen/include/asm-x86/init.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/init.h
rename to xen/arch/x86/include/asm/init.h
xen/arch/x86/include/asm/invpcid.h renamed from xen/include/asm-x86/invpcid.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/invpcid.h
rename to xen/arch/x86/include/asm/invpcid.h
xen/arch/x86/include/asm/io.h renamed from xen/include/asm-x86/io.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/io.h
rename to xen/arch/x86/include/asm/io.h
xen/arch/x86/include/asm/io_apic.h renamed from xen/include/asm-x86/io_apic.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/io_apic.h
rename to xen/arch/x86/include/asm/io_apic.h
xen/arch/x86/include/asm/iocap.h renamed from xen/include/asm-x86/iocap.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/iocap.h
rename to xen/arch/x86/include/asm/iocap.h
xen/arch/x86/include/asm/iommu.h renamed from xen/include/asm-x86/iommu.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/iommu.h
rename to xen/arch/x86/include/asm/iommu.h
xen/arch/x86/include/asm/ioreq.h renamed from xen/include/asm-x86/ioreq.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/ioreq.h
rename to xen/arch/x86/include/asm/ioreq.h
xen/arch/x86/include/asm/irq.h renamed from xen/include/asm-x86/irq.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/irq.h
rename to xen/arch/x86/include/asm/irq.h
xen/arch/x86/include/asm/ldt.h renamed from xen/include/asm-x86/ldt.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/ldt.h
rename to xen/arch/x86/include/asm/ldt.h
xen/arch/x86/include/asm/livepatch.h renamed from xen/include/asm-x86/livepatch.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/livepatch.h
rename to xen/arch/x86/include/asm/livepatch.h
xen/arch/x86/include/asm/mach-default/bios_ebda.h renamed from xen/include/asm-x86/mach-default/bios_ebda.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mach-default/bios_ebda.h
rename to xen/arch/x86/include/asm/mach-default/bios_ebda.h
xen/arch/x86/include/asm/mach-default/io_ports.h renamed from xen/include/asm-x86/mach-default/io_ports.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mach-default/io_ports.h
rename to xen/arch/x86/include/asm/mach-default/io_ports.h
xen/arch/x86/include/asm/mach-default/irq_vectors.h renamed from xen/include/asm-x86/mach-default/irq_vectors.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mach-default/irq_vectors.h
rename to xen/arch/x86/include/asm/mach-default/irq_vectors.h
xen/arch/x86/include/asm/mach-default/mach_mpparse.h renamed from xen/include/asm-x86/mach-default/mach_mpparse.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mach-default/mach_mpparse.h
rename to xen/arch/x86/include/asm/mach-default/mach_mpparse.h
xen/arch/x86/include/asm/mach-default/mach_mpspec.h renamed from xen/include/asm-x86/mach-default/mach_mpspec.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mach-default/mach_mpspec.h
rename to xen/arch/x86/include/asm/mach-default/mach_mpspec.h
xen/arch/x86/include/asm/mach-generic/mach_apic.h renamed from xen/include/asm-x86/mach-generic/mach_apic.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mach-generic/mach_apic.h
rename to xen/arch/x86/include/asm/mach-generic/mach_apic.h
xen/arch/x86/include/asm/mach-generic/mach_mpparse.h renamed from xen/include/asm-x86/mach-generic/mach_mpparse.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mach-generic/mach_mpparse.h
rename to xen/arch/x86/include/asm/mach-generic/mach_mpparse.h
xen/arch/x86/include/asm/machine_kexec.h renamed from xen/include/asm-x86/machine_kexec.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/machine_kexec.h
rename to xen/arch/x86/include/asm/machine_kexec.h
xen/arch/x86/include/asm/mc146818rtc.h renamed from xen/include/asm-x86/mc146818rtc.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mc146818rtc.h
rename to xen/arch/x86/include/asm/mc146818rtc.h
xen/arch/x86/include/asm/mce.h renamed from xen/include/asm-x86/mce.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mce.h
rename to xen/arch/x86/include/asm/mce.h
xen/arch/x86/include/asm/mem_access.h renamed from xen/include/asm-x86/mem_access.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mem_access.h
rename to xen/arch/x86/include/asm/mem_access.h
xen/arch/x86/include/asm/mem_paging.h renamed from xen/include/asm-x86/mem_paging.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mem_paging.h
rename to xen/arch/x86/include/asm/mem_paging.h
xen/arch/x86/include/asm/mem_sharing.h renamed from xen/include/asm-x86/mem_sharing.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mem_sharing.h
rename to xen/arch/x86/include/asm/mem_sharing.h
xen/arch/x86/include/asm/microcode.h renamed from xen/include/asm-x86/microcode.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/microcode.h
rename to xen/arch/x86/include/asm/microcode.h
xen/arch/x86/include/asm/mm.h renamed from xen/include/asm-x86/mm.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mm.h
rename to xen/arch/x86/include/asm/mm.h
xen/arch/x86/include/asm/monitor.h renamed from xen/include/asm-x86/monitor.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/monitor.h
rename to xen/arch/x86/include/asm/monitor.h
xen/arch/x86/include/asm/mpspec.h renamed from xen/include/asm-x86/mpspec.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mpspec.h
rename to xen/arch/x86/include/asm/mpspec.h
xen/arch/x86/include/asm/mpspec_def.h renamed from xen/include/asm-x86/mpspec_def.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mpspec_def.h
rename to xen/arch/x86/include/asm/mpspec_def.h
xen/arch/x86/include/asm/msi.h renamed from xen/include/asm-x86/msi.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/msi.h
rename to xen/arch/x86/include/asm/msi.h
xen/arch/x86/include/asm/msr-index.h renamed from xen/include/asm-x86/msr-index.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/msr-index.h
rename to xen/arch/x86/include/asm/msr-index.h
xen/arch/x86/include/asm/msr.h renamed from xen/include/asm-x86/msr.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/msr.h
rename to xen/arch/x86/include/asm/msr.h
xen/arch/x86/include/asm/mtrr.h renamed from xen/include/asm-x86/mtrr.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mtrr.h
rename to xen/arch/x86/include/asm/mtrr.h
xen/arch/x86/include/asm/multicall.h renamed from xen/include/asm-x86/multicall.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/multicall.h
rename to xen/arch/x86/include/asm/multicall.h
xen/arch/x86/include/asm/mwait.h renamed from xen/include/asm-x86/mwait.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/mwait.h
rename to xen/arch/x86/include/asm/mwait.h
xen/arch/x86/include/asm/nmi.h renamed from xen/include/asm-x86/nmi.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/nmi.h
rename to xen/arch/x86/include/asm/nmi.h
xen/arch/x86/include/asm/nops.h renamed from xen/include/asm-x86/nops.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/nops.h
rename to xen/arch/x86/include/asm/nops.h
xen/arch/x86/include/asm/nospec.h renamed from xen/include/asm-x86/nospec.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/nospec.h
rename to xen/arch/x86/include/asm/nospec.h
xen/arch/x86/include/asm/numa.h renamed from xen/include/asm-x86/numa.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/numa.h
rename to xen/arch/x86/include/asm/numa.h
xen/arch/x86/include/asm/p2m.h renamed from xen/include/asm-x86/p2m.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/p2m.h
rename to xen/arch/x86/include/asm/p2m.h
xen/arch/x86/include/asm/page-bits.h renamed from xen/include/asm-x86/page-bits.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/page-bits.h
rename to xen/arch/x86/include/asm/page-bits.h
xen/arch/x86/include/asm/page.h renamed from xen/include/asm-x86/page.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/page.h
rename to xen/arch/x86/include/asm/page.h
xen/arch/x86/include/asm/paging.h renamed from xen/include/asm-x86/paging.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/paging.h
rename to xen/arch/x86/include/asm/paging.h
xen/arch/x86/include/asm/pci.h renamed from xen/include/asm-x86/pci.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/pci.h
rename to xen/arch/x86/include/asm/pci.h
xen/arch/x86/include/asm/percpu.h renamed from xen/include/asm-x86/percpu.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/percpu.h
rename to xen/arch/x86/include/asm/percpu.h
xen/arch/x86/include/asm/perfc.h renamed from xen/include/asm-x86/perfc.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/perfc.h
rename to xen/arch/x86/include/asm/perfc.h
xen/arch/x86/include/asm/perfc_defn.h renamed from xen/include/asm-x86/perfc_defn.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/perfc_defn.h
rename to xen/arch/x86/include/asm/perfc_defn.h
xen/arch/x86/include/asm/processor.h renamed from xen/include/asm-x86/processor.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/processor.h
rename to xen/arch/x86/include/asm/processor.h
xen/arch/x86/include/asm/psr.h renamed from xen/include/asm-x86/psr.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/psr.h
rename to xen/arch/x86/include/asm/psr.h
xen/arch/x86/include/asm/pv/domain.h renamed from xen/include/asm-x86/pv/domain.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/pv/domain.h
rename to xen/arch/x86/include/asm/pv/domain.h
xen/arch/x86/include/asm/pv/grant_table.h renamed from xen/include/asm-x86/pv/grant_table.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/pv/grant_table.h
rename to xen/arch/x86/include/asm/pv/grant_table.h
xen/arch/x86/include/asm/pv/mm.h renamed from xen/include/asm-x86/pv/mm.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/pv/mm.h
rename to xen/arch/x86/include/asm/pv/mm.h
xen/arch/x86/include/asm/pv/shim.h renamed from xen/include/asm-x86/pv/shim.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/pv/shim.h
rename to xen/arch/x86/include/asm/pv/shim.h
xen/arch/x86/include/asm/pv/trace.h renamed from xen/include/asm-x86/pv/trace.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/pv/trace.h
rename to xen/arch/x86/include/asm/pv/trace.h
xen/arch/x86/include/asm/pv/traps.h renamed from xen/include/asm-x86/pv/traps.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/pv/traps.h
rename to xen/arch/x86/include/asm/pv/traps.h
xen/arch/x86/include/asm/random.h renamed from xen/include/asm-x86/random.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/random.h
rename to xen/arch/x86/include/asm/random.h
xen/arch/x86/include/asm/regs.h renamed from xen/include/asm-x86/regs.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/regs.h
rename to xen/arch/x86/include/asm/regs.h
xen/arch/x86/include/asm/setup.h renamed from xen/include/asm-x86/setup.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/setup.h
rename to xen/arch/x86/include/asm/setup.h
xen/arch/x86/include/asm/shadow.h renamed from xen/include/asm-x86/shadow.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/shadow.h
rename to xen/arch/x86/include/asm/shadow.h
xen/arch/x86/include/asm/shared.h renamed from xen/include/asm-x86/shared.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/shared.h
rename to xen/arch/x86/include/asm/shared.h
xen/arch/x86/include/asm/smp.h renamed from xen/include/asm-x86/smp.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/smp.h
rename to xen/arch/x86/include/asm/smp.h
xen/arch/x86/include/asm/softirq.h renamed from xen/include/asm-x86/softirq.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/softirq.h
rename to xen/arch/x86/include/asm/softirq.h
xen/arch/x86/include/asm/spec_ctrl.h renamed from xen/include/asm-x86/spec_ctrl.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/spec_ctrl.h
rename to xen/arch/x86/include/asm/spec_ctrl.h
xen/arch/x86/include/asm/spec_ctrl_asm.h renamed from xen/include/asm-x86/spec_ctrl_asm.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/spec_ctrl_asm.h
rename to xen/arch/x86/include/asm/spec_ctrl_asm.h
xen/arch/x86/include/asm/spinlock.h renamed from xen/include/asm-x86/spinlock.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/spinlock.h
rename to xen/arch/x86/include/asm/spinlock.h
xen/arch/x86/include/asm/string.h renamed from xen/include/asm-x86/string.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/string.h
rename to xen/arch/x86/include/asm/string.h
xen/arch/x86/include/asm/system.h renamed from xen/include/asm-x86/system.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/system.h
rename to xen/arch/x86/include/asm/system.h
xen/arch/x86/include/asm/tboot.h renamed from xen/include/asm-x86/tboot.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/tboot.h
rename to xen/arch/x86/include/asm/tboot.h
xen/arch/x86/include/asm/time.h renamed from xen/include/asm-x86/time.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/time.h
rename to xen/arch/x86/include/asm/time.h
xen/arch/x86/include/asm/trace.h renamed from xen/include/asm-x86/trace.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/trace.h
rename to xen/arch/x86/include/asm/trace.h
xen/arch/x86/include/asm/traps.h renamed from xen/include/asm-x86/traps.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/traps.h
rename to xen/arch/x86/include/asm/traps.h
xen/arch/x86/include/asm/types.h renamed from xen/include/asm-x86/types.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/types.h
rename to xen/arch/x86/include/asm/types.h
xen/arch/x86/include/asm/uaccess.h renamed from xen/include/asm-x86/uaccess.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/uaccess.h
rename to xen/arch/x86/include/asm/uaccess.h
xen/arch/x86/include/asm/unaligned.h renamed from xen/include/asm-x86/unaligned.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/unaligned.h
rename to xen/arch/x86/include/asm/unaligned.h
xen/arch/x86/include/asm/vm_event.h renamed from xen/include/asm-x86/vm_event.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/vm_event.h
rename to xen/arch/x86/include/asm/vm_event.h
xen/arch/x86/include/asm/vpmu.h renamed from xen/include/asm-x86/vpmu.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/vpmu.h
rename to xen/arch/x86/include/asm/vpmu.h
xen/arch/x86/include/asm/x86-defns.h renamed from xen/include/asm-x86/x86-defns.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/x86-defns.h
rename to xen/arch/x86/include/asm/x86-defns.h
xen/arch/x86/include/asm/x86-vendors.h renamed from xen/include/asm-x86/x86-vendors.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/x86-vendors.h
rename to xen/arch/x86/include/asm/x86-vendors.h
xen/arch/x86/include/asm/x86_64/efibind.h renamed from xen/include/asm-x86/x86_64/efibind.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/x86_64/efibind.h
rename to xen/arch/x86/include/asm/x86_64/efibind.h
xen/arch/x86/include/asm/x86_64/elf.h renamed from xen/include/asm-x86/x86_64/elf.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/x86_64/elf.h
rename to xen/arch/x86/include/asm/x86_64/elf.h
xen/arch/x86/include/asm/x86_64/page.h renamed from xen/include/asm-x86/x86_64/page.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/x86_64/page.h
rename to xen/arch/x86/include/asm/x86_64/page.h
xen/arch/x86/include/asm/x86_64/regs.h renamed from xen/include/asm-x86/x86_64/regs.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/x86_64/regs.h
rename to xen/arch/x86/include/asm/x86_64/regs.h
xen/arch/x86/include/asm/x86_64/system.h renamed from xen/include/asm-x86/x86_64/system.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/x86_64/system.h
rename to xen/arch/x86/include/asm/x86_64/system.h
xen/arch/x86/include/asm/x86_64/uaccess.h renamed from xen/include/asm-x86/x86_64/uaccess.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/x86_64/uaccess.h
rename to xen/arch/x86/include/asm/x86_64/uaccess.h
xen/arch/x86/include/asm/x86_emulate.h renamed from xen/include/asm-x86/x86_emulate.h +1 -1
similarity index 89%
rename from xen/include/asm-x86/x86_emulate.h
rename to xen/arch/x86/include/asm/x86_emulate.h
index 9125807e24fa..c184c0053c93 100644
@@ -16,6 +16,6 @@
 #include <xen/lib.h>
 #include <asm/regs.h>
 
-#include "../../arch/x86/x86_emulate/x86_emulate.h"
+#include "../../x86_emulate/x86_emulate.h"
 
 #endif /* __ASM_X86_X86_EMULATE_H__ */
xen/arch/x86/include/asm/xenoprof.h renamed from xen/include/asm-x86/xenoprof.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/xenoprof.h
rename to xen/arch/x86/include/asm/xenoprof.h
xen/arch/x86/include/asm/xstate.h renamed from xen/include/asm-x86/xstate.h +0 -0
similarity index 100%
rename from xen/include/asm-x86/xstate.h
rename to xen/arch/x86/include/asm/xstate.h
xen/common/efi/runtime.c +1 -1
index d2fdc28df3e0..541e462d961d 100644
@@ -12,7 +12,7 @@ struct efi_rs_state {
 #ifdef CONFIG_X86
  /*
   * The way stacks get set up leads to them always being on an 8-byte
-  * boundary not evenly divisible by 16 (see asm-x86/current.h). The EFI ABI,
+  * boundary not evenly divisible by 16 (see asm/current.h). The EFI ABI,
   * just like the CPU one, however requires stacks to be 16-byte aligned
   * before every function call. Since the compiler assumes this (unless
   * passing it -mpreferred-stack-boundary=3), it wouldn't generate code to
xen/common/page_alloc.c +1 -1
index d0baaa2ecd20..653f1ab09f63 100644
@@ -245,7 +245,7 @@ PAGE_LIST_HEAD(page_broken_list);
 
 /*
  * first_valid_mfn is exported because it is use in ARM specific NUMA
- * helpers. See comment in asm-arm/numa.h.
+ * helpers. See comment in arch/arm/include/asm/numa.h.
  */
 mfn_t first_valid_mfn = INVALID_MFN_INITIALIZER;
 
xen/include/xen/acpi.h +3 -2
index 088c238a504a..08834f140266 100644
@@ -40,8 +40,9 @@
 #define ACPI_MADT_GET_TRIGGER(inti)	ACPI_MADT_GET_(TRIGGER, inti)
 
 /*
- * Fixmap pages to reserve for ACPI boot-time tables (see asm-x86/fixmap.h or
- * asm-arm/config.h, 64 pages(256KB) is large enough for most cases.)
+ * Fixmap pages to reserve for ACPI boot-time tables (see
+ * arch/x86/include/asm/fixmap.h or arch/arm/include/asm/config.h,
+ * 64 pages(256KB) is large enough for most cases.)
  */
 #define NUM_FIXMAP_ACPI_PAGES  64
 
xen/include/xen/bitmap.h +1 -1
index e9175ab54a59..3caf92c76d6d 100644
@@ -14,7 +14,7 @@
  *
  * Function implementations generic to all architectures are in
  * lib/bitmap.c.  Functions implementations that are architecture
- * specific are in various include/asm-<arch>/bitops.h headers
+ * specific are in various asm/bitops.h headers
  * and other arch/<arch> specific files.
  *
  * See lib/bitmap.c for more details.
Signature · 1 line
Anthony PERARD
Acked-by on v8 2/47
#6 lore raw

Re: [XEN PATCH v8 02/47] xen: move include/asm-* to arch/*/include/asm

Quoted 10 lines · Anthony PERARD

This avoid the need to create the symbolic link "include/asm".

Whenever a comment refer to an "asm" headers, this patch avoid spelling the arch when not needed to avoid some code churn.

One unrelated change is to sort entries in MAINTAINERS for "INTEL(R) VT FOR X86 (VT-X)"

Acked-by on v8 2/47
#7 lore raw

Re: [XEN PATCH v8 02/47] xen: move include/asm-* to arch/*/include/asm

In reply to Anthony PERARD

Hi,

Quoted 10 lines · Anthony PERARD

This avoid the need to create the symbolic link "include/asm".

Whenever a comment refer to an "asm" headers, this patch avoid spelling the arch when not needed to avoid some code churn.

One unrelated change is to sort entries in MAINTAINERS for "INTEL(R) VT FOR X86 (VT-X)"

Cheers,

Signature · 1 line
Julien Grall
Acked-by on v8 2/47
#8 lore raw

Re: [XEN PATCH v8 02/47] xen: move include/asm-* to arch/*/include/asm

In reply to Anthony PERARD
Quoted 9 lines · Anthony PERARD

This avoid the need to create the symbolic link "include/asm".

Whenever a comment refer to an "asm" headers, this patch avoid spelling the arch when not needed to avoid some code churn.

One unrelated change is to sort entries in MAINTAINERS for "INTEL(R) VT FOR X86 (VT-X)"

#9 lore raw

PATCH v8 3/47 build: generate "include/xen/compile.h" with if_changed

In reply to Anthony PERARD

This will avoid regenerating "compile.h" if the content hasn't changed.

As it's currently the case, the file isn't regenerated during sudo make install if it exist and does belong to a different user, thus we can remove the target "delete-unfresh-files". Target "$(TARGET)" still need a phony dependency, so add "FORCE".

Use "$(dot-target).tmp" as temporary file as this is already cover by ".*.tmp" partern in ".gitconfig".

---

Notes:
v8:
- drop change in .gitignore

v7:
- Use $(if_changed,) instead of importing a new macro from Linux (filechk).
- use $(dot-target).tmp as temporary file, that way is hiden, and already cover by .gitignore via ".*.tmp". (filechk was doing the same)
- update .gitignore.

 xen/Makefile | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)
xen/Makefile +18 -17
index b2a63edca1eb..2ad7da7ad67b 100644
@@ -365,7 +365,7 @@ _debug:
 	$(OBJDUMP) -D -S $(TARGET)-syms > $(TARGET).s
 
 .PHONY: _clean
-_clean: delete-unfresh-files
+_clean:
 	$(MAKE) -C tools clean
 	$(MAKE) $(clean) include
 	$(MAKE) $(clean) common
@@ -383,7 +383,7 @@ _clean: delete-unfresh-files
 		-o -name "*.gcno" -o -name ".*.cmd" -o -name "lib.a" \) -exec rm -f {} \;
 	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map *~ core
 	rm -f asm-offsets.s arch/*/include/asm/asm-offsets.h
-	rm -f .banner .allconfig.tmp
+	rm -f .banner .allconfig.tmp include/xen/compile.h
 
 .PHONY: _distclean
 _distclean: clean
@@ -393,7 +393,7 @@ $(TARGET).gz: $(TARGET)
 	gzip -n -f -9 < $< > [email protected]
 	mv [email protected] $@
 
-$(TARGET): delete-unfresh-files
+$(TARGET): FORCE
 	$(MAKE) -C tools
 	$(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
 	[ -e arch/$(TARGET_ARCH)/efi ] && for f in $$(cd common/efi; echo *.[ch]); \
@@ -406,14 +406,6 @@ $(TARGET): delete-unfresh-files
 	$(MAKE) -f $(BASEDIR)/Rules.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
 
-# drivers/char/console.o contains static banner/compile info. Blow it away.
-# Don't refresh these files during e.g., 'sudo make install'
-.PHONY: delete-unfresh-files
-delete-unfresh-files:
-	@if [ ! -r include/xen/compile.h -o -O include/xen/compile.h ]; then \
-		rm -f include/xen/compile.h; \
-	fi
-
 quiet_cmd_banner = BANNER  $@
 define cmd_banner
     if which figlet >/dev/null 2>&1 ; then \
@@ -428,9 +420,11 @@ endef
 	$(call if_changed,banner)
 targets += .banner
 
-# compile.h contains dynamic build info. Rebuilt on every 'make' invocation.
-include/xen/compile.h: include/xen/compile.h.in .banner
-	@sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
+# Don't refresh this files during e.g., 'sudo make install'
+quiet_cmd_compile.h = UPD     $@
+define cmd_compile.h
+    if [ ! -r $@ -o -O $@ ]; then \
+	sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
 	    -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
 	    -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
 	    -e 's/@@domain@@/$(XEN_DOMAIN)/g' \
@@ -440,10 +434,17 @@ include/xen/compile.h: include/xen/compile.h.in .banner
 	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
 	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
 	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
-	    < include/xen/compile.h.in > [email protected]
+	    < $< > $(dot-target).tmp; \
+	sed -rf tools/process-banner.sed < .banner >> $(dot-target).tmp; \
+	mv -f $(dot-target).tmp $@; \
+    fi
+endef
+
+include/xen/compile.h: include/xen/compile.h.in .banner FORCE
 	@cat .banner
-	@sed -rf tools/process-banner.sed < .banner >> [email protected]
-	@mv -f [email protected] $@
+	$(call if_changed,compile.h)
+
+targets += include/xen/compile.h
 
 asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o [email protected] -MQ $@ $<
Signature · 1 line
Anthony PERARD
Acked-by on v8 3/47
#10 lore raw

Re: [XEN PATCH v8 03/47] build: generate "include/xen/compile.h" with if_changed

Quoted 11 lines · Anthony PERARD

This will avoid regenerating "compile.h" if the content hasn't changed.

As it's currently the case, the file isn't regenerated during sudo make install if it exist and does belong to a different user, thus we can remove the target "delete-unfresh-files". Target "$(TARGET)" still need a phony dependency, so add "FORCE".

Use "$(dot-target).tmp" as temporary file as this is already cover by ".*.tmp" partern in ".gitconfig".

#11 lore raw

PATCH v8 4/47 build: set XEN_BUILD_EFI earlier

In reply to Anthony PERARD

We are going to need the variable XEN_BUILD_EFI earlier.

But a side effect of calculating the value of $(XEN_BUILD_EFI) is to also to generate "efi/check.o" which is used for further checks. Thus the whole chain that check for EFI support is moved to "arch.mk".

Some other changes are made to avoid too much duplication:
- $(efi-check-o): Used to avoid repeating "efi/check.*". We don't set it to the path to the source as it would be wrong as soon as we support out-of-tree build.
- $(LD_PE_check_cmd): As it is called twice, with an updated $(EFI_LDFLAGS).

$(nr-fixups) is renamed to $(efi-nr-fixups) as the former might be a bit too generic.

---

Notes:
v8:
- rename to efi-nr-fixups rather than efi-check-relocs
- use := when assigning variable in makefile when recursive expansion isn't needed.
- no more check of $(efi-y) value for "CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI".

v7:
- Do the whole check for EFI support in arch.mk. So efi/check.o is produce there and used there, and produce efi/check.efi and use it there. Thus avoid the need to repeat the test done for XEN_BUILD_EFI.

 xen/arch/x86/Makefile | 38 ++------------------------------------
 xen/arch/x86/arch.mk  | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 36 deletions(-)
xen/arch/x86/Makefile +2 -36
index 8db4cb98edbb..d7d2adc1881e 100644
@@ -121,44 +121,8 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 		{ echo "No Multiboot2 header found" >&2; false; }
 	mv $(TMP) $(TARGET)
 
-ifneq ($(efi-y),)
-
-# Check if the compiler supports the MS ABI.
-export XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
 
-# Check if the linker supports PE.
-EFI_LDFLAGS = $(patsubst -m%,-mi386pep,$(XEN_LDFLAGS)) --subsystem=10
-XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o efi/check.efi efi/check.o))
-# If the above failed, it may be merely because of the linker not dealing well
-# with debug info. Try again with stripping it.
-ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
-EFI_LDFLAGS += --strip-debug
-XEN_BUILD_PE := $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o efi/check.efi efi/check.o)
-endif
-
-ifeq ($(XEN_BUILD_PE),y)
-
-# Check if the linker produces fixups in PE by default
-nr-fixups := $(shell $(OBJDUMP) -p efi/check.efi | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
-ifeq ($(nr-fixups),2)
-MKRELOC := :
-relocs-dummy :=
-else
-MKRELOC := efi/mkreloc
-relocs-dummy := efi/relocs-dummy.o
-# If the linker produced fixups but not precisely two of them, we need to
-# disable it doing so.  But if it didn't produce any fixups, it also wouldn't
-# recognize the option.
-ifneq ($(nr-fixups),0)
-EFI_LDFLAGS += --disable-reloc-section
-endif
-endif
-
-endif # $(XEN_BUILD_PE)
-
-endif # $(efi-y)
-
 ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
 
 ifeq ($(CONFIG_LTO),y)
@@ -217,8 +181,10 @@ endif
 
 $(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p')
 ifeq ($(MKRELOC),:)
+relocs-dummy :=
 $(TARGET).efi: ALT_BASE :=
 else
+relocs-dummy := efi/relocs-dummy.o
 $(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A ALT_START$$,,p')
 endif
 
xen/arch/x86/arch.mk +42 -0

47 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
Reviewed-by on v8 4/47
#12 lore raw

Re: [XEN PATCH v8 04/47] build: set XEN_BUILD_EFI earlier

Quoted 14 lines · Anthony PERARD

We are going to need the variable XEN_BUILD_EFI earlier.

But a side effect of calculating the value of $(XEN_BUILD_EFI) is to also to generate "efi/check.o" which is used for further checks. Thus the whole chain that check for EFI support is moved to "arch.mk".

Some other changes are made to avoid too much duplication:
- $(efi-check-o): Used to avoid repeating "efi/check.*". We don't set it to the path to the source as it would be wrong as soon as we support out-of-tree build.
- $(LD_PE_check_cmd): As it is called twice, with an updated $(EFI_LDFLAGS).

Quoted 4 lines

$(nr-fixups) is renamed to $(efi-nr-fixups) as the former might be a bit too generic.

Technically

Nevertheless a suggestion and a remark:

xen/arch/x86/arch.mk ifeq ($(CONFIG_UBSAN),y) · line 65

Quoted 9 lines
xen/arch/x86/arch.mk +3 -0
@@ -60,5 +60,47 @@ ifeq ($(CONFIG_UBSAN),y)
 $(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
 endif
 
+ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
+
+efi-check-o := arch/x86/efi/check.o

How about making this

efi-check := arch/x86/efi/check

That way you wouldn't need to replace the extension in a number of places, but simply append the respective one in every place using this.

Quoted 27 lines
xen/arch/x86/arch.mk +27 -0
+# Check if the compiler supports the MS ABI.
+XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(efi-check-o:.o=.c) -o $(efi-check-o),y)
+
+# Check if the linker supports PE.
+EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10
+LD_PE_check_cmd = $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o $(efi-check-o:.o=.efi) $(efi-check-o))
+XEN_BUILD_PE := $(LD_PE_check_cmd)
+
+# If the above failed, it may be merely because of the linker not dealing well
+# with debug info. Try again with stripping it.
+ifeq ($(CONFIG_DEBUG_INFO)-$(XEN_BUILD_PE),y-n)
+EFI_LDFLAGS += --strip-debug
+XEN_BUILD_PE := $(LD_PE_check_cmd)
+endif
+
+ifeq ($(XEN_BUILD_PE),y)
+
+# Check if the linker produces fixups in PE by default
+efi-nr-fixups := $(shell $(OBJDUMP) -p $(efi-check-o:.o=.efi) | grep '^[[:blank:]]*reloc[[:blank:]]*[0-9][[:blank:]].*DIR64$$' | wc -l)
+
+ifeq ($(efi-nr-fixups),2)
+MKRELOC := :
+else
+MKRELOC := efi/mkreloc
+# If the linker produced fixups but not precisely two of them, we need to
+# disable it doing so.  But if it didn't produce any fixups, it also wouldn't
+# recognize the option.

xen/arch/x86/arch.mk ifeq ($(CONFIG_UBSAN),y) · line 103

Quoted 10 lines
xen/arch/x86/arch.mk +10 -0
+ifneq ($(efi-nr-fixups),0)
+EFI_LDFLAGS += --disable-reloc-section
+endif
+endif
+
+endif # $(XEN_BUILD_PE)
+
+export XEN_BUILD_EFI XEN_BUILD_PE MKRELOC
+export EFI_LDFLAGS
+endif

Exporting MKRELOC in particular isn't very nice. I wonder whether there wouldn't be a way to keep it local to xen/Makefile.

Jan

#13 lore raw

Re: [XEN PATCH v8 04/47] build: set XEN_BUILD_EFI earlier

Quoted 9 lines · Jan Beulich
Quoted 1 line · Anthony PERARD

+efi-check-o := arch/x86/efi/check.o

How about making this

efi-check := arch/x86/efi/check

That way you wouldn't need to replace the extension in a number of places, but simply append the respective one in every place using this.

This change sound fine. I guess it will make reading the code a bit easier.

Quoted 6 lines

xen/arch/x86/arch.mk ifeq ($(CONFIG_UBSAN),y) · line 103

Quoted 3 lines
xen/arch/x86/arch.mk +3 -0
+export XEN_BUILD_EFI XEN_BUILD_PE MKRELOC
+export EFI_LDFLAGS
+endif

Exporting MKRELOC in particular isn't very nice. I wonder whether there wouldn't be a way to keep it local to xen/Makefile.

I don't think that's possible. The value of MKRELOC depends on a call with OBJDUMP which depends on call with LD which depends on a call with CC. And the call with CC is the one I'm trying to move.

Unless there is a better way to build *.efi, we need to know whether to use mkreloc or not.

I could rename it XEN_MKRELOC. Or if there is another name that could make sense, that would be fine too, like XEN_BUILD_EFI_NEED_RELOC which could be a boolean.

Thanks,

Signature · 1 line
Anthony PERARD
#14 lore raw

Re: [XEN PATCH v8 04/47] build: set XEN_BUILD_EFI earlier

Quoted 9 lines · Anthony PERARD
Quoted 7 lines · Jan Beulich

xen/arch/x86/arch.mk ifeq ($(CONFIG_UBSAN),y) · line 103

Quoted 3 lines · Anthony PERARD
xen/arch/x86/arch.mk +3 -0
+export XEN_BUILD_EFI XEN_BUILD_PE MKRELOC
+export EFI_LDFLAGS
+endif

Exporting MKRELOC in particular isn't very nice. I wonder whether there wouldn't be a way to keep it local to xen/Makefile.

Quoted 3 lines

I don't think that's possible. The value of MKRELOC depends on a call with OBJDUMP which depends on call with LD which depends on a call with CC. And the call with CC is the one I'm trying to move.

Like suggested for another variable elsewhere, besides moving the definition (which I agree looks difficult to achieve) there's also the option of passing it on the command line to (presumably) just the single sub-make which actually means to consume it. It's only the final linking step where it's needed afaict.

Jan

#15 lore raw

PATCH v8 5/47 build: adjust $(TARGET).efi creation in arch/arm

In reply to Anthony PERARD

There is no need to try to guess a relative path to the "xen.efi" file, we can simply use $@. Also, there's no need to use notdir, make already do that work via $(@F).

---

Notes:
v8:
- s/fix/adjust/ in patch title
- reviewed

 xen/arch/arm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/Makefile +1 -1
index a3a497bafe89..d0dee10102b6 100644
@@ -95,7 +95,7 @@ endif
 $(TARGET): $(TARGET)-syms
 	$(OBJCOPY) -O binary -S $< $@
 ifeq ($(CONFIG_ARM_64),y)
-	ln -sf $(notdir $@)  ../../$(notdir $@).efi
+	ln -sf $(@F) [email protected]
 endif
 
 ifeq ($(CONFIG_LTO),y)
Signature · 1 line
Anthony PERARD
Acked-by on v8 5/47
#16 lore raw

Re: [XEN PATCH v8 05/47] build: adjust $(TARGET).efi creation in arch/arm

Hi Anthony,

Quoted 6 lines · Anthony PERARD

There is no need to try to guess a relative path to the "xen.efi" file, we can simply use $@. Also, there's no need to use notdir, make already do that work via $(@F).

Cheers,

Signature · 1 line
Julien Grall
#17 lore raw

PATCH v8 6/47 build: avoid re-executing the main Makefile by introducing build.mk

In reply to Anthony PERARD

Currently, the xen/Makefile is re-parsed several times: once to start the build process, and several more time with Rules.mk including it. This makes it difficult to work with a Makefile used for several purpose, and it actually slow down the build process.

So this patch introduce "build.mk" which Rules.mk will use when present instead of the "Makefile" of a directory. (Linux's Kbuild named that file "Kbuild".)

We have a few targets to move to "build.mk" identified by them been build via "make -f Rules.mk" without changing directory.

As for the main targets like "build", we can have them depends on there underscore-prefix targets like "_build" without having to use "Rules.mk" while still retaining the check for unsupported architecture. (Those main rules are changed to be single-colon as there should only be a single recipe for them.)

With nearly everything needed to move to "build.mk" moved, there is a single dependency left from "Rules.mk": the variable $(TARGET), so its assignement is moved to the main Makefile.

---

Notes:
v8:
- for $(main-targets) rules, use ; on a single line instead of adding a recipe with only @:
- To include build.mk instead of Makefile, use a simpler expresion with $(firstword) and remove the use of $(mk-dir) var
- removed an extra blank line, and one when updating $(targets)
- reword patch description

v7:
- new patch

 xen/Makefile | 69 +++++-----------------------------------------------
 xen/Rules.mk |  6 ++---
 xen/build.mk | 60 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 67 deletions(-)
 create mode 100644 xen/build.mk
xen/Makefile +6 -63
index 2ad7da7ad67b..ed61f38dd335 100644
@@ -47,6 +47,8 @@ export KCONFIG_CONFIG ?= .config
 
 export CC CXX LD
 
+export TARGET := $(BASEDIR)/xen
+
 .PHONY: default
 default: build
 
@@ -293,11 +295,12 @@ export CFLAGS_UBSAN
 
 endif # need-config
 
-.PHONY: build install uninstall clean distclean MAP
-build install uninstall debug clean distclean MAP::
+main-targets := build install uninstall clean distclean MAP
+.PHONY: $(main-targets)
 ifneq ($(XEN_TARGET_ARCH),x86_32)
-	$(MAKE) -f Rules.mk _$@
+$(main-targets): %: _% ;
 else
+$(main-targets):
 	echo "*** Xen x86/32 target no longer supported!"
 endif
 
@@ -406,66 +409,6 @@ $(TARGET): FORCE
 	$(MAKE) -f $(BASEDIR)/Rules.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
 
-quiet_cmd_banner = BANNER  $@
-define cmd_banner
-    if which figlet >/dev/null 2>&1 ; then \
-	echo " Xen $(XEN_FULLVERSION)" | figlet -f $< > [email protected]; \
-    else \
-	echo " Xen $(XEN_FULLVERSION)" > [email protected]; \
-    fi; \
-    mv -f [email protected] $@
-endef
-
-.banner: tools/xen.flf FORCE
-	$(call if_changed,banner)
-targets += .banner
-
-# Don't refresh this files during e.g., 'sudo make install'
-quiet_cmd_compile.h = UPD     $@
-define cmd_compile.h
-    if [ ! -r $@ -o -O $@ ]; then \
-	sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \
-	    -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \
-	    -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \
-	    -e 's/@@domain@@/$(XEN_DOMAIN)/g' \
-	    -e 's/@@hostname@@/$(XEN_BUILD_HOST)/g' \
-	    -e 's!@@compiler@@!$(shell $(CC) $(CFLAGS) --version 2>&1 | head -1)!g' \
-	    -e 's/@@version@@/$(XEN_VERSION)/g' \
-	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
-	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
-	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
-	    < $< > $(dot-target).tmp; \
-	sed -rf tools/process-banner.sed < .banner >> $(dot-target).tmp; \
-	mv -f $(dot-target).tmp $@; \
-    fi
-endef
-
-include/xen/compile.h: include/xen/compile.h.in .banner FORCE
-	@cat .banner
-	$(call if_changed,compile.h)
-
-targets += include/xen/compile.h
-
-asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
-	$(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o [email protected] -MQ $@ $<
-	$(call move-if-changed,[email protected],$@)
-
-arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
-	@(set -e; \
-	  echo "/*"; \
-	  echo " * DO NOT MODIFY."; \
-	  echo " *"; \
-	  echo " * This file was auto-generated from $<"; \
-	  echo " *"; \
-	  echo " */"; \
-	  echo ""; \
-	  echo "#ifndef __ASM_OFFSETS_H__"; \
-	  echo "#define __ASM_OFFSETS_H__"; \
-	  echo ""; \
-	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
-	  echo ""; \
-	  echo "#endif") <$< >$@
-
 SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
 define all_sources
     ( find arch/$(TARGET_ARCH)/include -name '*.h' -print; \
xen/Rules.mk +2 -4
index d21930a7bf71..7b8b9047cfd5 100644
@@ -8,9 +8,6 @@
 include $(XEN_ROOT)/Config.mk
 include $(BASEDIR)/scripts/Kbuild.include
 
-
-TARGET := $(BASEDIR)/xen
-
 # Note that link order matters!
 ALL_OBJS-y               += $(BASEDIR)/common/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/drivers/built_in.o
@@ -36,7 +33,8 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \
                                             rodata.cst$(a)) \
                          $(foreach r,rel rel.ro,data.$(r).local)
 
-include Makefile
+# The filename build.mk has precedence over Makefile
+include $(firstword $(wildcard build.mk) Makefile)
 
 # Linking
 # ---------------------------------------------------------------------------
xen/build.mk new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
Reviewed-by on v8 6/47
#18 lore raw

Re: [XEN PATCH v8 06/47] build: avoid re-executing the main Makefile by introducing build.mk

Quoted 18 lines · Anthony PERARD

Currently, the xen/Makefile is re-parsed several times: once to start the build process, and several more time with Rules.mk including it. This makes it difficult to work with a Makefile used for several purpose, and it actually slow down the build process.

So this patch introduce "build.mk" which Rules.mk will use when present instead of the "Makefile" of a directory. (Linux's Kbuild named that file "Kbuild".)

We have a few targets to move to "build.mk" identified by them been build via "make -f Rules.mk" without changing directory.

As for the main targets like "build", we can have them depends on there underscore-prefix targets like "_build" without having to use "Rules.mk" while still retaining the check for unsupported architecture. (Those main rules are changed to be single-colon as there should only be a single recipe for them.)

Quoted 5 lines

With nearly everything needed to move to "build.mk" moved, there is a single dependency left from "Rules.mk": the variable $(TARGET), so its assignement is moved to the main Makefile.

#19 lore raw

PATCH v8 7/47 build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile

In reply to Anthony PERARD

This is to avoid arch/$arch/Makefile having to recurse into parents directories.

This avoid duplication of the logic to build prelink.o between arches.

In order to do that, we cut the $(TARGET) target in the main Makefile in two, there is a "prepare" phase/target runned before starting to build "prelink.o" which will prepare "include/" among other things, then all the $(ALL_OBJS) will be generated in order to build "prelink.o" and finally $(TARGET) will be generated by calling into "arch/*/" to make $(TARGET).

Now we don't need to prefix $(ALL_OBJS) with $(BASEDIR) as it is now only used from the main Makefile. Other changes is to use "$<" instead of spelling "prelink.o" in the target "$(TARGET)" in both arch/*/Makefile.

Beside "prelink.o" been at a different location, no other functional change intended.

---

Notes:
v8:
- rebased
- move Arm specific dependencies between $(ALL_OBJS) objects (head.o) into Arm specific "Rules.mk" instead of the common "build.mk".

v7:
- change, now things are in build.mk: no more prepare phase needed

 xen/Makefile          | 15 ++++++++++++++-
 xen/Rules.mk          | 13 -------------
 xen/arch/arm/Makefile | 31 ++++---------------------------
 xen/arch/arm/Rules.mk |  5 +++++
 xen/arch/arm/arch.mk  |  2 ++
 xen/arch/x86/Makefile | 29 ++++++-----------------------
 xen/arch/x86/arch.mk  |  2 ++
 xen/build.mk          | 18 ++++++++++++++++++
 8 files changed, 51 insertions(+), 64 deletions(-)
xen/Makefile +14 -1
index ed61f38dd335..7bb3595d649f 100644
@@ -285,8 +285,21 @@ CFLAGS += -flto
 LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so
 endif
 
+# Note that link order matters!
+ALL_OBJS-y                := common/built_in.o
+ALL_OBJS-y                += drivers/built_in.o
+ALL_OBJS-y                += lib/built_in.o
+ALL_OBJS-y                += xsm/built_in.o
+ALL_OBJS-y                += arch/$(TARGET_ARCH)/built_in.o
+ALL_OBJS-$(CONFIG_CRYPTO) += crypto/built_in.o
+
+ALL_LIBS-y                := lib/lib.a
+
 include $(BASEDIR)/arch/$(TARGET_ARCH)/arch.mk
 
+export ALL_OBJS := $(ALL_OBJS-y)
+export ALL_LIBS := $(ALL_LIBS-y)
+
 # define new variables to avoid the ones defined in Config.mk
 export XEN_CFLAGS := $(CFLAGS)
 export XEN_AFLAGS := $(AFLAGS)
@@ -407,7 +420,7 @@ $(TARGET): FORCE
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C include
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) include
 	$(MAKE) -f $(BASEDIR)/Rules.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
+	$(MAKE) -f $(BASEDIR)/Rules.mk $@
 
 SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
 define all_sources
xen/Rules.mk +0 -13
index 7b8b9047cfd5..77d359bedaf8 100644
@@ -8,25 +8,12 @@
 include $(XEN_ROOT)/Config.mk
 include $(BASEDIR)/scripts/Kbuild.include
 
-# Note that link order matters!
-ALL_OBJS-y               += $(BASEDIR)/common/built_in.o
-ALL_OBJS-y               += $(BASEDIR)/drivers/built_in.o
-ALL_OBJS-y               += $(BASEDIR)/lib/built_in.o
-ALL_OBJS-y               += $(BASEDIR)/xsm/built_in.o
-ALL_OBJS-y               += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o
-ALL_OBJS-$(CONFIG_CRYPTO)   += $(BASEDIR)/crypto/built_in.o
-
-ALL_LIBS-y               := $(BASEDIR)/lib/lib.a
-
 # Initialise some variables
 lib-y :=
 targets :=
 CFLAGS-y :=
 AFLAGS-y :=
 
-ALL_OBJS := $(ALL_OBJS-y)
-ALL_LIBS := $(ALL_LIBS-y)
-
 SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \
                                             $(foreach w,1 2 4, \
                                                         rodata.str$(w).$(a)) \
xen/arch/arm/Makefile +4 -27
index d0dee10102b6..14952275772b 100644
@@ -75,14 +75,6 @@ ifneq ($(CONFIG_DTB_FILE),"")
 obj-y += dtb.o
 endif
 
-ALL_OBJS := $(TARGET_SUBARCH)/head.o $(ALL_OBJS)
-
-# head.o is built by descending into the sub-directory, depends on the part of
-# $(ALL_OBJS) that will eventually recurse into $(TARGET_SUBARCH)/ and build
-# head.o
-$(TARGET_SUBARCH)/head.o: $(BASEDIR)/arch/arm/built_in.o
-$(TARGET_SUBARCH)/head.o: ;
-
 ifdef CONFIG_LIVEPATCH
 all_symbols = --all-symbols
 ifdef CONFIG_FAST_SYMBOL_LOOKUP
@@ -98,33 +90,18 @@ ifeq ($(CONFIG_ARM_64),y)
 	ln -sf $(@F) [email protected]
 endif
 
-ifeq ($(CONFIG_LTO),y)
-# Gather all LTO objects together
-prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS)
-	$(LD_LTO) -r -o $@ $(filter-out %.a,$^) --start-group $(filter %.a,$^) --end-group
-
-# Link it with all the binary objects
-prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o
-	$(call if_changed,ld)
-else
-prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
-	$(call if_changed,ld)
-endif
-
-targets += prelink.o
-
-$(TARGET)-syms: prelink.o xen.lds
-	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o \
+$(TARGET)-syms: $(BASEDIR)/prelink.o xen.lds
+	$(LD) $(XEN_LDFLAGS) -T xen.lds -N $< \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0.S
 	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o
-	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o \
+	$(LD) $(XEN_LDFLAGS) -T xen.lds -N $< \
 	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
 	$(NM) -pa --format=sysv $(@D)/.$(@F).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1.S
 	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o
-	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
+	$(LD) $(XEN_LDFLAGS) -T xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
 		| $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort \
xen/arch/arm/Rules.mk +5 -0
index e69de29bb2d1..290609487605 100644
@@ -0,0 +1,5 @@
+# head.o is built by descending into arch/arm/$(TARGET_SUBARCH), depends on the
+# part of $(ALL_OBJS) that will eventually recurse into $(TARGET_SUBARCH)/ and
+# build head.o
+arch/arm/$(TARGET_SUBARCH)/head.o: arch/arm/built_in.o
+arch/arm/$(TARGET_SUBARCH)/head.o: ;
xen/arch/arm/arch.mk +2 -0
index c3ac443b3788..ba3f140e2ea7 100644
@@ -26,3 +26,5 @@ ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
         LDFLAGS += --fix-cortex-a53-843419
     endif
 endif
+
+ALL_OBJS-y := arch/arm/$(TARGET_SUBARCH)/head.o $(ALL_OBJS-y)
xen/arch/x86/Makefile +6 -23
index d7d2adc1881e..b469ec8f2452 100644
@@ -123,37 +123,20 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
 
-ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
-
-ifeq ($(CONFIG_LTO),y)
-# Gather all LTO objects together
-prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS)
-	$(LD_LTO) -r -o $@ $(filter-out %.a,$^) --start-group $(filter %.a,$^) --end-group
-
-# Link it with all the binary objects
-prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
-	$(call if_changed,ld)
-else
-prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
-	$(call if_changed,ld)
-endif
-
-targets += prelink.o
-
-$(TARGET)-syms: prelink.o xen.lds
-	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
+$(TARGET)-syms: $(BASEDIR)/prelink.o xen.lds
+	$(LD) $(XEN_LDFLAGS) -T xen.lds -N $< $(build_id_linker) \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort \
 		>$(@D)/.$(@F).0.S
 	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).0.o
-	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
+	$(LD) $(XEN_LDFLAGS) -T xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
 	$(NM) -pa --format=sysv $(@D)/.$(@F).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-y) \
 		>$(@D)/.$(@F).1.S
 	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).1.o
-	$(LD) $(XEN_LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
+	$(LD) $(XEN_LDFLAGS) -T xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
 		| $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort \
@@ -206,7 +189,7 @@ note_file_option ?= $(note_file)
 
 ifeq ($(XEN_BUILD_PE),y)
 extra-y += efi.lds
-$(TARGET).efi: prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
+$(TARGET).efi: $(BASEDIR)/prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
 ifeq ($(CONFIG_DEBUG_INFO),y)
 	$(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug info from $(@F)"
 endif
@@ -235,7 +218,7 @@ $(TARGET).efi: FORCE
 	echo '$(if $(filter y,$(XEN_BUILD_EFI)),xen.efi generation,EFI support) disabled'
 endif
 
-efi/buildid.o efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o
+# These should already have been rebuilt when building the prerequisite of "prelink.o"
 efi/buildid.o efi/relocs-dummy.o: ;
 
 .PHONY: include
xen/arch/x86/arch.mk +2 -0
index 19c9cd206ed0..c830dc5b3a7c 100644
@@ -104,3 +104,5 @@ endif
 
 # Set up the assembler include path properly for older toolchains.
 CFLAGS += -Wa,-I$(BASEDIR)/include
+
+ALL_OBJS-y := arch/x86/boot/built_in.o arch/x86/efi/built_in.o $(ALL_OBJS-y)
xen/build.mk +18 -0
index 622e841c1cc0..740945333a97 100644
@@ -58,3 +58,21 @@ arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
 	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
 	  echo ""; \
 	  echo "#endif") <$< >$@
+
+ifeq ($(CONFIG_LTO),y)
+# Gather all LTO objects together
+prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS)
+	$(LD_LTO) -r -o $@ $(filter-out %.a,$^) --start-group $(filter %.a,$^) --end-group
+
+# Link it with all the binary objects
+prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o FORCE
+	$(call if_changed,ld)
+else
+prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
+	$(call if_changed,ld)
+endif
+
+targets += prelink.o
+
+$(TARGET): prelink.o FORCE
+	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
Signature · 1 line
Anthony PERARD
#20 lore raw

Re: [XEN PATCH v8 07/47] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile

On 25.11.2021 14:39, Anthony PERARD wrote:

Nit: In the title, do you mean "set ALL_OBJS in main Makefile; ..."?

Quoted 10 lines
xen/Makefile +4 -0
@@ -285,8 +285,21 @@ CFLAGS += -flto
 LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so
 endif
 
+# Note that link order matters!
+ALL_OBJS-y                := common/built_in.o
+ALL_OBJS-y                += drivers/built_in.o
+ALL_OBJS-y                += lib/built_in.o

xen/Makefile CFLAGS += -flto · line 301

Quoted 10 lines
xen/Makefile +8 -0
+ALL_OBJS-y                += xsm/built_in.o
+ALL_OBJS-y                += arch/$(TARGET_ARCH)/built_in.o
+ALL_OBJS-$(CONFIG_CRYPTO) += crypto/built_in.o
+
+ALL_LIBS-y                := lib/lib.a
+
 include $(BASEDIR)/arch/$(TARGET_ARCH)/arch.mk
 
+export ALL_OBJS := $(ALL_OBJS-y)
+export ALL_LIBS := $(ALL_LIBS-y)

Who's the consumer of these exports? I ask because I don't consider the names very suitable for exporting, and hence I'd prefer to see their scope limited. If e.g. it's only a single make invocation where they need propagating, doing so on the command line might be better.

xen/arch/arm/Rules.mk line 5

Quoted 8 lines
xen/arch/arm/Rules.mk +5 -0
@@ -0,0 +1,5 @@
+# head.o is built by descending into arch/arm/$(TARGET_SUBARCH), depends on the
+# part of $(ALL_OBJS) that will eventually recurse into $(TARGET_SUBARCH)/ and
+# build head.o
+arch/arm/$(TARGET_SUBARCH)/head.o: arch/arm/built_in.o
+arch/arm/$(TARGET_SUBARCH)/head.o: ;

Can't this be a single line:

arch/arm/$(TARGET_SUBARCH)/head.o: arch/arm/built_in.o ;

?

xen/arch/arm/Rules.mk $(TARGET).efi: FORCE · line 222

Quoted 7 lines
xen/arch/arm/Rules.mk +1 -1
@@ -235,7 +218,7 @@ $(TARGET).efi: FORCE
 	echo '$(if $(filter y,$(XEN_BUILD_EFI)),xen.efi generation,EFI support) disabled'
 endif
 
-efi/buildid.o efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o
+# These should already have been rebuilt when building the prerequisite of "prelink.o"
 efi/buildid.o efi/relocs-dummy.o: ;

If the comment is true in all cases, do they really still need an empty rule?

Jan

#21 lore raw

Re: [XEN PATCH v8 07/47] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile

Quoted 22 lines · Jan Beulich

On 25.11.2021 14:39, Anthony PERARD wrote:

Nit: In the title, do you mean "set ALL_OBJS in main Makefile; ..."?

Quoted 18 lines
xen/Makefile +10 -0
@@ -285,8 +285,21 @@ CFLAGS += -flto
 LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so
 endif
 
+# Note that link order matters!
+ALL_OBJS-y                := common/built_in.o
+ALL_OBJS-y                += drivers/built_in.o
+ALL_OBJS-y                += lib/built_in.o
+ALL_OBJS-y                += xsm/built_in.o
+ALL_OBJS-y                += arch/$(TARGET_ARCH)/built_in.o
+ALL_OBJS-$(CONFIG_CRYPTO) += crypto/built_in.o
+
+ALL_LIBS-y                := lib/lib.a
+
 include $(BASEDIR)/arch/$(TARGET_ARCH)/arch.mk
 
Quoted 7 lines

xen/Makefile CFLAGS += -flto · line 301

Quoted 2 lines
xen/Makefile +2 -0
+export ALL_OBJS := $(ALL_OBJS-y)
+export ALL_LIBS := $(ALL_LIBS-y)

Who's the consumer of these exports? I ask because I don't consider the names very suitable for exporting, and hence I'd prefer to see their scope limited. If e.g. it's only a single make invocation where they need propagating, doing so on the command line might be better.

There seems to be only one consumer, "build.mk", and only the last $(MAKE) call in the recipe "$(TARGET)". So, it's probably fine to set both on the command line instead of using export. I'll have a look.

Quoted 11 lines

xen/arch/arm/Rules.mk line 5

Quoted 8 lines
xen/arch/arm/Rules.mk +5 -0
@@ -0,0 +1,5 @@
+# head.o is built by descending into arch/arm/$(TARGET_SUBARCH), depends on the
+# part of $(ALL_OBJS) that will eventually recurse into $(TARGET_SUBARCH)/ and
+# build head.o
+arch/arm/$(TARGET_SUBARCH)/head.o: arch/arm/built_in.o
+arch/arm/$(TARGET_SUBARCH)/head.o: ;

Can't this be a single line:

Quoted 1 line

arch/arm/$(TARGET_SUBARCH)/head.o: arch/arm/built_in.o ;

Sure.

Quoted 10 lines

xen/arch/arm/Rules.mk $(TARGET).efi: FORCE · line 222

Quoted 7 lines
xen/arch/arm/Rules.mk +1 -1
@@ -235,7 +218,7 @@ $(TARGET).efi: FORCE
 	echo '$(if $(filter y,$(XEN_BUILD_EFI)),xen.efi generation,EFI support) disabled'
 endif
 
-efi/buildid.o efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o
+# These should already have been rebuilt when building the prerequisite of "prelink.o"
 efi/buildid.o efi/relocs-dummy.o: ;

If the comment is true in all cases, do they really still need an empty rule?

Yes. Those two targets are unfortunately a prerequisite of "xen.efi", so make will look for a rule to make them, and would use %.o:%.c without this explicit rule.

Thanks,

Signature · 1 line
Anthony PERARD
#22 lore raw

PATCH v8 8/47 build: prepare to always invoke $(MAKE) from xen/, use $(obj)

In reply to Anthony PERARD

In a future patch, when building a subdirectory, we will set "obj=$subdir" rather than change directory.

Before that, we add "$(obj)" and "$(src)" in as many places as possible where we will need to know which subdirectory is been built. "$(obj)" is for files been generated during the build, and "$(src)" is for files present in the source tree.

For now, we set both to "." in Rules.mk and Makefile.clean.

A few places don't tolerate the addition of "./", this is because make remove the leading "./" in targets and dependencies in rules, so these will be change later.

---

Notes:
v8:
- acked
- rebased

 xen/Rules.mk                            |  5 ++-
 xen/arch/arm/Makefile                   | 14 ++++----
 xen/arch/x86/Makefile                   | 48 ++++++++++++-------------
 xen/arch/x86/boot/Makefile              | 14 ++++----
 xen/arch/x86/efi/Makefile               |  6 ++--
 xen/common/Makefile                     |  8 ++---
 xen/common/libelf/Makefile              |  4 +--
 xen/common/libfdt/Makefile              |  6 ++--
 xen/include/Makefile                    | 44 +++++++++++------------
 xen/scripts/Makefile.clean              |  5 ++-
 xen/xsm/flask/Makefile                  | 36 +++++++++----------
 xen/xsm/flask/policy/mkaccess_vector.sh |  7 ++--
 12 files changed, 103 insertions(+), 94 deletions(-)
xen/Rules.mk +4 -1
index 77d359bedaf8..60d1d6c4f583 100644
@@ -3,6 +3,9 @@
 # Makefile and are consumed by Rules.mk
 #
 
+obj := .
+src := $(obj)
+
 -include $(BASEDIR)/include/config/auto.conf
 
 include $(XEN_ROOT)/Config.mk
@@ -21,7 +24,7 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \
                          $(foreach r,rel rel.ro,data.$(r).local)
 
 # The filename build.mk has precedence over Makefile
-include $(firstword $(wildcard build.mk) Makefile)
+include $(firstword $(wildcard $(src)/build.mk) $(src)/Makefile)
 
 # Linking
 # ---------------------------------------------------------------------------
xen/arch/arm/Makefile +7 -7
index 14952275772b..c993ce72a341 100644
@@ -90,18 +90,18 @@ ifeq ($(CONFIG_ARM_64),y)
 	ln -sf $(@F) [email protected]
 endif
 
-$(TARGET)-syms: $(BASEDIR)/prelink.o xen.lds
-	$(LD) $(XEN_LDFLAGS) -T xen.lds -N $< \
+$(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0.S
 	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o
-	$(LD) $(XEN_LDFLAGS) -T xen.lds -N $< \
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
 	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
 	$(NM) -pa --format=sysv $(@D)/.$(@F).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1.S
 	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o
-	$(LD) $(XEN_LDFLAGS) -T xen.lds -N $< $(build_id_linker) \
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
 		| $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort \
@@ -111,13 +111,13 @@ $(TARGET)-syms: $(BASEDIR)/prelink.o xen.lds
 .PHONY: include
 include:
 
-xen.lds: xen.lds.S FORCE
+$(obj)/xen.lds: $(src)/xen.lds.S FORCE
 	$(call if_changed,cpp_lds_S)
 
-dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
+$(obj)/dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 
 .PHONY: clean
 clean::
-	rm -f xen.lds
+	rm -f $(obj)/xen.lds
 	rm -f $(BASEDIR)/.xen-syms.[0-9]*
 	rm -f $(TARGET).efi
xen/arch/x86/Makefile +24 -24

144 lines not on this page · raw message

xen/arch/x86/boot/Makefile +7 -7
index d2eb277d428f..0aec8a464364 100644
@@ -1,8 +1,8 @@
 obj-bin-y += head.o
 
-DEFS_H_DEPS = defs.h $(BASEDIR)/include/xen/stdbool.h
+DEFS_H_DEPS = $(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) video.h \
+CMDLINE_DEPS = $(DEFS_H_DEPS) $(src)/video.h \
 	       $(BASEDIR)/include/xen/kconfig.h \
 	       $(BASEDIR)/include/generated/autoconf.h
 
@@ -14,10 +14,10 @@ RELOC_DEPS = $(DEFS_H_DEPS) \
 	     $(BASEDIR)/include/xen/const.h \
 	     $(BASEDIR)/include/public/arch-x86/hvm/start_info.h
 
-head.o: cmdline.S reloc.S
+$(obj)/head.o: $(obj)/cmdline.S $(obj)/reloc.S
 
-cmdline.S: cmdline.c $(CMDLINE_DEPS) build32.lds
-	$(MAKE) -f build32.mk $@ CMDLINE_DEPS="$(CMDLINE_DEPS)"
+$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) $(src)/build32.lds
+	$(MAKE) -f build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
-reloc.S: reloc.c $(RELOC_DEPS) build32.lds
-	$(MAKE) -f build32.mk $@ RELOC_DEPS="$(RELOC_DEPS)"
+$(obj)/reloc.S: $(src)/reloc.c $(RELOC_DEPS) $(src)/build32.lds
+	$(MAKE) -f build32.mk -C $(obj) $(@F) RELOC_DEPS="$(RELOC_DEPS)"
xen/arch/x86/efi/Makefile +3 -3
index 87b927ed865b..ac815f02cb5e 100644
@@ -3,16 +3,16 @@ CFLAGS-y += -fshort-wchar
 quiet_cmd_objcopy_o_ihex = OBJCOPY $@
 cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@
 
-%.o: %.ihex FORCE
+$(obj)/%.o: $(src)/%.ihex FORCE
 	$(call if_changed,objcopy_o_ihex)
 
-boot.init.o: buildid.o
+$(obj)/boot.init.o: $(obj)/buildid.o
 
 EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
 EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
 $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4)
-$(EFIOBJ-y): CFLAGS-stack-boundary := $(cflags-stack-boundary)
+$(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS-stack-boundary := $(cflags-stack-boundary)
 
 obj-y := stub.o
 obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
xen/common/Makefile +4 -4
index 141d7d40d3dc..ca839118e4d1 100644
@@ -75,13 +75,13 @@ obj-$(CONFIG_NEEDS_LIBELF) += libelf/
 obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
 
 CONF_FILE := $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(BASEDIR)/)$(KCONFIG_CONFIG)
-config.gz: $(CONF_FILE)
+$(obj)/config.gz: $(CONF_FILE)
 	gzip -n -c $< >$@
 
-config_data.o: config.gz
+$(obj)/config_data.o: $(obj)/config.gz
 
-config_data.S: $(BASEDIR)/tools/binfile FORCE
-	$(call if_changed,binfile,config.gz xen_config_data)
+$(obj)/config_data.S: $(BASEDIR)/tools/binfile FORCE
+	$(call if_changed,binfile,$(obj)/config.gz xen_config_data)
 targets += config_data.S
 
 clean::
xen/common/libelf/Makefile +2 -2
index a92326c982e9..8a4522e4e141 100644
@@ -7,10 +7,10 @@ OBJCOPYFLAGS := $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s))
 
 CFLAGS-y += -Wno-pointer-sign
 
-libelf.o: libelf-temp.o FORCE
+$(obj)/libelf.o: $(obj)/libelf-temp.o FORCE
 	$(call if_changed,objcopy)
 
-libelf-temp.o: $(libelf-objs) FORCE
+$(obj)/libelf-temp.o: $(addprefix $(obj)/,$(libelf-objs)) FORCE
 	$(call if_changed,ld)
 
 extra-y += libelf-temp.o $(libelf-objs)
xen/common/libfdt/Makefile +3 -3
index 6bd207cf8ffa..6708af12e583 100644
@@ -1,4 +1,4 @@
-include Makefile.libfdt
+include $(src)/Makefile.libfdt
 
 SECTIONS := text data $(SPECIAL_DATA_SECTIONS)
 OBJCOPYFLAGS := $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s))
@@ -8,10 +8,10 @@ nocov-y += libfdt.o
 
 CFLAGS-y += -I$(BASEDIR)/include/xen/libfdt/
 
-libfdt.o: libfdt-temp.o FORCE
+$(obj)/libfdt.o: $(obj)/libfdt-temp.o FORCE
 	$(call if_changed,objcopy)
 
-libfdt-temp.o: $(LIBFDT_OBJS) FORCE
+$(obj)/libfdt-temp.o: $(addprefix $(obj)/,$(LIBFDT_OBJS)) FORCE
 	$(call if_changed,ld)
 
 extra-y += libfdt-temp.o $(LIBFDT_OBJS)
xen/include/Makefile +22 -22

107 lines not on this page · raw message

xen/scripts/Makefile.clean +4 -1
index 8582ec35e4da..c3b0681611da 100644
@@ -3,11 +3,14 @@
 # Cleaning up
 # ==========================================================================
 
+obj := .
+src := $(obj)
+
 clean::
 
 include $(BASEDIR)/scripts/Kbuild.include
 
-include Makefile
+include $(src)/Makefile
 
 # Figure out what we need to clean from the various variables
 # ==========================================================================
xen/xsm/flask/Makefile +18 -18
index 11c530dcf458..51fd37f6c4d5 100644
@@ -4,46 +4,46 @@ obj-y += flask_op.o
 
 obj-y += ss/
 
-CFLAGS-y += -I./include
+CFLAGS-y += -I$(obj)/include
 
 AWK = awk
 
-FLASK_H_DEPEND = policy/security_classes policy/initial_sids
-AV_H_DEPEND = policy/access_vectors
+FLASK_H_DEPEND := $(addprefix $(src)/policy/,security_classes initial_sids)
+AV_H_DEPEND = $(src)/policy/access_vectors
 
-FLASK_H_FILES = include/flask.h include/class_to_string.h include/initial_sid_to_string.h
-AV_H_FILES = include/av_perm_to_string.h include/av_permissions.h
-ALL_H_FILES = $(FLASK_H_FILES) $(AV_H_FILES)
+FLASK_H_FILES := flask.h class_to_string.h initial_sid_to_string.h
+AV_H_FILES := av_perm_to_string.h av_permissions.h
+ALL_H_FILES := $(addprefix include/,$(FLASK_H_FILES) $(AV_H_FILES))
 
-$(obj-y) ss/built_in.o: $(ALL_H_FILES)
+$(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(ALL_H_FILES))
 extra-y += $(ALL_H_FILES)
 
-mkflask := policy/mkflask.sh
+mkflask := $(src)/policy/mkflask.sh
 quiet_cmd_mkflask = MKFLASK $@
-cmd_mkflask = $(SHELL) $(mkflask) $(AWK) include $(FLASK_H_DEPEND)
+cmd_mkflask = $(SHELL) $(mkflask) $(AWK) $(obj)/include $(FLASK_H_DEPEND)
 
-$(subst include/,%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE
+$(addprefix $(obj)/%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE
 	$(call if_changed,mkflask)
 
-mkaccess := policy/mkaccess_vector.sh
+mkaccess := $(src)/policy/mkaccess_vector.sh
 quiet_cmd_mkaccess = MKACCESS VECTOR $@
-cmd_mkaccess = $(SHELL) $(mkaccess) $(AWK) $(AV_H_DEPEND)
+cmd_mkaccess = $(SHELL) $(mkaccess) $(AWK) $(obj)/include $(AV_H_DEPEND)
 
-$(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE
+$(addprefix $(obj)/%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE
 	$(call if_changed,mkaccess)
 
 obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
-flask-policy.o: policy.bin
+$(obj)/flask-policy.o: $(obj)/policy.bin
 
-flask-policy.S: BINFILE_FLAGS := -i
-flask-policy.S: $(BASEDIR)/tools/binfile FORCE
-	$(call if_changed,binfile,policy.bin xsm_flask_init_policy)
+$(obj)/flask-policy.S: BINFILE_FLAGS := -i
+$(obj)/flask-policy.S: $(BASEDIR)/tools/binfile FORCE
+	$(call if_changed,binfile,$(obj)/policy.bin xsm_flask_init_policy)
 targets += flask-policy.S
 
 FLASK_BUILD_DIR := $(CURDIR)
 POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)
 
-policy.bin: FORCE
+$(obj)/policy.bin: FORCE
 	$(MAKE) -f $(XEN_ROOT)/tools/flask/policy/Makefile.common \
 	        -C $(XEN_ROOT)/tools/flask/policy \
 	        FLASK_BUILD_DIR=$(FLASK_BUILD_DIR) POLICY_FILENAME=$(POLICY_SRC)
xen/xsm/flask/policy/mkaccess_vector.sh +5 -2
index 942ede4713f1..ad9772193bff 100755
@@ -8,9 +8,12 @@ set -e
 awk=$1
 shift
 
+output_dir=$1
+shift
+
 # output files
-av_permissions="include/av_permissions.h"
-av_perm_to_string="include/av_perm_to_string.h"
+av_permissions="$output_dir/av_permissions.h"
+av_perm_to_string="$output_dir/av_perm_to_string.h"
 
 cat $* | $awk "
 BEGIN	{
Signature · 1 line
Anthony PERARD
Acked-by on v8 8/47
#23 lore raw

Re: [XEN PATCH v8 08/47] build: prepare to always invoke $(MAKE) from xen/, use $(obj)

Hi Anthony,

Quoted 8 lines · Anthony PERARD

In a future patch, when building a subdirectory, we will set "obj=$subdir" rather than change directory.

Before that, we add "$(obj)" and "$(src)" in as many places as possible where we will need to know which subdirectory is been built. "$(obj)" is for files been generated during the build, and "$(src)" is for files present in the source tree.

Quoted 8 lines

For now, we set both to "." in Rules.mk and Makefile.clean.

A few places don't tolerate the addition of "./", this is because make remove the leading "./" in targets and dependencies in rules, so these will be change later.

For Arm:

Cheers,

Signature · 1 line
Julien Grall
#24 lore raw

PATCH v8 9/47 build: rework test/livepatch/Makefile

In reply to Anthony PERARD

This rework the livepatch/Makefile to make it less repetitive and make use of the facilities. All the targets to be built are now listed in $(extra-y) which will allow Rules.mk to build them without the need of a local target in a future patch.

There are some changes/fixes in this patch:
- when "xen-syms" is used for a target, it is added to the dependency list of the target, which allow to rebuild the target when xen-syms changes. But if "xen-syms" is missing, make simply fails.
- modinfo.o wasn't removing it's [email protected] file like the other targets, this is now done.
- The command to build *.livepatch targets as been fixed to use $(XEN_LDFLAGS) rather than just $(LDFLAGS) which is a fallout from 2740d96efdd3 ("xen/build: have the root Makefile generates the CFLAGS")

make will findout the dependencies of the *.livepatch files and thus what to built by "looking" at the objects listed in the *-objs variables. The actual dependencies is generated by the new "multi-depend" macro.

"$(targets)" needs to be updated with the objects listed in the different *-objs variables to allow make to load the .*.cmd dependency files.

This patch copies the macro "multi_depend" from Linux 5.12, and rename it to "multi-depend".

---

Notes:
v8:
- rename multi_depend to multi-depend
- use $() for single-letter make variable
- re-indent one line

 xen/scripts/Kbuild.include  |   9 ++
 xen/test/livepatch/Makefile | 213 ++++++++++++++----------------------
 2 files changed, 91 insertions(+), 131 deletions(-)
xen/scripts/Kbuild.include +9 -0
index 83c7e1457baa..21030cfcfbc1 100644
@@ -151,3 +151,12 @@ why =                                                                        \
 
 echo-why = $(call escsq, $(strip $(why)))
 endif
+
+# Useful for describing the dependency of composite objects
+# Usage:
+#   $(call multi-depend, multi-used-targets, suffix-to-remove, suffix-to-add)
+define multi-depend
+$(foreach m, $(notdir $1), \
+	$(eval $(obj)/$(m): \
+	$(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))
+endef
xen/test/livepatch/Makefile +82 -131

283 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
Acked-by on v8 9/47
#25 lore raw

Re: [XEN PATCH v8 09/47] build: rework test/livepatch/Makefile

Quoted 37 lines · Anthony PERARD

This rework the livepatch/Makefile to make it less repetitive and make use of the facilities. All the targets to be built are now listed in $(extra-y) which will allow Rules.mk to build them without the need of a local target in a future patch.

There are some changes/fixes in this patch:
- when "xen-syms" is used for a target, it is added to the dependency list of the target, which allow to rebuild the target when xen-syms changes. But if "xen-syms" is missing, make simply fails.
- modinfo.o wasn't removing it's [email protected] file like the other targets, this is now done.
- The command to build *.livepatch targets as been fixed to use $(XEN_LDFLAGS) rather than just $(LDFLAGS) which is a fallout from 2740d96efdd3 ("xen/build: have the root Makefile generates the CFLAGS")

make will findout the dependencies of the *.livepatch files and thus what to built by "looking" at the objects listed in the *-objs variables. The actual dependencies is generated by the new "multi-depend" macro.

"$(targets)" needs to be updated with the objects listed in the different *-objs variables to allow make to load the .*.cmd dependency files.

This patch copies the macro "multi_depend" from Linux 5.12, and rename it to "multi-depend".

---

Notes:
v8:
- rename multi_depend to multi-depend
- use $() for single-letter make variable
- re-indent one line

Quoted 3 lines
 xen/scripts/Kbuild.include  |   9 ++
 xen/test/livepatch/Makefile | 213 ++++++++++++++----------------------
 2 files changed, 91 insertions(+), 131 deletions(-)

The tiny non-livepatch part

Jan

#26 lore raw

PATCH v8 10/47 build: rework cloc recipe

In reply to Anthony PERARD

We are going to make other modifications to the cloc recipe, so this patch prepare make those modification easier.

We replace the Makefile meta programming by just a shell script which should be easier to read and is actually faster to execute.

Instead of looking for files in "$(BASEDIR)", we use "." which is give the same result overall. We also avoid the need for a temporary file as cloc can read the list of files from stdin.

No change intended to the output of cloc.

---

Notes:
v8:
- rework cloc patch, move it ahead of problematic changes this is only a convertion to shell script with a single other change.

 xen/Makefile | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
xen/Makefile +6 -8
index 7bb3595d649f..6afae6ced37c 100644
@@ -477,14 +477,12 @@ _MAP:
 
 .PHONY: cloc
 cloc:
-	$(eval tmpfile := $(shell mktemp))
-	$(foreach f, $(shell find $(BASEDIR) -name *.o.d), \
-		$(eval path := $(dir $(f))) \
-		$(eval names := $(shell grep -o "[a-zA-Z0-9_/-]*\.[cS]" $(f))) \
-		$(foreach sf, $(names), \
-			$(shell if test -f $(path)/$(sf) ; then echo $(path)/$(sf) >> $(tmpfile); fi;)))
-	cloc --list-file=$(tmpfile)
-	rm $(tmpfile)
+	find . -name '*.o.d' | while read f; do \
+	    for sf in $$(grep -o "[a-zA-Z0-9_/-]*\.[cS]" $$f); do \
+		sf="$$(dirname $$f)/$$sf"; \
+		test -f "$$sf" && echo "$$sf"; \
+	    done; \
+	done | cloc --list-file=-
 
 endif #config-build
 
Signature · 1 line
Anthony PERARD
Acked-by on v8 10/47
#27 lore raw

Re: [XEN PATCH v8 10/47] build: rework cloc recipe

Quoted 6 lines · Anthony PERARD

We are going to make other modifications to the cloc recipe, so this patch prepare make those modification easier.

We replace the Makefile meta programming by just a shell script which should be easier to read and is actually faster to execute.

Quoted 7 lines

Instead of looking for files in "$(BASEDIR)", we use "." which is give the same result overall. We also avoid the need for a temporary file as cloc can read the list of files from stdin.

No change intended to the output of cloc.

#28 lore raw

PATCH v8 11/47 build: fix enforce unique symbols for recent clang version

In reply to Anthony PERARD

clang 6.0 and newer behave like gcc in regards for the FILE symbol, so only the filename rather than the full path to the source file.

clang 3.8.1-24 (in our debian:stretch container) and 3.5.0-10 (in our debian:jessie container) do store the full path to the source file in the FILE symbol.

This means that we also need to check clang version to figure out which command we need to use to redefine symbol.

I don't know which version of clang change behavior, we will guess 4.0.

---

"enforce unique symbols" works by chance with recent clang version. The few object built from source in subdir don't pose an issue.

With checking for 4.0 or newer, build may fails with a version of clang between 4.0 and 6.0.

With checking for 6.0 or newer, no build fails, but maybe that will happen later with patch "build: build everything from the root dir, use obj=$subdir" applied.
---

Notes:
v8:
- new patch, extracted from "build: build everything from the root dir, use obj=$subdir"

 xen/Rules.mk               | 2 +-
 xen/scripts/Kbuild.include | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
xen/Rules.mk +1 -1
index 60d1d6c4f583..14b6e7fdd721 100644
@@ -166,7 +166,7 @@ SRCPATH := $(patsubst $(BASEDIR)/%,%,$(CURDIR))
 quiet_cmd_cc_o_c = CC      $@
 ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y)
     cmd_cc_o_c = $(CC) $(c_flags) -c $< -o $(dot-target).tmp -MQ $@
-    ifeq ($(CONFIG_CC_IS_CLANG),y)
+    ifeq ($(CONFIG_CC_IS_CLANG)$(call clang-ifversion,-lt,400,y),yy)
         cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(dot-target).tmp $@
     else
         cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(dot-target).tmp $@
xen/scripts/Kbuild.include +2 -0
index 21030cfcfbc1..b4b77f85d8d5 100644
@@ -59,6 +59,8 @@ ld-option = $(call success,$(LD) -v $(1))
 # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
 cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
 
+clang-ifversion = $(shell [ $(CONFIG_CLANG_VERSION)0 $(1) $(2)000 ] && echo $(3) || echo $(4))
+
 # Shorthand for $(MAKE) clean
 # Usage:
 # $(MAKE) $(clean) dir
Signature · 1 line
Anthony PERARD
#29 lore raw

Re: [XEN PATCH v8 11/47] build: fix enforce unique symbols for recent clang version

Quoted 7 lines · Anthony PERARD

clang 6.0 and newer behave like gcc in regards for the FILE symbol, so only the filename rather than the full path to the source file.

clang 3.8.1-24 (in our debian:stretch container) and 3.5.0-10 (in our debian:jessie container) do store the full path to the source file in the FILE symbol.

Quoted 5 lines

This means that we also need to check clang version to figure out which command we need to use to redefine symbol.

I don't know which version of clang change behavior, we will guess 4.0.

When I did this earlier work, it was clang5 that I used. Which would seem to mean the change in behavior was in version 6.

Jan

#30 lore raw

Re: [XEN PATCH v8 11/47] build: fix enforce unique symbols for recent clang version

Quoted 8 lines · Jan Beulich
Quoted 7 lines · Anthony PERARD

clang 6.0 and newer behave like gcc in regards for the FILE symbol, so only the filename rather than the full path to the source file.

clang 3.8.1-24 (in our debian:stretch container) and 3.5.0-10 (in our debian:jessie container) do store the full path to the source file in the FILE symbol.

Quoted 8 lines
Quoted 5 lines

This means that we also need to check clang version to figure out which command we need to use to redefine symbol.

I don't know which version of clang change behavior, we will guess 4.0.

When I did this earlier work, it was clang5 that I used. Which would seem to mean the change in behavior was in version 6.

Thanks, I forgot this fact. I'll make change in the patch, and replace the last paragraph of the patch description and add something link this instead:

Also, based on commit 81ecb38b83 ("build: provide option to disambiguate symbol names"), which were using clang 5, the change of behavior likely happened in clang 6.0.

Thanks,

Signature · 1 line
Anthony PERARD
#31 lore raw

PATCH v8 12/47 build: build everything from the root dir, use obj=$subdir

In reply to Anthony PERARD

A subdirectory is now built by setting "$(obj)" instead of changing directory. "$(obj)" should always be set when using "Rules.mk" and thus a shortcut "$(build)" is introduced and should be used.

A new variable "$(need-builtin)" is introduce. It is to be used whenever a "built_in.o" is wanted from a subdirectory. "built_in.o" isn't the main target anymore, and thus only needs to depends on the objects that should be part of "built_in.o".

Introduce $(srctree) and $(objtree) to replace $(BASEDIR) in cases a relative path is better, and $(abs_srctree) and $(abs_objtree) which have an absolute path.

DEPS is updated as the existing macro to deal with it doesn't know about $(obj).

There's some changes in "Rules.mk" which in addition to deal with "$(obj)" also make it's looks more like "Makefile.build" from Linux v5.12.

test/Makefile doesn't need special handling in order to build everything under test/, Rules.mk will visit test/livepatch via $(subdir-y), thus "tests" "all" and "build" target are removed. "subtree-force-update" target isn't useful so it is removed as well.

test/livepatch/Makefile doesn't need default target anymore, Rules.mk will build everything in $(extra-y) and thus all *.livepatch.

Adjust cloc recipe: dependency files generated by CC will now have the full path to the source file, so we don't need to prepend the subdirectory. This fix some issue with source not been parsed by cloc before. Also source from tools/kconfig would be listed with changes in this patch so adjust the find command to stop listing the "tools" directory and thus kconfig. With a default build of Xen on X86, they are a few new files parsed by cloc:

    arch/x86/x86_64/compat/mm.c
    arch/x86/x86_64/mm.c
    common/compat/domain.c
    common/compat/memory.c
    common/compat/xlat.c

---

Notes:
v8:
- rebased
- move check for $(obj) in Rules.mk earlier
- use $(sort ) when adding directories in $(subdir-y)
- fix missing space between "DEPS" and ":="
- use -iquote when adding '.' for xen/arch/x86/usercopy.o
- introduce also abs_srctree and abs_objtree
those were in patch "build: replace $(BASEDIR) by $(objtree)"
- reworked cmd_objcopy_fix_sym, we don't need to do anything for old version of clang, and for recent version of clang the change is the same a for gcc.
- adjust "cloc" recipe
- add some more $(Q) to silent $(MAKE) $(build)=...

v7:
- Spell "Makefile.build" as "Rules.mk" in the warning in Rules.mk about undefined $(obj).
- use $(srctree) for include/xen/config.h
- handle $(nocov-y) and $(noubsan-y), needed to add $(obj)/

 xen/Makefile                |  36 ++++++----
 xen/Rules.mk                | 138 ++++++++++++++++++++++++------------
 xen/arch/arm/Makefile       |   4 +-
 xen/arch/arm/Rules.mk       |   5 --
 xen/arch/arm/arch.mk        |   4 +-
 xen/arch/riscv/arch.mk      |   4 +-
 xen/arch/x86/Makefile       |  11 +--
 xen/arch/x86/Rules.mk       |   4 +-
 xen/arch/x86/arch.mk        |  12 ++--
 xen/arch/x86/boot/Makefile  |   8 +--
 xen/build.mk                |  12 +++-
 xen/include/Makefile        |   6 +-
 xen/scripts/Kbuild.include  |   6 ++
 xen/test/Makefile           |   7 +-
 xen/test/livepatch/Makefile |   6 --
 xen/xsm/flask/Makefile      |   2 +-
 xen/xsm/flask/ss/Makefile   |   2 +-
 17 files changed, 162 insertions(+), 105 deletions(-)
xen/Makefile +22 -14
index 6afae6ced37c..88997244368c 100644
@@ -22,6 +22,15 @@ export CHECKPOLICY	?= checkpolicy
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 
+abs_objtree := $(CURDIR)
+abs_srctree := $(CURDIR)
+
+export abs_srctree abs_objtree
+
+srctree := .
+objtree := .
+export srctree objtree
+
 # Do not use make's built-in rules and variables
 MAKEFLAGS += -rR
 
@@ -47,7 +56,7 @@ export KCONFIG_CONFIG ?= .config
 
 export CC CXX LD
 
-export TARGET := $(BASEDIR)/xen
+export TARGET := xen
 
 .PHONY: default
 default: build
@@ -250,7 +259,7 @@ endif
 CFLAGS += -nostdinc -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
 $(call cc-option-add,CFLAGS,CC,-Wvla)
-CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+CFLAGS += -pipe -D__XEN__ -include $(srctree)/include/xen/config.h
 CFLAGS-$(CONFIG_DEBUG_INFO) += -g
 
 ifneq ($(CONFIG_CC_IS_CLANG),y)
@@ -352,10 +361,10 @@ _install: $(TARGET)$(CONFIG_XEN_INSTALL_SUFFIX)
 
 .PHONY: tests
 tests:
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C test tests
+	$(Q)$(MAKE) $(build)=test
 .PHONY: install-tests
 install-tests:
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C test install
+	$(Q)$(MAKE) $(build)=test install
 
 .PHONY: _uninstall
 _uninstall: D=$(DESTDIR)
@@ -411,16 +420,16 @@ $(TARGET).gz: $(TARGET)
 
 $(TARGET): FORCE
 	$(MAKE) -C tools
-	$(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
+	$(Q)$(MAKE) $(build)=. include/xen/compile.h
 	[ -e arch/$(TARGET_ARCH)/efi ] && for f in $$(cd common/efi; echo *.[ch]); \
 		do test -r arch/$(TARGET_ARCH)/efi/$$f || \
 		   ln -nsf ../../../common/efi/$$f arch/$(TARGET_ARCH)/efi/; \
 		done; \
 		true
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C include
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) include
-	$(MAKE) -f $(BASEDIR)/Rules.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
-	$(MAKE) -f $(BASEDIR)/Rules.mk $@
+	$(Q)$(MAKE) $(build)=include all
+	$(Q)$(MAKE) $(build)=arch/$(TARGET_ARCH) include
+	$(Q)$(MAKE) $(build)=. arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
+	$(Q)$(MAKE) $(build)=. $@
 
 SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
 define all_sources
@@ -467,19 +476,18 @@ _MAP:
 	$(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map
 
 %.o %.i %.s: %.c FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
+	$(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
 %.o %.s: %.S FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
+	$(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
 %/: FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o built_in_bin.o
+	$(Q)$(MAKE) $(build)=$* need-builtin=1
 
 .PHONY: cloc
 cloc:
-	find . -name '*.o.d' | while read f; do \
+	find . -name tools -prune -o -name '*.o.d' -print | while read f; do \
 	    for sf in $$(grep -o "[a-zA-Z0-9_/-]*\.[cS]" $$f); do \
-		sf="$$(dirname $$f)/$$sf"; \
 		test -f "$$sf" && echo "$$sf"; \
 	    done; \
 	done | cloc --list-file=-
xen/Rules.mk +91 -47

241 lines not on this page · raw message

xen/arch/arm/Makefile +2 -2
index c993ce72a341..fd24f0212ffa 100644
@@ -95,12 +95,12 @@ $(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).0.o
+	$(MAKE) $(build)=$(@D) $(@D)/.$(@F).0.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
 	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
 	$(NM) -pa --format=sysv $(@D)/.$(@F).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk $(@D)/.$(@F).1.o
+	$(MAKE) $(build)=$(@D) $(@D)/.$(@F).1.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
xen/arch/arm/Rules.mk +0 -5
index 290609487605..e69de29bb2d1 100644
@@ -1,5 +0,0 @@
-# head.o is built by descending into arch/arm/$(TARGET_SUBARCH), depends on the
-# part of $(ALL_OBJS) that will eventually recurse into $(TARGET_SUBARCH)/ and
-# build head.o
-arch/arm/$(TARGET_SUBARCH)/head.o: arch/arm/built_in.o
-arch/arm/$(TARGET_SUBARCH)/head.o: ;
xen/arch/arm/arch.mk +2 -2
index ba3f140e2ea7..4e3f7014305e 100644
@@ -1,8 +1,8 @@
 ########################################
 # arm-specific definitions
 
-CFLAGS += -I$(BASEDIR)/include
-CFLAGS += -I$(BASEDIR)/arch/$(TARGET_ARCH)/include
+CFLAGS += -I$(srctree)/include
+CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
xen/arch/riscv/arch.mk +2 -2
index 39ae6ffea94d..694ba053ceab 100644
@@ -11,5 +11,5 @@ riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
 # -mcmodel=medlow would force Xen into the lower half.
 
 CFLAGS += -march=$(riscv-march-y) -mstrict-align -mcmodel=medany
-CFLAGS += -I$(BASEDIR)/include
-CFLAGS += -I$(BASEDIR)/arch/$(TARGET_ARCH)/include
+CFLAGS += -I$(srctree)/include
+CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
xen/arch/x86/Makefile +7 -4
index f9af39ba6138..6f18daf9105c 100644
@@ -80,6 +80,9 @@ endif
 extra-y += asm-macros.i
 extra-y += xen.lds
 
+# Allows usercopy.c to include itself
+$(obj)/usercopy.o: CFLAGS-y += -iquote .
+
 ifneq ($(CONFIG_HVM),y)
 $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif
@@ -129,13 +132,13 @@ $(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort \
 		>$(@D)/.$(@F).0.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).0.o
+	$(MAKE) $(build)=$(@D) efi-y= $(@D)/.$(@F).0.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
 	$(NM) -pa --format=sysv $(@D)/.$(@F).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-y) \
 		>$(@D)/.$(@F).1.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).1.o
+	$(MAKE) $(build)=$(@D) efi-y= $(@D)/.$(@F).1.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
@@ -199,14 +202,14 @@ endif
 	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o
+	$(MAKE) $(build)=$(@D) efi-y= .$(@F).0r.o .$(@F).0s.o
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< \
 	                $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file_option) -o $(@D)/.$(@F).$(base).1 &&) :
 	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).1 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o
+	$(MAKE) $(build)=$(@D) efi-y= .$(@F).1r.o .$(@F).1s.o
 	$(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds -N $< \
 	                $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(note_file_option) -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
xen/arch/x86/Rules.mk +2 -2
index 56fe22c979ea..2d12c2dca208 100644
@@ -2,9 +2,9 @@
 # x86-specific definitions
 
 ifneq ($(filter -DHAVE_AS_QUOTED_SYM,$(XEN_CFLAGS)),)
-object_label_flags = '-D__OBJECT_LABEL__=$(subst $(BASEDIR)/,,$(CURDIR))/$@'
+object_label_flags = '-D__OBJECT_LABEL__=$@'
 else
-object_label_flags = '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))'
+object_label_flags = '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$@))'
 endif
 c_flags += $(object_label_flags) $(CFLAGS-stack-boundary)
 a_flags += $(object_label_flags) $(CFLAGS-stack-boundary)
xen/arch/x86/arch.mk +6 -6
index c830dc5b3a7c..5152de343082 100644
@@ -3,10 +3,10 @@
 
 export XEN_IMG_OFFSET := 0x200000
 
-CFLAGS += -I$(BASEDIR)/include
-CFLAGS += -I$(BASEDIR)/arch/$(TARGET_ARCH)/include
-CFLAGS += -I$(BASEDIR)/arch/x86/include/asm/mach-generic
-CFLAGS += -I$(BASEDIR)/arch/x86/include/asm/mach-default
+CFLAGS += -I$(srctree)/include
+CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
+CFLAGS += -I$(srctree)/arch/x86/include/asm/mach-generic
+CFLAGS += -I$(srctree)/arch/x86/include/asm/mach-default
 CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
 
 # Prevent floating-point variables from creeping into Xen.
@@ -87,7 +87,7 @@ efi-nr-fixups := $(shell $(OBJDUMP) -p $(efi-check-o:.o=.efi) | grep '^[[:blank:
 ifeq ($(efi-nr-fixups),2)
 MKRELOC := :
 else
-MKRELOC := efi/mkreloc
+MKRELOC := arch/x86/efi/mkreloc
 # If the linker produced fixups but not precisely two of them, we need to
 # disable it doing so.  But if it didn't produce any fixups, it also wouldn't
 # recognize the option.
@@ -103,6 +103,6 @@ export EFI_LDFLAGS
 endif
 
 # Set up the assembler include path properly for older toolchains.
-CFLAGS += -Wa,-I$(BASEDIR)/include
+CFLAGS += -Wa,-I$(srctree)/include
 
 ALL_OBJS-y := arch/x86/boot/built_in.o arch/x86/efi/built_in.o $(ALL_OBJS-y)
xen/arch/x86/boot/Makefile +4 -4
index 0aec8a464364..ba732e4a88c3 100644
@@ -1,8 +1,8 @@
 obj-bin-y += head.o
 
-DEFS_H_DEPS = $(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
+DEFS_H_DEPS = $(abs_srctree)/$(src)/defs.h $(abs_srctree)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) $(src)/video.h \
+CMDLINE_DEPS = $(DEFS_H_DEPS) $(abs_srctree)/$(src)/video.h \
 	       $(BASEDIR)/include/xen/kconfig.h \
 	       $(BASEDIR)/include/generated/autoconf.h
 
@@ -17,7 +17,7 @@ RELOC_DEPS = $(DEFS_H_DEPS) \
 $(obj)/head.o: $(obj)/cmdline.S $(obj)/reloc.S
 
 $(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) $(src)/build32.lds
-	$(MAKE) -f build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
+	$(MAKE) -f $(abs_srctree)/$(src)/build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
 $(obj)/reloc.S: $(src)/reloc.c $(RELOC_DEPS) $(src)/build32.lds
-	$(MAKE) -f build32.mk -C $(obj) $(@F) RELOC_DEPS="$(RELOC_DEPS)"
+	$(MAKE) -f $(abs_srctree)/$(src)/build32.mk -C $(obj) $(@F) RELOC_DEPS="$(RELOC_DEPS)"
xen/build.mk +11 -1
index 740945333a97..bf0c9710241a 100644
@@ -59,6 +59,16 @@ arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
 	  echo ""; \
 	  echo "#endif") <$< >$@
 
+build-dirs := $(patsubst %/built_in.o,%,$(filter %/built_in.o,$(ALL_OBJS) $(ALL_LIBS)))
+
+# The actual objects are generated when descending,
+# make sure no implicit rule kicks in
+$(sort $(ALL_OBJS) $(ALL_LIBS)): $(build-dirs) ;
+
+PHONY += $(build-dirs)
+$(build-dirs): FORCE
+	$(Q)$(MAKE) $(build)=$@ need-builtin=1
+
 ifeq ($(CONFIG_LTO),y)
 # Gather all LTO objects together
 prelink_lto.o: $(ALL_OBJS) $(ALL_LIBS)
@@ -75,4 +85,4 @@ endif
 targets += prelink.o
 
 $(TARGET): prelink.o FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
+	$(Q)$(MAKE) $(build)=arch/$(TARGET_ARCH) $@
xen/include/Makefile +3 -3
index d2f5a956a11a..cd40d5b4c923 100644
@@ -61,7 +61,7 @@ $(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(BASEDIR)/
 	export PYTHON=$(PYTHON); \
 	while read what name; do \
 		$(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $< || exit $$?; \
-	done <$(patsubst compat/%,compat/.xlat/%,$(basename $<)).lst >[email protected]
+	done <$(patsubst $(obj)/compat/%,$(obj)/compat/.xlat/%,$(basename $<)).lst >[email protected]
 	mv -f [email protected] $@
 
 .PRECIOUS: $(obj)/compat/.xlat/%.lst
@@ -86,8 +86,8 @@ PUBLIC_HEADERS := $(filter-out $(src)/public/arch-% $(src)/public/dom0_ops.h, $(
 PUBLIC_C99_HEADERS := $(src)/public/io/9pfs.h $(src)/public/io/pvcalls.h
 PUBLIC_ANSI_HEADERS := $(filter-out $(src)/public/%ctl.h $(src)/public/xsm/% $(src)/public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
 
-public/io/9pfs.h-prereq := string
-public/io/pvcalls.h-prereq := string
+$(src)/public/io/9pfs.h-prereq := string
+$(src)/public/io/pvcalls.h-prereq := string
 
 $(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(src)/Makefile
 	for i in $(filter %.h,$^); do \
xen/scripts/Kbuild.include +6 -0
index b4b77f85d8d5..a333c3961db6 100644
@@ -61,6 +61,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 scripts/Makefile.build obj=
+# Usage:
+# $(Q)$(MAKE) $(build)=dir
+build := -f $(srctree)/Rules.mk obj
+
 # Shorthand for $(MAKE) clean
 # Usage:
 # $(MAKE) $(clean) dir
xen/test/Makefile +2 -5
index 41e4d7bdb78b..080763c80766 100644
@@ -1,13 +1,10 @@
 
-tests all: build
-
-
 ifneq ($(XEN_TARGET_ARCH),x86_32)
 # Xen 32-bit x86 hypervisor no longer supported, so has no test livepatches
 subdir-y += livepatch
 endif
 
-install build subtree-force-update uninstall: %:
+install uninstall: %:
 	set -e; for s in $(subdir-y); do \
-		$(MAKE) -f $(BASEDIR)/Rules.mk -C $$s $*; \
+		$(MAKE) $(build)=$$s $*; \
 	done
xen/test/livepatch/Makefile +0 -6
index 69fadccd01ea..afb8d589ecae 100644
@@ -11,9 +11,6 @@ endif
 CODE_ADDR=$(shell nm --defined $(1) | grep $(2) | awk '{print "0x"$$1}')
 CODE_SZ=$(shell nm --defined -S $(1) | grep $(2) | awk '{ print "0x"$$2}')
 
-.PHONY: default
-build default: livepatch
-
 extra-y += xen_hello_world.livepatch
 xen_hello_world-objs := xen_hello_world_func.o xen_hello_world.o note.o xen_note.o modinfo.o
 $(obj)/xen_hello_world.o: $(obj)/config.h
@@ -156,9 +153,6 @@ LIVEPATCHES := $(filter %.livepatch,$(extra-y))
 
 LIVEPATCH_DEBUG_DIR ?= $(DEBUG_DIR)/xen-livepatch
 
-.PHONY: livepatch
-livepatch: $(LIVEPATCHES)
-
 install: $(addprefix $(obj)/,$(LIVEPATCHES))
 	$(INSTALL_DIR) $(DESTDIR)$(LIVEPATCH_DEBUG_DIR)
 	$(INSTALL_DATA) $(addprefix $(obj)/,$(LIVEPATCHES)) $(DESTDIR)$(LIVEPATCH_DEBUG_DIR)
xen/xsm/flask/Makefile +1 -1
index 51fd37f6c4d5..49cf730cf098 100644
@@ -40,7 +40,7 @@ $(obj)/flask-policy.S: $(BASEDIR)/tools/binfile FORCE
 	$(call if_changed,binfile,$(obj)/policy.bin xsm_flask_init_policy)
 targets += flask-policy.S
 
-FLASK_BUILD_DIR := $(CURDIR)
+FLASK_BUILD_DIR := $(abs_objtree)/$(obj)
 POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)
 
 $(obj)/policy.bin: FORCE
xen/xsm/flask/ss/Makefile +1 -1
index d32b9e07138e..aba1339f3808 100644
@@ -8,4 +8,4 @@ obj-y += services.o
 obj-y += conditional.o
 obj-y += mls.o
 
-CFLAGS-y += -I../include
+CFLAGS-y += -I$(srctree)/xsm/flask/include
Signature · 1 line
Anthony PERARD
Reviewed-by on v8 12/47
#32 lore raw

Re: [XEN PATCH v8 12/47] build: build everything from the root dir, use obj=$subdir

Quoted 35 lines · Anthony PERARD

A subdirectory is now built by setting "$(obj)" instead of changing directory. "$(obj)" should always be set when using "Rules.mk" and thus a shortcut "$(build)" is introduced and should be used.

A new variable "$(need-builtin)" is introduce. It is to be used whenever a "built_in.o" is wanted from a subdirectory. "built_in.o" isn't the main target anymore, and thus only needs to depends on the objects that should be part of "built_in.o".

Introduce $(srctree) and $(objtree) to replace $(BASEDIR) in cases a relative path is better, and $(abs_srctree) and $(abs_objtree) which have an absolute path.

DEPS is updated as the existing macro to deal with it doesn't know about $(obj).

There's some changes in "Rules.mk" which in addition to deal with "$(obj)" also make it's looks more like "Makefile.build" from Linux v5.12.

test/Makefile doesn't need special handling in order to build everything under test/, Rules.mk will visit test/livepatch via $(subdir-y), thus "tests" "all" and "build" target are removed. "subtree-force-update" target isn't useful so it is removed as well.

test/livepatch/Makefile doesn't need default target anymore, Rules.mk will build everything in $(extra-y) and thus all *.livepatch.

Adjust cloc recipe: dependency files generated by CC will now have the full path to the source file, so we don't need to prepend the subdirectory. This fix some issue with source not been parsed by cloc before. Also source from tools/kconfig would be listed with changes in this patch so adjust the find command to stop listing the "tools" directory and thus kconfig. With a default build of Xen on X86, they are a few new files parsed by cloc:

Quoted 8 lines
    arch/x86/x86_64/compat/mm.c
    arch/x86/x86_64/mm.c
    common/compat/domain.c
    common/compat/memory.c
    common/compat/xlat.c

with one nit and a remark:

xen/Makefile export CHECKPOLICY ?= checkpolicy · line 26

Quoted 8 lines
xen/Makefile +2 -0
@@ -22,6 +22,15 @@ export CHECKPOLICY	?= checkpolicy
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 
+abs_objtree := $(CURDIR)
+abs_srctree := $(CURDIR)

Nit: In line with e.g. obj-y I think these would better be abs-srctree and abs-objtree.

Quoted 13 lines
xen/arch/x86/Makefile +3 -0
@@ -80,6 +80,9 @@ endif
 extra-y += asm-macros.i
 extra-y += xen.lds
 
+# Allows usercopy.c to include itself
+$(obj)/usercopy.o: CFLAGS-y += -iquote .
+
 ifneq ($(CONFIG_HVM),y)
 $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif

xen/arch/x86/Makefile $(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds · line 135

Quoted 5 lines
xen/arch/x86/Makefile +1 -1
@@ -129,13 +132,13 @@ $(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort \
 		>$(@D)/.$(@F).0.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).0.o
+	$(MAKE) $(build)=$(@D) efi-y= $(@D)/.$(@F).0.o

Hmm, hasn't the efi-y= become unnecessary already by patch 6?

Jan

#33 lore raw

Re: [XEN PATCH v8 12/47] build: build everything from the root dir, use obj=$subdir

Quoted 54 lines · Jan Beulich
Quoted 35 lines · Anthony PERARD

A subdirectory is now built by setting "$(obj)" instead of changing directory. "$(obj)" should always be set when using "Rules.mk" and thus a shortcut "$(build)" is introduced and should be used.

A new variable "$(need-builtin)" is introduce. It is to be used whenever a "built_in.o" is wanted from a subdirectory. "built_in.o" isn't the main target anymore, and thus only needs to depends on the objects that should be part of "built_in.o".

Introduce $(srctree) and $(objtree) to replace $(BASEDIR) in cases a relative path is better, and $(abs_srctree) and $(abs_objtree) which have an absolute path.

DEPS is updated as the existing macro to deal with it doesn't know about $(obj).

There's some changes in "Rules.mk" which in addition to deal with "$(obj)" also make it's looks more like "Makefile.build" from Linux v5.12.

test/Makefile doesn't need special handling in order to build everything under test/, Rules.mk will visit test/livepatch via $(subdir-y), thus "tests" "all" and "build" target are removed. "subtree-force-update" target isn't useful so it is removed as well.

test/livepatch/Makefile doesn't need default target anymore, Rules.mk will build everything in $(extra-y) and thus all *.livepatch.

Adjust cloc recipe: dependency files generated by CC will now have the full path to the source file, so we don't need to prepend the subdirectory. This fix some issue with source not been parsed by cloc before. Also source from tools/kconfig would be listed with changes in this patch so adjust the find command to stop listing the "tools" directory and thus kconfig. With a default build of Xen on X86, they are a few new files parsed by cloc:

Quoted 8 lines
    arch/x86/x86_64/compat/mm.c
    arch/x86/x86_64/mm.c
    common/compat/domain.c
    common/compat/memory.c
    common/compat/xlat.c

with one nit and a remark:

Quoted 6 lines
xen/Makefile +0 -0
@@ -22,6 +22,15 @@ export CHECKPOLICY	?= checkpolicy
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 
Quoted 5 lines

xen/Makefile export CHECKPOLICY ?= checkpolicy · line 26

Quoted 2 lines
xen/Makefile +2 -0
+abs_objtree := $(CURDIR)
+abs_srctree := $(CURDIR)

Nit: In line with e.g. obj-y I think these would better be abs-srctree and abs-objtree.

I guess that would be fine, we don't need to keep the same spelling that Kbuild does.

Quoted 6 lines
Quoted 6 lines
xen/arch/x86/Makefile +0 -0
@@ -80,6 +80,9 @@ endif
 extra-y += asm-macros.i
 extra-y += xen.lds
 
Quoted 14 lines

xen/arch/x86/Makefile $(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds · line 135

Quoted 12 lines
xen/arch/x86/Makefile +4 -1
+# Allows usercopy.c to include itself
+$(obj)/usercopy.o: CFLAGS-y += -iquote .
+
 ifneq ($(CONFIG_HVM),y)
 $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif
@@ -129,13 +132,13 @@ $(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
 		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort \
 		>$(@D)/.$(@F).0.S
-	$(MAKE) -f $(BASEDIR)/Rules.mk efi-y= $(@D)/.$(@F).0.o
+	$(MAKE) $(build)=$(@D) efi-y= $(@D)/.$(@F).0.o

Hmm, hasn't the efi-y= become unnecessary already by patch 6?

I think since patch 4 "build: set XEN_BUILD_EFI earlier". I'll remove these there then.

Thanks,

Signature · 1 line
Anthony PERARD
#34 lore raw

Re: [XEN PATCH v8 12/47] build: build everything from the root dir, use obj=$subdir

Quoted 8 lines · Anthony PERARD
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/Makefile +0 -0
@@ -22,6 +22,15 @@ export CHECKPOLICY	?= checkpolicy
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 
Quoted 8 lines
Quoted 5 lines

xen/Makefile export CHECKPOLICY ?= checkpolicy · line 26

Quoted 2 lines
xen/Makefile +2 -0
+abs_objtree := $(CURDIR)
+abs_srctree := $(CURDIR)

Nit: In line with e.g. obj-y I think these would better be abs-srctree and abs-objtree.

I guess that would be fine, we don't need to keep the same spelling that Kbuild does.

Actually, those two variables are exported, as it appear in the next two lines. Exporting a variable with a dash doesn't work very well as shells may not be able to use them. When make find a variable with a dash in it in the environment, it unexport them.

So, for those two variable, we need to avoid using a dash, so I think keeping the current name is better. (And now, I've find out that there's an issue in the build system, I'll prepare a patch.)

Cheers,

Signature · 1 line
Anthony PERARD
#35 lore raw

Re: [XEN PATCH v8 12/47] build: build everything from the root dir, use obj=$subdir

Quoted 18 lines · Anthony PERARD
Quoted 8 lines · Anthony PERARD
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/Makefile +0 -0
@@ -22,6 +22,15 @@ export CHECKPOLICY	?= checkpolicy
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 
Quoted 8 lines
Quoted 5 lines

xen/Makefile export CHECKPOLICY ?= checkpolicy · line 26

Quoted 2 lines
xen/Makefile +2 -0
+abs_objtree := $(CURDIR)
+abs_srctree := $(CURDIR)

Nit: In line with e.g. obj-y I think these would better be abs-srctree and abs-objtree.

I guess that would be fine, we don't need to keep the same spelling that Kbuild does.

Quoted 8 lines

Actually, those two variables are exported, as it appear in the next two lines. Exporting a variable with a dash doesn't work very well as shells may not be able to use them. When make find a variable with a dash in it in the environment, it unexport them.

So, for those two variable, we need to avoid using a dash, so I think keeping the current name is better. (And now, I've find out that there's an issue in the build system, I'll prepare a patch.)

Oh, sure - if they have to be exported, the names should remain as they are. Question of course why they need exporting when by the end of the conversion you don't change directories anymore.

Jan

#36 lore raw

Re: [XEN PATCH v8 12/47] build: build everything from the root dir, use obj=$subdir

Quoted 24 lines · Jan Beulich
Quoted 23 lines · Anthony PERARD
Quoted 8 lines · Anthony PERARD
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/Makefile +0 -0
@@ -22,6 +22,15 @@ export CHECKPOLICY	?= checkpolicy
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 
Quoted 8 lines
Quoted 5 lines

xen/Makefile export CHECKPOLICY ?= checkpolicy · line 26

Quoted 2 lines
xen/Makefile +2 -0
+abs_objtree := $(CURDIR)
+abs_srctree := $(CURDIR)

Nit: In line with e.g. obj-y I think these would better be abs-srctree and abs-objtree.

I guess that would be fine, we don't need to keep the same spelling that Kbuild does.

Actually, those two variables are exported, as it appear in the next two lines. Exporting a variable with a dash doesn't work very well as shells may not be able to use them. When make find a variable with a dash in it in the environment, it unexport them.

Quoted 7 lines
Quoted 3 lines

So, for those two variable, we need to avoid using a dash, so I think keeping the current name is better. (And now, I've find out that there's an issue in the build system, I'll prepare a patch.)

Oh, sure - if they have to be exported, the names should remain as they are. Question of course why they need exporting when by the end of the conversion you don't change directories anymore.

So far, the value of those two variables are simple, but they get a bit more complicated when we introduce out-of-tree build. I would rather avoid recalculating those values later one and be sure that the values are the same on recursion.

Thanks,

Signature · 1 line
Anthony PERARD
Acked-by on v8 12/47
#37 lore raw

Re: [XEN PATCH v8 12/47] build: build everything from the root dir, use obj=$subdir

In reply to Anthony PERARD

Hi Anthonny,

Quoted 35 lines · Anthony PERARD

A subdirectory is now built by setting "$(obj)" instead of changing directory. "$(obj)" should always be set when using "Rules.mk" and thus a shortcut "$(build)" is introduced and should be used.

A new variable "$(need-builtin)" is introduce. It is to be used whenever a "built_in.o" is wanted from a subdirectory. "built_in.o" isn't the main target anymore, and thus only needs to depends on the objects that should be part of "built_in.o".

Introduce $(srctree) and $(objtree) to replace $(BASEDIR) in cases a relative path is better, and $(abs_srctree) and $(abs_objtree) which have an absolute path.

DEPS is updated as the existing macro to deal with it doesn't know about $(obj).

There's some changes in "Rules.mk" which in addition to deal with "$(obj)" also make it's looks more like "Makefile.build" from Linux v5.12.

test/Makefile doesn't need special handling in order to build everything under test/, Rules.mk will visit test/livepatch via $(subdir-y), thus "tests" "all" and "build" target are removed. "subtree-force-update" target isn't useful so it is removed as well.

test/livepatch/Makefile doesn't need default target anymore, Rules.mk will build everything in $(extra-y) and thus all *.livepatch.

Adjust cloc recipe: dependency files generated by CC will now have the full path to the source file, so we don't need to prepend the subdirectory. This fix some issue with source not been parsed by cloc before. Also source from tools/kconfig would be listed with changes in this patch so adjust the find command to stop listing the "tools" directory and thus kconfig. With a default build of Xen on X86, they are a few new files parsed by cloc:

Quoted 8 lines
     arch/x86/x86_64/compat/mm.c
     arch/x86/x86_64/mm.c
     common/compat/domain.c
     common/compat/memory.c
     common/compat/xlat.c

For Arm:

Cheers,

Signature · 1 line
Julien Grall
#38 lore raw

PATCH v8 13/47 build: introduce if_changed_deps

In reply to Anthony PERARD

This macro does compare command line like if_changed, but it also rewrite the dependencies generated by $(CC) in order to depend on a CONFIG_* as generated by kconfig instead of depending on autoconf.h. This allow to make a change in kconfig options and only rebuild the object that uses that CONFIG_* option.

cmd_and_record isn't needed anymore as it is replace by cmd_and_fixdep.

There's only one .*.d dependency file left which is explicitly included as a workound, all the other are been absorb into the .*.cmd dependency files via fixdep. So including .*.d can be removed from the makefile.

Also adjust "cloc" recipe due to .*.d been replace by .*.cmd files.

This imports fixdep.c and if_changed_deps macro from Linux v5.12.

---

Notes:
v8:
- reviewd
- remove "tools_fixdep" prerequisite in xen/Makefile from "$(TARGET)" target as the first command of the recipe will build everything in tools/ and thus tools/fixdep.
- adjust "cloc" recipe.

 .gitignore                 |   1 +
 xen/Makefile               |  15 +-
 xen/Rules.mk               |  17 +-
 xen/arch/x86/Makefile      |   8 +-
 xen/build.mk               |   1 +
 xen/scripts/Kbuild.include |  17 +-
 xen/tools/Makefile         |   7 +-
 xen/tools/fixdep.c         | 404 +++++++++++++++++++++++++++++++++++++
 8 files changed, 441 insertions(+), 29 deletions(-)
 create mode 100644 xen/tools/fixdep.c
.gitignore +1 -0
index 841ba1c0a84c..58740c035789 100644
@@ -339,6 +339,7 @@ xen/include/xen/lib/x86/cpuid-autogen.h
 xen/test/livepatch/config.h
 xen/test/livepatch/expect_config.h
 xen/test/livepatch/*.livepatch
+xen/tools/fixdep
 xen/tools/kconfig/.tmp_gtkcheck
 xen/tools/kconfig/.tmp_qtcheck
 xen/tools/symbols
xen/Makefile +11 -4
index 88997244368c..d38425234c6c 100644
@@ -196,6 +196,13 @@ export XEN_HAS_CHECKPOLICY := $(call success,$(CHECKPOLICY) -h 2>&1 | grep -q xe
 export root-make-done := y
 endif # root-make-done
 
+# ===========================================================================
+# Rules shared between *config targets and build targets
+
+PHONY += tools_fixdep
+tools_fixdep:
+	$(MAKE) -C tools fixdep
+
 # Shorthand for kconfig
 kconfig = -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)"
 
@@ -475,18 +482,18 @@ cscope:
 _MAP:
 	$(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map
 
-%.o %.i %.s: %.c FORCE
+%.o %.i %.s: %.c tools_fixdep FORCE
 	$(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
-%.o %.s: %.S FORCE
+%.o %.s: %.S tools_fixdep FORCE
 	$(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
-%/: FORCE
+%/: tools_fixdep FORCE
 	$(Q)$(MAKE) $(build)=$* need-builtin=1
 
 .PHONY: cloc
 cloc:
-	find . -name tools -prune -o -name '*.o.d' -print | while read f; do \
+	find . -name tools -prune -o -name '*.o.cmd' -print | while read f; do \
 	    for sf in $$(grep -o "[a-zA-Z0-9_/-]*\.[cS]" $$f); do \
 		test -f "$$sf" && echo "$$sf"; \
 	    done; \
xen/Rules.mk +7 -10
index 32a97e012060..4624739ca7e2 100644
@@ -147,8 +147,8 @@ cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1))
 # Calculation of flags, first the generic flags, then the arch specific flags,
 # and last the flags modified for a target or a directory.
 
-c_flags = -MMD -MP -MF $(@D)/.$(@F).d $(XEN_CFLAGS)
-a_flags = -MMD -MP -MF $(@D)/.$(@F).d $(XEN_AFLAGS)
+c_flags = -MMD -MP -MF $(depfile) $(XEN_CFLAGS)
+a_flags = -MMD -MP -MF $(depfile) $(XEN_AFLAGS)
 
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 
@@ -205,7 +205,7 @@ else
 endif
 
 define rule_cc_o_c
-    $(call cmd_and_record,cc_o_c)
+    $(call cmd_and_fixdep,cc_o_c)
     $(call cmd,objcopy_fix_sym)
 endef
 
@@ -216,7 +216,7 @@ quiet_cmd_cc_o_S = CC      $@
 cmd_cc_o_S = $(CC) $(a_flags) -c $< -o $@
 
 $(obj)/%.o: $(src)/%.S FORCE
-	$(call if_changed,cc_o_S)
+	$(call if_changed_dep,cc_o_S)
 
 
 quiet_cmd_obj_init_o = INIT_O  $@
@@ -246,13 +246,13 @@ quiet_cmd_cpp_s_S = CPP     $@
 cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
 
 $(obj)/%.i: $(src)/%.c FORCE
-	$(call if_changed,cpp_i_c)
+	$(call if_changed_dep,cpp_i_c)
 
 $(obj)/%.s: $(src)/%.c FORCE
-	$(call if_changed,cc_s_c)
+	$(call if_changed_dep,cc_s_c)
 
 $(obj)/%.s: $(src)/%.S FORCE
-	$(call if_changed,cpp_s_S)
+	$(call if_changed_dep,cpp_s_S)
 
 # Linker scripts, .lds.S -> .lds
 quiet_cmd_cpp_lds_S = LDS     $@
@@ -291,9 +291,6 @@ existing-targets := $(wildcard $(sort $(targets)))
 
 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
 
-DEPS := $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).d)
--include $(DEPS_INCLUDE)
-
 # 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/x86/Makefile +1 -7
index 6f18daf9105c..456b7eed7536 100644
@@ -245,7 +245,7 @@ $(BASEDIR)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefil
 
 $(obj)/efi.lds: AFLAGS-y += -DEFI
 $(obj)/xen.lds $(obj)/efi.lds: $(src)/xen.lds.S FORCE
-	$(call if_changed,cpp_lds_S)
+	$(call if_changed_dep,cpp_lds_S)
 
 $(obj)/boot/mkelf32: $(src)/boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
@@ -261,9 +261,3 @@ clean::
 	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc
 	rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin
 	rm -f note.o
-
-# Suppress loading of DEPS files for internal, temporary target files.  This
-# then also suppresses re-generation of the respective .*.d2 files.
-ifeq ($(filter-out .xen%.o,$(notdir $(MAKECMDGOALS))),)
-DEPS_INCLUDE:=
-endif
xen/build.mk +1 -0
index bf0c9710241a..c471312f98a3 100644
@@ -39,6 +39,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner FORCE
 
 targets += include/xen/compile.h
 
+-include $(wildcard .asm-offsets.s.d)
 asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o [email protected] -MQ $@ $<
 	$(call move-if-changed,[email protected],$@)
xen/scripts/Kbuild.include +11 -6
index a333c3961db6..6be38301e835 100644
@@ -15,8 +15,7 @@ dot-target = $(@D)/.$(@F)
 
 ###
 # dependencies
-DEPS = .*.d
-DEPS_INCLUDE = $(addsuffix .d2, $(basename $(wildcard $(DEPS))))
+depfile = $(dot-target).d
 
 ###
 # real prerequisites without phony targets
@@ -83,6 +82,8 @@ cmd = @set -e; $(echo-cmd) $(cmd_$(1))
 ###
 # if_changed      - execute command if any prerequisite is newer than
 #                   target, or command line has changed
+# if_changed_dep  - as if_changed, but uses fixdep to reveal dependencies
+#                   including used config symbols
 # if_changed_rule - as if_changed but execute rule instead
 
 ifneq ($(KBUILD_NOCMDDEP),1)
@@ -111,15 +112,19 @@ if_changed = $(if $(any-prereq)$(cmd-check),                                 \
         $(cmd);                                                              \
         printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
 
+# Execute the command and also postprocess generated .d dependencies file.
+if_changed_dep = $(if $(any-prereq)$(cmd-check),$(cmd_and_fixdep),@:)
+
+cmd_and_fixdep =                                                             \
+        $(cmd);                                                              \
+        tools/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;        \
+        rm -f $(depfile)
+
 # Usage: $(call if_changed_rule,foo)
 # Will check if $(cmd_foo) or any of the prerequisites changed,
 # and if so will execute $(rule_foo).
 if_changed_rule = $(if $(any-prereq)$(cmd-check),$(rule_$(1)),@:)
 
-cmd_and_record =                                                             \
-        $(cmd);                                                              \
-        printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd
-
 ###
 # why - tell why a target got built
 #       enabled by make V=2
xen/tools/Makefile +5 -2
index 4e42163f981c..722f3664549d 100644
@@ -2,11 +2,14 @@
 include $(XEN_ROOT)/Config.mk
 
 .PHONY: default
-default: symbols
+default: symbols fixdep
 
 .PHONY: clean
 clean:
-	rm -f *.o symbols
+	rm -f *.o symbols fixdep
 
 symbols: symbols.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
+
+fixdep: fixdep.c
+	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
xen/tools/fixdep.c new file +404 -0

404 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
#39 lore raw

PATCH v8 14/47 build: rename __LINKER__ to LINKER_SCRIPT

In reply to Anthony PERARD

For two reasons: this macro is used to generate a "linker script" and is not by the linker, and name starting with an underscore '_' are supposed to be reserved, so better avoid them when not needed.

---
 xen/Rules.mk                      | 2 +-
 xen/arch/arm/include/asm/config.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
xen/Rules.mk +1 -1
index 4624739ca7e2..d32fec0ae037 100644
@@ -256,7 +256,7 @@ $(obj)/%.s: $(src)/%.S FORCE
 
 # Linker scripts, .lds.S -> .lds
 quiet_cmd_cpp_lds_S = LDS     $@
-cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -D__LINKER__ -MQ $@ -o $@ $<
+cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -DLINKER_SCRIPT -MQ $@ -o $@ $<
 
 targets := $(filter-out $(PHONY), $(targets))
 
xen/arch/arm/include/asm/config.h +1 -1
index c7b77912013e..2aced0bc3b8b 100644
@@ -191,7 +191,7 @@ extern unsigned long frametable_virt_end;
 #define watchdog_disable() ((void)0)
 #define watchdog_enable()  ((void)0)
 
-#if defined(__ASSEMBLY__) && !defined(__LINKER__)
+#if defined(__ASSEMBLY__) && !defined(LINKER_SCRIPT)
 #include <asm/asm_defns.h>
 #include <asm/macros.h>
 #endif
Signature · 1 line
Anthony PERARD
Acked-by on v8 14/47
#40 lore raw

Re: [XEN PATCH v8 14/47] build: rename __LINKER__ to LINKER_SCRIPT

Hi Anthony,

Quoted 3 lines · Anthony PERARD

For two reasons: this macro is used to generate a "linker script" and is not by the linker, and name starting with an underscore '_' are supposed to be reserved, so better avoid them when not needed.

If that's the case, then shouldn't we also rename __ASSEMBLY__?

Quoted 3 lines

Cheers,

Quoted 31 lines
---
  xen/Rules.mk                      | 2 +-
  xen/arch/arm/include/asm/config.h | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
xen/Rules.mk +1 -1
index 4624739ca7e2..d32fec0ae037 100644
@@ -256,7 +256,7 @@ $(obj)/%.s: $(src)/%.S FORCE
 
  # Linker scripts, .lds.S -> .lds
  quiet_cmd_cpp_lds_S = LDS     $@
-cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -D__LINKER__ -MQ $@ -o $@ $<
+cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -DLINKER_SCRIPT -MQ $@ -o $@ $<
 
  targets := $(filter-out $(PHONY), $(targets))
 
xen/arch/arm/include/asm/config.h +1 -1
index c7b77912013e..2aced0bc3b8b 100644
@@ -191,7 +191,7 @@ extern unsigned long frametable_virt_end;
  #define watchdog_disable() ((void)0)
  #define watchdog_enable()  ((void)0)
 
-#if defined(__ASSEMBLY__) && !defined(__LINKER__)
+#if defined(__ASSEMBLY__) && !defined(LINKER_SCRIPT)
  #include <asm/asm_defns.h>
  #include <asm/macros.h>
  #endif
Signature · 1 line
Julien Grall
#41 lore raw

Re: [XEN PATCH v8 14/47] build: rename __LINKER__ to LINKER_SCRIPT

Quoted 6 lines · Julien Grall
Quoted 3 lines · Anthony PERARD

For two reasons: this macro is used to generate a "linker script" and is not by the linker, and name starting with an underscore '_' are supposed to be reserved, so better avoid them when not needed.

If that's the case, then shouldn't we also rename __ASSEMBLY__?

I'd rather not - unlike __LINKER__ (afaict at least) __ASSEMBLY__ is a commonly used identifier (which we've actually inherited from Linux).

Jan

#42 lore raw

Re: [XEN PATCH v8 14/47] build: rename __LINKER__ to LINKER_SCRIPT

Hi Jan,

Quoted 9 lines · Jan Beulich
Quoted 6 lines · Julien Grall
Quoted 3 lines · Anthony PERARD

For two reasons: this macro is used to generate a "linker script" and is not by the linker, and name starting with an underscore '_' are supposed to be reserved, so better avoid them when not needed.

If that's the case, then shouldn't we also rename __ASSEMBLY__?

I'd rather not - unlike __LINKER__ (afaict at least) __ASSEMBLY__

I can't remember where I took __LINKER__ from.

Quoted 2 lines

is a commonly used identifier (which we've actually inherited from Linux)

Fair enough.

Cheers,

Signature · 1 line
Julien Grall
#43 lore raw

PATCH v8 15/47 build: hook kconfig into xen build system

In reply to Anthony PERARD

Now that xen's build system is very close to Linux's ones, we can hook "Makefile.host" into Xen's build system, and we can build Kconfig with that.

"tools/kconfig/Makefile" now needs a workaround to not rebuild
"$(XEN_ROOT)/.config", as make tries the rules "%.config" which
fails with:
tools/kconfig/Makefile:95: *** No configuration exists for this target on this architecture. Stop.

---

Notes:
v8:
- reviewed
- adjust Makefile.host to use the renamed macro "multi-depend".
- move .config empty rules workaround into kconfig/Makefile (from Rules.mk) and merge the change of patch
build: add an other explicite rules to not build $(XEN_ROOT)/.config
into
build: hook kconfig into xen build system

 xen/Makefile                                 |  34 ++++--
 xen/Rules.mk                                 |  13 ++-
 xen/scripts/Kbuild.include                   |  31 ++++++
 xen/scripts/Makefile.clean                   |  11 +-
 xen/{tools/kconfig => scripts}/Makefile.host |  11 +-
 xen/tools/kconfig/Makefile                   |   3 +
 xen/tools/kconfig/Makefile.kconfig           | 106 -------------------
 7 files changed, 86 insertions(+), 123 deletions(-)
 rename xen/{tools/kconfig => scripts}/Makefile.host (95%)
 delete mode 100644 xen/tools/kconfig/Makefile.kconfig
xen/Makefile +23 -11
index d38425234c6c..c26c44818916 100644
@@ -40,6 +40,7 @@ ARCH=$(XEN_TARGET_ARCH)
 SRCARCH=$(shell echo $(ARCH) | \
           sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
               -e s'/riscv.*/riscv/g')
+export ARCH SRCARCH
 
 # Don't break if the build process wasn't called from the top level
 # we need XEN_TARGET_ARCH to generate the proper config
@@ -163,6 +164,13 @@ ifneq ($(filter %config,$(MAKECMDGOALS)),)
     config-build := y
 endif
 
+export CONFIG_SHELL := $(SHELL)
+export YACC = $(if $(BISON),$(BISON),bison)
+export LEX = $(if $(FLEX),$(FLEX),flex)
+
+# Default file for 'make defconfig'.
+export KBUILD_DEFCONFIG := $(ARCH)_defconfig
+
 # CLANG_FLAGS needs to be calculated before calling Kconfig
 ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
 CLANG_FLAGS :=
@@ -203,9 +211,6 @@ PHONY += tools_fixdep
 tools_fixdep:
 	$(MAKE) -C tools fixdep
 
-# Shorthand for kconfig
-kconfig = -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)"
-
 ifeq ($(config-build),y)
 # ===========================================================================
 # *config targets only - make sure prerequisites are updated, and descend
@@ -221,14 +226,14 @@ filechk_kconfig_allconfig = \
 .allconfig.tmp: FORCE
 	set -e; { $(call filechk_kconfig_allconfig); } > $@
 
-config: FORCE
-	$(MAKE) $(kconfig) $@
+config: tools_fixdep FORCE
+	$(Q)$(MAKE) $(build)=tools/kconfig $@
 
 # Config.mk tries to include .config file, don't try to remake it
 %/.config: ;
 
-%config: .allconfig.tmp FORCE
-	$(MAKE) $(kconfig) KCONFIG_ALLCONFIG=$< $@
+%config: .allconfig.tmp tools_fixdep FORCE
+	$(Q)$(MAKE) $(build)=tools/kconfig KCONFIG_ALLCONFIG=$< $@
 
 else # !config-build
 
@@ -238,9 +243,15 @@ ifeq ($(need-config),y)
 # changes are detected.
 -include include/config/auto.conf.cmd
 
+# This allows make to build fixdep before invoking defconfig. We can't use
+# "tools_fixdep" which is a .PHONY target and would force make to call
+# "defconfig" again to update $(KCONFIG_CONFIG).
+tools/fixdep:
+	$(MAKE) -C tools fixdep
+
 # Allow people to just run `make` as before and not force them to configure
-$(KCONFIG_CONFIG):
-	$(MAKE) $(kconfig) defconfig
+$(KCONFIG_CONFIG): tools/fixdep
+	$(Q)$(MAKE) $(build)=tools/kconfig defconfig
 
 # The actual configuration files used during the build are stored in
 # include/generated/ and include/config/. Update them if .config is newer than
@@ -249,7 +260,7 @@ $(KCONFIG_CONFIG):
 # This exploits the 'multi-target pattern rule' trick.
 # The syncconfig should be executed only once to make all the targets.
 include/config/%.conf include/config/%.conf.cmd: $(KCONFIG_CONFIG)
-	$(MAKE) $(kconfig) syncconfig
+	$(Q)$(MAKE) $(build)=tools/kconfig syncconfig
 
 ifeq ($(CONFIG_DEBUG),y)
 CFLAGS += -O1
@@ -409,9 +420,10 @@ _clean:
 	$(MAKE) $(clean) arch/riscv
 	$(MAKE) $(clean) arch/x86
 	$(MAKE) $(clean) test
-	$(MAKE) $(kconfig) clean
+	$(MAKE) $(clean) tools/kconfig
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \
 		-o -name ".*.o.tmp" -o -name "*~" -o -name "core" \
+		-o -name '*.lex.c' -o -name '*.tab.[ch]' \
 		-o -name "*.gcno" -o -name ".*.cmd" -o -name "lib.a" \) -exec rm -f {} \;
 	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map *~ core
 	rm -f asm-offsets.s arch/*/include/asm/asm-offsets.h
xen/Rules.mk +12 -1
index d32fec0ae037..f452a821cc86 100644
@@ -89,6 +89,13 @@ subdir-y        := $(addprefix $(obj)/,$(subdir-y))
 nocov-y         := $(addprefix $(obj)/,$(nocov-y))
 noubsan-y       := $(addprefix $(obj)/,$(noubsan-y))
 
+# Do not include hostprogs rules unless needed.
+# $(sort ...) is used here to remove duplicated words and excessive spaces.
+hostprogs-y := $(sort $(hostprogs-y))
+ifneq ($(hostprogs-y),)
+include scripts/Makefile.host
+endif
+
 # subdir-builtin may contain duplications. Use $(sort ...)
 subdir-builtin := $(sort $(filter %/built_in.o, $(obj-y)))
 
@@ -267,7 +274,11 @@ intermediate_targets = $(foreach sfx, $(2), \
 				$(patsubst %$(strip $(1)),%$(sfx), \
 					$(filter %$(strip $(1)), $(targets))))
 # %.init.o <- %.o
-targets += $(call intermediate_targets, .init.o, .o)
+# %.lex.o <- %.lex.c <- %.l
+# %.tab.o <- %.tab.[ch] <- %.y
+targets += $(call intermediate_targets, .init.o, .o) \
+	   $(call intermediate_targets, .lex.o, .lex.c) \
+	   $(call intermediate_targets, .tab.o, .tab.c .tab.h)
 
 # Build
 # ---------------------------------------------------------------------------
xen/scripts/Kbuild.include +31 -0
index 6be38301e835..79b42e1252d6 100644
@@ -25,6 +25,37 @@ real-prereqs = $(filter-out $(PHONY), $^)
 # Escape single quote for use in echo statements
 escsq = $(subst $(squote),'\$(squote)',$1)
 
+###
+# Easy method for doing a status message
+       kecho := :
+ quiet_kecho := echo
+silent_kecho := :
+kecho := $($(quiet)kecho)
+
+###
+# filechk is used to check if the content of a generated file is updated.
+# Sample usage:
+#
+# filechk_sample = echo $(KERNELRELEASE)
+# version.h: FORCE
+#	$(call filechk,sample)
+#
+# The rule defined shall write to stdout the content of the new file.
+# The existing file will be compared with the new one.
+# - If no file exist it is created
+# - If the content differ the new file is used
+# - If they are equal no change, and no timestamp update
+define filechk
+	$(Q)set -e;						\
+	mkdir -p $(dir $@);					\
+	trap "rm -f $(dot-target).tmp" EXIT;			\
+	{ $(filechk_$(1)); } > $(dot-target).tmp;		\
+	if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then	\
+		$(kecho) '  UPD     $@';			\
+		mv -f $(dot-target).tmp $@;			\
+	fi
+endef
+
 # as-insn: Check whether assembler supports an instruction.
 # Usage: cflags-y += $(call as-insn,CC FLAGS,"insn",option-yes,option-no)
 as-insn = $(if $(shell echo 'void _(void) { asm volatile ( $(2) ); }' \
xen/scripts/Makefile.clean +10 -1
index c3b0681611da..156d6307cf83 100644
@@ -17,8 +17,17 @@ include $(src)/Makefile
 subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
               $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
 
+__clean-files := \
+    $(clean-files) $(hostprogs-y) $(hostprogs-)
+
+__clean-files := $(wildcard $(__clean-files))
+
 .PHONY: clean
-clean:: $(subdir-all) ;
+clean:: $(subdir-all)
+ifneq ($(strip $(__clean-files)),)
+	rm -rf $(__clean-files)
+endif
+	@:
 
 # Descending
 # ---------------------------------------------------------------------------
xen/scripts/Makefile.host renamed from xen/tools/kconfig/Makefile.host +7 -4
similarity index 95%
rename from xen/tools/kconfig/Makefile.host
rename to xen/scripts/Makefile.host
index 4c51c95d40f4..8a85f94316bc 100644
@@ -1,5 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
+# target with $(obj)/ and its suffix stripped
+target-stem = $(basename $(patsubst $(obj)/%,%,$@))
+
 # LEX
 # ---------------------------------------------------------------------------
 quiet_cmd_flex = LEX     $@
@@ -114,7 +117,7 @@ quiet_cmd_host-cmulti	= HOSTLD  $@
 			  $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem))
 $(host-cmulti): FORCE
 	$(call if_changed,host-cmulti)
-$(call multi_depend, $(host-cmulti), , -objs)
+$(call multi-depend, $(host-cmulti), , -objs)
 
 # Create .o file from a single .c file
 # host-cobjs -> .o
@@ -132,7 +135,7 @@ quiet_cmd_host-cxxmulti	= HOSTLD  $@
 			  $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem))
 $(host-cxxmulti): FORCE
 	$(call if_changed,host-cxxmulti)
-$(call multi_depend, $(host-cxxmulti), , -objs -cxxobjs)
+$(call multi-depend, $(host-cxxmulti), , -objs -cxxobjs)
 
 # Create .o file from a single .cc (C++) file
 quiet_cmd_host-cxxobjs	= HOSTCXX $@
@@ -165,7 +168,7 @@ quiet_cmd_host-cshlib	= HOSTLLD -shared $@
 			  $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem).so)
 $(host-cshlib): FORCE
 	$(call if_changed,host-cshlib)
-$(call multi_depend, $(host-cshlib), .so, -objs)
+$(call multi-depend, $(host-cshlib), .so, -objs)
 
 # Link a shared library, based on position independent .o files
 # *.o -> .so shared library (host-cxxshlib)
@@ -175,7 +178,7 @@ quiet_cmd_host-cxxshlib	= HOSTLLD -shared $@
 			  $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem).so)
 $(host-cxxshlib): FORCE
 	$(call if_changed,host-cxxshlib)
-$(call multi_depend, $(host-cxxshlib), .so, -objs)
+$(call multi-depend, $(host-cxxshlib), .so, -objs)
 
 targets += $(host-csingle)  $(host-cmulti) $(host-cobjs)\
 	   $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) $(host-cxxshlib) $(host-cxxshobjs)
xen/tools/kconfig/Makefile +3 -0
index f39521a0ed5b..b7b9a419ad59 100644
@@ -91,6 +91,9 @@ endif
 
 configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)
 
+# Don't try to remake this file included by Config.mk.
+$(XEN_ROOT)/.config: ;
+
 %.config: $(obj)/conf
 	$(if $(call configfiles),, $(error No configuration exists for this target on this architecture))
 	$(Q)$(CONFIG_SHELL) $(srctree)/tools/kconfig/merge_config.sh -m .config $(configfiles)
xen/tools/kconfig/Makefile.kconfig deleted +0 -106

106 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
#44 lore raw

PATCH v8 16/47 xen/tools/kconfig: fix build with -Wdeclaration-after-statement

In reply to Anthony PERARD

We are going to start building kconfig with HOSTCFLAGS from Config.mk, it has the flag "-Wdeclaration-after-statement".

---
 xen/tools/kconfig/confdata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/tools/kconfig/confdata.c +1 -1
index 3569d2dec37c..a69250c91355 100644
@@ -1237,6 +1237,7 @@ void set_all_choice_values(struct symbol *csym)
 
 bool conf_set_all_new_symbols(enum conf_def_mode mode)
 {
+	bool has_changed = false;
 	struct symbol *sym, *csym;
 	int i, cnt, pby, pty, ptm;	/* pby: probability of bool     = y
 					 * pty: probability of tristate = y
@@ -1283,7 +1284,6 @@ bool conf_set_all_new_symbols(enum conf_def_mode mode)
 			exit( 1 );
 		}
 	}
-	bool has_changed = false;
 
 	for_all_symbols(i, sym) {
 		if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID))
Signature · 1 line
Anthony PERARD
#46 lore raw

PATCH v8 17/47 build: remove KBUILD_ specific from Makefile.host

In reply to Anthony PERARD

This will allow $(HOSTCFLAGS) to actually be used when building programmes for the build-host.

The other variable don't exist in our build system.

Also remove $(KBUILD_EXTMOD) since it should always be empty.

---
 xen/scripts/Makefile.host | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
xen/scripts/Makefile.host +12 -14
index 8a85f94316bc..d6c358095ee8 100644
@@ -82,18 +82,16 @@ host-cxxshobjs	:= $(addprefix $(obj)/,$(host-cxxshobjs))
 #####
 # Handle options to gcc. Support building with separate output directory
 
-_hostc_flags   = $(KBUILD_HOSTCFLAGS)   $(HOST_EXTRACFLAGS)   \
+_hostc_flags   = $(HOSTCFLAGS)   $(HOST_EXTRACFLAGS)   \
                  $(HOSTCFLAGS_$(target-stem).o)
-_hostcxx_flags = $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
+_hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \
                  $(HOSTCXXFLAGS_$(target-stem).o)
 
 # $(objtree)/$(obj) for including generated headers from checkin source files
-ifeq ($(KBUILD_EXTMOD),)
 ifdef building_out_of_srctree
 _hostc_flags   += -I $(objtree)/$(obj)
 _hostcxx_flags += -I $(objtree)/$(obj)
 endif
-endif
 
 hostc_flags    = -Wp,-MD,$(depfile) $(_hostc_flags)
 hostcxx_flags  = -Wp,-MD,$(depfile) $(_hostcxx_flags)
@@ -104,17 +102,17 @@ hostcxx_flags  = -Wp,-MD,$(depfile) $(_hostcxx_flags)
 # Create executable from a single .c file
 # host-csingle -> Executable
 quiet_cmd_host-csingle 	= HOSTCC  $@
-      cmd_host-csingle	= $(HOSTCC) $(hostc_flags) $(KBUILD_HOSTLDFLAGS) -o $@ $< \
-		$(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem))
+      cmd_host-csingle	= $(HOSTCC) $(hostc_flags) $(HOSTLDFLAGS) -o $@ $< \
+		$(HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem))
 $(host-csingle): $(obj)/%: $(src)/%.c FORCE
 	$(call if_changed_dep,host-csingle)
 
 # Link an executable based on list of .o files, all plain c
 # host-cmulti -> executable
 quiet_cmd_host-cmulti	= HOSTLD  $@
-      cmd_host-cmulti	= $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -o $@ \
+      cmd_host-cmulti	= $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
 			  $(addprefix $(obj)/, $($(target-stem)-objs)) \
-			  $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem))
+			  $(HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem))
 $(host-cmulti): FORCE
 	$(call if_changed,host-cmulti)
 $(call multi-depend, $(host-cmulti), , -objs)
@@ -129,10 +127,10 @@ $(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE
 # Link an executable based on list of .o files, a mixture of .c and .cc
 # host-cxxmulti -> executable
 quiet_cmd_host-cxxmulti	= HOSTLD  $@
-      cmd_host-cxxmulti	= $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -o $@ \
+      cmd_host-cxxmulti	= $(HOSTCXX) $(HOSTLDFLAGS) -o $@ \
 			  $(foreach o,objs cxxobjs,\
 			  $(addprefix $(obj)/, $($(target-stem)-$(o)))) \
-			  $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem))
+			  $(HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem))
 $(host-cxxmulti): FORCE
 	$(call if_changed,host-cxxmulti)
 $(call multi-depend, $(host-cxxmulti), , -objs -cxxobjs)
@@ -163,9 +161,9 @@ $(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE
 # Link a shared library, based on position independent .o files
 # *.o -> .so shared library (host-cshlib)
 quiet_cmd_host-cshlib	= HOSTLLD -shared $@
-      cmd_host-cshlib	= $(HOSTCC) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \
+      cmd_host-cshlib	= $(HOSTCC) $(HOSTLDFLAGS) -shared -o $@ \
 			  $(addprefix $(obj)/, $($(target-stem)-objs)) \
-			  $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem).so)
+			  $(HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem).so)
 $(host-cshlib): FORCE
 	$(call if_changed,host-cshlib)
 $(call multi-depend, $(host-cshlib), .so, -objs)
@@ -173,9 +171,9 @@ $(call multi-depend, $(host-cshlib), .so, -objs)
 # Link a shared library, based on position independent .o files
 # *.o -> .so shared library (host-cxxshlib)
 quiet_cmd_host-cxxshlib	= HOSTLLD -shared $@
-      cmd_host-cxxshlib	= $(HOSTCXX) $(KBUILD_HOSTLDFLAGS) -shared -o $@ \
+      cmd_host-cxxshlib	= $(HOSTCXX) $(HOSTLDFLAGS) -shared -o $@ \
 			  $(addprefix $(obj)/, $($(target-stem)-objs)) \
-			  $(KBUILD_HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem).so)
+			  $(HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem).so)
 $(host-cxxshlib): FORCE
 	$(call if_changed,host-cxxshlib)
 $(call multi-depend, $(host-cxxshlib), .so, -objs)
Signature · 1 line
Anthony PERARD
#47 lore raw

PATCH v8 18/47 build: handle always-y and hostprogs-always-y

In reply to Anthony PERARD

This will be used for xen/tools/.

---
 xen/Rules.mk               | 10 +++++++++-
 xen/scripts/Makefile.clean |  3 ++-
 2 files changed, 11 insertions(+), 2 deletions(-)
xen/Rules.mk +9 -1
index f452a821cc86..9eb3093f43fb 100644
@@ -78,9 +78,17 @@ else
 obj-y    := $(filter-out %/, $(obj-y))
 endif
 
+# hostprogs-always-y += foo
+# ... is a shorthand for
+# hostprogs-y += foo
+# always-y  += foo
+hostprogs-y += $(hostprogs-always-y)
+always-y += $(hostprogs-always-y)
+
 # Add subdir path
 
 extra-y         := $(addprefix $(obj)/,$(extra-y))
+always-y        := $(addprefix $(obj)/,$(always-y))
 targets         := $(addprefix $(obj)/,$(targets))
 lib-y           := $(addprefix $(obj)/,$(lib-y))
 obj-y           := $(addprefix $(obj)/,$(obj-y))
@@ -283,7 +291,7 @@ targets += $(call intermediate_targets, .init.o, .o) \
 # Build
 # ---------------------------------------------------------------------------
 
-__build: $(targets-for-builtin) $(subdir-y)
+__build: $(targets-for-builtin) $(subdir-y) $(always-y)
 	@:
 
 # Descending
xen/scripts/Makefile.clean +2 -1
index 156d6307cf83..c2689d4af5fa 100644
@@ -18,7 +18,8 @@ subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
               $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
 
 __clean-files := \
-    $(clean-files) $(hostprogs-y) $(hostprogs-)
+    $(clean-files) $(hostprogs-y) $(hostprogs-) \
+    $(hostprogs-always-y) $(hostprogs-always-)
 
 __clean-files := $(wildcard $(__clean-files))
 
Signature · 1 line
Anthony PERARD
#48 lore raw

PATCH v8 19/47 build: start building the tools with the main makefiles

In reply to Anthony PERARD

This will make out-of-tree build easier.

---

Notes:
v8:
- add some $(Q)

 xen/Makefile       |  8 ++++----
 xen/tools/Makefile | 17 ++---------------
 2 files changed, 6 insertions(+), 19 deletions(-)
xen/Makefile +4 -4
index c26c44818916..06d5e4fd61c1 100644
@@ -209,7 +209,7 @@ endif # root-make-done
 
 PHONY += tools_fixdep
 tools_fixdep:
-	$(MAKE) -C tools fixdep
+	$(Q)$(MAKE) $(build)=tools tools/fixdep
 
 ifeq ($(config-build),y)
 # ===========================================================================
@@ -247,7 +247,7 @@ ifeq ($(need-config),y)
 # "tools_fixdep" which is a .PHONY target and would force make to call
 # "defconfig" again to update $(KCONFIG_CONFIG).
 tools/fixdep:
-	$(MAKE) -C tools fixdep
+	$(Q)$(MAKE) $(build)=tools tools/fixdep
 
 # Allow people to just run `make` as before and not force them to configure
 $(KCONFIG_CONFIG): tools/fixdep
@@ -409,7 +409,7 @@ _debug:
 
 .PHONY: _clean
 _clean:
-	$(MAKE) -C tools clean
+	$(MAKE) $(clean) tools
 	$(MAKE) $(clean) include
 	$(MAKE) $(clean) common
 	$(MAKE) $(clean) drivers
@@ -438,7 +438,7 @@ $(TARGET).gz: $(TARGET)
 	mv [email protected] $@
 
 $(TARGET): FORCE
-	$(MAKE) -C tools
+	$(Q)$(MAKE) $(build)=tools
 	$(Q)$(MAKE) $(build)=. include/xen/compile.h
 	[ -e arch/$(TARGET_ARCH)/efi ] && for f in $$(cd common/efi; echo *.[ch]); \
 		do test -r arch/$(TARGET_ARCH)/efi/$$f || \
xen/tools/Makefile +2 -15
index 722f3664549d..a5078b7cb8de 100644
@@ -1,15 +1,2 @@
-
-include $(XEN_ROOT)/Config.mk
-
-.PHONY: default
-default: symbols fixdep
-
-.PHONY: clean
-clean:
-	rm -f *.o symbols fixdep
-
-symbols: symbols.c
-	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
-
-fixdep: fixdep.c
-	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
+hostprogs-always-y += symbols
+hostprogs-always-y += fixdep
Signature · 1 line
Anthony PERARD
#49 lore raw

PATCH v8 20/47 build: add headers path to CFLAGS once for all archs

In reply to Anthony PERARD

This just remove duplication.

---
 xen/Makefile           | 3 +++
 xen/arch/arm/arch.mk   | 3 ---
 xen/arch/riscv/arch.mk | 2 --
 xen/arch/x86/arch.mk   | 2 --
 4 files changed, 3 insertions(+), 7 deletions(-)
xen/Makefile +3 -0
index 06d5e4fd61c1..efd7538099f3 100644
@@ -312,6 +312,9 @@ CFLAGS += -flto
 LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so
 endif
 
+CFLAGS += -I$(srctree)/include
+CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
+
 # Note that link order matters!
 ALL_OBJS-y                := common/built_in.o
 ALL_OBJS-y                += drivers/built_in.o
xen/arch/arm/arch.mk +0 -3
index 4e3f7014305e..094b67072304 100644
@@ -1,9 +1,6 @@
 ########################################
 # arm-specific definitions
 
-CFLAGS += -I$(srctree)/include
-CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
-
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 
xen/arch/riscv/arch.mk +0 -2
index 694ba053ceab..ae8fe9dec730 100644
@@ -11,5 +11,3 @@ riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
 # -mcmodel=medlow would force Xen into the lower half.
 
 CFLAGS += -march=$(riscv-march-y) -mstrict-align -mcmodel=medany
-CFLAGS += -I$(srctree)/include
-CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
xen/arch/x86/arch.mk +0 -2
index 5152de343082..1ba488d645c0 100644
@@ -3,8 +3,6 @@
 
 export XEN_IMG_OFFSET := 0x200000
 
-CFLAGS += -I$(srctree)/include
-CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
 CFLAGS += -I$(srctree)/arch/x86/include/asm/mach-generic
 CFLAGS += -I$(srctree)/arch/x86/include/asm/mach-default
 CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
Signature · 1 line
Anthony PERARD
Acked-by on v8 20/47
#50 lore raw

Re: [XEN PATCH v8 20/47] build: add headers path to CFLAGS once for all archs

Hi Anthony,

Quoted 4 lines · Anthony PERARD

This just remove duplication.

For Arm:

Cheers,

Quoted 58 lines
---
  xen/Makefile           | 3 +++
  xen/arch/arm/arch.mk   | 3 ---
  xen/arch/riscv/arch.mk | 2 --
  xen/arch/x86/arch.mk   | 2 --
  4 files changed, 3 insertions(+), 7 deletions(-)
xen/Makefile +3 -0
index 06d5e4fd61c1..efd7538099f3 100644
@@ -312,6 +312,9 @@ CFLAGS += -flto
  LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so
  endif
 
+CFLAGS += -I$(srctree)/include
+CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
+
  # Note that link order matters!
  ALL_OBJS-y                := common/built_in.o
  ALL_OBJS-y                += drivers/built_in.o
xen/arch/arm/arch.mk +0 -3
index 4e3f7014305e..094b67072304 100644
@@ -1,9 +1,6 @@
  ########################################
  # arm-specific definitions
 
-CFLAGS += -I$(srctree)/include
-CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
-
  $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
  $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 
xen/arch/riscv/arch.mk +0 -2
index 694ba053ceab..ae8fe9dec730 100644
@@ -11,5 +11,3 @@ riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
  # -mcmodel=medlow would force Xen into the lower half.
 
  CFLAGS += -march=$(riscv-march-y) -mstrict-align -mcmodel=medany
-CFLAGS += -I$(srctree)/include
-CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
xen/arch/x86/arch.mk +0 -2
index 5152de343082..1ba488d645c0 100644
@@ -3,8 +3,6 @@
 
  export XEN_IMG_OFFSET := 0x200000
 
-CFLAGS += -I$(srctree)/include
-CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
  CFLAGS += -I$(srctree)/arch/x86/include/asm/mach-generic
  CFLAGS += -I$(srctree)/arch/x86/include/asm/mach-default
  CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
Signature · 1 line
Julien Grall
#51 lore raw

PATCH v8 21/47 build: generate x86's asm-macros.h with filechk

In reply to Anthony PERARD

When we will build out-of-tree, make is going to try to generate "asm-macros.h" before the directories "arch/x86/include/asm" exist, thus we would need to call mkdir explicitly. We will use "filechk" for that as it does everything that the current recipe does and does call mkdir.

Also, they are no more "*.new" files generated in this directory.

---
 xen/arch/x86/Makefile | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)
xen/arch/x86/Makefile +16 -13
index 456b7eed7536..873b32cc6945 100644
@@ -230,18 +230,21 @@ include: $(BASEDIR)/arch/x86/include/asm/asm-macros.h
 $(obj)/asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
 $(BASEDIR)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile
-	echo '#if 0' >[email protected]
-	echo '.if 0' >>[email protected]
-	echo '#endif' >>[email protected]
-	echo '#ifndef __ASM_MACROS_H__' >>[email protected]
-	echo '#define __ASM_MACROS_H__' >>[email protected]
-	echo 'asm ( ".include \"$@\"" );' >>[email protected]
-	echo '#endif /* __ASM_MACROS_H__ */' >>[email protected]
-	echo '#if 0' >>[email protected]
-	echo '.endif' >>[email protected]
-	cat $< >>[email protected]
-	echo '#endif' >>[email protected]
-	$(call move-if-changed,[email protected],$@)
+	$(call filechk,asm-macros.h)
+
+define filechk_asm-macros.h
+    echo '#if 0'; \
+    echo '.if 0'; \
+    echo '#endif'; \
+    echo '#ifndef __ASM_MACROS_H__'; \
+    echo '#define __ASM_MACROS_H__'; \
+    echo 'asm ( ".include \"$@\"" );'; \
+    echo '#endif /* __ASM_MACROS_H__ */'; \
+    echo '#if 0'; \
+    echo '.endif'; \
+    cat $<; \
+    echo '#endif'
+endef
 
 $(obj)/efi.lds: AFLAGS-y += -DEFI
 $(obj)/xen.lds $(obj)/efi.lds: $(src)/xen.lds.S FORCE
@@ -255,7 +258,7 @@ $(obj)/efi/mkreloc: $(src)/efi/mkreloc.c
 
 .PHONY: clean
 clean::
-	rm -f *.lds *.new boot/*.o boot/*~ boot/core boot/mkelf32
+	rm -f *.lds boot/*.o boot/*~ boot/core boot/mkelf32
 	rm -f asm-macros.i $(BASEDIR)/arch/x86/include/asm/asm-macros.*
 	rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d $(BASEDIR)/.xen.elf32
 	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc
Signature · 1 line
Anthony PERARD
#52 lore raw

PATCH v8 22/47 build: clean-up "clean" rules of duplication

In reply to Anthony PERARD

All those files to be removed are already done in the main Makefile, either by the "find" command or directly (for $(TARGET).efi).

---
 xen/Makefile                | 2 +-
 xen/arch/arm/Makefile       | 1 -
 xen/arch/x86/Makefile       | 5 ++---
 xen/test/livepatch/Makefile | 2 +-
 xen/xsm/flask/Makefile      | 2 +-
 5 files changed, 5 insertions(+), 7 deletions(-)
xen/Makefile +1 -1
index efd7538099f3..86bcedd7fa5b 100644
@@ -428,7 +428,7 @@ _clean:
 		-o -name ".*.o.tmp" -o -name "*~" -o -name "core" \
 		-o -name '*.lex.c' -o -name '*.tab.[ch]' \
 		-o -name "*.gcno" -o -name ".*.cmd" -o -name "lib.a" \) -exec rm -f {} \;
-	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map *~ core
+	rm -f include/asm $(TARGET) $(TARGET).gz $(TARGET).efi $(TARGET).efi.map $(TARGET)-syms $(TARGET)-syms.map
 	rm -f asm-offsets.s arch/*/include/asm/asm-offsets.h
 	rm -f .banner .allconfig.tmp include/xen/compile.h
 
xen/arch/arm/Makefile +0 -1
index fd24f0212ffa..3ce5f1674f6f 100644
@@ -120,4 +120,3 @@ $(obj)/dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 clean::
 	rm -f $(obj)/xen.lds
 	rm -f $(BASEDIR)/.xen-syms.[0-9]*
-	rm -f $(TARGET).efi
xen/arch/x86/Makefile +2 -3
index 873b32cc6945..0b0ef6205bc1 100644
@@ -258,9 +258,8 @@ $(obj)/efi/mkreloc: $(src)/efi/mkreloc.c
 
 .PHONY: clean
 clean::
-	rm -f *.lds boot/*.o boot/*~ boot/core boot/mkelf32
+	rm -f *.lds boot/mkelf32
 	rm -f asm-macros.i $(BASEDIR)/arch/x86/include/asm/asm-macros.*
-	rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d $(BASEDIR)/.xen.elf32
+	rm -f $(BASEDIR)/.xen-syms.[0-9]* $(BASEDIR)/.xen.elf32
 	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc
 	rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin
-	rm -f note.o
xen/test/livepatch/Makefile +1 -1
index afb8d589ecae..adb484dc5d2c 100644
@@ -162,4 +162,4 @@ uninstall:
 
 .PHONY: clean
 clean::
-	rm -f *.o .*.o.d *.livepatch config.h expect_config.h
+	rm -f *.livepatch config.h expect_config.h
xen/xsm/flask/Makefile +1 -1
index 49cf730cf098..832f65274cc0 100644
@@ -51,4 +51,4 @@ $(obj)/policy.bin: FORCE
 
 .PHONY: clean
 clean::
-	rm -f $(ALL_H_FILES) *.o $(DEPS_RM) policy.* $(POLICY_SRC) flask-policy.S
+	rm -f $(ALL_H_FILES) policy.* $(POLICY_SRC) flask-policy.S
Signature · 1 line
Anthony PERARD
#54 lore raw

PATCH v8 23/47 build: rework "clean" to clean from the root dir

In reply to Anthony PERARD

This will allow "clean" to work from an out-of-tree build when it will be available.

Some of the file been removed in current "clean" target aren't added to $(clean-files) because they are already listed in $(extra-) or $(extra-y).

Also start to clean files listed in $(targets). This allows to clean "common/config_data.S" and "xsm/flask/flask-policy.S" without having to list them a second time.

Also clean files in "arch/x86/boot" from that directory by allowing "clean" to descend into the subdir by adding "boot" into $(subdir-).

---

Notes:
v8:
- fix comment for the shorthand
- move this patch earlier in the series
- replace some BASEDIR by objtree
- start to clean $(targets) files.

 xen/Makefile                | 24 ++++++++++++------------
 xen/arch/arm/Makefile       |  5 +----
 xen/arch/x86/Makefile       | 20 ++++++++++++--------
 xen/arch/x86/boot/Makefile  |  2 ++
 xen/common/Makefile         |  3 +--
 xen/include/Makefile        |  4 +---
 xen/scripts/Kbuild.include  |  4 ++--
 xen/scripts/Makefile.clean  | 14 +++++++++++---
 xen/test/livepatch/Makefile |  4 +---
 xen/xsm/flask/Makefile      |  4 +---
 10 files changed, 44 insertions(+), 40 deletions(-)
xen/Makefile +12 -12
index 86bcedd7fa5b..deae319c8a5a 100644
@@ -412,18 +412,18 @@ _debug:
 
 .PHONY: _clean
 _clean:
-	$(MAKE) $(clean) tools
-	$(MAKE) $(clean) include
-	$(MAKE) $(clean) common
-	$(MAKE) $(clean) drivers
-	$(MAKE) $(clean) lib
-	$(MAKE) $(clean) xsm
-	$(MAKE) $(clean) crypto
-	$(MAKE) $(clean) arch/arm
-	$(MAKE) $(clean) arch/riscv
-	$(MAKE) $(clean) arch/x86
-	$(MAKE) $(clean) test
-	$(MAKE) $(clean) tools/kconfig
+	$(Q)$(MAKE) $(clean)=tools
+	$(Q)$(MAKE) $(clean)=include
+	$(Q)$(MAKE) $(clean)=common
+	$(Q)$(MAKE) $(clean)=drivers
+	$(Q)$(MAKE) $(clean)=lib
+	$(Q)$(MAKE) $(clean)=xsm
+	$(Q)$(MAKE) $(clean)=crypto
+	$(Q)$(MAKE) $(clean)=arch/arm
+	$(Q)$(MAKE) $(clean)=arch/riscv
+	$(Q)$(MAKE) $(clean)=arch/x86
+	$(Q)$(MAKE) $(clean)=test
+	$(Q)$(MAKE) $(clean)=tools/kconfig
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \
 		-o -name ".*.o.tmp" -o -name "*~" -o -name "core" \
 		-o -name '*.lex.c' -o -name '*.tab.[ch]' \
xen/arch/arm/Makefile +1 -4
index 3ce5f1674f6f..cecfaf4f3c0f 100644
@@ -116,7 +116,4 @@ $(obj)/xen.lds: $(src)/xen.lds.S FORCE
 
 $(obj)/dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
 
-.PHONY: clean
-clean::
-	rm -f $(obj)/xen.lds
-	rm -f $(BASEDIR)/.xen-syms.[0-9]*
+clean-files := $(objtree)/.xen-syms.[0-9]*
xen/arch/x86/Makefile +12 -8
index 0b0ef6205bc1..243ca17f701e 100644
@@ -77,6 +77,9 @@ obj-$(CONFIG_COMPAT) += x86_64/platform_hypercall.o
 obj-y += sysctl.o
 endif
 
+# Allows "clean" to descend into boot/
+subdir- += boot
+
 extra-y += asm-macros.i
 extra-y += xen.lds
 
@@ -190,8 +193,8 @@ note_file :=
 endif
 note_file_option ?= $(note_file)
 
+extra-$(XEN_BUILD_PE) += efi.lds
 ifeq ($(XEN_BUILD_PE),y)
-extra-y += efi.lds
 $(TARGET).efi: $(BASEDIR)/prelink.o $(note_file) $(obj)/efi.lds $(obj)/efi/relocs-dummy.o $(obj)/efi/mkreloc
 ifeq ($(CONFIG_DEBUG_INFO),y)
 	$(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug info from $(@F)"
@@ -256,10 +259,11 @@ $(obj)/boot/mkelf32: $(src)/boot/mkelf32.c
 $(obj)/efi/mkreloc: $(src)/efi/mkreloc.c
 	$(HOSTCC) $(HOSTCFLAGS) -g -o $@ $<
 
-.PHONY: clean
-clean::
-	rm -f *.lds boot/mkelf32
-	rm -f asm-macros.i $(BASEDIR)/arch/x86/include/asm/asm-macros.*
-	rm -f $(BASEDIR)/.xen-syms.[0-9]* $(BASEDIR)/.xen.elf32
-	rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc
-	rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin
+clean-files := \
+    boot/mkelf32 \
+    include/asm/asm-macros.* \
+    $(objtree)/.xen-syms.[0-9]* \
+    $(objtree)/.xen.elf32 \
+    $(objtree)/.xen.efi.[0-9]* \
+    efi/*.efi \
+    efi/mkreloc
xen/arch/x86/boot/Makefile +2 -0
index ba732e4a88c3..1ac8cb435e0e 100644
@@ -21,3 +21,5 @@ $(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) $(src)/build32.lds
 
 $(obj)/reloc.S: $(src)/reloc.c $(RELOC_DEPS) $(src)/build32.lds
 	$(MAKE) -f $(abs_srctree)/$(src)/build32.mk -C $(obj) $(@F) RELOC_DEPS="$(RELOC_DEPS)"
+
+clean-files := cmdline.S reloc.S *.lnk *.bin
xen/common/Makefile +1 -2
index ca839118e4d1..dc8d3a13f5b8 100644
@@ -84,5 +84,4 @@ $(obj)/config_data.S: $(BASEDIR)/tools/binfile FORCE
 	$(call if_changed,binfile,$(obj)/config.gz xen_config_data)
 targets += config_data.S
 
-clean::
-	rm -f config_data.S config.gz 2>/dev/null
+clean-files := config.gz
xen/include/Makefile +1 -3
index cd40d5b4c923..a3c2511f5f60 100644
@@ -131,6 +131,4 @@ lib-x86-all:
 all: lib-x86-all
 endif
 
-clean::
-	rm -rf compat config generated headers*.chk
-	rm -f $(BASEDIR)/include/xen/lib/x86/cpuid-autogen.h
+clean-files := compat config generated headers*.chk xen/lib/x86/cpuid-autogen.h
xen/scripts/Kbuild.include +2 -2
index 79b42e1252d6..d56bf7d4a452 100644
@@ -99,8 +99,8 @@ build := -f $(srctree)/Rules.mk obj
 
 # Shorthand for $(MAKE) clean
 # Usage:
-# $(MAKE) $(clean) dir
-clean := -f $(BASEDIR)/scripts/Makefile.clean clean -C
+# $(Q)$(MAKE) $(clean)=dir
+clean := -f $(srctree)/scripts/Makefile.clean obj
 
 # echo command.
 # Short version is used, if $(quiet) equals `quiet_', otherwise full one.
xen/scripts/Makefile.clean +11 -3
index c2689d4af5fa..4eed31974509 100644
@@ -3,7 +3,6 @@
 # Cleaning up
 # ==========================================================================
 
-obj := .
 src := $(obj)
 
 clean::
@@ -17,11 +16,20 @@ include $(src)/Makefile
 subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
               $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
 
+subdir-all := $(addprefix $(obj)/,$(subdir-all))
+
 __clean-files := \
     $(clean-files) $(hostprogs-y) $(hostprogs-) \
+    $(extra-y) $(extra-) $(targets) \
     $(hostprogs-always-y) $(hostprogs-always-)
 
-__clean-files := $(wildcard $(__clean-files))
+# clean-files is given relative to the current directory, unless it
+# starts with $(objtree)/ (which means "./", so do not add "./" unless
+# you want to delete a file from the toplevel object directory).
+
+__clean-files := $(wildcard \
+		   $(addprefix $(obj)/, $(filter-out /% $(objtree)/%, $(__clean-files))) \
+		   $(filter /% $(objtree)/%, $(__clean-files)))
 
 .PHONY: clean
 clean:: $(subdir-all)
@@ -35,6 +43,6 @@ endif
 
 PHONY += $(subdir-all)
 $(subdir-all):
-	$(MAKE) $(clean) $@
+	$(Q)$(MAKE) $(clean)=$@
 
 .PHONY: $(PHONY)
xen/test/livepatch/Makefile +1 -3
index adb484dc5d2c..e6fee84b69da 100644
@@ -160,6 +160,4 @@ install: $(addprefix $(obj)/,$(LIVEPATCHES))
 uninstall:
 	cd $(DESTDIR)$(LIVEPATCH_DEBUG_DIR) && rm -f $(LIVEPATCHES)
 
-.PHONY: clean
-clean::
-	rm -f *.livepatch config.h expect_config.h
+clean-files := config.h expect_config.h
xen/xsm/flask/Makefile +1 -3
index 832f65274cc0..4ac6fb8778ae 100644
@@ -49,6 +49,4 @@ $(obj)/policy.bin: FORCE
 	        FLASK_BUILD_DIR=$(FLASK_BUILD_DIR) POLICY_FILENAME=$(POLICY_SRC)
 	cmp -s $(POLICY_SRC) $@ || cp $(POLICY_SRC) $@
 
-.PHONY: clean
-clean::
-	rm -f $(ALL_H_FILES) policy.* $(POLICY_SRC) flask-policy.S
+clean-files := policy.* $(POLICY_SRC)
Signature · 1 line
Anthony PERARD
Reviewed-by on v8 23/47
#55 lore raw

Re: [XEN PATCH v8 23/47] build: rework "clean" to clean from the root dir

Quoted 7 lines · Anthony PERARD

This will allow "clean" to work from an out-of-tree build when it will be available.

Some of the file been removed in current "clean" target aren't added to $(clean-files) because they are already listed in $(extra-) or $(extra-y).

Quoted 8 lines

Also start to clean files listed in $(targets). This allows to clean "common/config_data.S" and "xsm/flask/flask-policy.S" without having to list them a second time.

Also clean files in "arch/x86/boot" from that directory by allowing "clean" to descend into the subdir by adding "boot" into $(subdir-).

#56 lore raw

PATCH v8 24/47 build: use main rune to build host binary x86's mkelf32 and mkreloc

In reply to Anthony PERARD

Also, remove the HOSTCFLAGS "-g" from "mkreloc" command line.

---

Notes:
v8:
- acked
- remove the cflags "-g" from "mkreloc"

 xen/arch/x86/Makefile | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
xen/arch/x86/Makefile +4 -9
index 243ca17f701e..e8151bf4b111 100644
@@ -83,6 +83,9 @@ subdir- += boot
 extra-y += asm-macros.i
 extra-y += xen.lds
 
+hostprogs-y += boot/mkelf32
+hostprogs-y += efi/mkreloc
+
 # Allows usercopy.c to include itself
 $(obj)/usercopy.o: CFLAGS-y += -iquote .
 
@@ -253,17 +256,9 @@ $(obj)/efi.lds: AFLAGS-y += -DEFI
 $(obj)/xen.lds $(obj)/efi.lds: $(src)/xen.lds.S FORCE
 	$(call if_changed_dep,cpp_lds_S)
 
-$(obj)/boot/mkelf32: $(src)/boot/mkelf32.c
-	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
-
-$(obj)/efi/mkreloc: $(src)/efi/mkreloc.c
-	$(HOSTCC) $(HOSTCFLAGS) -g -o $@ $<
-
 clean-files := \
-    boot/mkelf32 \
     include/asm/asm-macros.* \
     $(objtree)/.xen-syms.[0-9]* \
     $(objtree)/.xen.elf32 \
     $(objtree)/.xen.efi.[0-9]* \
-    efi/*.efi \
-    efi/mkreloc
+    efi/*.efi
Signature · 1 line
Anthony PERARD
#57 lore raw

PATCH v8 25/47 build: rework coverage and ubsan CFLAGS handling

In reply to Anthony PERARD

When assigning a value a target-specific variable, that also affect prerequisite of the target. This is mostly fine, but there is one case where we will not want the COV_FLAGS added to the CFLAGS.

In arch/x86/boot, we have "head.o" with "cmdline.S" as prerequisite and ultimately "cmdline.o", we don't want COV_FLAGS to that last one.

---

Notes:
v8:
- reorder target-specific assignments
- fix typo in comment
- reviewed

 xen/Rules.mk | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
xen/Rules.mk +18 -3
index 9eb3093f43fb..d6eabd3415b5 100644
@@ -126,19 +126,31 @@ targets += $(targets-for-builtin)
 
 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS-y += -DINIT_SECTIONS_ONLY
 
+non-init-objects = $(filter-out %.init.o, $(obj-y) $(obj-bin-y) $(extra-y))
+
 ifeq ($(CONFIG_COVERAGE),y)
 ifeq ($(CONFIG_CC_IS_CLANG),y)
     COV_FLAGS := -fprofile-instr-generate -fcoverage-mapping
 else
     COV_FLAGS := -fprofile-arcs -ftest-coverage
 endif
-$(filter-out %.init.o $(nocov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS-y += $(COV_FLAGS)
+
+# Reset COV_FLAGS in cases where an objects has another one as prerequisite
+$(nocov-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
+    COV_FLAGS :=
+
+$(non-init-objects): _c_flags += $(COV_FLAGS)
 endif
 
 ifeq ($(CONFIG_UBSAN),y)
 # Any -fno-sanitize= options need to come after any -fsanitize= options
-$(filter-out %.init.o $(noubsan-y),$(obj-y) $(obj-bin-y) $(extra-y)): \
-CFLAGS-y += $(filter-out -fno-%,$(CFLAGS_UBSAN)) $(filter -fno-%,$(CFLAGS_UBSAN))
+UBSAN_FLAGS := $(filter-out -fno-%,$(CFLAGS_UBSAN)) $(filter -fno-%,$(CFLAGS_UBSAN))
+
+# Reset UBSAN_FLAGS in cases where an objects has another one as prerequisite
+$(noubsan-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
+    UBSAN_FLAGS :=
+
+$(non-init-objects): _c_flags += $(UBSAN_FLAGS)
 endif
 
 ifeq ($(CONFIG_LTO),y)
@@ -167,6 +179,9 @@ a_flags = -MMD -MP -MF $(depfile) $(XEN_AFLAGS)
 
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 
+c_flags += $(_c_flags)
+a_flags += $(_c_flags)
+
 c_flags += $(CFLAGS-y)
 a_flags += $(CFLAGS-y) $(AFLAGS-y)
 
Signature · 1 line
Anthony PERARD
#58 lore raw

PATCH v8 26/47 build,x86: remove the need for build32.mk

In reply to Anthony PERARD

Rework "arch/x86/boot/Makefile" to allow it to build both file "cmdline.S" and "reloc.S" without "build32.mk".

These will now use the main rules for "%.o: %.c", and thus generate a dependency file. (We will not need to track the dependency manually anymore.)

But for that, we need to override the main CFLAGS to do a 32bit build. We introduce XEN_COMMON_CFLAGS which can be reused in boot/Makefile, and avoid the need to reparse Config.mk with a different value for XEN_TARGET_ARCH. From this new $(XEN_COMMON_CFLAGS), we only need to change -m64 to have the 32bit flags. Then those are applied only to "cmdline.o" and "reloc.o".

Specifically apply the rule "%.S: %.bin" to both cmdline.S and reloc.S to avoid make trying to regenerate other %.S files with it.

There is no change expected to the resulting "cmdline.S" and "reloc.S", only the *.o file changes as their symbol for FILE goes from "cmdline.c" to "arch/x86//cmdline.c". (No idea why "boot" is missing from the string.) (I've only check with GCC, not clang.)

---

Notes:
v8:
- avoid the need to list CFLAGS from Config.mk a second time by introducing XEN_COMMON_CFLAGS, and using it in boot/
- improve LDFLAGS_DIRECT, by just substitute x64 to i368 from x86 LDFLAGS_DIRECT. And thus avoid copying the logic from Config.mk.

 xen/Makefile                 |  4 +++
 xen/arch/x86/boot/Makefile   | 52 +++++++++++++++++++++++++-----------
 xen/arch/x86/boot/build32.mk | 40 ---------------------------
 3 files changed, 40 insertions(+), 56 deletions(-)
 delete mode 100644 xen/arch/x86/boot/build32.mk
xen/Makefile +4 -0
index deae319c8a5a..90e8191f51ce 100644
@@ -171,6 +171,10 @@ export LEX = $(if $(FLEX),$(FLEX),flex)
 # Default file for 'make defconfig'.
 export KBUILD_DEFCONFIG := $(ARCH)_defconfig
 
+# Copy CFLAGS generated by "Config.mk" so they can be reused later without
+# reparsing Config.mk by e.g. arch/x86/boot/.
+export XEN_COMMON_CFLAGS := $(CFLAGS)
+
 # CLANG_FLAGS needs to be calculated before calling Kconfig
 ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
 CLANG_FLAGS :=
xen/arch/x86/boot/Makefile +36 -16

61 lines not on this page · raw message

xen/arch/x86/boot/build32.mk deleted +0 -40
deleted file mode 100644
index e90680cd9f52..000000000000
@@ -1,40 +0,0 @@
-override XEN_TARGET_ARCH=x86_32
-CFLAGS =
-include $(XEN_ROOT)/Config.mk
-
-$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
-
-CFLAGS += -Werror -fno-builtin -g0 -msoft-float
-CFLAGS += -I$(BASEDIR)/include
-CFLAGS := $(filter-out -flto,$(CFLAGS)) 
-
-# NB. awk invocation is a portable alternative to 'head -n -1'
-%.S: %.bin
-	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
-	sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@
-
-# Drop .got.plt during conversion to plain binary format.
-# Please check build32.lds for more details.
-%.bin: %.lnk
-	$(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' | \
-		while read idx name sz rest; do \
-			case "$$name" in \
-			.got.plt) \
-				test $$sz != 0c || continue; \
-				echo "Error: non-empty $$name: 0x$$sz" >&2; \
-				exit $$(expr $$idx + 1);; \
-			esac; \
-		done
-	$(OBJCOPY) -O binary -R .got.plt $< $@
-
-%.lnk: %.o build32.lds
-	$(LD) $(LDFLAGS_DIRECT) -N -T build32.lds -o $@ $<
-
-%.o: %.c
-	$(CC) $(CFLAGS) -c -fpic $< -o $@
-
-cmdline.o: cmdline.c $(CMDLINE_DEPS)
-
-reloc.o: reloc.c $(RELOC_DEPS)
-
-.PRECIOUS: %.bin %.lnk
Signature · 1 line
Anthony PERARD
#59 lore raw

Re: [XEN PATCH v8 26/47] build,x86: remove the need for build32.mk

xen/Makefile export LEX = $(if $(FLEX),$(FLEX),flex) · line 176

Quoted 9 lines · Anthony PERARD
xen/Makefile +3 -0
@@ -171,6 +171,10 @@ export LEX = $(if $(FLEX),$(FLEX),flex)
 # Default file for 'make defconfig'.
 export KBUILD_DEFCONFIG := $(ARCH)_defconfig
 
+# Copy CFLAGS generated by "Config.mk" so they can be reused later without
+# reparsing Config.mk by e.g. arch/x86/boot/.
+export XEN_COMMON_CFLAGS := $(CFLAGS)

For my own understanding (it's hard to check being half way through the series): At this point there are no further adjustments expected to CFLAGS?

xen/arch/x86/boot/Makefile line 2

Quoted 5 lines
xen/arch/x86/boot/Makefile +1 -0
@@ -1,25 +1,45 @@
 obj-bin-y += head.o
+head-objs := cmdline.S reloc.S

Is "-objs" really a suitable part of the name for a list of *.S?

Quoted 11 lines
xen/arch/x86/boot/Makefile +4 -5
-DEFS_H_DEPS = $(abs_srctree)/$(src)/defs.h $(abs_srctree)/include/xen/stdbool.h
+nocov-y += $(head-objs:.S=.o)
+noubsan-y += $(head-objs:.S=.o)
+targets += $(head-objs:.S=.o)
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) $(abs_srctree)/$(src)/video.h \
-	       $(BASEDIR)/include/xen/kconfig.h \
-	       $(BASEDIR)/include/generated/autoconf.h
+head-objs := $(addprefix $(obj)/, $(head-objs))
 
-RELOC_DEPS = $(DEFS_H_DEPS) \

xen/arch/x86/boot/Makefile line 12

Quoted 10 lines
xen/arch/x86/boot/Makefile +2 -7
-	     $(BASEDIR)/include/generated/autoconf.h \
-	     $(BASEDIR)/include/xen/kconfig.h \
-	     $(BASEDIR)/include/xen/multiboot.h \
-	     $(BASEDIR)/include/xen/multiboot2.h \
-	     $(BASEDIR)/include/xen/const.h \
-	     $(BASEDIR)/include/public/arch-x86/hvm/start_info.h
+$(obj)/head.o: $(head-objs)
 
-$(obj)/head.o: $(obj)/cmdline.S $(obj)/reloc.S
+$(head-objs:.S=.lnk): LDFLAGS_DIRECT := $(subst x86_64,i386,$(LDFLAGS_DIRECT))

Considering there's just a single use of LDFLAGS_DIRECT below, wouldn't it make sense to avoid overriding the variable and doing the $(subst ...) right at the use site instead?

xen/arch/x86/boot/Makefile line 14

Quoted 3 lines
xen/arch/x86/boot/Makefile +1 -2
-$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) $(src)/build32.lds
-	$(MAKE) -f $(abs_srctree)/$(src)/build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
+CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_COMMON_CFLAGS))

I can't seem to be able to spot -march=i686 in the old code. Or wait - Is this duplicating what config/x86_32.mk has?

xen/arch/x86/boot/Makefile line 16

Quoted 2 lines
xen/arch/x86/boot/Makefile +2 -0
+$(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
+CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float

You did inherit -Werror and -fno-builtin from $(XEN_COMMON_CFLAGS) already, so I don't think you need to specify these again?

xen/arch/x86/boot/Makefile line 17

Quoted 1 line
xen/arch/x86/boot/Makefile +1 -0
+CFLAGS_x86_32 += -I$(srctree)/include

Isn't this present in $(XEN_COMMON_CFLAGS) as well?

xen/arch/x86/boot/Makefile line 21

Quoted 5 lines
xen/arch/x86/boot/Makefile +3 -2
-$(obj)/reloc.S: $(src)/reloc.c $(RELOC_DEPS) $(src)/build32.lds
-	$(MAKE) -f $(abs_srctree)/$(src)/build32.mk -C $(obj) $(@F) RELOC_DEPS="$(RELOC_DEPS)"
+# override for 32bit binaries
+$(head-objs:.S=.o): CFLAGS-stack-boundary :=
+$(head-objs:.S=.o): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic

-fpic should again already be there.

Quoted 9 lines
xen/arch/x86/boot/Makefile +9 -0
+$(head-objs): %.S: %.bin
+	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
+	sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@
+
+# Drop .got.plt during conversion to plain binary format.
+# Please check build32.lds for more details.
+%.bin: %.lnk
+	$(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' | \
+		while read idx name sz rest; do \

xen/arch/x86/boot/Makefile line 41

Quoted 10 lines
xen/arch/x86/boot/Makefile +10 -0
+			case "$$name" in \
+			.got.plt) \
+				test $$sz != 0c || continue; \
+				echo "Error: non-empty $$name: 0x$$sz" >&2; \
+				exit $$(expr $$idx + 1);; \
+			esac; \
+		done
+	$(OBJCOPY) -O binary -R .got.plt $< $@
+
+

Nit: Please no double blank lines.

Jan

#60 lore raw

Re: [XEN PATCH v8 26/47] build,x86: remove the need for build32.mk

Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/Makefile +0 -0
@@ -171,6 +171,10 @@ export LEX = $(if $(FLEX),$(FLEX),flex)
 # Default file for 'make defconfig'.
 export KBUILD_DEFCONFIG := $(ARCH)_defconfig
 
Quoted 7 lines

xen/Makefile export LEX = $(if $(FLEX),$(FLEX),flex) · line 176

Quoted 3 lines
xen/Makefile +3 -0
+# Copy CFLAGS generated by "Config.mk" so they can be reused later without
+# reparsing Config.mk by e.g. arch/x86/boot/.
+export XEN_COMMON_CFLAGS := $(CFLAGS)

For my own understanding (it's hard to check being half way through the series): At this point there are no further adjustments expected to CFLAGS?

I'm not sure what you mean. The comment should be explicit.

CFLAGS is going to be adjusted after the copy, for the benefit of all the 64bit code (when building x86_64). The "renamed" to XEN_CFLAGS to be useable by the rest of the tree.

The name "XEN_COMMON_CFLAGS" might not be the right one, it is only common to everything in xen.git, so same flags that the toolstack would work with.

Quoted 7 lines

xen/arch/x86/boot/Makefile line 2

Quoted 5 lines
xen/arch/x86/boot/Makefile +1 -0
@@ -1,25 +1,45 @@
 obj-bin-y += head.o
+head-objs := cmdline.S reloc.S

Is "-objs" really a suitable part of the name for a list of *.S?

Maybe not. I think this "x-objs" naming is used in Linux to build modules with more than one object. But I guess here we have an object with more than one source. Maybe "head-srcs" is better, even if it's compiled code made ready to include into a .S source file.

Quoted 19 lines
Quoted 19 lines
xen/arch/x86/boot/Makefile +5 -11
-DEFS_H_DEPS = $(abs_srctree)/$(src)/defs.h $(abs_srctree)/include/xen/stdbool.h
+nocov-y += $(head-objs:.S=.o)
+noubsan-y += $(head-objs:.S=.o)
+targets += $(head-objs:.S=.o)
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) $(abs_srctree)/$(src)/video.h \
-	       $(BASEDIR)/include/xen/kconfig.h \
-	       $(BASEDIR)/include/generated/autoconf.h
+head-objs := $(addprefix $(obj)/, $(head-objs))
 
-RELOC_DEPS = $(DEFS_H_DEPS) \
-	     $(BASEDIR)/include/generated/autoconf.h \
-	     $(BASEDIR)/include/xen/kconfig.h \
-	     $(BASEDIR)/include/xen/multiboot.h \
-	     $(BASEDIR)/include/xen/multiboot2.h \
-	     $(BASEDIR)/include/xen/const.h \
-	     $(BASEDIR)/include/public/arch-x86/hvm/start_info.h
+$(obj)/head.o: $(head-objs)
 
Quoted 6 lines

xen/arch/x86/boot/Makefile line 12

Quoted 2 lines
xen/arch/x86/boot/Makefile +1 -1
-$(obj)/head.o: $(obj)/cmdline.S $(obj)/reloc.S
+$(head-objs:.S=.lnk): LDFLAGS_DIRECT := $(subst x86_64,i386,$(LDFLAGS_DIRECT))

Considering there's just a single use of LDFLAGS_DIRECT below, wouldn't it make sense to avoid overriding the variable and doing the $(subst ...) right at the use site instead?

Yes, that might be ok to do.

Quoted 6 lines

xen/arch/x86/boot/Makefile line 14

Quoted 3 lines
xen/arch/x86/boot/Makefile +1 -2
-$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) $(src)/build32.lds
-	$(MAKE) -f $(abs_srctree)/$(src)/build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
+CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_COMMON_CFLAGS))

I can't seem to be able to spot -march=i686 in the old code. Or wait - Is this duplicating what config/x86_32.mk has?

Yes.

Quoted 5 lines

xen/arch/x86/boot/Makefile line 16

Quoted 2 lines
xen/arch/x86/boot/Makefile +2 -0
+$(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
+CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float

You did inherit -Werror and -fno-builtin from $(XEN_COMMON_CFLAGS) already, so I don't think you need to specify these again?

No, because I didn't want to change the CFLAGS used to build the 32bits binaries in this patch. So XEN_COMMON_CFLAGS just hold the CFLAGS produced by "Config.mk" for the x86_32 arch. So XEN_COMMON_CFLAGS is different from XEN_CFLAGS.

If we want to use the same CFLAGS to build head.o, then I think it would be better to do in it's own patch. I can probably do it before or after this patch as XEN_CFLAGS is already available.

Thanks,

Signature · 1 line
Anthony PERARD
#61 lore raw

Re: [XEN PATCH v8 26/47] build,x86: remove the need for build32.mk

Quoted 16 lines · Anthony PERARD
Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/Makefile +0 -0
@@ -171,6 +171,10 @@ export LEX = $(if $(FLEX),$(FLEX),flex)
 # Default file for 'make defconfig'.
 export KBUILD_DEFCONFIG := $(ARCH)_defconfig
 
Quoted 7 lines

xen/Makefile export LEX = $(if $(FLEX),$(FLEX),flex) · line 176

Quoted 3 lines
xen/Makefile +3 -0
+# Copy CFLAGS generated by "Config.mk" so they can be reused later without
+# reparsing Config.mk by e.g. arch/x86/boot/.
+export XEN_COMMON_CFLAGS := $(CFLAGS)

For my own understanding (it's hard to check being half way through the series): At this point there are no further adjustments expected to CFLAGS?

Quoted 5 lines

I'm not sure what you mean. The comment should be explicit.

CFLAGS is going to be adjusted after the copy, for the benefit of all the 64bit code (when building x86_64). The "renamed" to XEN_CFLAGS to be useable by the rest of the tree.

I guess I misread the comment, sorry.

Quoted 3 lines

The name "XEN_COMMON_CFLAGS" might not be the right one, it is only common to everything in xen.git, so same flags that the toolstack would work with.

XEN_GLOBAL_CFLAGS would come to mind, but is unlikely to be viewed as significantly better. Maybe XEN_TREEWIDE_CFLAGS?

Jan

#62 lore raw

PATCH v8 27/47 build: grab common EFI source files in arch specific dir

In reply to Anthony PERARD

Rather than preparing the efi source file, we will make the symbolic link as needed from the build location.

The ln command is run every time to allow to update the link in case the source tree change location.

This patch also introduce "efi_common.mk" which allow to reuse the common make instructions without having to duplicate them into each arch.

And now that we have a list of common source file, we can start to remove the links to the source files on clean.

---

Notes:
v8:
- use symbolic link instead of making a copy of the source
- introduce efi_common.mk
- remove links to source file on clean
- use -iquote for "efi.h" headers in common/efi

 xen/Makefile                 |  5 -----
 xen/arch/arm/efi/Makefile    |  4 ++--
 xen/arch/x86/Makefile        |  1 +
 xen/arch/x86/efi/Makefile    |  5 +----
 xen/common/efi/efi_common.mk | 12 ++++++++++++
 5 files changed, 16 insertions(+), 11 deletions(-)
 create mode 100644 xen/common/efi/efi_common.mk
xen/Makefile +0 -5
index 90e8191f51ce..2a809d577fc3 100644
@@ -447,11 +447,6 @@ $(TARGET).gz: $(TARGET)
 $(TARGET): FORCE
 	$(Q)$(MAKE) $(build)=tools
 	$(Q)$(MAKE) $(build)=. include/xen/compile.h
-	[ -e arch/$(TARGET_ARCH)/efi ] && for f in $$(cd common/efi; echo *.[ch]); \
-		do test -r arch/$(TARGET_ARCH)/efi/$$f || \
-		   ln -nsf ../../../common/efi/$$f arch/$(TARGET_ARCH)/efi/; \
-		done; \
-		true
 	$(Q)$(MAKE) $(build)=include all
 	$(Q)$(MAKE) $(build)=arch/$(TARGET_ARCH) include
 	$(Q)$(MAKE) $(build)=. arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
xen/arch/arm/efi/Makefile +2 -2
index 1b1ed06feddc..57616a17cb03 100644
@@ -1,4 +1,4 @@
-CFLAGS-y += -fshort-wchar
+include $(srctree)/common/efi/efi_common.mk
 
-obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o
+obj-y += $(EFIOBJ-y)
 obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
xen/arch/x86/Makefile +1 -0
index e8151bf4b111..eabd8d3919a4 100644
@@ -79,6 +79,7 @@ endif
 
 # Allows "clean" to descend into boot/
 subdir- += boot
+subdir- += efi
 
 extra-y += asm-macros.i
 extra-y += xen.lds
xen/arch/x86/efi/Makefile +1 -4
index ac815f02cb5e..81fda12a70ea 100644
@@ -1,4 +1,4 @@
-CFLAGS-y += -fshort-wchar
+include $(srctree)/common/efi/efi_common.mk
 
 quiet_cmd_objcopy_o_ihex = OBJCOPY $@
 cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@
@@ -8,9 +8,6 @@ $(obj)/%.o: $(src)/%.ihex FORCE
 
 $(obj)/boot.init.o: $(obj)/buildid.o
 
-EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
-EFIOBJ-$(CONFIG_COMPAT) += compat.o
-
 $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4)
 $(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS-stack-boundary := $(cflags-stack-boundary)
 
xen/common/efi/efi_common.mk new file +12 -0
new file mode 100644
index 000000000000..d2845fd6b3c8
@@ -0,0 +1,12 @@
+EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
+EFIOBJ-$(CONFIG_COMPAT) += compat.o
+
+CFLAGS-y += -fshort-wchar
+CFLAGS-y += -iquote $(srctree)/common/efi
+
+$(obj)/%.c: $(abs_srctree)/common/efi/%.c FORCE
+	$(Q)ln -nfs $< $@
+
+clean-files += $(patsubst %.o,%.c, $(EFIOBJ-y:.init.o=.o) $(EFIOBJ-))
+
+.PRECIOUS: $(obj)/%.c
Signature · 1 line
Anthony PERARD
#63 lore raw

Re: [XEN PATCH v8 27/47] build: grab common EFI source files in arch specific dir

Quoted 5 lines · Anthony PERARD

Rather than preparing the efi source file, we will make the symbolic link as needed from the build location.

The ln command is run every time to allow to update the link in case the source tree change location.

Btw, since symlinks aren't being liked, would there be a way to make things work using vpath?

Quoted 17 lines

This patch also introduce "efi_common.mk" which allow to reuse the common make instructions without having to duplicate them into each arch.

And now that we have a list of common source file, we can start to remove the links to the source files on clean.

---

Notes:
v8:
- use symbolic link instead of making a copy of the source
- introduce efi_common.mk
- remove links to source file on clean
- use -iquote for "efi.h" headers in common/efi

Quoted 5 lines
 xen/Makefile                 |  5 -----
 xen/arch/arm/efi/Makefile    |  4 ++--
 xen/arch/x86/Makefile        |  1 +
 xen/arch/x86/efi/Makefile    |  5 +----
 xen/common/efi/efi_common.mk | 12 ++++++++++++

Could I talk you into avoiding _ when - is suitable, which is the case not only for (non-exported) make variables, but also file names?

Quoted 14 lines
xen/arch/arm/efi/Makefile +2 -2
@@ -1,4 +1,4 @@
-CFLAGS-y += -fshort-wchar
+include $(srctree)/common/efi/efi_common.mk
 
-obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o
+obj-y += $(EFIOBJ-y)
 obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
xen/arch/x86/Makefile +0 -0
index e8151bf4b111..eabd8d3919a4 100644

xen/arch/x86/Makefile endif · line 82

Quoted 4 lines
xen/arch/x86/Makefile +1 -0
@@ -79,6 +79,7 @@ endif
 
 # Allows "clean" to descend into boot/
 subdir- += boot
+subdir- += efi

This renders the comment stale - please generalize it.

Also, any reason a similar adjustment isn't needed for Arm? Perhaps this could even move into xen/Makefile:

subdir- += $(wildcard efi/)

xen/common/efi/efi_common.mk line 8

Quoted 11 lines
xen/common/efi/efi_common.mk new file +8 -0
@@ -0,0 +1,12 @@
+EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
+EFIOBJ-$(CONFIG_COMPAT) += compat.o
+
+CFLAGS-y += -fshort-wchar
+CFLAGS-y += -iquote $(srctree)/common/efi
+
+$(obj)/%.c: $(abs_srctree)/common/efi/%.c FORCE
+	$(Q)ln -nfs $< $@

Like was the case before, I think it would be better if the links were relative ones, at least when srctree == objtree (but ideally always).

xen/common/efi/efi_common.mk line 10

Quoted 1 line
xen/common/efi/efi_common.mk new file +1 -0
+clean-files += $(patsubst %.o,%.c, $(EFIOBJ-y:.init.o=.o) $(EFIOBJ-))

Nit: Please be consistent (at least within a single line) about blanks following commas.

Jan

#64 lore raw

Re: [XEN PATCH v8 27/47] build: grab common EFI source files in arch specific dir

Quoted 9 lines · Jan Beulich
Quoted 5 lines · Anthony PERARD

Rather than preparing the efi source file, we will make the symbolic link as needed from the build location.

The ln command is run every time to allow to update the link in case the source tree change location.

Btw, since symlinks aren't being liked, would there be a way to make things work using vpath?

No, that's not possible. With "vpath = /build/xen/common/efi", make would look at path "/build/xen/common/efi/arch/x86/efi/runtime.c" to build "arch/x86/efi/runtime.o".

Quoted 17 lines
Quoted 17 lines

This patch also introduce "efi_common.mk" which allow to reuse the common make instructions without having to duplicate them into each arch.

And now that we have a list of common source file, we can start to remove the links to the source files on clean.

---

Notes:
v8:
- use symbolic link instead of making a copy of the source
- introduce efi_common.mk
- remove links to source file on clean
- use -iquote for "efi.h" headers in common/efi

Quoted 8 lines
Quoted 5 lines
 xen/Makefile                 |  5 -----
 xen/arch/arm/efi/Makefile    |  4 ++--
 xen/arch/x86/Makefile        |  1 +
 xen/arch/x86/efi/Makefile    |  5 +----
 xen/common/efi/efi_common.mk | 12 ++++++++++++

Could I talk you into avoiding _ when - is suitable, which is the case not only for (non-exported) make variables, but also file names?

I'll try. I'll change this one.

Quoted 15 lines
Quoted 15 lines
xen/arch/arm/efi/Makefile +2 -2
@@ -1,4 +1,4 @@
-CFLAGS-y += -fshort-wchar
+include $(srctree)/common/efi/efi_common.mk
 
-obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o
+obj-y += $(EFIOBJ-y)
 obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
xen/arch/x86/Makefile +0 -0
index e8151bf4b111..eabd8d3919a4 100644
@@ -79,6 +79,7 @@ endif
 
Quoted 7 lines

xen/arch/x86/Makefile endif · line 82

Quoted 3 lines
xen/arch/x86/Makefile +1 -0
 # Allows "clean" to descend into boot/
 subdir- += boot
+subdir- += efi

This renders the comment stale - please generalize it.

Also, any reason a similar adjustment isn't needed for Arm?

Yes, there's already "obj- += efi/" on the arm side. On x86, efi/ is only in ALL_OBJS which make.clean doesn't use.

Quoted 6 lines
Quoted 6 lines
xen/common/efi/efi_common.mk new file +3 -0
@@ -0,0 +1,12 @@
+EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
+EFIOBJ-$(CONFIG_COMPAT) += compat.o
+
Quoted 8 lines

xen/common/efi/efi_common.mk line 8

Quoted 5 lines
xen/common/efi/efi_common.mk new file +5 -0
+CFLAGS-y += -fshort-wchar
+CFLAGS-y += -iquote $(srctree)/common/efi
+
+$(obj)/%.c: $(abs_srctree)/common/efi/%.c FORCE
+	$(Q)ln -nfs $< $@

Like was the case before, I think it would be better if the links were relative ones, at least when srctree == objtree (but ideally always).

I can give it a try.

Quoted 4 lines

xen/common/efi/efi_common.mk line 10

Quoted 1 line
xen/common/efi/efi_common.mk new file +1 -0
+clean-files += $(patsubst %.o,%.c, $(EFIOBJ-y:.init.o=.o) $(EFIOBJ-))

Nit: Please be consistent (at least within a single line) about blanks following commas.

You mean to never put spaces after a comma because they are sometime significant? That's the only way I know how to be consistent.

Thanks,

Signature · 1 line
Anthony PERARD
#65 lore raw

Re: [XEN PATCH v8 27/47] build: grab common EFI source files in arch specific dir

Quoted 8 lines · Anthony PERARD
Quoted 7 lines · Jan Beulich
Quoted 5 lines · Anthony PERARD

Rather than preparing the efi source file, we will make the symbolic link as needed from the build location.

The ln command is run every time to allow to update the link in case the source tree change location.

Quoted 6 lines
Quoted 2 lines

Btw, since symlinks aren't being liked, would there be a way to make things work using vpath?

No, that's not possible. With "vpath = /build/xen/common/efi", make would look at path "/build/xen/common/efi/arch/x86/efi/runtime.c" to build "arch/x86/efi/runtime.o".

But /build/xen/common/efi/arch/x86/efi/runtime.c doesn't exist (and never will afaict), so wouldn't make go on finding the file elsewhere?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

+clean-files += $(patsubst %.o,%.c, $(EFIOBJ-y:.init.o=.o) $(EFIOBJ-))

Nit: Please be consistent (at least within a single line) about blanks following commas.

You mean to never put spaces after a comma because they are sometime significant? That's the only way I know how to be consistent.

When spaces are significant, they of course cannot be stripped. But here they aren't (afaict), and hence

clean-files += $(patsubst %.o,%.c,$(EFIOBJ-y:.init.o=.o) $(EFIOBJ-))

or

clean-files += $(patsubst %.o, %.c, $(EFIOBJ-y:.init.o=.o) $(EFIOBJ-))

are the two consistent (in my eyes) forms.

Jan

#66 lore raw

Re: [XEN PATCH v8 27/47] build: grab common EFI source files in arch specific dir

Quoted 12 lines · Jan Beulich
Quoted 11 lines · Anthony PERARD
Quoted 9 lines · Jan Beulich
Quoted 5 lines · Anthony PERARD

Rather than preparing the efi source file, we will make the symbolic link as needed from the build location.

The ln command is run every time to allow to update the link in case the source tree change location.

Btw, since symlinks aren't being liked, would there be a way to make things work using vpath?

Quoted 6 lines
Quoted 3 lines

No, that's not possible. With "vpath = /build/xen/common/efi", make would look at path "/build/xen/common/efi/arch/x86/efi/runtime.c" to build "arch/x86/efi/runtime.o".

But /build/xen/common/efi/arch/x86/efi/runtime.c doesn't exist (and never will afaict), so wouldn't make go on finding the file elsewhere?

If we have the implicit rule

    %.o: %.c

and vpath set.
When trying to build the target "arch/x86/efi/runtime.o", make will try our above rule and look for "arch/x86/efi/runtime.c" as make will not remove the directory part from the path. If that prerequisite isn't found, make will also try to prepend $(VPATH) to it.

I don't think it's not possible to tell make to substitute a directory for vpath, in a target or prerequisite.

Cheers,

Signature · 1 line
Anthony PERARD
#67 lore raw

Re: [XEN PATCH v8 27/47] build: grab common EFI source files in arch specific dir

In reply to Anthony PERARD
Quoted 9 lines · Anthony PERARD
Quoted 6 lines · Jan Beulich

xen/common/efi/efi_common.mk line 8

Quoted 2 lines · Anthony PERARD

+$(obj)/%.c: $(abs_srctree)/common/efi/%.c FORCE

xen/common/efi/efi_common.mk new file +1 -0
+	$(Q)ln -nfs $< $@

Like was the case before, I think it would be better if the links were relative ones, at least when srctree == objtree (but ideally always).

I can give it a try.

How about:

    ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst /, ,$(obj))))/$(if $(building_out_of_srctree),source/)common/efi/$(<F) $@

This will result in the relative path "../../../common/efi/runtime.c" for in-tree builds, and "../../../source/common/efi/runtime.c" for out-of-tree builds. There's a "source" symlink that can be used which point to the source tree when doing out-of-tree builds.

The part:

    $(subst $(space),/,$(patsubst %,..,$(subst /, ,$(obj))))
means that if $(obj) were to be something other than "arch/*/efi", the
command would still works and give the right number of "../".
It does this steps to "arch/x86/efi":
    arch x86 efi
    .. .. ..
    ../../..

The added "source/" depends on whether we do out-of-tree build or not.

Signature · 1 line
Anthony PERARD
#68 lore raw

Re: [XEN PATCH v8 27/47] build: grab common EFI source files in arch specific dir

Quoted 19 lines · Anthony PERARD
Quoted 9 lines · Anthony PERARD
Quoted 6 lines · Jan Beulich

xen/common/efi/efi_common.mk line 8

Quoted 2 lines · Anthony PERARD

+$(obj)/%.c: $(abs_srctree)/common/efi/%.c FORCE

xen/common/efi/efi_common.mk new file +1 -0
+	$(Q)ln -nfs $< $@

Like was the case before, I think it would be better if the links were relative ones, at least when srctree == objtree (but ideally always).

I can give it a try.

How about:

    ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst /, ,$(obj))))/$(if $(building_out_of_srctree),source/)common/efi/$(<F) $@

This will result in the relative path "../../../common/efi/runtime.c" for in-tree builds, and "../../../source/common/efi/runtime.c" for out-of-tree builds. There's a "source" symlink that can be used which point to the source tree when doing out-of-tree builds.

Quoted 8 lines

The part:

    $(subst $(space),/,$(patsubst %,..,$(subst /, ,$(obj))))
means that if $(obj) were to be something other than "arch/*/efi", the
command would still works and give the right number of "../".
It does this steps to "arch/x86/efi":
    arch x86 efi
    .. .. ..
    ../../..

Looks good to me.

Quoted 1 line

The added "source/" depends on whether we do out-of-tree build or not.

Well, I guess we're free to add a "source => ." symlink even in the in-tree build case, deviating slightly from what Linux does? That would then slightly simplify your construct.

Jan

#69 lore raw

Re: [XEN PATCH v8 27/47] build: grab common EFI source files in arch specific dir

Quoted 6 lines · Jan Beulich
Quoted 1 line · Anthony PERARD

The added "source/" depends on whether we do out-of-tree build or not.

Well, I guess we're free to add a "source => ." symlink even in the in-tree build case, deviating slightly from what Linux does? That would then slightly simplify your construct.

I'm not sure about that, but I can see only one issue with that: if one was to use "source/" in a make rules (in target or prerequisite), make would potentially have two different path leading to the same file when running out-of-tree. But that shouldn't happen has we have "$(srctree)". Currently, Kbuild doesn't remove "source" on distclean, but I guess we can do that, which would avoid the potential issue.

I don't see other reason a link "source -> ." would be an issue, so I'll add that to the patch "build: adding out-of-tree support to the xen build".

Thanks,

Signature · 1 line
Anthony PERARD
#70 lore raw

PATCH v8 28/47 build: replace $(BASEDIR) by $(objtree)

In reply to Anthony PERARD

We need to differentiate between source files and generated/built files. We will be replacing $(BASEDIR) by $(objtree) for files that are generated.

---

Notes:
v8:
- rebased

 xen/Rules.mk                |  2 +-
 xen/arch/arm/Makefile       | 10 +++++-----
 xen/arch/x86/Makefile       | 28 ++++++++++++++--------------
 xen/common/Makefile         |  2 +-
 xen/test/livepatch/Makefile | 12 ++++++------
 5 files changed, 27 insertions(+), 27 deletions(-)
xen/Rules.mk +1 -1
index d6eabd3415b5..cd00f006ee8f 100644
@@ -12,7 +12,7 @@ src := $(obj)
 PHONY := __build
 __build:
 
--include $(BASEDIR)/include/config/auto.conf
+-include $(objtree)/include/config/auto.conf
 
 include $(XEN_ROOT)/Config.mk
 include $(BASEDIR)/scripts/Kbuild.include
xen/arch/arm/Makefile +5 -5
index cecfaf4f3c0f..ae7a2f907540 100644
@@ -90,21 +90,21 @@ ifeq ($(CONFIG_ARM_64),y)
 	ln -sf $(@F) [email protected]
 endif
 
-$(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds
+$(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
-	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
+	    $(objtree)/common/symbols-dummy.o -o $(@D)/.$(@F).0
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
-		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0.S
+		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0.S
 	$(MAKE) $(build)=$(@D) $(@D)/.$(@F).0.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
 	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
 	$(NM) -pa --format=sysv $(@D)/.$(@F).1 \
-		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1.S
+		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1.S
 	$(MAKE) $(build)=$(@D) $(@D)/.$(@F).1.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
-		| $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort \
+		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
 		>$(@D)/$(@F).map
 	rm -f $(@D)/.$(@F).[0-9]*
 
xen/arch/x86/Makefile +14 -14
index eabd8d3919a4..5fb7f1408768 100644
@@ -94,8 +94,8 @@ ifneq ($(CONFIG_HVM),y)
 $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif
 
-efi-y := $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \
-                      -O $(BASEDIR)/include/xen/compile.h ]; then \
+efi-y := $(shell if [ ! -r $(objtree)/include/xen/compile.h -o \
+                      -O $(objtree)/include/xen/compile.h ]; then \
                          echo '$(TARGET).efi'; fi) \
          $(space)
 efi-$(CONFIG_PV_SHIM_EXCLUSIVE) :=
@@ -133,23 +133,23 @@ $(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32
 
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
 
-$(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds
+$(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
-	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
+	    $(objtree)/common/symbols-dummy.o -o $(@D)/.$(@F).0
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
-		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort \
+		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
 		>$(@D)/.$(@F).0.S
 	$(MAKE) $(build)=$(@D) efi-y= $(@D)/.$(@F).0.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).0.o -o $(@D)/.$(@F).1
 	$(NM) -pa --format=sysv $(@D)/.$(@F).1 \
-		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-y) \
+		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-y) \
 		>$(@D)/.$(@F).1.S
 	$(MAKE) $(build)=$(@D) efi-y= $(@D)/.$(@F).1.o
 	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(@D)/.$(@F).1.o -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
-		| $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort \
+		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
 		>$(@D)/$(@F).map
 	rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*
 
@@ -199,28 +199,28 @@ note_file_option ?= $(note_file)
 
 extra-$(XEN_BUILD_PE) += efi.lds
 ifeq ($(XEN_BUILD_PE),y)
-$(TARGET).efi: $(BASEDIR)/prelink.o $(note_file) $(obj)/efi.lds $(obj)/efi/relocs-dummy.o $(obj)/efi/mkreloc
+$(TARGET).efi: $(objtree)/prelink.o $(note_file) $(obj)/efi.lds $(obj)/efi/relocs-dummy.o $(obj)/efi/mkreloc
 ifeq ($(CONFIG_DEBUG_INFO),y)
 	$(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug info from $(@F)"
 endif
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< $(relocs-dummy) \
-	                $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o $(@D)/.$(@F).$(base).0 &&) :
+	                $(objtree)/common/symbols-dummy.o $(note_file_option) -o $(@D)/.$(@F).$(base).0 &&) :
 	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).0) >$(@D)/.$(@F).0r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).0 \
-		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s.S
+		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).0s.S
 	$(MAKE) $(build)=$(@D) efi-y= .$(@F).0r.o .$(@F).0s.o
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< \
 	                $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o $(note_file_option) -o $(@D)/.$(@F).$(base).1 &&) :
 	$(MKRELOC) $(foreach base,$(VIRT_BASE) $(ALT_BASE),$(@D)/.$(@F).$(base).1) >$(@D)/.$(@F).1r.S
 	$(NM) -pa --format=sysv $(@D)/.$(@F).$(VIRT_BASE).1 \
-		| $(BASEDIR)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s.S
+		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort >$(@D)/.$(@F).1s.S
 	$(MAKE) $(build)=$(@D) efi-y= .$(@F).1r.o .$(@F).1s.o
 	$(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds -N $< \
 	                $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(note_file_option) -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
-		| $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort >$(@D)/$(@F).map
+		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort >$(@D)/$(@F).map
 	rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*
 else
 $(TARGET).efi: FORCE
@@ -232,11 +232,11 @@ endif
 $(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ;
 
 .PHONY: include
-include: $(BASEDIR)/arch/x86/include/asm/asm-macros.h
+include: $(objtree)/arch/x86/include/asm/asm-macros.h
 
 $(obj)/asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
-$(BASEDIR)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile
+$(objtree)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile
 	$(call filechk,asm-macros.h)
 
 define filechk_asm-macros.h
xen/common/Makefile +1 -1
index dc8d3a13f5b8..30641a737231 100644
@@ -74,7 +74,7 @@ obj-$(CONFIG_UBSAN) += ubsan/
 obj-$(CONFIG_NEEDS_LIBELF) += libelf/
 obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
 
-CONF_FILE := $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(BASEDIR)/)$(KCONFIG_CONFIG)
+CONF_FILE := $(if $(patsubst /%,,$(KCONFIG_CONFIG)),$(objtree)/)$(KCONFIG_CONFIG)
 $(obj)/config.gz: $(CONF_FILE)
 	gzip -n -c $< >$@
 
xen/test/livepatch/Makefile +6 -6
index e6fee84b69da..ddb07371315e 100644
@@ -22,9 +22,9 @@ $(obj)/xen_hello_world.o: $(obj)/config.h
 $(obj)/config.h: $(obj)/xen_hello_world_func.o
 	(set -e; \
 	 echo "#define NEW_CODE_SZ $(call CODE_SZ,$<,xen_hello_world)"; \
-	 echo "#define MINOR_VERSION_SZ $(call CODE_SZ,$(BASEDIR)/xen-syms,xen_minor_version)"; \
-	 echo "#define MINOR_VERSION_ADDR $(call CODE_ADDR,$(BASEDIR)/xen-syms,xen_minor_version)"; \
-	 echo "#define OLD_CODE_SZ $(call CODE_SZ,$(BASEDIR)/xen-syms,xen_extra_version)") > $@
+	 echo "#define MINOR_VERSION_SZ $(call CODE_SZ,$(objtree)/xen-syms,xen_minor_version)"; \
+	 echo "#define MINOR_VERSION_ADDR $(call CODE_ADDR,$(objtree)/xen-syms,xen_minor_version)"; \
+	 echo "#define OLD_CODE_SZ $(call CODE_SZ,$(objtree)/xen-syms,xen_extra_version)") > $@
 
 $(obj)/modinfo.o:
 	(set -e; \
@@ -42,7 +42,7 @@ $(obj)/modinfo.o:
 # not be built (it is for EFI builds), and that we do not have
 # the note.o.bin to muck with (as it gets deleted)
 #
-$(obj)/note.o: $(BASEDIR)/xen-syms
+$(obj)/note.o: $(objtree)/xen-syms
 	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $< [email protected]
 	$(OBJCOPY) $(OBJCOPY_MAGIC) \
 		   --rename-section=.data=.livepatch.depends,alloc,load,readonly,data,contents -S [email protected] $@
@@ -52,7 +52,7 @@ $(obj)/note.o: $(BASEDIR)/xen-syms
 # Append .livepatch.xen_depends section
 # with Xen build-id derived from xen-syms.
 #
-$(obj)/xen_note.o: $(BASEDIR)/xen-syms
+$(obj)/xen_note.o: $(objtree)/xen-syms
 	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $< [email protected]
 	$(OBJCOPY) $(OBJCOPY_MAGIC) \
 		   --rename-section=.data=.livepatch.xen_depends,alloc,load,readonly,data,contents -S [email protected] $@
@@ -125,7 +125,7 @@ xen_action_hooks_norevert-objs := xen_action_hooks_marker.o xen_hello_world_func
 
 EXPECT_BYTES_COUNT := 8
 CODE_GET_EXPECT=$(shell $(OBJDUMP) -d --insn-width=1 $(1) | sed -n -e '/<'$(2)'>:$$/,/^$$/ p' | tail -n +2 | head -n $(EXPECT_BYTES_COUNT) | awk '{$$0=$$2; printf "%s", substr($$0,length-1)}' | sed 's/.\{2\}/0x&,/g' | sed 's/^/{/;s/,$$/}/g')
-$(obj)/expect_config.h: $(BASEDIR)/xen-syms
+$(obj)/expect_config.h: $(objtree)/xen-syms
 	(set -e; \
 	 echo "#define EXPECT_BYTES $(call CODE_GET_EXPECT,$<,xen_extra_version)"; \
          echo "#define EXPECT_BYTES_COUNT $(EXPECT_BYTES_COUNT)") > $@
Signature · 1 line
Anthony PERARD
#72 lore raw

PATCH v8 29/47 build: replace $(BASEDIR) and use $(srctree)

In reply to Anthony PERARD

$(srctree) is a better description for the source directory than $(BASEDIR) that has been used for both source and build directory (which where the same).

This adds $(srctree) to a few path where make's VPATH=$(srctree) won't apply. And replace $(BASEDIR) by $(srctree).

Introduce "$(srcdir)" as a shortcut for "$(srctree)/$(src)" as the later is used often enough.

---

Notes:
v8:
- merge of two patchs from v7:
build: add $(srctree) in few key places
build: replace $(BASEDIR) by $(srctree)
both patch were acked
- introduce $(srcdir) as a shortcut for $(srctree)/$(src)

 xen/Kconfig                 |  4 ++--
 xen/Makefile                |  7 +++----
 xen/Rules.mk                |  9 ++++++---
 xen/arch/x86/arch.mk        |  2 +-
 xen/build.mk                |  4 ++--
 xen/common/Makefile         |  2 +-
 xen/common/libfdt/Makefile  |  2 +-
 xen/include/Makefile        | 14 +++++++-------
 xen/scripts/Kconfig.include |  2 +-
 xen/scripts/Makefile.clean  |  5 ++++-
 xen/xsm/flask/Makefile      | 10 +++++-----
 11 files changed, 33 insertions(+), 28 deletions(-)
xen/Kconfig +2 -2
index bcbd2758e5d3..ac9a638d372e 100644
@@ -14,14 +14,14 @@ config CC_IS_GCC
 
 config GCC_VERSION
 	int
-	default $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC))
+	default $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
 
 config CC_IS_CLANG
 	def_bool $(success,$(CC) --version | head -n 1 | grep -q clang)
 
 config CLANG_VERSION
 	int
-	default $(shell,$(BASEDIR)/scripts/clang-version.sh $(CC))
+	default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
 
 # -fvisibility=hidden reduces -fpic cost, if it's available
 config CC_HAS_VISIBILITY_ATTRIBUTE
xen/Makefile +3 -4
index 2a809d577fc3..318320e79c7d 100644
@@ -19,8 +19,7 @@ export PYTHON		?= $(PYTHON_INTERPRETER)
 
 export CHECKPOLICY	?= checkpolicy
 
-export BASEDIR := $(CURDIR)
-export XEN_ROOT := $(BASEDIR)/..
+export XEN_ROOT := $(CURDIR)/..
 
 abs_objtree := $(CURDIR)
 abs_srctree := $(CURDIR)
@@ -189,7 +188,7 @@ ifeq ($(TARGET_ARCH),x86)
 t1 = $(call as-insn,$(CC),".L0: .L1: .skip (.L1 - .L0)",,-no-integrated-as)
 
 # Check whether clang asm()-s support .include.
-t2 = $(call as-insn,$(CC) -I$(BASEDIR)/arch/x86/include,".include \"asm/asm-defns.h\"",,-no-integrated-as)
+t2 = $(call as-insn,$(CC) -I$(srctree)/arch/x86/include,".include \"asm/asm-defns.h\"",,-no-integrated-as)
 
 # Check whether clang keeps .macro-s between asm()-s:
 # https://bugs.llvm.org/show_bug.cgi?id=36110
@@ -329,7 +328,7 @@ ALL_OBJS-$(CONFIG_CRYPTO) += crypto/built_in.o
 
 ALL_LIBS-y                := lib/lib.a
 
-include $(BASEDIR)/arch/$(TARGET_ARCH)/arch.mk
+include $(srctree)/arch/$(TARGET_ARCH)/arch.mk
 
 export ALL_OBJS := $(ALL_OBJS-y)
 export ALL_LIBS := $(ALL_LIBS-y)
xen/Rules.mk +6 -3
index cd00f006ee8f..20dedce06cd8 100644
@@ -9,13 +9,16 @@ endif
 
 src := $(obj)
 
+# shortcut for $(srctree)/$(src)
+srcdir := $(srctree)/$(src)
+
 PHONY := __build
 __build:
 
 -include $(objtree)/include/config/auto.conf
 
 include $(XEN_ROOT)/Config.mk
-include $(BASEDIR)/scripts/Kbuild.include
+include $(srctree)/scripts/Kbuild.include
 
 # Initialise some variables
 obj-y :=
@@ -58,7 +61,7 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
 # binfile
 # use e.g. $(call if_changed,binfile,binary-file varname)
 quiet_cmd_binfile = BINFILE $@
-cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
+cmd_binfile = $(SHELL) $(srctree)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
 
 # Figure out what we need to build from the various variables
 # ===========================================================================
@@ -177,7 +180,7 @@ cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1))
 c_flags = -MMD -MP -MF $(depfile) $(XEN_CFLAGS)
 a_flags = -MMD -MP -MF $(depfile) $(XEN_AFLAGS)
 
-include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
+include $(srctree)/arch/$(TARGET_ARCH)/Rules.mk
 
 c_flags += $(_c_flags)
 a_flags += $(_c_flags)
xen/arch/x86/arch.mk +1 -1
index 1ba488d645c0..7cfc9fd3bb1c 100644
@@ -63,7 +63,7 @@ ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
 efi-check-o := arch/x86/efi/check.o
 
 # Check if the compiler supports the MS ABI.
-XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(efi-check-o:.o=.c) -o $(efi-check-o),y)
+XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(srctree)/$(efi-check-o:.o=.c) -o $(efi-check-o),y)
 
 # Check if the linker supports PE.
 EFI_LDFLAGS := $(patsubst -m%,-mi386pep,$(LDFLAGS)) --subsystem=10
xen/build.mk +2 -2
index c471312f98a3..65d8dbc13828 100644
@@ -26,9 +26,9 @@ define cmd_compile.h
 	    -e 's/@@version@@/$(XEN_VERSION)/g' \
 	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
 	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
-	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
+	    -e 's!@@changeset@@!$(shell $(srctree)/tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
 	    < $< > $(dot-target).tmp; \
-	sed -rf tools/process-banner.sed < .banner >> $(dot-target).tmp; \
+	sed -rf $(srctree)/tools/process-banner.sed < .banner >> $(dot-target).tmp; \
 	mv -f $(dot-target).tmp $@; \
     fi
 endef
xen/common/Makefile +1 -1
index 30641a737231..b1e076c30b81 100644
@@ -80,7 +80,7 @@ $(obj)/config.gz: $(CONF_FILE)
 
 $(obj)/config_data.o: $(obj)/config.gz
 
-$(obj)/config_data.S: $(BASEDIR)/tools/binfile FORCE
+$(obj)/config_data.S: $(srctree)/tools/binfile FORCE
 	$(call if_changed,binfile,$(obj)/config.gz xen_config_data)
 targets += config_data.S
 
xen/common/libfdt/Makefile +1 -1
index 6708af12e583..75aaefa2e37f 100644
@@ -6,7 +6,7 @@ OBJCOPYFLAGS := $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s))
 obj-y += libfdt.o
 nocov-y += libfdt.o
 
-CFLAGS-y += -I$(BASEDIR)/include/xen/libfdt/
+CFLAGS-y += -I$(srctree)/include/xen/libfdt/
 
 $(obj)/libfdt.o: $(obj)/libfdt-temp.o FORCE
 	$(call if_changed,objcopy)
xen/include/Makefile +7 -7
index a3c2511f5f60..5a2b4c9f65fa 100644
@@ -45,22 +45,22 @@ public-$(CONFIG_ARM) := $(wildcard $(src)/public/arch-arm/*.h $(src)/public/arch
 .PHONY: all
 all: $(addprefix $(obj)/,$(headers-y))
 
-$(obj)/compat/%.h: $(obj)/compat/%.i $(src)/Makefile $(BASEDIR)/tools/compat-build-header.py
-	$(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $(patsubst $(obj)/%,%,$@) >>[email protected]; \
+$(obj)/compat/%.h: $(obj)/compat/%.i $(src)/Makefile $(srctree)/tools/compat-build-header.py
+	$(PYTHON) $(srctree)/tools/compat-build-header.py <$< $(patsubst $(obj)/%,%,$@) >>[email protected]; \
 	mv -f [email protected] $@
 
 $(obj)/compat/%.i: $(obj)/compat/%.c $(src)/Makefile
 	$(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $<
 
-$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(src)/Makefile $(BASEDIR)/tools/compat-build-source.py
+$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(src)/Makefile $(srctree)/tools/compat-build-source.py
 	mkdir -p $(@D)
-	$(PYTHON) $(BASEDIR)/tools/compat-build-source.py $(src)/xlat.lst <$< >[email protected]
+	$(PYTHON) $(srctree)/tools/compat-build-source.py $(srcdir)/xlat.lst <$< >[email protected]
 	mv -f [email protected] $@
 
-$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(BASEDIR)/tools/get-fields.sh $(src)/Makefile
+$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(srctree)/tools/get-fields.sh $(src)/Makefile
 	export PYTHON=$(PYTHON); \
 	while read what name; do \
-		$(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $< || exit $$?; \
+		$(SHELL) $(srctree)/tools/get-fields.sh "$$what" compat_$$name $< || exit $$?; \
 	done <$(patsubst $(obj)/compat/%,$(obj)/compat/.xlat/%,$(basename $<)).lst >[email protected]
 	mv -f [email protected] $@
 
@@ -70,7 +70,7 @@ $(obj)/compat/.xlat/%.lst: $(src)/xlat.lst $(src)/Makefile
 	grep -v '^[[:blank:]]*#' $< | sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,[[:blank:]]+$*\.h[[:blank:]]*$$,,p' >[email protected]
 	$(call move-if-changed,[email protected],$@)
 
-xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:blank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(src)/xlat.lst | uniq)
+xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:blank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(srcdir)/xlat.lst | uniq)
 xlat-y := $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y))
 
 $(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) $(obj)/config/auto.conf $(src)/Makefile
xen/scripts/Kconfig.include +1 -1
index e1f13e17207e..389a690a127a 100644
@@ -40,4 +40,4 @@ $(error-if,$(failure,command -v $(CC)),compiler '$(CC)' not found)
 $(error-if,$(failure,command -v $(LD)),linker '$(LD)' not found)
 
 # gcc version including patch level
-gcc-version := $(shell,$(BASEDIR)/scripts/gcc-version.sh $(CC))
+gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh $(CC))
xen/scripts/Makefile.clean +4 -1
index 4eed31974509..53f7a76b3075 100644
@@ -5,9 +5,12 @@
 
 src := $(obj)
 
+# shortcut for $(srctree)/$(src)
+srcdir := $(srctree)/$(src)
+
 clean::
 
-include $(BASEDIR)/scripts/Kbuild.include
+include $(srctree)/scripts/Kbuild.include
 
 include $(src)/Makefile
 
xen/xsm/flask/Makefile +5 -5
index 4ac6fb8778ae..a99038cb5722 100644
@@ -8,8 +8,8 @@ CFLAGS-y += -I$(obj)/include
 
 AWK = awk
 
-FLASK_H_DEPEND := $(addprefix $(src)/policy/,security_classes initial_sids)
-AV_H_DEPEND = $(src)/policy/access_vectors
+FLASK_H_DEPEND := $(addprefix $(srcdir)/policy/,security_classes initial_sids)
+AV_H_DEPEND := $(srcdir)/policy/access_vectors
 
 FLASK_H_FILES := flask.h class_to_string.h initial_sid_to_string.h
 AV_H_FILES := av_perm_to_string.h av_permissions.h
@@ -18,14 +18,14 @@ ALL_H_FILES := $(addprefix include/,$(FLASK_H_FILES) $(AV_H_FILES))
 $(addprefix $(obj)/,$(obj-y)) $(obj)/ss/built_in.o: $(addprefix $(obj)/,$(ALL_H_FILES))
 extra-y += $(ALL_H_FILES)
 
-mkflask := $(src)/policy/mkflask.sh
+mkflask := $(srcdir)/policy/mkflask.sh
 quiet_cmd_mkflask = MKFLASK $@
 cmd_mkflask = $(SHELL) $(mkflask) $(AWK) $(obj)/include $(FLASK_H_DEPEND)
 
 $(addprefix $(obj)/%/,$(FLASK_H_FILES)): $(FLASK_H_DEPEND) $(mkflask) FORCE
 	$(call if_changed,mkflask)
 
-mkaccess := $(src)/policy/mkaccess_vector.sh
+mkaccess := $(srcdir)/policy/mkaccess_vector.sh
 quiet_cmd_mkaccess = MKACCESS VECTOR $@
 cmd_mkaccess = $(SHELL) $(mkaccess) $(AWK) $(obj)/include $(AV_H_DEPEND)
 
@@ -36,7 +36,7 @@ obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
 $(obj)/flask-policy.o: $(obj)/policy.bin
 
 $(obj)/flask-policy.S: BINFILE_FLAGS := -i
-$(obj)/flask-policy.S: $(BASEDIR)/tools/binfile FORCE
+$(obj)/flask-policy.S: $(srctree)/tools/binfile FORCE
 	$(call if_changed,binfile,$(obj)/policy.bin xsm_flask_init_policy)
 targets += flask-policy.S
 
Signature · 1 line
Anthony PERARD
Acked-by on v8 29/47
#73 lore raw

Re: [XEN PATCH v8 29/47] build: replace $(BASEDIR) and use $(srctree)

Quoted 11 lines · Anthony PERARD

$(srctree) is a better description for the source directory than $(BASEDIR) that has been used for both source and build directory (which where the same).

This adds $(srctree) to a few path where make's VPATH=$(srctree) won't apply. And replace $(BASEDIR) by $(srctree).

Introduce "$(srcdir)" as a shortcut for "$(srctree)/$(src)" as the later is used often enough.

One remark:

xen/scripts/Makefile.clean line 9

Quoted 8 lines
xen/scripts/Makefile.clean +2 -0
@@ -5,9 +5,12 @@
 
 src := $(obj)
 
+# shortcut for $(srctree)/$(src)
+srcdir := $(srctree)/$(src)

Might it make sense to generalize the comment to "# shortcuts" right away, in case further ones appear? There seems little reason to have the comment duplicate what the assignment actually does.

Jan

#74 lore raw

PATCH v8 30/47 build: rework "headers*.chk" prerequisite in include/

In reply to Anthony PERARD

Listing public headers when out-of-tree build are involved becomes more annoying where every path to every headers needs to start with "$(srctree)/$(src)", or $(wildcard ) will not work. This means more repetition. ( "$(srcdir)" is a shortcut for "$(srctree)/$(src)" )

This patch attempt to reduce the amount of duplication and make better use of make's meta programming capability. The filters are now listed in a variable and don't have to repeat the path to the headers files as this is added later as needed.

---

Notes:
v8:
- add prefix "public-" to newly introduced macros.
- make use of the new "$(srcdir)" shortcut.

 xen/include/Makefile | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
xen/include/Makefile +16 -5
index 5a2b4c9f65fa..6e80ef276fd9 100644
@@ -39,8 +39,8 @@ cppflags-$(CONFIG_X86)    += -m32
 
 endif
 
-public-$(CONFIG_X86) := $(wildcard $(src)/public/arch-x86/*.h $(src)/public/arch-x86/*/*.h)
-public-$(CONFIG_ARM) := $(wildcard $(src)/public/arch-arm/*.h $(src)/public/arch-arm/*/*.h)
+public-$(CONFIG_X86) := $(wildcard $(srcdir)/public/arch-x86/*.h $(srcdir)/public/arch-x86/*/*.h)
+public-$(CONFIG_ARM) := $(wildcard $(srcdir)/public/arch-arm/*.h $(srcdir)/public/arch-arm/*/*.h)
 
 .PHONY: all
 all: $(addprefix $(obj)/,$(headers-y))
@@ -81,10 +81,21 @@ ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
 
 all: $(obj)/headers.chk $(obj)/headers99.chk $(obj)/headers++.chk
 
-PUBLIC_HEADERS := $(filter-out $(src)/public/arch-% $(src)/public/dom0_ops.h, $(wildcard $(src)/public/*.h $(src)/public/*/*.h) $(public-y))
+public-hdrs-path := $(srcdir)/public
 
-PUBLIC_C99_HEADERS := $(src)/public/io/9pfs.h $(src)/public/io/pvcalls.h
-PUBLIC_ANSI_HEADERS := $(filter-out $(src)/public/%ctl.h $(src)/public/xsm/% $(src)/public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
+public-list-headers = $(wildcard $1/*.h $1/*/*.h)
+public-filter-headers = $(filter-out $(addprefix $(public-hdrs-path)/,$($1-filter)), $($1))
+
+public-c99-headers := io/9pfs.h io/pvcalls.h
+public-headers := $(call public-list-headers,$(public-hdrs-path)) $(public-y)
+public-ansi-headers := $(public-headers)
+
+public-headers-filter := dom0_ops.h arch-%
+public-ansi-headers-filter := %ctl.h xsm/% %hvm/save.h $(public-headers-filter) $(public-c99-headers)
+
+PUBLIC_HEADERS := $(call public-filter-headers,public-headers)
+PUBLIC_ANSI_HEADERS := $(call public-filter-headers,public-ansi-headers)
+PUBLIC_C99_HEADERS := $(addprefix $(public-hdrs-path)/, $(public-c99-headers))
 
 $(src)/public/io/9pfs.h-prereq := string
 $(src)/public/io/pvcalls.h-prereq := string
Signature · 1 line
Anthony PERARD
#75 lore raw

Re: [XEN PATCH v8 30/47] build: rework "headers*.chk" prerequisite in include/

Quoted 5 lines · Anthony PERARD
xen/include/Makefile +0 -1
@@ -81,10 +81,21 @@ ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
 
 all: $(obj)/headers.chk $(obj)/headers99.chk $(obj)/headers++.chk
 
-PUBLIC_HEADERS := $(filter-out $(src)/public/arch-% $(src)/public/dom0_ops.h, $(wildcard $(src)/public/*.h $(src)/public/*/*.h) $(public-y))

xen/include/Makefile ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) · line 91

Quoted 10 lines
xen/include/Makefile +7 -2
+public-hdrs-path := $(srcdir)/public
 
-PUBLIC_C99_HEADERS := $(src)/public/io/9pfs.h $(src)/public/io/pvcalls.h
-PUBLIC_ANSI_HEADERS := $(filter-out $(src)/public/%ctl.h $(src)/public/xsm/% $(src)/public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
+public-list-headers = $(wildcard $1/*.h $1/*/*.h)
+public-filter-headers = $(filter-out $(addprefix $(public-hdrs-path)/,$($1-filter)), $($1))
+
+public-c99-headers := io/9pfs.h io/pvcalls.h
+public-headers := $(call public-list-headers,$(public-hdrs-path)) $(public-y)
+public-ansi-headers := $(public-headers)

Personally I find it odd for public-c99-headers to be first in this group. Further down, in the upper-case counterparts, you have it at the end (still in context below).

xen/include/Makefile ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) · line 93

Quoted 1 line
xen/include/Makefile +1 -0
+public-headers-filter := dom0_ops.h arch-%

What is the criteria to be listed here vs ...

xen/include/Makefile ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) · line 94

Quoted 1 line
xen/include/Makefile +1 -0
+public-ansi-headers-filter := %ctl.h xsm/% %hvm/save.h $(public-headers-filter) $(public-c99-headers)

... outside of that macro's expansion here? There's no other use of the macro that I can spot, so its presence is puzzling me.

xen/include/Makefile ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) · line 98

Quoted 4 lines
xen/include/Makefile +4 -0
+
+PUBLIC_HEADERS := $(call public-filter-headers,public-headers)
+PUBLIC_ANSI_HEADERS := $(call public-filter-headers,public-ansi-headers)
+PUBLIC_C99_HEADERS := $(addprefix $(public-hdrs-path)/, $(public-c99-headers))

While benign right now, wouldn't it be more consistent if public-filter-headers was also applied in this last case? Or is there a reason not to?

Jan

#76 lore raw

Re: [XEN PATCH v8 30/47] build: rework "headers*.chk" prerequisite in include/

Quoted 21 lines · Jan Beulich
Quoted 5 lines · Anthony PERARD
xen/include/Makefile +0 -1
@@ -81,10 +81,21 @@ ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
 
 all: $(obj)/headers.chk $(obj)/headers99.chk $(obj)/headers++.chk
 
-PUBLIC_HEADERS := $(filter-out $(src)/public/arch-% $(src)/public/dom0_ops.h, $(wildcard $(src)/public/*.h $(src)/public/*/*.h) $(public-y))

xen/include/Makefile ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) · line 91

Quoted 10 lines
xen/include/Makefile +7 -2
+public-hdrs-path := $(srcdir)/public
 
-PUBLIC_C99_HEADERS := $(src)/public/io/9pfs.h $(src)/public/io/pvcalls.h
-PUBLIC_ANSI_HEADERS := $(filter-out $(src)/public/%ctl.h $(src)/public/xsm/% $(src)/public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
+public-list-headers = $(wildcard $1/*.h $1/*/*.h)
+public-filter-headers = $(filter-out $(addprefix $(public-hdrs-path)/,$($1-filter)), $($1))
+
+public-c99-headers := io/9pfs.h io/pvcalls.h
+public-headers := $(call public-list-headers,$(public-hdrs-path)) $(public-y)
+public-ansi-headers := $(public-headers)

Personally I find it odd for public-c99-headers to be first in this group. Further down, in the upper-case counterparts, you have it at the end (still in context below).

Quoted 8 lines

xen/include/Makefile ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) · line 93

Quoted 1 line
xen/include/Makefile +1 -0
+public-headers-filter := dom0_ops.h arch-%

What is the criteria to be listed here vs ...

xen/include/Makefile ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) · line 94

Quoted 1 line
xen/include/Makefile +1 -0
+public-ansi-headers-filter := %ctl.h xsm/% %hvm/save.h $(public-headers-filter) $(public-c99-headers)

... outside of that macro's expansion here? There's no other use of the macro that I can spot, so its presence is puzzling me.

The "%-filter" macro are used by the macro "public-filter-headers", which takes "$(%)" and filter-out "$(%-filter)".

Currently, PUBLIC_ANSI_HEADERS is PUBLIC_HEADERS with headers filtered-out.
And PUBLIC_HEADERS is public-y with headers filtered-out.

In my patch, I derive PUBLIC_ANSI_HEADERS from public-y, so I also need to use the filter used to generate PUBLIC_HEADERS. So $(public-headers-filter) is both used on its own and in the ansi-filter.

Quoted 7 lines

xen/include/Makefile ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) · line 98

Quoted 3 lines
xen/include/Makefile +3 -0
+PUBLIC_HEADERS := $(call public-filter-headers,public-headers)
+PUBLIC_ANSI_HEADERS := $(call public-filter-headers,public-ansi-headers)
+PUBLIC_C99_HEADERS := $(addprefix $(public-hdrs-path)/, $(public-c99-headers))

While benign right now, wouldn't it be more consistent if public-filter-headers was also applied in this last case? Or is there a reason not to?

It wouldn't work at the moment because $(public-c99-headers) aren't prefix with "$(public-hdrs-path)" like $(public-headers). This is because I'm using $(public-c99-headers) in $(public-ansi-headers-filter).

Maybe I should just had the prefix to the c99-headers and removing the prefix when using it in the filter, something like that:

    public-c99-headers := $(addprefix $(public-hdrs-path)/,io/9pfs.h io/pvcalls.h)
    public-ansi-headers-filter := %ctl.h xsm/% %hvm/save.h $(public-headers-filter) \
        $(patsubst $(public-hdrs-path)/%,%,$(public-c99-headers))

then I thin that would work:

    PUBLIC_C99_HEADERS := $(call public-filter-headers,public-c99-headers)

I could put an empty "public-c99-headers-filter :=" somewhere, just in case one is looking for it later.

Thanks,

Signature · 1 line
Anthony PERARD
#77 lore raw

PATCH v8 31/47 build: specify source tree in include/ for prerequisite

In reply to Anthony PERARD

When doing an out-of-tree build, and thus setting VPATH, GNU Make 3.81 on Ubuntu Trusty complains about Circular dependency of include/Makefile and include/xlat.lst and drop them. The build fails later due to headers malformed.

---

Notes:
v8:
- make use of the new "$(srcdir)" shortcut
- move the patch ahead of the problematic patch:
build: adding out-of-tree support to the xen build

 xen/include/Makefile | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
xen/include/Makefile +9 -9
index 6e80ef276fd9..f64bc293c7f4 100644
@@ -45,19 +45,19 @@ public-$(CONFIG_ARM) := $(wildcard $(srcdir)/public/arch-arm/*.h $(srcdir)/publi
 .PHONY: all
 all: $(addprefix $(obj)/,$(headers-y))
 
-$(obj)/compat/%.h: $(obj)/compat/%.i $(src)/Makefile $(srctree)/tools/compat-build-header.py
+$(obj)/compat/%.h: $(obj)/compat/%.i $(srcdir)/Makefile $(srctree)/tools/compat-build-header.py
 	$(PYTHON) $(srctree)/tools/compat-build-header.py <$< $(patsubst $(obj)/%,%,$@) >>[email protected]; \
 	mv -f [email protected] $@
 
-$(obj)/compat/%.i: $(obj)/compat/%.c $(src)/Makefile
+$(obj)/compat/%.i: $(obj)/compat/%.c $(srcdir)/Makefile
 	$(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $<
 
-$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(src)/Makefile $(srctree)/tools/compat-build-source.py
+$(obj)/compat/%.c: $(src)/public/%.h $(srcdir)/xlat.lst $(srcdir)/Makefile $(srctree)/tools/compat-build-source.py
 	mkdir -p $(@D)
 	$(PYTHON) $(srctree)/tools/compat-build-source.py $(srcdir)/xlat.lst <$< >[email protected]
 	mv -f [email protected] $@
 
-$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(srctree)/tools/get-fields.sh $(src)/Makefile
+$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(srctree)/tools/get-fields.sh $(srcdir)/Makefile
 	export PYTHON=$(PYTHON); \
 	while read what name; do \
 		$(SHELL) $(srctree)/tools/get-fields.sh "$$what" compat_$$name $< || exit $$?; \
@@ -65,7 +65,7 @@ $(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(srctree)/
 	mv -f [email protected] $@
 
 .PRECIOUS: $(obj)/compat/.xlat/%.lst
-$(obj)/compat/.xlat/%.lst: $(src)/xlat.lst $(src)/Makefile
+$(obj)/compat/.xlat/%.lst: $(srcdir)/xlat.lst $(srcdir)/Makefile
 	mkdir -p $(@D)
 	grep -v '^[[:blank:]]*#' $< | sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,[[:blank:]]+$*\.h[[:blank:]]*$$,,p' >[email protected]
 	$(call move-if-changed,[email protected],$@)
@@ -73,7 +73,7 @@ $(obj)/compat/.xlat/%.lst: $(src)/xlat.lst $(src)/Makefile
 xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:blank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(srcdir)/xlat.lst | uniq)
 xlat-y := $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y))
 
-$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) $(obj)/config/auto.conf $(src)/Makefile
+$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) $(obj)/config/auto.conf $(srcdir)/Makefile
 	cat $(filter %.h,$^) >[email protected]
 	mv -f [email protected] $@
 
@@ -100,7 +100,7 @@ PUBLIC_C99_HEADERS := $(addprefix $(public-hdrs-path)/, $(public-c99-headers))
 $(src)/public/io/9pfs.h-prereq := string
 $(src)/public/io/pvcalls.h-prereq := string
 
-$(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(src)/Makefile
+$(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(srcdir)/Makefile
 	for i in $(filter %.h,$^); do \
 	    $(CC) -x c -ansi -Wall -Werror -include stdint.h \
 	          -S -o /dev/null $$i || exit 1; \
@@ -108,7 +108,7 @@ $(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(src)/Makefile
 	done >[email protected]
 	mv [email protected] $@
 
-$(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(src)/Makefile
+$(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(srcdir)/Makefile
 	rm -f [email protected]
 	$(foreach i, $(filter %.h,$^),                                        \
 	    echo "#include "\"$(i)\"                                          \
@@ -118,7 +118,7 @@ $(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(src)/Makefile
 	    || exit $$?; echo $(i) >> [email protected];)
 	mv [email protected] $@
 
-$(obj)/headers++.chk: $(PUBLIC_HEADERS) $(src)/Makefile
+$(obj)/headers++.chk: $(PUBLIC_HEADERS) $(srcdir)/Makefile
 	rm -f [email protected]
 	if ! $(CXX) -v >/dev/null 2>&1; then                                  \
 	    touch [email protected];                                                     \
Signature · 1 line
Anthony PERARD
#78 lore raw

Re: [XEN PATCH v8 31/47] build: specify source tree in include/ for prerequisite

Quoted 4 lines · Anthony PERARD

When doing an out-of-tree build, and thus setting VPATH, GNU Make 3.81 on Ubuntu Trusty complains about Circular dependency of include/Makefile and include/xlat.lst and drop them. The build fails later due to headers malformed.

A circular dependency would mean that besides the expected dependency there is also one of include/Makefile on include/xlat.lst. Where is that? I'm not aware of anything include/Makefile depends on. Is there any dependency being introduced in this series, perhaps by way of new (generated) dependency files? It would be good to have a clear understanding of the issue - as you describe it, it could as well be a make flaw.

The adjustments themselves look okay to me, but of course they don't help readability.

Jan

#79 lore raw

Re: [XEN PATCH v8 31/47] build: specify source tree in include/ for prerequisite

Quoted 6 lines · Jan Beulich
Quoted 4 lines · Anthony PERARD

When doing an out-of-tree build, and thus setting VPATH, GNU Make 3.81 on Ubuntu Trusty complains about Circular dependency of include/Makefile and include/xlat.lst and drop them. The build fails later due to headers malformed.

Quoted 7 lines

A circular dependency would mean that besides the expected dependency there is also one of include/Makefile on include/xlat.lst. Where is that? I'm not aware of anything include/Makefile depends on. Is there any dependency being introduced in this series, perhaps by way of new (generated) dependency files? It would be good to have a clear understanding of the issue - as you describe it, it could as well be a make flaw.

I've got a bunch of:
make[2]: Circular include/compat/arch-x86_32.i <- include/Makefile dependency dropped.

Maybe the issue is with:
make[2]: Circular include/compat/.xlat/arch-x86/pmu.lst <- include/xlat.lst dependency dropped. make[2]: Circular include/compat/.xlat/arch-x86/pmu.lst <- include/Makefile dependency dropped.

with rule

     $(obj)/compat/.xlat/%.lst:  $(src)/xlat.lst $(src)/Makefile

at that mean %.lst have no prerequisite left, so $< is empty in "grep pattern $<" so there's nothing to grep.

But that doesn't happen every time.

I can't think of anything or find anything which would introduce a prerequisite for "xlat.lst".

The build seems to work if I only change this rule, to avoid make looking into VPATH to find $(src)/xlat.lst. Changing this to "$(srcdir)/xlat.lst" works. But of course, make still complain about circular dependencies on include/Makefile.

I think I've look for this issue online at the time, but I probably found the workaround rather than a bug report.

Cheers,

Signature · 1 line
Anthony PERARD
#80 lore raw

PATCH v8 32/47 build: shuffle main Makefile

In reply to Anthony PERARD

Reorganize a bit the Makefile ahead of patch "build: adding out-of-tree support to the xen build"

This should only be code movement without functional changes.

---

Notes:
v8:
- new patch

 xen/Makefile | 58 ++++++++++++++++++++++++++--------------------------
 1 file changed, 29 insertions(+), 29 deletions(-)
xen/Makefile +29 -29
index 318320e79c7d..bfc96562c5ec 100644
@@ -19,38 +19,11 @@ export PYTHON		?= $(PYTHON_INTERPRETER)
 
 export CHECKPOLICY	?= checkpolicy
 
-export XEN_ROOT := $(CURDIR)/..
-
-abs_objtree := $(CURDIR)
-abs_srctree := $(CURDIR)
-
-export abs_srctree abs_objtree
-
-srctree := .
-objtree := .
-export srctree objtree
-
 # Do not use make's built-in rules and variables
 MAKEFLAGS += -rR
 
 EFI_MOUNTPOINT ?= $(BOOT_DIR)/efi
 
-ARCH=$(XEN_TARGET_ARCH)
-SRCARCH=$(shell echo $(ARCH) | \
-          sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
-              -e s'/riscv.*/riscv/g')
-export ARCH SRCARCH
-
-# Don't break if the build process wasn't called from the top level
-# we need XEN_TARGET_ARCH to generate the proper config
-include $(XEN_ROOT)/Config.mk
-
-# Set ARCH/SUBARCH appropriately.
-export TARGET_SUBARCH  := $(XEN_TARGET_ARCH)
-export TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
-                            sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
-                                -e s'/riscv.*/riscv/g')
-
 # Allow someone to change their config file
 export KCONFIG_CONFIG ?= .config
 
@@ -64,8 +37,6 @@ default: build
 .PHONY: dist
 dist: install
 
-include scripts/Kbuild.include
-
 ifneq ($(root-make-done),y)
 # section to run before calling Rules.mk, but only once.
 
@@ -141,6 +112,17 @@ endif
 
 export quiet Q KBUILD_VERBOSE
 
+abs_objtree := $(CURDIR)
+abs_srctree := $(CURDIR)
+
+export abs_srctree abs_objtree
+
+srctree := .
+objtree := .
+export srctree objtree
+
+export XEN_ROOT := $(CURDIR)/..
+
 # To make sure we do not include .config for any of the *config targets
 # catch them early, and hand them over to tools/kconfig/Makefile
 
@@ -163,6 +145,24 @@ ifneq ($(filter %config,$(MAKECMDGOALS)),)
     config-build := y
 endif
 
+include scripts/Kbuild.include
+
+ARCH=$(XEN_TARGET_ARCH)
+SRCARCH=$(shell echo $(ARCH) | \
+          sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
+              -e s'/riscv.*/riscv/g')
+export ARCH SRCARCH
+
+# Don't break if the build process wasn't called from the top level
+# we need XEN_TARGET_ARCH to generate the proper config
+include $(XEN_ROOT)/Config.mk
+
+# Set ARCH/SUBARCH appropriately.
+export TARGET_SUBARCH  := $(XEN_TARGET_ARCH)
+export TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
+                            sed -e 's/x86.*/x86/' -e s'/arm\(32\|64\)/arm/g' \
+                                -e s'/riscv.*/riscv/g')
+
 export CONFIG_SHELL := $(SHELL)
 export YACC = $(if $(BISON),$(BISON),bison)
 export LEX = $(if $(FLEX),$(FLEX),flex)
Signature · 1 line
Anthony PERARD
#81 lore raw

Re: [XEN PATCH v8 32/47] build: shuffle main Makefile

Quoted 2 lines · Anthony PERARD

Reorganize a bit the Makefile ahead of patch "build: adding out-of-tree support to the xen build"

Without you saying so it's not clear why that's good of even necessary. Moving things around always has the potential of breaking subtle ordering requirements, so I'd prefer to see what good the movement does.

Jan

#82 lore raw

Re: [XEN PATCH v8 32/47] build: shuffle main Makefile

Quoted 8 lines · Jan Beulich
Quoted 2 lines · Anthony PERARD

Reorganize a bit the Makefile ahead of patch "build: adding out-of-tree support to the xen build"

Without you saying so it's not clear why that's good of even necessary. Moving things around always has the potential of breaking subtle ordering requirements, so I'd prefer to see what good the movement does.

Some explanation about why most of the code movement is needed:

In Kbuild, *srctree and *objtree are been set after setting $(quiet), $(Q), $(KBUILD_VERBOSE). We will do the same. Also, we need to set the $(*tree) variables only on first execution of Makefile, not in sub-make, the we need to move them. Been before or after $(KBUILD_VERBOSE) doesn't seems to matter, but they needs to be in the area, in "root-make-done" guard.

$(XEN_ROOT) as the same issue as $(*srctree), it will be set only after we know the value of $(abs_srctree).

"Kbuild.include" needs to be included after $(srctree) is set.

We can't include "Config.mk" without knowing $(XEN_ROOT), it needs to move.

We can't calculate without $(TARGET_*ARCH) without $(XEN_TARGET_ARCH) which is set if needed in "Config.mk".

$(ARCH) and $(SRCARCH) seems misplaced before the patch, Not moving them might mean wrong value might be exported if "Config.mk" isn't included. I think I have to investigate this one, and potentially produce a new patch.

So the code movement is just because we need to be careful when setting the different $(*tree) variables, and $(XEN_ROOT).

I'll add something like that to the commit message.

Cheers,

Signature · 1 line
Anthony PERARD
#83 lore raw

PATCH v8 33/47 build: adding out-of-tree support to the xen build

In reply to Anthony PERARD

This implement out-of-tree support, there's two ways to create an out-of-tree build tree (after that, make in that new directory works):
make O=build
mkdir build; cd build; make -f ../Makefile
also works with an absolute path for both.

This implementation only works if the source tree is clean, as we use VPATH.

This patch copies most new code with handling out-of-tree build from Linux v5.12.

---

Notes:
v8:
- replace script/mkmakefile by cmd_makefile like it's been done in Linux 5.13.
- fix GNU Make version, replace few 0.81 by 3.81.
- reorder include header path in CFLAGS ( -I ), to have the $(objtree) paths listed before the $(srctree) paths. This will be usefull later if we allow to build out-of-tree from a dirty source tree.
- make use of -iquote
- sometime, add -iquote path even when not necessary when building in-tree.
- extract code movement into a separate patch
- make use of the new "$(srcdir)" shortcut
- split command line in headers*.chk target into more lines

 xen/Makefile                 | 141 +++++++++++++++++++++++++++++++----
 xen/Rules.mk                 |  11 ++-
 xen/arch/x86/arch.mk         |   5 +-
 xen/arch/x86/boot/Makefile   |   6 ++
 xen/common/efi/efi_common.mk |   1 +
 xen/include/Makefile         |  11 ++-
 xen/test/livepatch/Makefile  |   2 +
 xen/xsm/flask/Makefile       |   3 +-
 xen/xsm/flask/ss/Makefile    |   1 +
 9 files changed, 161 insertions(+), 20 deletions(-)
xen/Makefile +128 -13
index bfc96562c5ec..995815e82235 100644
@@ -1,3 +1,7 @@
+# $(lastword,) for GNU Make older than 3.81
+lastword = $(word $(words $(1)),$(1))
+this-makefile := $(call lastword,$(MAKEFILE_LIST))
+
 # This is the correct place to edit the build version.
 # All other places this is stored (eg. compile.h) should be autogenerated.
 export XEN_VERSION       = 4
@@ -19,6 +23,13 @@ export PYTHON		?= $(PYTHON_INTERPRETER)
 
 export CHECKPOLICY	?= checkpolicy
 
+$(if $(filter __%, $(MAKECMDGOALS)), \
+    $(error targets prefixed with '__' are only for internal use))
+
+# That's our default target when none is given on the command line
+PHONY := __all
+__all:
+
 # Do not use make's built-in rules and variables
 MAKEFLAGS += -rR
 
@@ -31,9 +42,6 @@ export CC CXX LD
 
 export TARGET := xen
 
-.PHONY: default
-default: build
-
 .PHONY: dist
 dist: install
 
@@ -112,16 +120,88 @@ endif
 
 export quiet Q KBUILD_VERBOSE
 
+# $(realpath,) for GNU Make older than 3.81
+realpath = $(wildcard $(foreach file,$(1),$(shell cd -P $(dir $(file)) && echo "$$PWD/$(notdir $(file))")))
+
+ifeq ("$(origin O)", "command line")
+    KBUILD_OUTPUT := $(O)
+endif
+
+ifneq ($(KBUILD_OUTPUT),)
+# Make's built-in functions such as $(abspath ...), $(realpath ...) cannot
+# expand a shell special character '~'. We use a somewhat tedious way here.
+abs_objtree := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) && pwd)
+$(if $(abs_objtree),, \
+     $(error failed to create output directory "$(KBUILD_OUTPUT)"))
+
+# $(realpath ...) resolves symlinks
+abs_objtree := $(call realpath,$(abs_objtree))
+else
 abs_objtree := $(CURDIR)
-abs_srctree := $(CURDIR)
+endif
+
+ifeq ($(abs_objtree),$(CURDIR))
+# Suppress "Entering directory ..." unless we are changing the work directory.
+MAKEFLAGS += --no-print-directory
+else
+need-sub-make := 1
+endif
+
+abs_srctree := $(call realpath,$(dir $(this-makefile)))
+
+ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
+$(error source directory cannot contain spaces or colons)
+endif
+
+ifneq ($(abs_srctree),$(abs_objtree))
+# Look for make include files relative to root of kernel src
+#
+# This does not become effective immediately because MAKEFLAGS is re-parsed
+# once after the Makefile is read. We need to invoke sub-make.
+MAKEFLAGS += --include-dir=$(abs_srctree)
+need-sub-make := 1
+endif
 
 export abs_srctree abs_objtree
+export root-make-done := y
+
+ifeq ($(need-sub-make),1)
+
+PHONY += $(MAKECMDGOALS) __sub-make
+
+$(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make
+	@:
+
+# Invoke a second make in the output directory, passing relevant variables
+__sub-make:
+	$(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS)
+
+endif # need-sub-make
+endif # root-make-done
+
+# We process the rest of the Makefile if this is the final invocation of make
+ifeq ($(need-sub-make),)
+
+ifeq ($(abs_srctree),$(abs_objtree))
+    # building in the source tree
+    srctree := .
+    building_out_of_srctree :=
+else
+    ifeq ($(abs_srctree)/,$(dir $(abs_objtree)))
+        # building in a subdirectory of the source tree
+        srctree := ..
+    else
+        srctree := $(abs_srctree)
+    endif
+    building_out_of_srctree := 1
+endif
 
-srctree := .
 objtree := .
-export srctree objtree
+VPATH := $(srctree)
+
+export building_out_of_srctree srctree objtree VPATH
 
-export XEN_ROOT := $(CURDIR)/..
+export XEN_ROOT := $(abs_srctree)/..
 
 # To make sure we do not include .config for any of the *config targets
 # catch them early, and hand them over to tools/kconfig/Makefile
@@ -204,9 +284,6 @@ endif
 
 export XEN_HAS_CHECKPOLICY := $(call success,$(CHECKPOLICY) -h 2>&1 | grep -q xen)
 
-export root-make-done := y
-endif # root-make-done
-
 # ===========================================================================
 # Rules shared between *config targets and build targets
 
@@ -214,6 +291,37 @@ PHONY += tools_fixdep
 tools_fixdep:
 	$(Q)$(MAKE) $(build)=tools tools/fixdep
 
+PHONY += outputmakefile
+# Before starting out-of-tree build, make sure the source tree is clean.
+# outputmakefile generates a Makefile in the output directory, if using a
+# separate output directory. This allows convenient use of make in the
+# output directory.
+# At the same time when output Makefile generated, generate .gitignore to
+# ignore whole output directory
+
+quiet_cmd_makefile = GEN     Makefile
+cmd_makefile = { \
+    echo "\# Automatically generated by $(srctree)/Makefile: don't edit"; \
+    echo "include $(srctree)/Makefile"; \
+    } > Makefile
+
+outputmakefile:
+ifdef building_out_of_srctree
+	$(Q)if [ -f $(srctree)/.config -o \
+		 -d $(srctree)/include/config -o \
+		 -d $(srctree)/include/generated ]; then \
+		echo >&2 "***"; \
+		echo >&2 "*** The source tree is not clean, please run 'make$(if $(findstring command line, $(origin XEN_TARGET_ARCH)), XEN_TARGET_ARCH=$(XEN_TARGET_ARCH)) distclean'"; \
+		echo >&2 "*** in $(abs_srctree)";\
+		echo >&2 "***"; \
+		false; \
+	fi
+	$(Q)ln -fsn $(srctree) source
+	$(call cmd,makefile)
+	$(Q)test -e .gitignore || \
+	{ echo "# this is build directory, ignore it"; echo "*"; } > .gitignore
+endif
+
 ifeq ($(config-build),y)
 # ===========================================================================
 # *config targets only - make sure prerequisites are updated, and descend
@@ -229,13 +337,13 @@ filechk_kconfig_allconfig = \
 .allconfig.tmp: FORCE
 	set -e; { $(call filechk_kconfig_allconfig); } > $@
 
-config: tools_fixdep FORCE
+config: tools_fixdep outputmakefile FORCE
 	$(Q)$(MAKE) $(build)=tools/kconfig $@
 
 # Config.mk tries to include .config file, don't try to remake it
 %/.config: ;
 
-%config: .allconfig.tmp tools_fixdep FORCE
+%config: .allconfig.tmp tools_fixdep outputmakefile FORCE
 	$(Q)$(MAKE) $(build)=tools/kconfig KCONFIG_ALLCONFIG=$< $@
 
 else # !config-build
@@ -315,6 +423,10 @@ CFLAGS += -flto
 LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so
 endif
 
+ifdef building_out_of_srctree
+    CFLAGS += -I$(objtree)/include
+    CFLAGS += -I$(objtree)/arch/$(TARGET_ARCH)/include
+endif
 CFLAGS += -I$(srctree)/include
 CFLAGS += -I$(srctree)/arch/$(TARGET_ARCH)/include
 
@@ -341,6 +453,8 @@ export CFLAGS_UBSAN
 
 endif # need-config
 
+__all: build
+
 main-targets := build install uninstall clean distclean MAP
 .PHONY: $(main-targets)
 ifneq ($(XEN_TARGET_ARCH),x86_32)
@@ -443,7 +557,7 @@ $(TARGET).gz: $(TARGET)
 	gzip -n -f -9 < $< > [email protected]
 	mv [email protected] $@
 
-$(TARGET): FORCE
+$(TARGET): outputmakefile FORCE
 	$(Q)$(MAKE) $(build)=tools
 	$(Q)$(MAKE) $(build)=. include/xen/compile.h
 	$(Q)$(MAKE) $(build)=include all
@@ -513,6 +627,7 @@ cloc:
 	done | cloc --list-file=-
 
 endif #config-build
+endif # need-sub-make
 
 PHONY += FORCE
 FORCE:
xen/Rules.mk +10 -1
index 20dedce06cd8..73d5b82ab2e7 100644
@@ -37,7 +37,7 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \
                          $(foreach r,rel rel.ro,data.$(r).local)
 
 # The filename build.mk has precedence over Makefile
-include $(firstword $(wildcard $(src)/build.mk) $(src)/Makefile)
+include $(firstword $(wildcard $(srcdir)/build.mk) $(srcdir)/Makefile)
 
 # Linking
 # ---------------------------------------------------------------------------
@@ -328,6 +328,15 @@ existing-targets := $(wildcard $(sort $(targets)))
 
 -include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
 
+# Create directories for object files if they do not exist
+obj-dirs := $(sort $(patsubst %/,%, $(dir $(targets))))
+# If targets exist, their directories apparently exist. Skip mkdir.
+existing-dirs := $(sort $(patsubst %/,%, $(dir $(existing-targets))))
+obj-dirs := $(strip $(filter-out $(existing-dirs), $(obj-dirs)))
+ifneq ($(obj-dirs),)
+$(shell mkdir -p $(obj-dirs))
+endif
+
 # 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/x86/arch.mk +4 -1
index 7cfc9fd3bb1c..554ac341522c 100644
@@ -62,6 +62,9 @@ ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
 
 efi-check-o := arch/x86/efi/check.o
 
+# Create the directory for out-of-tree build
+$(shell mkdir -p $(dir $(efi-check-o)))
+
 # Check if the compiler supports the MS ABI.
 XEN_BUILD_EFI := $(call if-success,$(CC) $(CFLAGS) -c $(srctree)/$(efi-check-o:.o=.c) -o $(efi-check-o),y)
 
@@ -101,6 +104,6 @@ export EFI_LDFLAGS
 endif
 
 # Set up the assembler include path properly for older toolchains.
-CFLAGS += -Wa,-I$(srctree)/include
+CFLAGS += -Wa,-I$(objtree)/include -Wa,-I$(srctree)/include
 
 ALL_OBJS-y := arch/x86/boot/built_in.o arch/x86/efi/built_in.o $(ALL_OBJS-y)
xen/arch/x86/boot/Makefile +6 -0
index 5395aae5d57e..04ee9da83333 100644
@@ -7,6 +7,9 @@ targets += $(head-objs:.S=.o)
 
 head-objs := $(addprefix $(obj)/, $(head-objs))
 
+ifdef building_out_of_srctree
+$(obj)/head.o: CFLAGS-y += -iquote $(obj)
+endif
 $(obj)/head.o: $(head-objs)
 
 $(head-objs:.S=.lnk): LDFLAGS_DIRECT := $(subst x86_64,i386,$(LDFLAGS_DIRECT))
@@ -14,6 +17,9 @@ $(head-objs:.S=.lnk): LDFLAGS_DIRECT := $(subst x86_64,i386,$(LDFLAGS_DIRECT))
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_COMMON_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float
+ifdef building_out_of_srctree
+CFLAGS_x86_32 += -I$(objtree)/include
+endif
 CFLAGS_x86_32 += -I$(srctree)/include
 
 # override for 32bit binaries
xen/common/efi/efi_common.mk +1 -0
index d2845fd6b3c8..d059bb30afa5 100644
@@ -3,6 +3,7 @@ EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
 CFLAGS-y += -fshort-wchar
 CFLAGS-y += -iquote $(srctree)/common/efi
+CFLAGS-y += -iquote $(srcdir)
 
 $(obj)/%.c: $(abs_srctree)/common/efi/%.c FORCE
 	$(Q)ln -nfs $< $@
xen/include/Makefile +7 -4
index f64bc293c7f4..a3977a8bfccd 100644
@@ -113,7 +113,8 @@ $(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(srcdir)/Makefile
 	$(foreach i, $(filter %.h,$^),                                        \
 	    echo "#include "\"$(i)\"                                          \
 	    | $(CC) -x c -std=c99 -Wall -Werror                               \
-	      -include stdint.h $(foreach j, $($(i)-prereq), -include $(j).h) \
+	      -include stdint.h                                               \
+	      $(foreach j, $($(patsubst $(srctree)/%,%,$i)-prereq), -include $(j).h) \
 	      -S -o /dev/null -                                               \
 	    || exit $$?; echo $(i) >> [email protected];)
 	mv [email protected] $@
@@ -127,8 +128,9 @@ $(obj)/headers++.chk: $(PUBLIC_HEADERS) $(srcdir)/Makefile
 	$(foreach i, $(filter %.h,$^),                                        \
 	    echo "#include "\"$(i)\"                                          \
 	    | $(CXX) -x c++ -std=gnu++98 -Wall -Werror -D__XEN_TOOLS__        \
-	      -include stdint.h -include $(src)/public/xen.h                  \
-	      $(foreach j, $($(i)-prereq), -include c$(j)) -S -o /dev/null -  \
+	      -include stdint.h -include $(srcdir)/public/xen.h               \
+	      $(foreach j, $($(patsubst $(srctree)/%,%,$i)-prereq), -include c$(j)) \
+	      -S -o /dev/null -                                               \
 	    || exit $$?; echo $(i) >> [email protected];)
 	mv [email protected] $@
 
@@ -137,7 +139,8 @@ endif
 ifeq ($(XEN_TARGET_ARCH),x86_64)
 .PHONY: lib-x86-all
 lib-x86-all:
-	$(MAKE) -C $(obj)/xen/lib/x86 all
+	@mkdir -p $(obj)/xen/lib/x86
+	$(MAKE) -C $(obj)/xen/lib/x86 -f $(abs_srctree)/$(src)/xen/lib/x86/Makefile all
 
 all: lib-x86-all
 endif
xen/test/livepatch/Makefile +2 -0
index ddb07371315e..c258ab0b5940 100644
@@ -11,6 +11,8 @@ endif
 CODE_ADDR=$(shell nm --defined $(1) | grep $(2) | awk '{print "0x"$$1}')
 CODE_SZ=$(shell nm --defined -S $(1) | grep $(2) | awk '{ print "0x"$$2}')
 
+CFLAGS-y += -iquote $(obj)
+
 extra-y += xen_hello_world.livepatch
 xen_hello_world-objs := xen_hello_world_func.o xen_hello_world.o note.o xen_note.o modinfo.o
 $(obj)/xen_hello_world.o: $(obj)/config.h
xen/xsm/flask/Makefile +2 -1
index a99038cb5722..d25312f4fa1c 100644
@@ -4,7 +4,8 @@ obj-y += flask_op.o
 
 obj-y += ss/
 
-CFLAGS-y += -I$(obj)/include
+CFLAGS-y += -iquote $(obj)/include
+CFLAGS-y += -I$(srcdir)/include
 
 AWK = awk
 
xen/xsm/flask/ss/Makefile +1 -0
index aba1339f3808..ffe92ec19ed6 100644
@@ -8,4 +8,5 @@ obj-y += services.o
 obj-y += conditional.o
 obj-y += mls.o
 
+CFLAGS-y += -iquote $(objtree)/xsm/flask/include
 CFLAGS-y += -I$(srctree)/xsm/flask/include
Signature · 1 line
Anthony PERARD
Acked-by on v8 33/47
#84 lore raw

Re: [XEN PATCH v8 33/47] build: adding out-of-tree support to the xen build

Quoted 7 lines · Anthony PERARD

This implement out-of-tree support, there's two ways to create an out-of-tree build tree (after that, make in that new directory works):
make O=build
mkdir build; cd build; make -f ../Makefile
also works with an absolute path for both.

Quoted 7 lines

This implementation only works if the source tree is clean, as we use VPATH.

This patch copies most new code with handling out-of-tree build from Linux v5.12.

#85 lore raw

PATCH v8 34/47 build: add %.E targets

In reply to Anthony PERARD

I guess it's easier to remember that %.E does "$(CC) -E" or "$(CPP)".

---
 xen/Makefile | 4 ++--
 xen/Rules.mk | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
xen/Makefile +2 -2
index 995815e82235..e39a6f82859a 100644
@@ -609,10 +609,10 @@ cscope:
 _MAP:
 	$(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map
 
-%.o %.i %.s: %.c tools_fixdep FORCE
+%.o %.i %.s %.E: %.c tools_fixdep FORCE
 	$(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
-%.o %.s: %.S tools_fixdep FORCE
+%.o %.s %.E: %.S tools_fixdep FORCE
 	$(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
 %/: tools_fixdep FORCE
xen/Rules.mk +5 -0
index 73d5b82ab2e7..745d892d0707 100644
@@ -287,6 +287,11 @@ $(obj)/%.s: $(src)/%.c FORCE
 $(obj)/%.s: $(src)/%.S FORCE
 	$(call if_changed_dep,cpp_s_S)
 
+$(obj)/%.E: $(src)/%.c FORCE
+	$(call if_changed_dep,cpp_i_c)
+$(obj)/%.E: $(src)/%.S FORCE
+	$(call if_changed_dep,cpp_s_S)
+
 # Linker scripts, .lds.S -> .lds
 quiet_cmd_cpp_lds_S = LDS     $@
 cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -DLINKER_SCRIPT -MQ $@ -o $@ $<
Signature · 1 line
Anthony PERARD
#86 lore raw

Re: [XEN PATCH v8 34/47] build: add %.E targets

Quoted 14 lines · Anthony PERARD

I guess it's easier to remember that %.E does "$(CC) -E" or "$(CPP)".

---
 xen/Makefile | 4 ++--
 xen/Rules.mk | 5 +++++
 2 files changed, 7 insertions(+), 2 deletions(-)
xen/Makefile +0 -0
index 995815e82235..e39a6f82859a 100644

xen/Makefile cscope: · line 613

Quoted 6 lines
xen/Makefile +1 -1
@@ -609,10 +609,10 @@ cscope:
 _MAP:
 	$(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map
 
-%.o %.i %.s: %.c tools_fixdep FORCE
+%.o %.i %.s %.E: %.c tools_fixdep FORCE
 	$(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F)

So what I hadn't realised when asking was that Linux calls this .i and we've already got support for what I wanted.  Sorry :)

Thus, I suspect we probably don't want to take an extra %.E alias to the existing %.i, although...

Quoted 11 lines
xen/Makefile +1 -1
-%.o %.s: %.S tools_fixdep FORCE
+%.o %.s %.E: %.S tools_fixdep FORCE
 	$(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
 %/: tools_fixdep FORCE
xen/Rules.mk +0 -0
index 73d5b82ab2e7..745d892d0707 100644

xen/Rules.mk $(obj)/%.s: $(src)/%.c FORCE · line 293

Quoted 7 lines
xen/Rules.mk +4 -0
@@ -287,6 +287,11 @@ $(obj)/%.s: $(src)/%.c FORCE
 $(obj)/%.s: $(src)/%.S FORCE
 	$(call if_changed_dep,cpp_s_S)
 
+$(obj)/%.E: $(src)/%.c FORCE
+	$(call if_changed_dep,cpp_i_c)
+$(obj)/%.E: $(src)/%.S FORCE
+	$(call if_changed_dep,cpp_s_S)

... I don't currently see support for %.i from %.S in the tree.  That one probably would be useful to introduce.

~Andrew

Quoted 4 lines
xen/Rules.mk +1 -0
+
 # Linker scripts, .lds.S -> .lds
 quiet_cmd_cpp_lds_S = LDS     $@
 cmd_cpp_lds_S = $(CPP) -P $(call cpp_flags,$(a_flags)) -DLINKER_SCRIPT -MQ $@ -o $@ $<
#87 lore raw

Re: [XEN PATCH v8 34/47] build: add %.E targets

Quoted 17 lines · Andrew Cooper
Quoted 5 lines · Anthony PERARD

I guess it's easier to remember that %.E does "$(CC) -E" or "$(CPP)".

-%.o %.i %.s: %.c tools_fixdep FORCE
+%.o %.i %.s %.E: %.c tools_fixdep FORCE
$(Q)$(MAKE) $(build)=$(*D) $(*D)/$(@F)

So what I hadn't realised when asking was that Linux calls this .i and we've already got support for what I wanted.  Sorry :)

Thus, I suspect we probably don't want to take an extra %.E alias to the existing %.i, although...

Quoted 3 lines

-%.o %.s: %.S tools_fixdep FORCE
+%.o %.s %.E: %.S tools_fixdep FORCE

Quoted 7 lines

xen/Rules.mk $(obj)/%.s: $(src)/%.c FORCE · line 293

Quoted 4 lines

+$(obj)/%.E: $(src)/%.c FORCE

xen/Rules.mk +3 -0
+	$(call if_changed_dep,cpp_i_c)
+$(obj)/%.E: $(src)/%.S FORCE
+	$(call if_changed_dep,cpp_s_S)

... I don't currently see support for %.i from %.S in the tree.  That one probably would be useful to introduce.

It's %.s for %.S, easy ;-)

Yep, %.s may run gcc -S or gcc -E.
And %.i may run gcc -E or may not run at all.

It seems that Linux have the same rules.

So, I guess to run gcc -E, one have to run make dir/target.i || make dir/target.s currently, :-).

Another thing, %.s:%.S was broken for a while, and no one complained.

Cheers,

Signature · 1 line
Anthony PERARD
#89 lore raw

PATCH v8 35/47 RFC, no-VPATH: Kconfig: tell where Kconfig files are

In reply to Anthony PERARD

From: Anthony PERARD <[email protected]>

deps_config is the list of all Kconfig files, we need to say that they are in the source tree, or make isn't going to find them without VPATH and will try to rebuild 'syncconfig' over and over again.

---
 xen/tools/kconfig/confdata.c | 1 +
 1 file changed, 1 insertion(+)
xen/tools/kconfig/confdata.c +1 -0
index a69250c91355..4f9139d055be 100644
@@ -971,6 +971,7 @@ static int conf_write_dep(const char *name)
 		else
 			fprintf(out, "\t%s\n", file->name);
 	}
+	fprintf(out, "deps_config := $(addprefix $(srctree)/, $(deps_config))\n");
 	fprintf(out, "\n%s: \\\n"
 		     "\t$(deps_config)\n\n", conf_get_autoconfig_name());
 
Signature · 1 line
Anthony PERARD
#90 lore raw

PATCH v8 36/47 RFC, no-VPATH: Kconfig: only ready auto.conf from objtree

In reply to Anthony PERARD

From: Anthony PERARD <[email protected]>

zconf_fopen() will open file in $srctree if the file isn't in $objtree. This is an issue for "auto.conf" as it could be in the source tree if it is dirty. With "auto.conf" read from the source tree, kconfig will not properly set the file associated with a CONFIG_* properly in "include/config/" and instead only touch the files that correspond to new CONFIG_* option that were not set in the "auto.conf" found in the source tree.

That might not be an issue, but it is probably better to have a populated "include/config/" directory in sync with "include/config/auto.conf".

The second that read from conf_get_configname() would read ".config" from the source directory which is also not wanted in Xen.

---
 xen/tools/kconfig/confdata.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
xen/tools/kconfig/confdata.c +7 -2
index 4f9139d055be..805d4c3e5636 100644
@@ -357,12 +357,17 @@ int conf_read_simple(const char *name, int def)
 	int i, def_flags;
 
 	if (name) {
-		in = zconf_fopen(name);
+		if (def == S_DEF_AUTO) {
+			/* only open include/config/auto.conf in objtree */
+			in = fopen(name, "r");
+		} else {
+			in = zconf_fopen(name);
+		}
 	} else {
 		struct property *prop;
 
 		name = conf_get_configname();
-		in = zconf_fopen(name);
+		in = fopen(name, "r");
 		if (in)
 			goto load;
 		sym_add_change_count(1);
Signature · 1 line
Anthony PERARD
#91 lore raw

Re: [XEN PATCH v8 36/47] RFC, no-VPATH: Kconfig: only ready auto.conf from objtree

Quoted 9 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>

zconf_fopen() will open file in $srctree if the file isn't in $objtree. This is an issue for "auto.conf" as it could be in the source tree if it is dirty. With "auto.conf" read from the source tree, kconfig will not properly set the file associated with a CONFIG_* properly in "include/config/" and instead only touch the files that correspond to new CONFIG_* option that were not set in the "auto.conf" found in the source tree.

Do we really mean to support mixing in-tree and out-of-tree builds from one source tree? Without such mixing, iiuc there would be no such problem.

Jan

#92 lore raw

Re: [XEN PATCH v8 36/47] RFC, no-VPATH: Kconfig: only ready auto.conf from objtree

Quoted 11 lines · Jan Beulich
Quoted 9 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>

zconf_fopen() will open file in $srctree if the file isn't in $objtree. This is an issue for "auto.conf" as it could be in the source tree if it is dirty. With "auto.conf" read from the source tree, kconfig will not properly set the file associated with a CONFIG_* properly in "include/config/" and instead only touch the files that correspond to new CONFIG_* option that were not set in the "auto.conf" found in the source tree.

Quoted 3 lines

Do we really mean to support mixing in-tree and out-of-tree builds from one source tree? Without such mixing, iiuc there would be no such problem.

Could you read and reply to the cover letter instead? The second paragraph of the v8 changelog speaks about this. I would rather have a discussion about this on the cover letter thread than in a patch.

Thanks,

Signature · 1 line
Anthony PERARD
#93 lore raw

PATCH v8 37/47 RFC, no-VPATH: build: remove --include-dir option from MAKEFLAGS

In reply to Anthony PERARD

From: Anthony PERARD <[email protected]>

File "include/config/auto.conf" and "include/config/auto.conf.cmd" should be included from the build tree even if they are present in the source tree. Avoiding to use make's command line option --include-dir will have make include the right "auto.conf" file. But that mean we now need to specify $(srctree) for all other Makefile we include.

---
 xen/Makefile               | 11 +----------
 xen/Rules.mk               |  2 +-
 xen/common/libfdt/Makefile |  2 +-
 xen/scripts/Makefile.clean |  2 +-
 4 files changed, 4 insertions(+), 13 deletions(-)
xen/Makefile +1 -10
index e39a6f82859a..fbce0f6771fb 100644
@@ -153,15 +153,6 @@ ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
 $(error source directory cannot contain spaces or colons)
 endif
 
-ifneq ($(abs_srctree),$(abs_objtree))
-# Look for make include files relative to root of kernel src
-#
-# This does not become effective immediately because MAKEFLAGS is re-parsed
-# once after the Makefile is read. We need to invoke sub-make.
-MAKEFLAGS += --include-dir=$(abs_srctree)
-need-sub-make := 1
-endif
-
 export abs_srctree abs_objtree
 export root-make-done := y
 
@@ -225,7 +216,7 @@ ifneq ($(filter %config,$(MAKECMDGOALS)),)
     config-build := y
 endif
 
-include scripts/Kbuild.include
+include $(srctree)/scripts/Kbuild.include
 
 ARCH=$(XEN_TARGET_ARCH)
 SRCARCH=$(shell echo $(ARCH) | \
xen/Rules.mk +1 -1
index 745d892d0707..45d2b72158b8 100644
@@ -104,7 +104,7 @@ noubsan-y       := $(addprefix $(obj)/,$(noubsan-y))
 # $(sort ...) is used here to remove duplicated words and excessive spaces.
 hostprogs-y := $(sort $(hostprogs-y))
 ifneq ($(hostprogs-y),)
-include scripts/Makefile.host
+include $(srctree)/scripts/Makefile.host
 endif
 
 # subdir-builtin may contain duplications. Use $(sort ...)
xen/common/libfdt/Makefile +1 -1
index 75aaefa2e37f..8d484063753b 100644
@@ -1,4 +1,4 @@
-include $(src)/Makefile.libfdt
+include $(srcdir)/Makefile.libfdt
 
 SECTIONS := text data $(SPECIAL_DATA_SECTIONS)
 OBJCOPYFLAGS := $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s))
xen/scripts/Makefile.clean +1 -1
index 53f7a76b3075..fa5f332e49a0 100644
@@ -12,7 +12,7 @@ clean::
 
 include $(srctree)/scripts/Kbuild.include
 
-include $(src)/Makefile
+include $(srcdir)/Makefile
 
 # Figure out what we need to clean from the various variables
 # ==========================================================================
Signature · 1 line
Anthony PERARD
#94 lore raw

PATCH v8 38/47 WIP, no-VPATH: rework Makefile.host

In reply to Anthony PERARD

From: Anthony PERARD <[email protected]>

Allow to build 'defconfig' target without VPATH in out-of-tree build

---
 xen/scripts/Makefile.host  | 34 +++++++++++++++++++++++++---------
 xen/tools/kconfig/Makefile | 12 +++++++++---
 2 files changed, 34 insertions(+), 12 deletions(-)
xen/scripts/Makefile.host +25 -9
index d6c358095ee8..d083c6dbca76 100644
@@ -8,7 +8,7 @@ target-stem = $(basename $(patsubst $(obj)/%,%,$@))
 quiet_cmd_flex = LEX     $@
       cmd_flex = $(LEX) -o$@ -L $<
 
-$(obj)/%.lex.c: $(src)/%.l FORCE
+$(obj)/%.lex.c: $(srctree)/$(src)/%.l FORCE
 	$(call if_changed,flex)
 
 # YACC
@@ -16,7 +16,7 @@ $(obj)/%.lex.c: $(src)/%.l FORCE
 quiet_cmd_bison = YACC    $(basename $@).[ch]
       cmd_bison = $(YACC) -o $(basename $@).c --defines=$(basename $@).h -t -l $<
 
-$(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE
+$(obj)/%.tab.c $(obj)/%.tab.h: $(srctree)/$(src)/%.y FORCE
 	$(call if_changed,bison)
 
 # ==========================================================================
@@ -56,6 +56,11 @@ host-cmulti	:= $(foreach m,$(__hostprogs),\
 
 # Object (.o) files compiled from .c files
 host-cobjs	:= $(sort $(foreach m,$(__hostprogs),$($(m)-objs)))
+# from generated .c files
+host-cobjs-generated	:= $(sort $(foreach m,$(__hostprogs),$($(m)-objs-generated)))
+ifndef building_out_of_srctree
+host-cobjs += $(host-cobjs-generated)
+endif
 
 # C++ code
 # C++ executables compiled from at least one .cc file
@@ -72,6 +77,9 @@ host-cxxshobjs	:= $(sort $(foreach m,$(host-cxxshlib),$($(m:.so=-objs))))
 host-csingle	:= $(addprefix $(obj)/,$(host-csingle))
 host-cmulti	:= $(addprefix $(obj)/,$(host-cmulti))
 host-cobjs	:= $(addprefix $(obj)/,$(host-cobjs))
+ifdef building_out_of_srctree
+host-cobjs-generated	:= $(addprefix $(obj)/,$(host-cobjs-generated))
+endif
 host-cxxmulti	:= $(addprefix $(obj)/,$(host-cxxmulti))
 host-cxxobjs	:= $(addprefix $(obj)/,$(host-cxxobjs))
 host-cshlib	:= $(addprefix $(obj)/,$(host-cshlib))
@@ -104,25 +112,30 @@ hostcxx_flags  = -Wp,-MD,$(depfile) $(_hostcxx_flags)
 quiet_cmd_host-csingle 	= HOSTCC  $@
       cmd_host-csingle	= $(HOSTCC) $(hostc_flags) $(HOSTLDFLAGS) -o $@ $< \
 		$(HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem))
-$(host-csingle): $(obj)/%: $(src)/%.c FORCE
+$(host-csingle): $(obj)/%: $(srctree)/$(src)/%.c FORCE
 	$(call if_changed_dep,host-csingle)
 
 # Link an executable based on list of .o files, all plain c
 # host-cmulti -> executable
 quiet_cmd_host-cmulti	= HOSTLD  $@
       cmd_host-cmulti	= $(HOSTCC) $(HOSTLDFLAGS) -o $@ \
-			  $(addprefix $(obj)/, $($(target-stem)-objs)) \
+			  $(foreach o,objs objs-generated, \
+			  $(addprefix $(obj)/, $($(target-stem)-$(o)))) \
 			  $(HOSTLDLIBS) $(HOSTLDLIBS_$(target-stem))
 $(host-cmulti): FORCE
 	$(call if_changed,host-cmulti)
-$(call multi-depend, $(host-cmulti), , -objs)
+$(call multi-depend, $(host-cmulti), , -objs -objs-generated)
 
 # Create .o file from a single .c file
 # host-cobjs -> .o
 quiet_cmd_host-cobjs	= HOSTCC  $@
       cmd_host-cobjs	= $(HOSTCC) $(hostc_flags) -c -o $@ $<
-$(host-cobjs): $(obj)/%.o: $(src)/%.c FORCE
+$(host-cobjs): $(obj)/%.o: $(srctree)/$(src)/%.c FORCE
 	$(call if_changed_dep,host-cobjs)
+ifdef building_out_of_srctree
+$(host-cobjs-generated): $(obj)/%.o: $(obj)/%.c FORCE
+	$(call if_changed_dep,host-cobjs)
+endif
 
 # Link an executable based on list of .o files, a mixture of .c and .cc
 # host-cxxmulti -> executable
@@ -138,14 +151,14 @@ $(call multi-depend, $(host-cxxmulti), , -objs -cxxobjs)
 # Create .o file from a single .cc (C++) file
 quiet_cmd_host-cxxobjs	= HOSTCXX $@
       cmd_host-cxxobjs	= $(HOSTCXX) $(hostcxx_flags) -c -o $@ $<
-$(host-cxxobjs): $(obj)/%.o: $(src)/%.cc FORCE
+$(host-cxxobjs): $(obj)/%.o: $(srctree)/$(src)/%.cc FORCE
 	$(call if_changed_dep,host-cxxobjs)
 
 # Compile .c file, create position independent .o file
 # host-cshobjs -> .o
 quiet_cmd_host-cshobjs	= HOSTCC  -fPIC $@
       cmd_host-cshobjs	= $(HOSTCC) $(hostc_flags) -fPIC -c -o $@ $<
-$(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE
+$(host-cshobjs): $(obj)/%.o: $(srctree)/$(src)/%.c FORCE
 	$(call if_changed_dep,host-cshobjs)
 
 # Compile .c file, create position independent .o file
@@ -155,7 +168,7 @@ $(host-cshobjs): $(obj)/%.o: $(src)/%.c FORCE
 # host-cxxshobjs -> .o
 quiet_cmd_host-cxxshobjs	= HOSTCXX -fPIC $@
       cmd_host-cxxshobjs	= $(HOSTCXX) $(hostcxx_flags) -fPIC -c -o $@ $<
-$(host-cxxshobjs): $(obj)/%.o: $(src)/%.c FORCE
+$(host-cxxshobjs): $(obj)/%.o: $(srctree)/$(src)/%.c FORCE
 	$(call if_changed_dep,host-cxxshobjs)
 
 # Link a shared library, based on position independent .o files
@@ -180,3 +193,6 @@ $(call multi-depend, $(host-cxxshlib), .so, -objs)
 
 targets += $(host-csingle)  $(host-cmulti) $(host-cobjs)\
 	   $(host-cxxmulti) $(host-cxxobjs) $(host-cshlib) $(host-cshobjs) $(host-cxxshlib) $(host-cxxshobjs)
+ifdef building_out_of_srctree
+targets += $(host-cobjs-generated)
+endif
xen/tools/kconfig/Makefile +9 -3
index b7b9a419ad59..c2ecf4b36652 100644
@@ -146,8 +146,9 @@ help:
 
 # ===========================================================================
 # object files used by all kconfig flavours
-common-objs	:= confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
+common-objs	:= confdata.o expr.o  preprocess.o \
 		   symbol.o
+common-objs-generated := lexer.lex.o parser.tab.o
 
 $(obj)/lexer.lex.o: $(obj)/parser.tab.h
 HOSTCFLAGS_lexer.lex.o	:= -I $(srctree)/$(src)
@@ -156,10 +157,12 @@ HOSTCFLAGS_parser.tab.o	:= -I $(srctree)/$(src)
 # conf: Used for defconfig, oldconfig and related targets
 hostprogs-y	+= conf
 conf-objs	:= conf.o $(common-objs)
+conf-objs-generated := $(common-objs-generated)
 
 # nconf: Used for the nconfig target based on ncurses
 hostprogs-y	+= nconf
 nconf-objs	:= nconf.o nconf.gui.o $(common-objs)
+nconf-objs-generated := $(common-objs-generated)
 
 HOSTLDLIBS_nconf	= $(shell . $(obj)/nconf-cfg && echo $$libs)
 HOSTCFLAGS_nconf.o	= $(shell . $(obj)/nconf-cfg && echo $$cflags)
@@ -172,6 +175,7 @@ hostprogs-y	+= mconf
 lxdialog	:= $(addprefix lxdialog/, \
 		     checklist.o inputbox.o menubox.o textbox.o util.o yesno.o)
 mconf-objs	:= mconf.o $(lxdialog) $(common-objs)
+mconf-objs-generated	:= $(common-objs-generated)
 
 HOSTLDLIBS_mconf = $(shell . $(obj)/mconf-cfg && echo $$libs)
 $(foreach f, mconf.o $(lxdialog), \
@@ -183,6 +187,7 @@ $(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg
 hostprogs-y	+= qconf
 qconf-cxxobjs	:= qconf.o
 qconf-objs	:= images.o $(common-objs)
+qconf-objs-generated	:= $(common-objs-generated)
 
 HOSTLDLIBS_qconf	= $(shell . $(obj)/qconf-cfg && echo $$libs)
 HOSTCXXFLAGS_qconf.o	= $(shell . $(obj)/qconf-cfg && echo $$cflags)
@@ -192,12 +197,13 @@ $(obj)/qconf.o: $(obj)/qconf-cfg $(obj)/qconf.moc
 quiet_cmd_moc = MOC     $@
       cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) -i $< -o $@
 
-$(obj)/%.moc: $(src)/%.h $(obj)/qconf-cfg
+$(obj)/%.moc: $(srctree)/$(src)/%.h $(obj)/qconf-cfg
 	$(call cmd,moc)
 
 # gconf: Used for the gconfig target based on GTK+
 hostprogs-y	+= gconf
 gconf-objs	:= gconf.o images.o $(common-objs)
+gconf-objs-generated	:= $(common-objs-generated)
 
 HOSTLDLIBS_gconf    = $(shell . $(obj)/gconf-cfg && echo $$libs)
 HOSTCFLAGS_gconf.o  = $(shell . $(obj)/gconf-cfg && echo $$cflags)
@@ -207,7 +213,7 @@ $(obj)/gconf.o: $(obj)/gconf-cfg
 # check if necessary packages are available, and configure build flags
 filechk_conf_cfg = $(CONFIG_SHELL) $<
 
-$(obj)/%conf-cfg: $(src)/%conf-cfg.sh FORCE
+$(obj)/%conf-cfg: $(srctree)/$(src)/%conf-cfg.sh FORCE
 	$(call filechk,conf_cfg)
 
 clean-files += *conf-cfg
Signature · 1 line
Anthony PERARD
#95 lore raw

PATCH v8 39/47 RFC, no-VPATH: x86/boot: workaround gcc including the wrong file

In reply to Anthony PERARD

From: Anthony PERARD <[email protected]>

we generate cmdline.S and reloc.S, so we should include those generated file as presented in the build tree, but for file included with quote, gcc will first look into the directory where the source file is, that is where head.S is located and thus include cmdline.S that is present in the source tree when it is dirty. But that the wrong file as we want to include the file from the build tree. Work around by using <> to include those file as if the come from the system, as gcc will first look in directories listed with '-I' on the command line.

So now we also need to add -I when building in the source tree.

---
 xen/arch/x86/boot/Makefile | 4 +++-
 xen/arch/x86/boot/head.S   | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)
xen/arch/x86/boot/Makefile +3 -1
index 04ee9da83333..4fc6b1d8ffc2 100644
@@ -8,7 +8,9 @@ targets += $(head-objs:.S=.o)
 head-objs := $(addprefix $(obj)/, $(head-objs))
 
 ifdef building_out_of_srctree
-$(obj)/head.o: CFLAGS-y += -iquote $(obj)
+$(obj)/head.o: CFLAGS-y += -I$(obj)
+else
+$(obj)/head.o: CFLAGS-y += -I$(src)
 endif
 $(obj)/head.o: $(head-objs)
 
xen/arch/x86/boot/head.S +2 -2
index dd1bea0d10b3..66acd2e9bfc0 100644
@@ -772,10 +772,10 @@ trampoline_setup:
         lret
 
 cmdline_parse_early:
-#include "cmdline.S"
+#include <cmdline.S>
 
 reloc:
-#include "reloc.S"
+#include <reloc.S>
 
 ENTRY(trampoline_start)
 #include "trampoline.S"
Signature · 1 line
Anthony PERARD
#96 lore raw

PATCH v8 40/47 RFC, no-VPATH: prepend $(srctree) to source prerequisite

In reply to Anthony PERARD

From: Anthony PERARD <[email protected]>

Prefix many prerequisite with $(srctree) or replace $(src) with $(srcdir) to not have to rely on VPATH=$(srctree).

---
 xen/arch/arm/Makefile      | 2 +-
 xen/arch/x86/Makefile      | 4 ++--
 xen/arch/x86/boot/Makefile | 2 +-
 xen/arch/x86/efi/Makefile  | 2 +-
 xen/build.mk               | 6 +++---
 xen/include/Makefile       | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)
xen/arch/arm/Makefile +1 -1
index ae7a2f907540..8b340affbe38 100644
@@ -111,7 +111,7 @@ $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
 .PHONY: include
 include:
 
-$(obj)/xen.lds: $(src)/xen.lds.S FORCE
+$(obj)/xen.lds: $(srcdir)/xen.lds.S FORCE
 	$(call if_changed,cpp_lds_S)
 
 $(obj)/dtb.o: $(patsubst "%",%,$(CONFIG_DTB_FILE))
xen/arch/x86/Makefile +2 -2
index 5fb7f1408768..9e5195f58d3b 100644
@@ -236,7 +236,7 @@ include: $(objtree)/arch/x86/include/asm/asm-macros.h
 
 $(obj)/asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
-$(objtree)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile
+$(objtree)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(srcdir)/Makefile
 	$(call filechk,asm-macros.h)
 
 define filechk_asm-macros.h
@@ -254,7 +254,7 @@ define filechk_asm-macros.h
 endef
 
 $(obj)/efi.lds: AFLAGS-y += -DEFI
-$(obj)/xen.lds $(obj)/efi.lds: $(src)/xen.lds.S FORCE
+$(obj)/xen.lds $(obj)/efi.lds: $(srcdir)/xen.lds.S FORCE
 	$(call if_changed_dep,cpp_lds_S)
 
 clean-files := \
xen/arch/x86/boot/Makefile +1 -1
index 4fc6b1d8ffc2..ccba2e281dfc 100644
@@ -47,7 +47,7 @@ $(head-objs): %.S: %.bin
 	$(OBJCOPY) -O binary -R .got.plt $< $@
 
 
-%.lnk: %.o $(src)/build32.lds
+%.lnk: %.o $(srcdir)/build32.lds
 	$(LD) $(LDFLAGS_DIRECT) -N -T $(filter %.lds,$^) -o $@ $<
 
 clean-files := cmdline.S reloc.S *.lnk *.bin
xen/arch/x86/efi/Makefile +1 -1
index 81fda12a70ea..7af96629294a 100644
@@ -3,7 +3,7 @@ include $(srctree)/common/efi/efi_common.mk
 quiet_cmd_objcopy_o_ihex = OBJCOPY $@
 cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@
 
-$(obj)/%.o: $(src)/%.ihex FORCE
+$(obj)/%.o: $(srcdir)/%.ihex FORCE
 	$(call if_changed,objcopy_o_ihex)
 
 $(obj)/boot.init.o: $(obj)/buildid.o
xen/build.mk +3 -3
index 65d8dbc13828..7b48b7eb1404 100644
@@ -8,7 +8,7 @@ define cmd_banner
     mv -f [email protected] $@
 endef
 
-.banner: tools/xen.flf FORCE
+.banner: $(srctree)/tools/xen.flf FORCE
 	$(call if_changed,banner)
 
 targets += .banner
@@ -33,14 +33,14 @@ define cmd_compile.h
     fi
 endef
 
-include/xen/compile.h: include/xen/compile.h.in .banner FORCE
+include/xen/compile.h: $(srctree)/include/xen/compile.h.in .banner FORCE
 	@cat .banner
 	$(call if_changed,compile.h)
 
 targets += include/xen/compile.h
 
 -include $(wildcard .asm-offsets.s.d)
-asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
+asm-offsets.s: $(srctree)/arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o [email protected] -MQ $@ $<
 	$(call move-if-changed,[email protected],$@)
 
xen/include/Makefile +1 -1
index a3977a8bfccd..9fbe9f0de772 100644
@@ -52,7 +52,7 @@ $(obj)/compat/%.h: $(obj)/compat/%.i $(srcdir)/Makefile $(srctree)/tools/compat-
 $(obj)/compat/%.i: $(obj)/compat/%.c $(srcdir)/Makefile
 	$(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $<
 
-$(obj)/compat/%.c: $(src)/public/%.h $(srcdir)/xlat.lst $(srcdir)/Makefile $(srctree)/tools/compat-build-source.py
+$(obj)/compat/%.c: $(srcdir)/public/%.h $(srcdir)/xlat.lst $(srcdir)/Makefile $(srctree)/tools/compat-build-source.py
 	mkdir -p $(@D)
 	$(PYTHON) $(srctree)/tools/compat-build-source.py $(srcdir)/xlat.lst <$< >[email protected]
 	mv -f [email protected] $@
Signature · 1 line
Anthony PERARD
#97 lore raw

PATCH v8 41/47 WIP, no-VPATH: build object from generated C files

In reply to Anthony PERARD

From: Anthony PERARD <[email protected]>

we need to tell that the efi source files are "generated"

Maybe listing generated sources would be better, and then we can automaticaly select the right rule.

---
 xen/Rules.mk                 | 9 ++++++++-
 xen/common/efi/efi_common.mk | 3 +++
 2 files changed, 11 insertions(+), 1 deletion(-)
xen/Rules.mk +8 -1
index 45d2b72158b8..44af005fd57e 100644
@@ -24,6 +24,8 @@ include $(srctree)/scripts/Kbuild.include
 obj-y :=
 lib-y :=
 targets :=
+## targets made from generated sources
+gen-objs-c :=
 subdir-y :=
 CFLAGS-y :=
 AFLAGS-y :=
@@ -96,6 +98,7 @@ targets         := $(addprefix $(obj)/,$(targets))
 lib-y           := $(addprefix $(obj)/,$(lib-y))
 obj-y           := $(addprefix $(obj)/,$(obj-y))
 obj-bin-y       := $(addprefix $(obj)/,$(obj-bin-y))
+gen-objs-c      := $(addprefix $(obj)/,$(gen-objs-c))
 subdir-y        := $(addprefix $(obj)/,$(subdir-y))
 nocov-y         := $(addprefix $(obj)/,$(nocov-y))
 noubsan-y       := $(addprefix $(obj)/,$(noubsan-y))
@@ -242,7 +245,11 @@ define rule_cc_o_c
     $(call cmd,objcopy_fix_sym)
 endef
 
-$(obj)/%.o: $(src)/%.c FORCE
+ifdef building_out_of_srctree
+$(gen-objs-c): $(obj)/%.o: $(obj)/%.c FORCE
+	$(call if_changed_rule,cc_o_c)
+endif
+$(obj)/%.o: $(srctree)/$(src)/%.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
 quiet_cmd_cc_o_S = CC      $@
xen/common/efi/efi_common.mk +3 -0
index d059bb30afa5..232cb508ee85 100644
@@ -1,6 +1,9 @@
 EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
 EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
+# common-efi-objs := boot.c  compat.c  ebmalloc.c  pe.c  runtime.c
+gen-objs-c := boot.o compat.o ebmalloc.o pe.o runtime.o
+
 CFLAGS-y += -fshort-wchar
 CFLAGS-y += -iquote $(srctree)/common/efi
 CFLAGS-y += -iquote $(srcdir)
Signature · 1 line
Anthony PERARD
#98 lore raw

PATCH v8 42/47 RFC, no-VPATH: workaround includes in xsm/flask

In reply to Anthony PERARD

From: Anthony PERARD <[email protected]>

maybe generated header should be in a different directory

using <>-included headers instead of "" to avoid gcc including headers from the source tree when it needs to includes them from the build tree.

---
 xen/xsm/flask/include/avc.h      | 4 ++--
 xen/xsm/flask/include/avc_ss.h   | 2 +-
 xen/xsm/flask/include/objsec.h   | 2 +-
 xen/xsm/flask/include/security.h | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
xen/xsm/flask/include/avc.h +2 -2
index c14bd07a2b39..b9be6ca5aa8b 100644
@@ -14,8 +14,8 @@
 #include <xen/percpu.h>
 #include <xen/spinlock.h>
 
-#include "flask.h"
-#include "av_permissions.h"
+#include <flask.h>
+#include <av_permissions.h>
 #include "security.h"
 
 extern bool flask_enforcing;
xen/xsm/flask/include/avc_ss.h +1 -1
index a3d7d1ef07a8..d80c2c7e57d8 100644
@@ -6,7 +6,7 @@
 #ifndef _FLASK_AVC_SS_H_
 #define _FLASK_AVC_SS_H_
 
-#include "flask.h"
+#include <flask.h>
 
 int avc_ss_reset(u32 seqno);
 
xen/xsm/flask/include/objsec.h +1 -1
index b576a5dd4381..69ec66d3fe33 100644
@@ -14,7 +14,7 @@
 #define _FLASK_OBJSEC_H_
 
 #include <xen/sched.h>
-#include "flask.h"
+#include <flask.h>
 #include "avc.h"
 
 struct domain_security_struct {
xen/xsm/flask/include/security.h +1 -1
index ec8b442a8f3b..8433541aa738 100644
@@ -10,7 +10,7 @@
 #ifndef _FLASK_SECURITY_H_
 #define _FLASK_SECURITY_H_
 
-#include "flask.h"
+#include <flask.h>
 
 #define SECSID_NULL            0x00000000 /* unspecified SID */
 #define SECSID_WILD            0xffffffff /* wildcard SID */
Signature · 1 line
Anthony PERARD
#99 lore raw

PATCH v8 43/47 WIP, no-VPATH: build object from generated assembly source file

In reply to Anthony PERARD

gen-objs-c and gen-objs-S can't have the list of targets.

Alternative, merge both list and use $(filter ).

---
 xen/Rules.mk | 6 ++++++
 xen/build.mk | 7 +++++++
 2 files changed, 13 insertions(+)
xen/Rules.mk +6 -0
index 44af005fd57e..2d8d32f5fd72 100644
@@ -26,6 +26,7 @@ lib-y :=
 targets :=
 ## targets made from generated sources
 gen-objs-c :=
+gen-objs-S :=
 subdir-y :=
 CFLAGS-y :=
 AFLAGS-y :=
@@ -99,6 +100,7 @@ lib-y           := $(addprefix $(obj)/,$(lib-y))
 obj-y           := $(addprefix $(obj)/,$(obj-y))
 obj-bin-y       := $(addprefix $(obj)/,$(obj-bin-y))
 gen-objs-c      := $(addprefix $(obj)/,$(gen-objs-c))
+gen-objs-S      := $(addprefix $(obj)/,$(gen-objs-S))
 subdir-y        := $(addprefix $(obj)/,$(subdir-y))
 nocov-y         := $(addprefix $(obj)/,$(nocov-y))
 noubsan-y       := $(addprefix $(obj)/,$(noubsan-y))
@@ -255,6 +257,10 @@ $(obj)/%.o: $(srctree)/$(src)/%.c FORCE
 quiet_cmd_cc_o_S = CC      $@
 cmd_cc_o_S = $(CC) $(a_flags) -c $< -o $@
 
+ifdef building_out_of_srctree
+$(gen-objs-S): $(obj)/%.o: $(obj)/%.S FORCE
+	$(call if_changed_dep,cc_o_S)
+endif
 $(obj)/%.o: $(src)/%.S FORCE
 	$(call if_changed_dep,cc_o_S)
 
xen/build.mk +7 -0
index 7b48b7eb1404..2f2cbbbeabf8 100644
@@ -83,6 +83,13 @@ prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
 	$(call if_changed,ld)
 endif
 
+# Source generated in arch/*/Makefile to build $(TARGET)-syms
+gen-objs-S += .$(TARGET)-syms.0.o
+gen-objs-S += .$(TARGET)-syms.1.o
+# Source generated in arch/*/Makefile to build $(TARGET).efi
+gen-objs-S += .$(TARGET).efi.0r.o .$(TARGET).efi.0s.o
+gen-objs-S += .$(TARGET).efi.1r.o .$(TARGET).efi.1s.o
+
 targets += prelink.o
 
 $(TARGET): prelink.o FORCE
Signature · 1 line
Anthony PERARD
#100 lore raw

PATCH v8 44/47 WIP, no-VPATH: build object from S source to be in build_in.o

In reply to Anthony PERARD

similair to gen-objs-S, but obj-gen-y will be added to build_in.o

---

Notes:

    we could maybe use $(targets) instead of introducing new variables.
 xen/Rules.mk        | 21 ++++++++++++++-------
 xen/common/Makefile |  2 +-
 2 files changed, 15 insertions(+), 8 deletions(-)
xen/Rules.mk +14 -7
index 2d8d32f5fd72..0ef45d2c7087 100644
@@ -22,6 +22,7 @@ include $(srctree)/scripts/Kbuild.include
 
 # Initialise some variables
 obj-y :=
+obj-gen-y :=
 lib-y :=
 targets :=
 ## targets made from generated sources
@@ -98,6 +99,7 @@ always-y        := $(addprefix $(obj)/,$(always-y))
 targets         := $(addprefix $(obj)/,$(targets))
 lib-y           := $(addprefix $(obj)/,$(lib-y))
 obj-y           := $(addprefix $(obj)/,$(obj-y))
+obj-gen-y       := $(addprefix $(obj)/,$(obj-gen-y))
 obj-bin-y       := $(addprefix $(obj)/,$(obj-bin-y))
 gen-objs-c      := $(addprefix $(obj)/,$(gen-objs-c))
 gen-objs-S      := $(addprefix $(obj)/,$(gen-objs-S))
@@ -112,6 +114,11 @@ ifneq ($(hostprogs-y),)
 include $(srctree)/scripts/Makefile.host
 endif
 
+ifndef building_out_of_srctree
+    obj-y += $(obj-gen-y)
+    obj-gen-y :=
+endif
+
 # subdir-builtin may contain duplications. Use $(sort ...)
 subdir-builtin := $(sort $(filter %/built_in.o, $(obj-y)))
 
@@ -144,7 +151,7 @@ else
 endif
 
 # Reset COV_FLAGS in cases where an objects has another one as prerequisite
-$(nocov-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
+$(nocov-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(obj-gen-y) $(extra-y)): \
     COV_FLAGS :=
 
 $(non-init-objects): _c_flags += $(COV_FLAGS)
@@ -155,7 +162,7 @@ ifeq ($(CONFIG_UBSAN),y)
 UBSAN_FLAGS := $(filter-out -fno-%,$(CFLAGS_UBSAN)) $(filter -fno-%,$(CFLAGS_UBSAN))
 
 # Reset UBSAN_FLAGS in cases where an objects has another one as prerequisite
-$(noubsan-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
+$(noubsan-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(obj-gen-y) $(extra-y)): \
     UBSAN_FLAGS :=
 
 $(non-init-objects): _c_flags += $(UBSAN_FLAGS)
@@ -209,13 +216,13 @@ cmd_ld_builtin = \
     $(LD) $(XEN_LDFLAGS) -r -o $@ $(real-prereqs)
 endif
 
-$(obj)/built_in.o: $(obj-y) FORCE
-	$(call if_changed,$(if $(strip $(obj-y)),ld_builtin,cc_builtin))
+$(obj)/built_in.o: $(obj-y) $(obj-gen-y) FORCE
+	$(call if_changed,$(if $(strip $(obj-y) $(obj-gen-y)),ld_builtin,cc_builtin))
 
 $(obj)/lib.a: $(lib-y) FORCE
 	$(call if_changed,ar)
 
-targets += $(filter-out $(subdir-builtin), $(obj-y))
+targets += $(filter-out $(subdir-builtin), $(obj-y) $(obj-gen-y))
 targets += $(lib-y) $(MAKECMDGOALS)
 
 $(obj)/built_in_bin.o: $(obj-bin-y)
@@ -258,7 +265,7 @@ quiet_cmd_cc_o_S = CC      $@
 cmd_cc_o_S = $(CC) $(a_flags) -c $< -o $@
 
 ifdef building_out_of_srctree
-$(gen-objs-S): $(obj)/%.o: $(obj)/%.S FORCE
+$(gen-objs-S) $(obj-gen-y): $(obj)/%.o: $(obj)/%.S FORCE
 	$(call if_changed_dep,cc_o_S)
 endif
 $(obj)/%.o: $(src)/%.S FORCE
@@ -279,7 +286,7 @@ define cmd_obj_init_o
     $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
 endef
 
-$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): $(obj)/%.init.o: $(obj)/%.o FORCE
+$(filter %.init.o,$(obj-y) $(obj-bin-y) $(obj-gen-y) $(extra-y)): $(obj)/%.init.o: $(obj)/%.o FORCE
 	$(call if_changed,obj_init_o)
 
 quiet_cmd_cpp_i_c = CPP     $@
xen/common/Makefile +1 -1
index b1e076c30b81..fe3a4b7a8619 100644
@@ -1,6 +1,6 @@
 obj-$(CONFIG_ARGO) += argo.o
 obj-y += bitmap.o
-obj-$(CONFIG_HYPFS_CONFIG) += config_data.o
+obj-gen-$(CONFIG_HYPFS_CONFIG) += config_data.o
 obj-$(CONFIG_CORE_PARKING) += core_parking.o
 obj-y += cpu.o
 obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
Signature · 1 line
Anthony PERARD
#101 lore raw

PATCH v8 45/47 WIP, no-VPATH: build xen, out-of-tree!

In reply to Anthony PERARD

From: Anthony PERARD <[email protected]>

We can retire VPATH now, and $(srctree) to prerequisite of generic rules.

(targets %.i and %.s and %.E are updated but may not work as expected.)

---
 xen/Makefile |  3 +--
 xen/Rules.mk | 12 ++++++------
 2 files changed, 7 insertions(+), 8 deletions(-)
xen/Makefile +1 -2
index fbce0f6771fb..32c36426ed7c 100644
@@ -188,9 +188,8 @@ else
 endif
 
 objtree := .
-VPATH := $(srctree)
 
-export building_out_of_srctree srctree objtree VPATH
+export building_out_of_srctree srctree objtree
 
 export XEN_ROOT := $(abs_srctree)/..
 
xen/Rules.mk +6 -6
index 0ef45d2c7087..6fcb1f6b769f 100644
@@ -268,7 +268,7 @@ ifdef building_out_of_srctree
 $(gen-objs-S) $(obj-gen-y): $(obj)/%.o: $(obj)/%.S FORCE
 	$(call if_changed_dep,cc_o_S)
 endif
-$(obj)/%.o: $(src)/%.S FORCE
+$(obj)/%.o: $(srctree)/$(src)/%.S FORCE
 	$(call if_changed_dep,cc_o_S)
 
 
@@ -298,18 +298,18 @@ cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
 quiet_cmd_cpp_s_S = CPP     $@
 cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
 
-$(obj)/%.i: $(src)/%.c FORCE
+$(obj)/%.i: $(srctree)/$(src)/%.c FORCE
 	$(call if_changed_dep,cpp_i_c)
 
-$(obj)/%.s: $(src)/%.c FORCE
+$(obj)/%.s: $(srctree)/$(src)/%.c FORCE
 	$(call if_changed_dep,cc_s_c)
 
-$(obj)/%.s: $(src)/%.S FORCE
+$(obj)/%.s: $(srctree)/$(src)/%.S FORCE
 	$(call if_changed_dep,cpp_s_S)
 
-$(obj)/%.E: $(src)/%.c FORCE
+$(obj)/%.E: $(srctree)/$(src)/%.c FORCE
 	$(call if_changed_dep,cpp_i_c)
-$(obj)/%.E: $(src)/%.S FORCE
+$(obj)/%.E: $(srctree)/$(src)/%.S FORCE
 	$(call if_changed_dep,cpp_s_S)
 
 # Linker scripts, .lds.S -> .lds
Signature · 1 line
Anthony PERARD
#102 lore raw

PATCH v8 46/47 RFC, no-VPATH: remove check for clean source tree for out-of-tree builds

In reply to Anthony PERARD

From: Anthony PERARD <[email protected]>

---
 xen/Makefile | 10 ----------
 1 file changed, 10 deletions(-)
xen/Makefile +0 -10
index 32c36426ed7c..a3c574ed1a87 100644
@@ -282,7 +282,6 @@ tools_fixdep:
 	$(Q)$(MAKE) $(build)=tools tools/fixdep
 
 PHONY += outputmakefile
-# Before starting out-of-tree build, make sure the source tree is clean.
 # outputmakefile generates a Makefile in the output directory, if using a
 # separate output directory. This allows convenient use of make in the
 # output directory.
@@ -297,15 +296,6 @@ cmd_makefile = { \
 
 outputmakefile:
 ifdef building_out_of_srctree
-	$(Q)if [ -f $(srctree)/.config -o \
-		 -d $(srctree)/include/config -o \
-		 -d $(srctree)/include/generated ]; then \
-		echo >&2 "***"; \
-		echo >&2 "*** The source tree is not clean, please run 'make$(if $(findstring command line, $(origin XEN_TARGET_ARCH)), XEN_TARGET_ARCH=$(XEN_TARGET_ARCH)) distclean'"; \
-		echo >&2 "*** in $(abs_srctree)";\
-		echo >&2 "***"; \
-		false; \
-	fi
 	$(Q)ln -fsn $(srctree) source
 	$(call cmd,makefile)
 	$(Q)test -e .gitignore || \
Signature · 1 line
Anthony PERARD
#103 lore raw

PATCH v8 47/47 WIP: no more link farming for xen-shim

In reply to Anthony PERARD
---
 tools/firmware/xen-dir/Makefile | 71 ++-------------------------------
 1 file changed, 3 insertions(+), 68 deletions(-)
tools/firmware/xen-dir/Makefile +3 -68
index 6f5e208ab413..a50fdcbb8b17 100644
@@ -7,74 +7,9 @@ FORCE:
 
 D=xen-root
 
-# Minimun set of files / directories go get Xen to build
-LINK_DIRS=config xen
-LINK_FILES=Config.mk
-
-DEP_DIRS=$(foreach i, $(LINK_DIRS), $(XEN_ROOT)/$(i))
-DEP_FILES=$(foreach i, $(LINK_FILES), $(XEN_ROOT)/$(i))
-
-# Exclude some intermediate files and final build products
-LINK_EXCLUDES := '*.[isoa]' '*.bin' '*.chk' '*.lnk' '*.gz' '.*'
-LINK_EXCLUDES += lexer.lex.? parser.tab.? conf
-LINK_EXCLUDES += asm-offsets.h asm-macros.h compile.h '*-autogen.h'
-LINK_EXCLUDES += mkelf32 mkreloc symbols config_data.S xen.lds efi.lds
-LINK_EXCLUDES += '*.map' xen xen.gz xen.efi xen-syms check.efi
-
-# To exclude full subtrees or individual files of not sufficiently specific
-# names, regular expressions are used:
-LINK_EXCLUDE_PATHS := xen/include/compat/.*
-LINK_EXCLUDE_PATHS += xen/include/config/.*
-LINK_EXCLUDE_PATHS += xen/include/generated/.*
-LINK_EXCLUDE_PATHS += xen/arch/x86/boot/reloc[.]S
-LINK_EXCLUDE_PATHS += xen/arch/x86/boot/cmdline[.]S
-
-# This is all a giant mess and doesn't really work.
-#
-# The correct solution is to fix Xen to be able to do out-of-tree builds.
-#
-# Until that happens, we set up a linkfarm by iterating over the xen/ tree,
-# linking source files.  This is repeated each time we enter this directory,
-# which poses a problem for a two-step "make; make install" build process.
-#
-# Any time the list of files to link changes, we relink all files, then
-# distclean to take out not-easy-to-classify intermediate files.  This is to
-# support easy development of the shim, but has a side effect of clobbering
-# the already-built shim.
-#
-# $(LINK_EXCLUDES) and $(LINK_EXCLUDE_DIRS) should be set such that a parallel
-# build of shim and xen/ doesn't cause a subsequent `make install` to decide to
-# regenerate the linkfarm.  This means that all intermediate and final build
-# artefacts must be excluded.
-linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
-	mkdir -p $(D)
-	rm -f linkfarm.stamp.tmp
-	set -e; \
-	$(foreach d, $(LINK_DIRS), \
-		 (mkdir -p $(D)/$(d); \
-		  cd $(D)/$(d); \
-		  find $(XEN_ROOT)/$(d)/ -type d |\
-			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p .);) \
-	$(foreach d, $(LINK_DIRS), \
-		(cd $(XEN_ROOT); \
-		 find $(d) ! -type l -type f $(addprefix ! -name ,$(LINK_EXCLUDES)) \
-		 | grep -v $(patsubst %,-e '^%$$',$(LINK_EXCLUDE_PATHS))) \
-		 >> linkfarm.stamp.tmp ; ) \
-	$(foreach f, $(LINK_FILES), \
-		echo $(f) >> linkfarm.stamp.tmp ;)
-	cmp -s linkfarm.stamp.tmp linkfarm.stamp && \
-		rm linkfarm.stamp.tmp || { \
-		cat linkfarm.stamp.tmp | while read f; \
-		  do rm -f "$(D)/$$f"; ln -s "$(XEN_ROOT)/$$f" "$(D)/$$f"; done; \
-		mv linkfarm.stamp.tmp linkfarm.stamp; \
-		}
-
-# Copy enough of the tree to build the shim hypervisor
-$(D): linkfarm.stamp
-	$(MAKE) -C $(D)/xen distclean
-
-$(D)/xen/.config: $(D)
-	$(MAKE) -C $(@D) KBUILD_DEFCONFIG=pvshim_defconfig defconfig
+$(D)/xen/.config: FORCE
+	mkdir -p $(@D)
+	$(MAKE) -f $(XEN_ROOT)/xen/Makefile -C $(@D) KBUILD_DEFCONFIG=pvshim_defconfig defconfig
 
 xen-shim: $(D)/xen/.config
 	$(MAKE) -C $(<D) build
Signature · 1 line
Anthony PERARD
#104 lore raw
In reply to Anthony PERARD
Quoted 15 lines · Anthony PERARD

Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-system-xen-v8

v8:
Mostly rework of v7. With many patch already applied.
Some detail changes that are spread through many patches:
- make cloc recipe should now work throughout the series, update of it is done in 3 patches.
- new patch "build: fix enforce unique symbols for recent clang version" to fix an issue with clang.
- introducing $(srctree) and $(objtree) earlier
- introducing $(srcdir) as shortcut for $(srctree)/$(src)
- introduce usage of -iquote instead of -I in some cases
More detail change log can be found in patches notes.

Quoted 9 lines

Also this v8 present a work-in-progress of the ability to do out-of-tree build without setting VPATH. This is presented as an alternative to force use of out-of-tree build. As the last patch show, it allows to build the xen-shim without the linkfarm and we don't need to make any other changes to any thing that build xen (osstest, distribution packages, xen.git, ..., and developers finger macros). The patches are only there as WIP / RFC as they were some concern about the usefulness and extra changes needed. We can decide whether those changes are good or if this is too much and we should force out-of-tree build for the hypervisor.

I'm afraid I'm of two minds here. I don't think we want to force people to do out-of-tree builds, but I also dislike the idea of mixing in-tree and out-of-tree builds. Yet reading the above I understand that the shim build would conflict with an in-tree build because certain files would be picked (the shim build being an out-of-tree one) from the (dirtied) source tree, rather than the shim's build tree. Perhaps the extra path prefixes that I commented upon in an individual patch are then indeed the least bad route to take.

There's one compromise which comes to mind, but which may also not be
liked: We could simply fail out-of-tree builds when the source tree is dirty. Then people wanting the shim built would need to use out-of-tree builds also for the "main" hypervisor, but people suppressing the shim build anyway (or doing it separately, e.g. using a non-default .config) could continue to do in-tree builds. The one puzzle piece I'm lacking so far (perhaps simply because of having overlooked where it is) is how, for a full-build-of-everything, one would control where the xen/ part of the build would go _outside_ of the source (sub-)tree.

Jan

#105 lore raw
Quoted 26 lines · Jan Beulich
Quoted 15 lines · Anthony PERARD

Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-system-xen-v8

v8:
Mostly rework of v7. With many patch already applied.
Some detail changes that are spread through many patches:
- make cloc recipe should now work throughout the series, update of it is done in 3 patches.
- new patch "build: fix enforce unique symbols for recent clang version" to fix an issue with clang.
- introducing $(srctree) and $(objtree) earlier
- introducing $(srcdir) as shortcut for $(srctree)/$(src)
- introduce usage of -iquote instead of -I in some cases
More detail change log can be found in patches notes.

Quoted 9 lines

Also this v8 present a work-in-progress of the ability to do out-of-tree build without setting VPATH. This is presented as an alternative to force use of out-of-tree build. As the last patch show, it allows to build the xen-shim without the linkfarm and we don't need to make any other changes to any thing that build xen (osstest, distribution packages, xen.git, ..., and developers finger macros). The patches are only there as WIP / RFC as they were some concern about the usefulness and extra changes needed. We can decide whether those changes are good or if this is too much and we should force out-of-tree build for the hypervisor.

Quoted 8 lines

I'm afraid I'm of two minds here. I don't think we want to force people to do out-of-tree builds, but I also dislike the idea of mixing in-tree and out-of-tree builds. Yet reading the above I understand that the shim build would conflict with an in-tree build because certain files would be picked (the shim build being an out-of-tree one) from the (dirtied) source tree, rather than the shim's build tree. Perhaps the extra path prefixes that I commented upon in an individual patch are then indeed the least bad route to take.

Having looked at the RFC patches near the end of the series, I find the need to convert from '#include "..."' to '#include <...>' particularly
problematic: Using "" for "local" files is common practice, and hence even if you take care of the existing cases I'm afraid we'll be at constant risk of re-introducing such an issue somewhere. And someone hitting this issue may have a hard time figuring that it's simply the wrong file which gets included somewhere. IOW I guess I'm now favoring the "require clean source tree for out-of-tree builds" model.

Jan

#106 lore raw
In reply to Jan Beulich
Quoted 11 lines · Jan Beulich
Quoted 9 lines · Anthony PERARD

Also this v8 present a work-in-progress of the ability to do out-of-tree build without setting VPATH. This is presented as an alternative to force use of out-of-tree build. As the last patch show, it allows to build the xen-shim without the linkfarm and we don't need to make any other changes to any thing that build xen (osstest, distribution packages, xen.git, ..., and developers finger macros). The patches are only there as WIP / RFC as they were some concern about the usefulness and extra changes needed. We can decide whether those changes are good or if this is too much and we should force out-of-tree build for the hypervisor.

Quoted 8 lines

I'm afraid I'm of two minds here. I don't think we want to force people to do out-of-tree builds, but I also dislike the idea of mixing in-tree and out-of-tree builds. Yet reading the above I understand that the shim build would conflict with an in-tree build because certain files would be picked (the shim build being an out-of-tree one) from the (dirtied) source tree, rather than the shim's build tree. Perhaps the extra path prefixes that I commented upon in an individual patch are then indeed the least bad route to take.

To me, the problem is with a few build artefact and configuration: the ".config" file that osstest write and edit, and the final location of the "xen*" artefacts. Having something or someone wanting to edit ".config" breaks out-of-tree build. Otherwise, we could have forced out-of-tree build like libvirt or qemu are doing.

Quoted 3 lines

There's one compromise which comes to mind, but which may also not be
liked: We could simply fail out-of-tree builds when the source tree is dirty. Then people wanting the shim built would need to use out-of-tree

This isn't a compromise, it is already implemented in "build: adding out-of-tree support to the xen build". I revert this in patch "RFC,
no-VPATH: remove check for clean source tree for out-of-tree".

Quoted 6 lines

builds also for the "main" hypervisor, but people suppressing the shim build anyway (or doing it separately, e.g. using a non-default .config) could continue to do in-tree builds. The one puzzle piece I'm lacking so far (perhaps simply because of having overlooked where it is) is how, for a full-build-of-everything, one would control where the xen/ part of the build would go _outside_ of the source (sub-)tree.

I guess that's not really an issue. It would be easy to run make -C xen-build -f ../xen/Makefile (or make -C xen O=../xen-build, or even make -C xen O=build would be fine too). With maybe a make variable to let someone specify a different output tree.

For a full-build-of-everything, we can easily do out-of-tree build. The full-install-of-everything can pick the build artefact from the new place. The issue is when someone want that and edit ".config" of the hypervisor, as adding the file will stop out-of-tree build, so pv shim will not be able to use out-of-tree build.

But maybe going with mixing in-tree and out-of-tree build is going to be too complicated. The hard part is for the build system to differentiate between source file and generated source file, so that might break from time to time. So maybe avoiding mixing and thus breaking build of some users might be better and more reliable in the long term.

Cheers,

Signature · 1 line
Anthony PERARD
#107 lore raw
In reply to Anthony PERARD
Quoted 13 lines · Anthony PERARD

Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-system-xen-v8

v8:
Mostly rework of v7. With many patch already applied.
Some detail changes that are spread through many patches:
- make cloc recipe should now work throughout the series, update of it is done in 3 patches.
- new patch "build: fix enforce unique symbols for recent clang version" to fix an issue with clang.
- introducing $(srctree) and $(objtree) earlier
- introducing $(srcdir) as shortcut for $(srctree)/$(src)
- introduce usage of -iquote instead of -I in some cases

One more question: With an out-of-tree build, where do I put the (build flavor specific) ./.config (not xen/.config)? I'm using this extensively for cross builds and to override tool chain components (to avoid having to remember to always specify the right combination for a certain flavor on the command line).

Jan

#108 lore raw
Quoted 5 lines · Jan Beulich

One more question: With an out-of-tree build, where do I put the (build flavor specific) ./.config (not xen/.config)? I'm using this extensively for cross builds and to override tool chain components (to avoid having to remember to always specify the right combination for a certain flavor on the command line).

You mean the optional ".config" that "Config.mk" includes? This file is still included as "$(XEN_ROOT)/.config", and XEN_ROOT is set to be the source tree.

Maybe you could abuse a file named "xen-version" which is included near the top of "xen/Makefile" instead.

Signature · 1 line
Anthony PERARD
#109 lore raw
Quoted 10 lines · Anthony PERARD
Quoted 5 lines · Jan Beulich

One more question: With an out-of-tree build, where do I put the (build flavor specific) ./.config (not xen/.config)? I'm using this extensively for cross builds and to override tool chain components (to avoid having to remember to always specify the right combination for a certain flavor on the command line).

You mean the optional ".config" that "Config.mk" includes? This file is still included as "$(XEN_ROOT)/.config", and XEN_ROOT is set to be the source tree.

It being taken from the source tree is precisely the issue.

Quoted 2 lines

Maybe you could abuse a file named "xen-version" which is included near the top of "xen/Makefile" instead.

I don't think that would work. The settings from ./.config are needed ahead of

include $(XEN_ROOT)/config/$(XEN_OS).mk
include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk

which come later in Config.mk, at least when e.g. config/StdGNU.mk properly used ?= . Plus obviously for the 2nd of the lines above to use the right file, XEN_TARGET_ARCH already needs to be set to its designated value (same would of course be true for XEN_OS, if one was to override that).

Jan