Skip to contentSkip to conversation

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

PATCH Superseded Anthony PERARD 8 participants 161 messages Aug 24, 2021 – Nov 4, 2021 Page 1 of 2

Subsystems (5)

v7 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v7 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-v7

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.

v6:
This new version of the series get's us very close to be able to do out-of-tree build, but I've stop at been able to use Linux's fixdep and getting rid of those annoying *.d2 files generation.

There a few patch left from the previous round within the first 8 patches (mixed with new or replaced patches). All the rest is new.

The main patch is probably "build: build everything from the root dir, use obj=$subdir" which has still quite a few changes left. I might be still be able to break it down even more if needed to help with review (and might allow me to better explain some changes in it).

v5:
https://lore.kernel.org/xen-devel/[email protected]/
- few changes detailed in patch notes.
- 1 new patch

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.

This new version of the series get's us very close to be able to do out-of-tree build, but I've stop at been able to use Linux's fixdep and getting rid of those annoying *.d2 files.

Cheers,

Anthony PERARD (51):
build: introduce cpp_flags macro
build: use if_changed on built_in.o
build: use if_changed_rules with %.o:%.c targets
build: factorise generation of the linker scripts
x86/mm: avoid building multiple .o from a single .c file build,include: rework compat-build-source.py build,include: rework compat-build-header.py
build: fix clean targets when subdir-y is used
build: use subdir-y in test/Makefile
build,arm: move LDFLAGS change to arch.mk
build: move make option changes check earlier
build: avoid building arm/arm/*/head.o twice
build: convert binfile use to if_changed
xen: move include/asm-* to arch/*/include/asm
build,riscv: tell the build system about riscv64/head.S
build: generate "include/xen/compile.h" with if_changed
build: set XEN_BUILD_EFI earlier
build: fix $(TARGET).efi creation in arch/arm
build: fix arch/x86/note.o rule
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: clean common temporary files from root makefile build,include: remove arch-*/*.h public header listing from
headers*.chk
build: prepare to always invoke $(MAKE) from xen/, use $(obj)
build: rework test/livepatch/Makefile
build: build everything from the root dir, use obj=$subdir
build: introduce if_changed_deps
build: rename __LINKER__ to LINKER_SCRIPT
build: add an other explicite rules to not build $(XEN_ROOT)/.config
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: use main rune to build host binary x86's mkelf32 and mkreloc
build: rework coverage and ubsan CFLAGS handling
build: fix dependencies in arch/x86/boot
build,x86: remove the need for build32.mk
build: grab common EFI source files in arch specific dir
build: replace $(BASEDIR) by $(objtree)
build: add $(srctree) in few key places
build: rework cloc recipe
build: replace $(BASEDIR) by $(srctree)
build: Rework "clean" to clean from the root dir
build: Rework "headers*.chk" prerequisite in include/
build: adding out-of-tree support to the xen build
build: specify source tree in include/ for prerequisite
build: add %.E targets

 .gitignore                                    |   7 +-
 MAINTAINERS                                   |  37 +-
 tools/include/Makefile                        |   2 +-
 tools/misc/xen-access.c                       |   4 +-
 tools/tests/vhpet/Makefile                    |   2 +-
 xen/Kconfig                                   |   4 +-
 xen/Makefile                                  | 408 +++++++++++-------
 xen/Rules.mk                                  | 293 ++++++++-----
 xen/arch/arm/Makefile                         |  62 +--
 xen/arch/arm/README.LinuxPrimitives           |  10 +-
 xen/arch/arm/arch.mk                          |  12 +-
 xen/arch/arm/arm32/Makefile                   |   1 +
 xen/arch/arm/arm32/head.S                     |   2 +-
 xen/arch/arm/arm64/Makefile                   |   2 +
 xen/arch/arm/arm64/head.S                     |   2 +-
 xen/arch/arm/efi/Makefile                     |   9 +
 .../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/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/riscv/riscv64/Makefile               |   1 +
 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/efi/Makefile                     |  15 +-
 .../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/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/arch/x86/mm/Makefile                      |   9 -
 xen/arch/x86/mm/guest_walk.c                  |   3 -
 xen/arch/x86/mm/guest_walk_2.c                |   2 +
 xen/arch/x86/mm/guest_walk_3.c                |   2 +
 xen/arch/x86/mm/guest_walk_4.c                |   2 +
 xen/arch/x86/mm/hap/Makefile                  |  15 +-
 xen/arch/x86/mm/hap/guest_walk.c              |   3 -
 xen/arch/x86/mm/hap/guest_walk_2.c            |   2 +
 xen/arch/x86/mm/hap/guest_walk_3.c            |   2 +
 xen/arch/x86/mm/hap/guest_walk_4.c            |   2 +
 xen/arch/x86/mm/shadow/Makefile               |   9 -
 xen/arch/x86/mm/shadow/guest_2.c              |   2 +
 xen/arch/x86/mm/shadow/guest_3.c              |   2 +
 xen/arch/x86/mm/shadow/guest_4.c              |   2 +
 xen/arch/x86/mm/shadow/multi.c                |   3 -
 xen/build.mk                                  |  87 ++++
 xen/common/Makefile                           |  14 +-
 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                          |  81 ++--
 xen/include/xen/acpi.h                        |   5 +-
 xen/include/xen/bitmap.h                      |   2 +-
 xen/scripts/Kbuild.include                    |  65 ++-
 xen/scripts/Kconfig.include                   |   2 +-
 xen/scripts/Makefile.clean                    |  40 +-
 xen/{tools/kconfig => scripts}/Makefile.host  |  29 +-
 xen/scripts/mkmakefile                        |  17 +
 xen/test/Makefile                             |  16 +-
 xen/test/livepatch/Makefile                   | 213 ++++-----
 xen/tools/Makefile                            |  14 +-
 xen/tools/compat-build-header.py              |  44 +-
 xen/tools/compat-build-source.py              |   8 +-
 xen/tools/fixdep.c                            | 404 +++++++++++++++++
 xen/tools/kconfig/Makefile.kconfig            | 106 -----
 xen/tools/kconfig/confdata.c                  |   2 +-
 xen/tools/symbols.c                           |  18 +-
 xen/xsm/flask/Makefile                        |  45 +-
 xen/xsm/flask/policy/mkaccess_vector.sh       |   7 +-
 xen/xsm/flask/ss/Makefile                     |   5 +-
 378 files changed, 1572 insertions(+), 978 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/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%)
 create mode 100644 xen/arch/riscv/riscv64/Makefile
 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/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/arch/x86/mm/guest_walk_2.c
 create mode 100644 xen/arch/x86/mm/guest_walk_3.c
 create mode 100644 xen/arch/x86/mm/guest_walk_4.c
 create mode 100644 xen/arch/x86/mm/hap/guest_walk_2.c
 create mode 100644 xen/arch/x86/mm/hap/guest_walk_3.c
 create mode 100644 xen/arch/x86/mm/hap/guest_walk_4.c
 create mode 100644 xen/arch/x86/mm/shadow/guest_2.c
 create mode 100644 xen/arch/x86/mm/shadow/guest_3.c
 create mode 100644 xen/arch/x86/mm/shadow/guest_4.c
 create mode 100644 xen/build.mk
 rename xen/{tools/kconfig => scripts}/Makefile.host (88%)
 create mode 100755 xen/scripts/mkmakefile
 create mode 100644 xen/tools/fixdep.c
 delete mode 100644 xen/tools/kconfig/Makefile.kconfig
Signature · 1 line
Anthony PERARD
#1 lore raw

PATCH v7 1/51 build: introduce cpp_flags macro

---

Notes:
v7:
- also filter -flto
- and convert "asm-offsets.s" and "xen/x86/%.lds" to use cpp_flags as well.

v6:
- switch to a macro as suggested
which allows to be used with both a_flags and c_flags

v5:
- new patch

 xen/Makefile                    | 2 +-
 xen/Rules.mk                    | 7 +++++--
 xen/arch/x86/Makefile           | 2 +-
 xen/arch/x86/mm/Makefile        | 2 +-
 xen/arch/x86/mm/hap/Makefile    | 2 +-
 xen/arch/x86/mm/shadow/Makefile | 2 +-
 6 files changed, 10 insertions(+), 7 deletions(-)
xen/Makefile +1 -1
index 94e837182615..4ceb02d37441 100644
@@ -410,7 +410,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner
 	@mv -f [email protected] $@
 
 asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
-	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o [email protected] -MQ $@ $<
+	$(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
xen/Rules.mk +5 -2
index d65d6a48993b..c99c4a9475c9 100644
@@ -133,6 +133,9 @@ endif
 # Always build obj-bin files as binary even if they come from C source. 
 $(obj-bin-y): XEN_CFLAGS := $(filter-out -flto,$(XEN_CFLAGS))
 
+# To be use with $(a_flags) or $(c_flags) to produce CPP flags
+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.
 
@@ -222,13 +225,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE
 	$(call if_changed,obj_init_o)
 
 quiet_cmd_cpp_i_c = CPP     $@
-cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -MQ $@ -o $@ $<
+cmd_cpp_i_c = $(CPP) $(call cpp_flags,$(c_flags)) -MQ $@ -o $@ $<
 
 quiet_cmd_cc_s_c = CC      $@
 cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
 
 quiet_cmd_cpp_s_S = CPP     $@
-cmd_cpp_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $<
+cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
 
 %.i: %.c FORCE
 	$(call if_changed,cpp_i_c)
xen/arch/x86/Makefile +1 -1
index fe38cfd54421..462472215c91 100644
@@ -292,7 +292,7 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
 
 efi.lds: AFLAGS-y += -DEFI
 xen.lds efi.lds: xen.lds.S
-	$(CPP) -P $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $<
+	$(CPP) -P $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
 
 boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
xen/arch/x86/mm/Makefile +1 -1
index b31041644fe8..2818c066f76a 100644
@@ -15,7 +15,7 @@ guest_walk_%.o: guest_walk.c Makefile
 	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_walk_%.i: guest_walk.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+	$(CPP) $(call cpp_flags,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_walk_%.s: guest_walk.c Makefile
 	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
xen/arch/x86/mm/hap/Makefile +1 -1
index 22e7ad54bd33..c6d296b51720 100644
@@ -9,7 +9,7 @@ guest_walk_%level.o: guest_walk.c Makefile
 	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_walk_%level.i: guest_walk.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+	$(CPP) $(call cpp_flags,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_walk_%level.s: guest_walk.c Makefile
 	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
xen/arch/x86/mm/shadow/Makefile +1 -1
index 770213fe9d84..fd64b4dda925 100644
@@ -10,7 +10,7 @@ guest_%.o: multi.c Makefile
 	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_%.i: multi.c Makefile
-	$(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
+	$(CPP) $(call cpp_flags,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
 
 guest_%.s: multi.c Makefile
 	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
Signature · 1 line
Anthony PERARD
Reviewed-by on v7 1/51
#2 lore raw

Re: [XEN PATCH v7 01/51] build: introduce cpp_flags macro

Quoted 1 line · Anthony PERARD

albeit with a remark:

xen/Rules.mk endif · line 137

Quoted 8 lines
xen/Rules.mk +2 -0
@@ -133,6 +133,9 @@ endif
 # Always build obj-bin files as binary even if they come from C source. 
 $(obj-bin-y): XEN_CFLAGS := $(filter-out -flto,$(XEN_CFLAGS))
 
+# To be use with $(a_flags) or $(c_flags) to produce CPP flags
+cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1))

Afaics this has nothing to do with Linux'es cpp_flags, so what we do here is entirely up to us. If this is strictly intended to be used the another macro, wouldn't it make sense to have

cpp_flags = $(filter-out -Wa$(comma)% -flto,$($(1)))

here and then e.g. ...

xen/Rules.mk $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE · line 228

Quoted 6 lines
xen/Rules.mk +1 -1
@@ -222,13 +225,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE
 	$(call if_changed,obj_init_o)
 
 quiet_cmd_cpp_i_c = CPP     $@
-cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -MQ $@ -o $@ $<
+cmd_cpp_i_c = $(CPP) $(call cpp_flags,$(c_flags)) -MQ $@ -o $@ $<

... the slightly simpler / easier to read

cmd_cpp_i_c = $(CPP) $(call cpp_flags,c_flags) -MQ $@ -o $@ $<

here?

Jan

#3 lore raw

Re: [XEN PATCH v7 01/51] build: introduce cpp_flags macro

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

albeit with a remark:

xen/Rules.mk endif · line 137

Quoted 8 lines
xen/Rules.mk +2 -0
@@ -133,6 +133,9 @@ endif
 # Always build obj-bin files as binary even if they come from C source. 
 $(obj-bin-y): XEN_CFLAGS := $(filter-out -flto,$(XEN_CFLAGS))
 
+# To be use with $(a_flags) or $(c_flags) to produce CPP flags
+cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1))

Afaics this has nothing to do with Linux'es cpp_flags, so what we do here is entirely up to us. If this is strictly intended to be used the another macro, wouldn't it make sense to have

cpp_flags = $(filter-out -Wa$(comma)% -flto,$($(1)))

here and then e.g. ...

xen/Rules.mk $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE · line 228

Quoted 6 lines
xen/Rules.mk +1 -1
@@ -222,13 +225,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE
 	$(call if_changed,obj_init_o)
 
 quiet_cmd_cpp_i_c = CPP     $@
-cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -MQ $@ -o $@ $<
+cmd_cpp_i_c = $(CPP) $(call cpp_flags,$(c_flags)) -MQ $@ -o $@ $<

... the slightly simpler / easier to read

Quoted 3 lines

cmd_cpp_i_c = $(CPP) $(call cpp_flags,c_flags) -MQ $@ -o $@ $<

here?

I don't think this is better or simpler. "cpp_flags" don't need to know the name of the variable to be useful. I think it is better to know that "cpp_flags" act on the value of the variable rather than the variable itself, when reading "$(call cpp_flags, $(a_flags))".

But thanks for the suggestion, and for the review,

Signature · 1 line
Anthony PERARD
#4 lore raw

Re: [XEN PATCH v7 01/51] build: introduce cpp_flags macro

Quoted 33 lines · Anthony PERARD
Quoted 32 lines · Jan Beulich
Quoted 1 line · Anthony PERARD

albeit with a remark:

xen/Rules.mk endif · line 137

Quoted 8 lines
xen/Rules.mk +2 -0
@@ -133,6 +133,9 @@ endif
 # Always build obj-bin files as binary even if they come from C source. 
 $(obj-bin-y): XEN_CFLAGS := $(filter-out -flto,$(XEN_CFLAGS))
 
+# To be use with $(a_flags) or $(c_flags) to produce CPP flags
+cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1))

Afaics this has nothing to do with Linux'es cpp_flags, so what we do here is entirely up to us. If this is strictly intended to be used the another macro, wouldn't it make sense to have

cpp_flags = $(filter-out -Wa$(comma)% -flto,$($(1)))

here and then e.g. ...

xen/Rules.mk $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE · line 228

Quoted 6 lines
xen/Rules.mk +1 -1
@@ -222,13 +225,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE
 	$(call if_changed,obj_init_o)
 
 quiet_cmd_cpp_i_c = CPP     $@
-cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -MQ $@ -o $@ $<
+cmd_cpp_i_c = $(CPP) $(call cpp_flags,$(c_flags)) -MQ $@ -o $@ $<

... the slightly simpler / easier to read

Quoted 8 lines
Quoted 3 lines

cmd_cpp_i_c = $(CPP) $(call cpp_flags,c_flags) -MQ $@ -o $@ $<

here?

I don't think this is better or simpler. "cpp_flags" don't need to know the name of the variable to be useful. I think it is better to know that "cpp_flags" act on the value of the variable rather than the variable itself, when reading "$(call cpp_flags, $(a_flags))".

Well, yes. This way one could also pass more than just the expansion of either of these two variables. The thing that made me think of the alternative is the comment: Would you mind if I inserted "e.g." in there, to make clear this isn't limited to these two variables?

Jan

#5 lore raw

Re: [XEN PATCH v7 01/51] build: introduce cpp_flags macro

Quoted 5 lines · Jan Beulich
Quoted 4 lines · Anthony PERARD
Quoted 3 lines · Jan Beulich
Quoted 2 lines · Anthony PERARD
xen/Rules.mk +2 -0
+# To be use with $(a_flags) or $(c_flags) to produce CPP flags
+cpp_flags = $(filter-out -Wa$(comma)% -flto,$(1))

[..]

Quoted 4 lines

Well, yes. This way one could also pass more than just the expansion of either of these two variables. The thing that made me think of the alternative is the comment: Would you mind if I inserted "e.g." in there, to make clear this isn't limited to these two variables?

Adding "e.g." is fine. Thanks.

Signature · 1 line
Anthony PERARD
#6 lore raw

PATCH v7 2/51 build: use if_changed on built_in.o

In reply to Anthony PERARD

In the case where $(obj-y) is empty, we also replace $(c_flags) by $(XEN_CFLAGS) to avoid generating an .%.d dependency file. This avoid make trying to include %.h file in the ld command if $(obj-y) isn't empty anymore on a second run.

---

Notes:
v7:
- Display "CC" for cmd_cc_builtin instead of "LD".

v6:
- use $(if $(strip $(obj-y)),ld_builtin,cc_builtin) as suggested
- rebased

v4:
- Have cmd_ld_builtin depends on CONFIG_LTO, which simplify built_in.o rule.

 xen/Rules.mk | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
xen/Rules.mk +12 -7
index c99c4a9475c9..5a6a5d63260f 100644
@@ -147,17 +147,22 @@ include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 c_flags += $(CFLAGS-y)
 a_flags += $(CFLAGS-y) $(AFLAGS-y)
 
-built_in.o: $(obj-y) $(if $(strip $(lib-y)),lib.a) $(extra-y)
-ifeq ($(strip $(obj-y)),)
-	$(CC) $(c_flags) -c -x c /dev/null -o $@
-else
+quiet_cmd_cc_builtin = CC      $@
+cmd_cc_builtin = \
+    $(CC) $(XEN_CFLAGS) -c -x c /dev/null -o $@
+
+quiet_cmd_ld_builtin = LD      $@
 ifeq ($(CONFIG_LTO),y)
-	$(LD_LTO) -r -o $@ $(filter $(obj-y),$^)
+cmd_ld_builtin = \
+    $(LD_LTO) -r -o $@ $(filter $(obj-y),$(real-prereqs))
 else
-	$(LD) $(XEN_LDFLAGS) -r -o $@ $(filter $(obj-y),$^)
-endif
+cmd_ld_builtin = \
+    $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter $(obj-y),$(real-prereqs))
 endif
 
+built_in.o: $(obj-y) $(if $(strip $(lib-y)),lib.a) $(extra-y) FORCE
+	$(call if_changed,$(if $(strip $(obj-y)),ld_builtin,cc_builtin))
+
 lib.a: $(lib-y) FORCE
 	$(call if_changed,ar)
 
Signature · 1 line
Anthony PERARD
#7 lore raw

PATCH v7 3/51 build: use if_changed_rules with %.o:%.c targets

In reply to Anthony PERARD

Use $(dot-target) to have the target name prefix with a dot.

Now, when the CC command has run, it is recorded in .*.cmd file, then if_changed_rules will compare it on subsequent runs.

---
 xen/Rules.mk | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
xen/Rules.mk +17 -9
index 5a6a5d63260f..eaf770414305 100644
@@ -192,19 +192,27 @@ FORCE:
 
 SRCPATH := $(patsubst $(BASEDIR)/%,%,$(CURDIR))
 
-%.o: %.c Makefile
+quiet_cmd_cc_o_c = CC      $@
 ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y)
-	$(CC) $(c_flags) -c $< -o $(@D)/.$(@F).tmp -MQ $@
-ifeq ($(CONFIG_CC_IS_CLANG),y)
-	$(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(@D)/.$(@F).tmp $@
-else
-	$(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(@D)/.$(@F).tmp $@
-endif
-	rm -f $(@D)/.$(@F).tmp
+    cmd_cc_o_c = $(CC) $(c_flags) -c $< -o $(dot-target).tmp -MQ $@
+    ifeq ($(CONFIG_CC_IS_CLANG),y)
+        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(dot-target).tmp $@
+    else
+        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(dot-target).tmp $@
+    endif
+    cmd_objcopy_fix_sym += && rm -f $(dot-target).tmp
 else
-	$(CC) $(c_flags) -c $< -o $@
+    cmd_cc_o_c = $(CC) $(c_flags) -c $< -o $@
 endif
 
+define rule_cc_o_c
+    $(call cmd_and_record,cc_o_c)
+    $(call cmd,objcopy_fix_sym)
+endef
+
+%.o: %.c FORCE
+	$(call if_changed_rule,cc_o_c)
+
 quiet_cmd_cc_o_S = CC      $@
 cmd_cc_o_S = $(CC) $(a_flags) -c $< -o $@
 
Signature · 1 line
Anthony PERARD
#8 lore raw

PATCH v7 4/51 build: factorise generation of the linker scripts

In reply to 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 eaf770414305..3f61682ceab7 100644
@@ -255,6 +255,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 3d3b97b5b440..0edd9dee6f49 100644
@@ -66,6 +66,8 @@ obj-y += vpsci.o
 obj-y += vuart.o
 extra-y += $(TARGET_SUBARCH)/head.o
 
+extra-y += xen.lds
+
 #obj-bin-y += ....o
 
 ifneq ($(CONFIG_DTB_FILE),"")
@@ -133,8 +135,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 462472215c91..929227f5a3ac 100644
@@ -79,6 +79,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
@@ -239,6 +240,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)"
@@ -291,8 +293,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
#9 lore raw

Re: [XEN PATCH v7 04/51] build: factorise generation of the linker scripts

(dropping most CC)

Quoted 6 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.

Quoted 6 lines

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.

Hi Julian,

Could you give a Ack to this patch? I think it only misses an ack from Arm maintainers.

And if you don't mind, could you commit it with the two other arm patch that are ready?

- build,arm: move LDFLAGS change to arch.mk
( you proposed to edit the commit message before committing )
- build: avoid building arm/arm/*/head.o twice

Cheers,

Quoted 45 lines
---
 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 eaf770414305..3f61682ceab7 100644
@@ -255,6 +255,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 3d3b97b5b440..0edd9dee6f49 100644
@@ -66,6 +66,8 @@ obj-y += vpsci.o
 obj-y += vuart.o
 extra-y += $(TARGET_SUBARCH)/head.o
 
+extra-y += xen.lds
+
 #obj-bin-y += ....o
 
 ifneq ($(CONFIG_DTB_FILE),"")
@@ -133,8 +135,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))
 
Signature · 1 line
Anthony PERARD
#10 lore raw

PATCH v7 5/51 x86/mm: avoid building multiple .o from a single .c file

In reply to Anthony PERARD

This replace the use of a single .c file use for multiple .o file by creating multiple .c file including the first one.

There's quite a few issues with trying to build more than one object file from a single source file: there's is a duplication of the make rules to generate those targets; there is an additional ".file" symbol added in order to differentiate between the object files; and the tools/symbols have an heuristic to try to pick up the right ".file".

This patch adds new .c source file which avoid the need to add a second ".file" symbol and thus avoid the need to deal with those issues.

Also remove __OBJECT_FILE__ from $(CC) command line as it isn't used anywhere anymore. And remove the macro "build-intermediate" since the generic rules for single targets can be used.

And rename the objects in mm/hap/ to remove the extra "level".

---

Notes:
v7:
- rename hap/guest_walk_${level}level.c to hap/guest_walk_${level}.c

v6:
- new patch
to replace both from v5:
xen,symbols: rework file symbols selection
build: use if_changed to build mm/*/guest_%.o

The changes in the patch for symbols.c was too complicated to explain, and I probably didn't realize one important fact about the tool: it deal with all *.o been concatenated to each other, without a way to figure out which symbol belong to which original file, and certainly no way to figure out if there's more than one ".file" symbol to choose from beside some fragile heuristic.

 xen/Makefile                       | 11 -----------
 xen/Rules.mk                       |  2 +-
 xen/arch/x86/mm/Makefile           |  9 ---------
 xen/arch/x86/mm/guest_walk.c       |  3 ---
 xen/arch/x86/mm/guest_walk_2.c     |  2 ++
 xen/arch/x86/mm/guest_walk_3.c     |  2 ++
 xen/arch/x86/mm/guest_walk_4.c     |  2 ++
 xen/arch/x86/mm/hap/Makefile       | 15 +++------------
 xen/arch/x86/mm/hap/guest_walk.c   |  3 ---
 xen/arch/x86/mm/hap/guest_walk_2.c |  2 ++
 xen/arch/x86/mm/hap/guest_walk_3.c |  2 ++
 xen/arch/x86/mm/hap/guest_walk_4.c |  2 ++
 xen/arch/x86/mm/shadow/Makefile    |  9 ---------
 xen/arch/x86/mm/shadow/guest_2.c   |  2 ++
 xen/arch/x86/mm/shadow/guest_3.c   |  2 ++
 xen/arch/x86/mm/shadow/guest_4.c   |  2 ++
 xen/arch/x86/mm/shadow/multi.c     |  3 ---
 xen/tools/symbols.c                | 18 ++----------------
 18 files changed, 24 insertions(+), 67 deletions(-)
 create mode 100644 xen/arch/x86/mm/guest_walk_2.c
 create mode 100644 xen/arch/x86/mm/guest_walk_3.c
 create mode 100644 xen/arch/x86/mm/guest_walk_4.c
 create mode 100644 xen/arch/x86/mm/hap/guest_walk_2.c
 create mode 100644 xen/arch/x86/mm/hap/guest_walk_3.c
 create mode 100644 xen/arch/x86/mm/hap/guest_walk_4.c
 create mode 100644 xen/arch/x86/mm/shadow/guest_2.c
 create mode 100644 xen/arch/x86/mm/shadow/guest_3.c
 create mode 100644 xen/arch/x86/mm/shadow/guest_4.c
xen/Makefile +0 -11
index 4ceb02d37441..f35a4d84f7cd 100644
@@ -482,17 +482,6 @@ _MAP:
 %/: FORCE
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o built_in_bin.o
 
-build-intermediate = $(eval $(call build-intermediate-closure,$(1)))
-define build-intermediate-closure
-$(1): FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $$(@D) $$(@F)
-endef
-
-$(foreach base,arch/x86/mm/guest_walk_% \
-               arch/x86/mm/hap/guest_walk_%level \
-               arch/x86/mm/shadow/guest_%, \
-    $(foreach ext,o i s,$(call build-intermediate,$(base).$(ext))))
-
 .PHONY: cloc
 cloc:
 	$(eval tmpfile := $(shell mktemp))
xen/Rules.mk +1 -1
index 3f61682ceab7..48ae519d0153 100644
@@ -139,7 +139,7 @@ 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) '-D__OBJECT_FILE__="$@"'
+c_flags = -MMD -MP -MF $(@D)/.$(@F).d $(XEN_CFLAGS)
 a_flags = -MMD -MP -MF $(@D)/.$(@F).d $(XEN_AFLAGS)
 
 include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
xen/arch/x86/mm/Makefile +0 -9
index 2818c066f76a..6b7882d992bb 100644
@@ -10,12 +10,3 @@ obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
 obj-y += p2m.o
 obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o p2m-pt.o
 obj-y += paging.o
-
-guest_walk_%.o: guest_walk.c Makefile
-	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
-
-guest_walk_%.i: guest_walk.c Makefile
-	$(CPP) $(call cpp_flags,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
-
-guest_walk_%.s: guest_walk.c Makefile
-	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
xen/arch/x86/mm/guest_walk.c +0 -3
index 30d83cf1e0e6..b9f607272c39 100644
@@ -21,9 +21,6 @@
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* Allow uniquely identifying static symbols in the 3 generated objects. */
-asm(".file \"" __OBJECT_FILE__ "\"");
-
 #include <xen/types.h>
 #include <xen/mm.h>
 #include <xen/paging.h>
xen/arch/x86/mm/guest_walk_2.c new file +2 -0
new file mode 100644
index 000000000000..defcd59bc260
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 2
+#include "guest_walk.c"
xen/arch/x86/mm/guest_walk_3.c new file +2 -0
new file mode 100644
index 000000000000..1c9eca37741e
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 3
+#include "guest_walk.c"
xen/arch/x86/mm/guest_walk_4.c new file +2 -0
new file mode 100644
index 000000000000..aa3900338a2d
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 4
+#include "guest_walk.c"
xen/arch/x86/mm/hap/Makefile +3 -12
index c6d296b51720..8ef54b1faa50 100644
@@ -1,15 +1,6 @@
 obj-y += hap.o
-obj-y += guest_walk_2level.o
-obj-y += guest_walk_3level.o
-obj-y += guest_walk_4level.o
+obj-y += guest_walk_2.o
+obj-y += guest_walk_3.o
+obj-y += guest_walk_4.o
 obj-y += nested_hap.o
 obj-y += nested_ept.o
-
-guest_walk_%level.o: guest_walk.c Makefile
-	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
-
-guest_walk_%level.i: guest_walk.c Makefile
-	$(CPP) $(call cpp_flags,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
-
-guest_walk_%level.s: guest_walk.c Makefile
-	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
xen/arch/x86/mm/hap/guest_walk.c +0 -3
index f59ebc84a290..832a8058471e 100644
@@ -18,9 +18,6 @@
  * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* Allow uniquely identifying static symbols in the 3 generated objects. */
-asm(".file \"" __OBJECT_FILE__ "\"");
-
 #include <xen/domain_page.h>
 #include <xen/paging.h>
 #include <xen/sched.h>
xen/arch/x86/mm/hap/guest_walk_2.c new file +2 -0
new file mode 100644
index 000000000000..defcd59bc260
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 2
+#include "guest_walk.c"
xen/arch/x86/mm/hap/guest_walk_3.c new file +2 -0
new file mode 100644
index 000000000000..1c9eca37741e
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 3
+#include "guest_walk.c"
xen/arch/x86/mm/hap/guest_walk_4.c new file +2 -0
new file mode 100644
index 000000000000..aa3900338a2d
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 4
+#include "guest_walk.c"
xen/arch/x86/mm/shadow/Makefile +0 -9
index fd64b4dda925..b4a1620b6920 100644
@@ -5,12 +5,3 @@ obj-$(CONFIG_PV) += pv.o guest_4.o
 else
 obj-y += none.o
 endif
-
-guest_%.o: multi.c Makefile
-	$(CC) $(c_flags) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
-
-guest_%.i: multi.c Makefile
-	$(CPP) $(call cpp_flags,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -c $< -o $@
-
-guest_%.s: multi.c Makefile
-	$(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -DGUEST_PAGING_LEVELS=$* -S $< -o $@
xen/arch/x86/mm/shadow/guest_2.c new file +2 -0
new file mode 100644
index 000000000000..288b229982b0
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 2
+#include "multi.c"
xen/arch/x86/mm/shadow/guest_3.c new file +2 -0
new file mode 100644
index 000000000000..04e17b0b8adc
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 3
+#include "multi.c"
xen/arch/x86/mm/shadow/guest_4.c new file +2 -0
new file mode 100644
index 000000000000..c0c5d3cb11ad
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 4
+#include "multi.c"
xen/arch/x86/mm/shadow/multi.c +0 -3
index 8bb028c2e2fa..7207fcf9e75f 100644
@@ -20,9 +20,6 @@
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-/* Allow uniquely identifying static symbols in the 3 generated objects. */
-asm(".file \"" __OBJECT_FILE__ "\"");
-
 #include <xen/types.h>
 #include <xen/mm.h>
 #include <xen/trace.h>
xen/tools/symbols.c +2 -16
index 0b124526165d..710e9785d348 100644
@@ -84,7 +84,6 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 {
 	char str[500], type[20] = "";
 	char *sym, stype;
-	static enum { symbol, single_source, multi_source } last;
 	static char *filename;
 	int rc = -1;
 
@@ -118,24 +117,11 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 	      */
 	     input_format == fmt_sysv && !*type && stype == '?' && sym &&
 	     sym[1] && strchr("cSsoh", sym[1]) && !sym[2])) {
-		/*
-		 * gas prior to binutils commit fbdf9406b0 (expected to appear
-		 * in 2.27) outputs symbol table entries resulting from .file
-		 * in reverse order. If we get two consecutive file symbols,
-		 * prefer the first one if that names an object file or has a
-		 * directory component (to cover multiply compiled files).
-		 */
-		bool multi = strchr(str, '/') || (sym && sym[1] == 'o');
-
-		if (multi || last != multi_source) {
-			free(filename);
-			filename = *str ? strdup(str) : NULL;
-		}
-		last = multi ? multi_source : single_source;
+		free(filename);
+		filename = *str ? strdup(str) : NULL;
 		goto skip_tail;
 	}
 
-	last = symbol;
 	rc = -1;
 
 	sym = str;
Signature · 1 line
Anthony PERARD
#11 lore raw

Re: [XEN PATCH v7 05/51] x86/mm: avoid building multiple .o from a single .c file

Quoted 13 lines · Anthony PERARD

This replace the use of a single .c file use for multiple .o file by creating multiple .c file including the first one.

There's quite a few issues with trying to build more than one object file from a single source file: there's is a duplication of the make rules to generate those targets; there is an additional ".file" symbol added in order to differentiate between the object files; and the tools/symbols have an heuristic to try to pick up the right ".file".

This patch adds new .c source file which avoid the need to add a second ".file" symbol and thus avoid the need to deal with those issues.

Quoted 8 lines

Also remove __OBJECT_FILE__ from $(CC) command line as it isn't used anywhere anymore. And remove the macro "build-intermediate" since the generic rules for single targets can be used.

And rename the objects in mm/hap/ to remove the extra "level".

Hmm, when replying to 00/51 I didn't recall I gave an R-b for this one already. I'd like to restrict it some: It should be taken to stand for the technical correctness of the change. Nevertheless I'm not really happy with the introduction of the various tiny source files. I've meanwhile been wondering: Can't these be generated (in the build tree, as soon as that's possible to be separate) rather than getting put in the repo?

Jan

#12 lore raw

Re: [XEN PATCH v7 05/51] x86/mm: avoid building multiple .o from a single .c file

Quoted 23 lines · Jan Beulich
Quoted 13 lines · Anthony PERARD

This replace the use of a single .c file use for multiple .o file by creating multiple .c file including the first one.

There's quite a few issues with trying to build more than one object file from a single source file: there's is a duplication of the make rules to generate those targets; there is an additional ".file" symbol added in order to differentiate between the object files; and the tools/symbols have an heuristic to try to pick up the right ".file".

This patch adds new .c source file which avoid the need to add a second ".file" symbol and thus avoid the need to deal with those issues.

Quoted 8 lines

Also remove __OBJECT_FILE__ from $(CC) command line as it isn't used anywhere anymore. And remove the macro "build-intermediate" since the generic rules for single targets can be used.

And rename the objects in mm/hap/ to remove the extra "level".

Quoted 7 lines

Hmm, when replying to 00/51 I didn't recall I gave an R-b for this one already. I'd like to restrict it some: It should be taken to stand for the technical correctness of the change. Nevertheless I'm not really happy with the introduction of the various tiny source files. I've meanwhile been wondering: Can't these be generated (in the build tree, as soon as that's possible to be separate) rather than getting put in the repo?

Do we really need to generated those never to be change tiny source file? Do we really need to make the build system a lot more complicated?

With those tiny source file in a different directory to the main source file, we need to add "-I" to CFLAGS. (source tree vs build tree.)

I don't like preparation phase, I'd rather do just-in-time generation of those tiny file (if we really have too...) as to let make organize itself on when to do things. That mean, extra targets on how to generate the files, and telling make that those would be intermediate target shouldn't be deleted to avoid the final object from been regenerated over and over again (I'm not sure why the rebuild of tiny source file happen when they are intermediate, maybe because FORCE prerequisite on %.o).

Can't we commit this patch as is? What kind of issue is there with those tiny source files? Should we add a warning in those tiny source files, something like "No modification of this file allowed, it's part of the build system." ?

Thanks,

Signature · 1 line
Anthony PERARD
#13 lore raw

Re: [XEN PATCH v7 05/51] x86/mm: avoid building multiple .o from a single .c file

Anthony PERARD writes ("Re: [XEN PATCH v7 05/51] x86/mm: avoid building multiple .o from a single .c file"):

Quoted 11 lines · Jan Beulich
Quoted 7 lines

Hmm, when replying to 00/51 I didn't recall I gave an R-b for this one already. I'd like to restrict it some: It should be taken to stand for the technical correctness of the change. Nevertheless I'm not really happy with the introduction of the various tiny source files. I've meanwhile been wondering: Can't these be generated (in the build tree, as soon as that's possible to be separate) rather than getting put in the repo?

Do we really need to generated those never to be change tiny source file? Do we really need to make the build system a lot more complicated?

I'm not an x86 maintainer, but my 2p anyway:

I think the handful of tiny source files is probably better than some contraption in the build system. Much less risk of something funny and confusing going on.

We could reduce the number of copies of the same text by making the copies of guest_walk*.c in hap/ be symlinks to ../guest_walk*.c.

Quoted 4 lines

Can't we commit this patch as is? What kind of issue is there with those tiny source files? Should we add a warning in those tiny source files, something like "No modification of this file allowed, it's part of the build system." ?

I don't think we need any such warning. No-one is going to take that tiny file and try to edit it to put functionality in it, and if they do it will be spotted on review.

Thanks,
Ian.

#14 lore raw

Re: [XEN PATCH v7 05/51] x86/mm: avoid building multiple .o from a single .c file

Quoted 9 lines · Ian Jackson

Anthony PERARD writes ("Re: [XEN PATCH v7 05/51] x86/mm: avoid building multiple .o from a single .c file"):

Quoted 8 lines · Jan Beulich
Quoted 7 lines

Hmm, when replying to 00/51 I didn't recall I gave an R-b for this one already. I'd like to restrict it some: It should be taken to stand for the technical correctness of the change. Nevertheless I'm not really happy with the introduction of the various tiny source files. I've meanwhile been wondering: Can't these be generated (in the build tree, as soon as that's possible to be separate) rather than getting put in the repo?

Quoted 7 lines
Quoted 2 lines

Do we really need to generated those never to be change tiny source file? Do we really need to make the build system a lot more complicated?

I'm not an x86 maintainer, but my 2p anyway:

I think the handful of tiny source files is probably better than some contraption in the build system. Much less risk of something funny and confusing going on.

I agree.  This patch is definitely an improvement on the status quo.

Quoted 2 lines

We could reduce the number of copies of the same text by making the copies of guest_walk*.c in hap/ be symlinks to ../guest_walk*.c.

The two guest_walk's are totally different logic.  Adding a symlink would be reintroducing "something funny and confusing".

Quoted 8 lines
Quoted 5 lines

Can't we commit this patch as is? What kind of issue is there with those tiny source files? Should we add a warning in those tiny source files, something like "No modification of this file allowed, it's part of the build system." ?

I don't think we need any such warning. No-one is going to take that tiny file and try to edit it to put functionality in it, and if they do it will be spotted on review.

Agreed.

FTR, this patch is Reviewed-by: Andrew Cooper <[email protected]> and fit to be committed.

#15 lore raw

Re: [XEN PATCH v7 05/51] x86/mm: avoid building multiple .o from a single .c file

In reply to Anthony PERARD
Quoted 47 lines · Anthony PERARD
Quoted 23 lines · Jan Beulich
Quoted 13 lines · Anthony PERARD

This replace the use of a single .c file use for multiple .o file by creating multiple .c file including the first one.

There's quite a few issues with trying to build more than one object file from a single source file: there's is a duplication of the make rules to generate those targets; there is an additional ".file" symbol added in order to differentiate between the object files; and the tools/symbols have an heuristic to try to pick up the right ".file".

This patch adds new .c source file which avoid the need to add a second ".file" symbol and thus avoid the need to deal with those issues.

Quoted 8 lines

Also remove __OBJECT_FILE__ from $(CC) command line as it isn't used anywhere anymore. And remove the macro "build-intermediate" since the generic rules for single targets can be used.

And rename the objects in mm/hap/ to remove the extra "level".

Quoted 7 lines

Hmm, when replying to 00/51 I didn't recall I gave an R-b for this one already. I'd like to restrict it some: It should be taken to stand for the technical correctness of the change. Nevertheless I'm not really happy with the introduction of the various tiny source files. I've meanwhile been wondering: Can't these be generated (in the build tree, as soon as that's possible to be separate) rather than getting put in the repo?

Do we really need to generated those never to be change tiny source file? Do we really need to make the build system a lot more complicated?

With those tiny source file in a different directory to the main source file, we need to add "-I" to CFLAGS. (source tree vs build tree.)

I don't like preparation phase, I'd rather do just-in-time generation of those tiny file (if we really have too...) as to let make organize itself on when to do things. That mean, extra targets on how to generate the files, and telling make that those would be intermediate target shouldn't be deleted to avoid the final object from been regenerated over and over again (I'm not sure why the rebuild of tiny source file happen when they are intermediate, maybe because FORCE prerequisite on %.o).

Quoted 1 line

Can't we commit this patch as is?

I'll consider another time.

Quoted 1 line

What kind of issue is there with those tiny source files?

To me they're ugly and their presence is at least mildly confusing. And apparently I'm not the only one thinking that way, or else such tiny stubs would have been put there right when introducing these multiply built sources.

Quoted 3 lines

Should we add a warning in those tiny source files, something like "No modification of this file allowed, it's part of the build system." ?

Not sure this would make much of a difference. Them getting touched later on is not a primary concern of mine. In fact once they're there, I don't see why they couldn't be extended. At least in shadow code there might be functions which could live there, reducing #ifdef-ary.

Jan

#16 lore raw

Re: [XEN PATCH v7 05/51] x86/mm: avoid building multiple .o from a single .c file

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

What kind of issue is there with those tiny source files?

To me they're ugly and their presence is at least mildly confusing. And apparently I'm not the only one thinking that way, or else such tiny stubs would have been put there right when introducing these multiply built sources.

Well, at the time when this was introduced, tools/symbols didn't exist, so avoiding the stubs might have been ok by then, but it meant to duplicated %.o:%.c rules in the Makefile...

Now, we have tools/symbols, a hack put into the source file to add a ".file instruction", a heuristic in tools/symbols to pick up the ".file" we want, and a workaround to change in behavior of binutils.

This is a lot of complexity to avoid introducing those extra source files... complexity that were needed to by added _after_ the initial introduction of multiply built sources, due to changes in the build system.

My patches have attempted to remove all the complexity, and having ugly small source files is the price to pay. And you want to add back some complexity in the build system just to avoid those tiny files? I mean hypervisor and build system are complex software to write, do we really need to add complexity at every opportunity?

Signature · 1 line
Anthony PERARD
#17 lore raw

PATCH v7 6/51 build,include: rework compat-build-source.py

In reply to Anthony PERARD

Improvement are:
- give the path to xlat.lst as argument
- include grep -v in compat-build-source.py script, we don't need to write this in several scripted language.

No changes in final compat/%.h headers.

---

Notes:
v7:
- actually keep the dependency on Makefile

v6:
- remove dependency on Makefile as it's not needed anymore

v5:
- removed "have 'xlat.lst' path as a variable" from the patch.

v4:
- new patch

 xen/include/Makefile             | 3 +--
 xen/tools/compat-build-source.py | 8 +++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)
xen/include/Makefile +1 -2
index c8ca97eed0fc..4fa10e68f997 100644
@@ -61,8 +61,7 @@ compat/%.i: compat/%.c Makefile
 
 compat/%.c: public/%.h xlat.lst Makefile $(BASEDIR)/tools/compat-build-source.py
 	mkdir -p $(@D)
-	grep -v 'DEFINE_XEN_GUEST_HANDLE(long)' $< | \
-	$(PYTHON) $(BASEDIR)/tools/compat-build-source.py >[email protected]
+	$(PYTHON) $(BASEDIR)/tools/compat-build-source.py xlat.lst <$< >[email protected]
 	mv -f [email protected] $@
 
 compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst $(BASEDIR)/tools/get-fields.sh Makefile
xen/tools/compat-build-source.py +7 -1
index 2bcaf27d05a3..274d6917ab7f 100755
@@ -13,7 +13,11 @@ pats = [
  [ r"XEN_GUEST_HANDLE", r"COMPAT_HANDLE" ],
 ];
 
-xlatf = open('xlat.lst', 'r')
+try:
+    xlatf = open(sys.argv[1], 'r')
+except IndexError:
+    print('missing path to xlat.lst argument')
+    sys.exit(1)
 for line in xlatf.readlines():
     match = re.subn(r"^\s*\?\s+(\w*)\s.*", r"\1", line.rstrip())
     if match[1]:
@@ -25,6 +29,8 @@ for pat in pats:
     pat[0] = re.compile(pat[0])
 
 for line in sys.stdin.readlines():
+    if 'DEFINE_XEN_GUEST_HANDLE(long)' in line:
+        continue
     for pat in pats:
         line = re.sub(pat[0], pat[1], line)
     print(line.rstrip())
Signature · 1 line
Anthony PERARD
#18 lore raw

PATCH v7 7/51 build,include: rework compat-build-header.py

In reply to Anthony PERARD

Replace a mix of shell script and python script by all python script.

No change to the final generated headers.

---

Notes:
v7:
- actually keep the dependency on Makefile

v6:
- removed handling of $(prefix-y) and $(suffix-y), they've been removed.
- remove dependency on Makefile as it's not needed anymore
- rebased

v5:
- Removed -P from CPP when generating compat/%.i
-> keep removing linemarkers and keep de-duplicating empty lines. So that all the blank line that currently exist in the generated headers stays in place.

v4:
- new patch

 xen/include/Makefile             |  9 +------
 xen/tools/compat-build-header.py | 44 ++++++++++++++++++++++++++++++--
 2 files changed, 43 insertions(+), 10 deletions(-)
xen/include/Makefile +1 -8
index 4fa10e68f997..95daa8a28975 100644
@@ -46,14 +46,7 @@ public-$(CONFIG_ARM) := $(wildcard public/arch-arm/*.h public/arch-arm/*/*.h)
 all: $(headers-y)
 
 compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-build-header.py
-	set -e; id=_$$(echo $@ | tr '[:lower:]-/.' '[:upper:]___'); \
-	echo "#ifndef $$id" >[email protected]; \
-	echo "#define $$id" >>[email protected]; \
-	echo "#include <xen/compat.h>" >>[email protected]; \
-	$(if $(filter-out compat/arch-%.h,$@),echo "#include <$(patsubst compat/%,public/%,$@)>" >>[email protected];) \
-	grep -v '^# [0-9]' $< | \
-	$(PYTHON) $(BASEDIR)/tools/compat-build-header.py | uniq >>[email protected]; \
-	echo "#endif /* $$id */" >>[email protected]
+	$(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $@ >>[email protected]; \
 	mv -f [email protected] $@
 
 compat/%.i: compat/%.c Makefile
xen/tools/compat-build-header.py +42 -2

55 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
#19 lore raw

PATCH v7 8/51 build: fix clean targets when subdir-y is used

In reply to Anthony PERARD

The make variable $(subdir-y) isn't used yet but will be in a following patch. Anything in $(subdir-y) doesn't to have a '/' as suffix as we already now it's a directory.

Rework the rules so that it doesn't matter whether there is a '/' or not. It also mimic more closely to the way Linux's Kbuild descend in subdirectories.

FORCE phony target isn't needed anymore running clean, so it can be removed.

---
 xen/scripts/Makefile.clean | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
xen/scripts/Makefile.clean +6 -7
index 53379e6102cc..027c200c0efc 100644
@@ -12,19 +12,18 @@ include Makefile
 # Figure out what we need to clean from the various variables
 # ==========================================================================
 subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
-              $(filter %/, $(obj-y) $(obj-n) $(obj-))
+              $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
 
 DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
 .PHONY: clean
-clean:: $(addprefix _clean_, $(subdir-all))
+clean:: $(subdir-all)
 	rm -f *.o .*.o.tmp *~ core $(DEPS_RM)
 
 # Descending
 # ---------------------------------------------------------------------------
 
-_clean_%/: FORCE
-	$(MAKE) $(clean) $*
+PHONY += $(subdir-all)
+$(subdir-all):
+	$(MAKE) $(clean) $@
 
-# Force execution of pattern rules (for which PHONY cannot be directly used).
-.PHONY: FORCE
-FORCE:
+.PHONY: $(PHONY)
Signature · 1 line
Anthony PERARD
#20 lore raw

PATCH v7 9/51 build: use subdir-y in test/Makefile

In reply to Anthony PERARD

This allows Makefile.clean to recurse into livepatch without help.

---
 xen/test/Makefile | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
xen/test/Makefile +2 -7
index aaa499664396..41e4d7bdb78b 100644
@@ -4,15 +4,10 @@ tests all: build
 
 ifneq ($(XEN_TARGET_ARCH),x86_32)
 # Xen 32-bit x86 hypervisor no longer supported, so has no test livepatches
-SUBDIRS += livepatch
+subdir-y += livepatch
 endif
 
 install build subtree-force-update uninstall: %:
-	set -e; for s in $(SUBDIRS); do \
+	set -e; for s in $(subdir-y); do \
 		$(MAKE) -f $(BASEDIR)/Rules.mk -C $$s $*; \
 	done
-
-clean::
-	set -e; for s in $(SUBDIRS); do \
-		$(MAKE) -f $(BASEDIR)/Rules.mk -C $$s $@; \
-	done
Signature · 1 line
Anthony PERARD
#22 lore raw

PATCH v7 10/51 build,arm: move LDFLAGS change to arch.mk

In reply to Anthony PERARD
---
 xen/arch/arm/Makefile | 8 --------
 xen/arch/arm/arch.mk  | 8 ++++++++
 2 files changed, 8 insertions(+), 8 deletions(-)
xen/arch/arm/Makefile +0 -8
index 0edd9dee6f49..3d0af8ebc93c 100644
@@ -104,14 +104,6 @@ prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
 	$(call if_changed,ld)
 endif
 
-ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
-    ifeq ($(call ld-option, --fix-cortex-a53-843419),n)
-        $(warning ld does not support --fix-cortex-a53-843419; xen may be susceptible to erratum)
-    else
-        XEN_LDFLAGS += --fix-cortex-a53-843419
-    endif
-endif
-
 targets += prelink.o
 
 $(TARGET)-syms: prelink.o xen.lds
xen/arch/arm/arch.mk +8 -0
index 11caec86ba14..6a2982059486 100644
@@ -17,3 +17,11 @@ $(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
 ifneq ($(filter command line environment,$(origin CONFIG_EARLY_PRINTK)),)
     $(error You must use 'make menuconfig' to enable/disable early printk now)
 endif
+
+ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
+    ifeq ($(call ld-option, --fix-cortex-a53-843419),n)
+        $(warning ld does not support --fix-cortex-a53-843419; xen may be susceptible to erratum)
+    else
+        LDFLAGS += --fix-cortex-a53-843419
+    endif
+endif
Signature · 1 line
Anthony PERARD
#23 lore raw

Re: [XEN PATCH v7 10/51] build,arm: move LDFLAGS change to arch.mk

Hi Anthony,

Can you explain why this is moved?

Cheers,

Quoted 42 lines · Anthony PERARD
---
  xen/arch/arm/Makefile | 8 --------
  xen/arch/arm/arch.mk  | 8 ++++++++
  2 files changed, 8 insertions(+), 8 deletions(-)
xen/arch/arm/Makefile +0 -8
index 0edd9dee6f49..3d0af8ebc93c 100644
@@ -104,14 +104,6 @@ prelink.o: $(ALL_OBJS) $(ALL_LIBS) FORCE
  	$(call if_changed,ld)
  endif
 
-ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
-    ifeq ($(call ld-option, --fix-cortex-a53-843419),n)
-        $(warning ld does not support --fix-cortex-a53-843419; xen may be susceptible to erratum)
-    else
-        XEN_LDFLAGS += --fix-cortex-a53-843419
-    endif
-endif
-
  targets += prelink.o
 
  $(TARGET)-syms: prelink.o xen.lds
xen/arch/arm/arch.mk +8 -0
index 11caec86ba14..6a2982059486 100644
@@ -17,3 +17,11 @@ $(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
  ifneq ($(filter command line environment,$(origin CONFIG_EARLY_PRINTK)),)
      $(error You must use 'make menuconfig' to enable/disable early printk now)
  endif
+
+ifeq ($(CONFIG_ARM64_ERRATUM_843419),y)
+    ifeq ($(call ld-option, --fix-cortex-a53-843419),n)
+        $(warning ld does not support --fix-cortex-a53-843419; xen may be susceptible to erratum)
+    else
+        LDFLAGS += --fix-cortex-a53-843419
+    endif
+endif
Signature · 1 line
Julien Grall
#24 lore raw

Re: [XEN PATCH v7 10/51] build,arm: move LDFLAGS change to arch.mk

Quoted 3 lines · Julien Grall

Hi Anthony,

Can you explain why this is moved?

Well, it was in the wrong place, it is best to avoid making changes to XEN_CFLAGS or XEN_LDFLAGS in Makefile in subdirectories as those are exported variable and may not work as expected. They may or may not change *flags in subdirectories, or in the case of arch/*/Makefile, they might changes *flags in the other directories or not depending on whether one try to build "xen" or just "common/".

But more importantly, with patch
build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile
make isn't going to load arch/*/Makefile before building the rest of xen, and thus changes to XEN_LDFLAGS will only apply to arch/*/Makefile rather than for all objects. (XEN_LDFLAGS is used with all built_in.o and few other places like for libfdt-temp.o)

If you want an explanation in the commit message, maybe this one will do:
Changes to XEN_LDFLAGS may or may not apply to targets in for example "common/" depending on whether one runs make or make common/.

But arch.mk is loaded before doing any build, so changes to LDFLAGS there mean that the value of XEN_LDFLAGS won't depends on the initial target.

Thanks,

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

Re: [XEN PATCH v7 10/51] build,arm: move LDFLAGS change to arch.mk

Hi Anthony,

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

Hi Anthony,

Can you explain why this is moved?

Well, it was in the wrong place, it is best to avoid making changes to XEN_CFLAGS or XEN_LDFLAGS in Makefile in subdirectories as those are exported variable and may not work as expected. They may or may not change *flags in subdirectories, or in the case of arch/*/Makefile, they might changes *flags in the other directories or not depending on whether one try to build "xen" or just "common/".

Quoted 6 lines

But more importantly, with patch
build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile
make isn't going to load arch/*/Makefile before building the rest of xen, and thus changes to XEN_LDFLAGS will only apply to arch/*/Makefile rather than for all objects. (XEN_LDFLAGS is used with all built_in.o and few other places like for libfdt-temp.o)

Thanks for the explanation. That makes sense.

Quoted 10 lines

If you want an explanation in the commit message, maybe this one will do:
Changes to XEN_LDFLAGS may or may not apply to targets in for example "common/" depending on whether one runs make or make common/.

But arch.mk is loaded before doing any build, so changes to LDFLAGS there mean that the value of XEN_LDFLAGS won't depends on the initial target.

An explanation in the commit message would be useful. This one you provided looks good. So:

Can it be merged before the previous patch? If so, I can update the commit message and commit it.

Cheers,

Signature · 1 line
Julien Grall
#26 lore raw

Re: [XEN PATCH v7 10/51] build,arm: move LDFLAGS change to arch.mk

Quoted 11 lines · Julien Grall

Hi Anthony,

Quoted 7 lines · Anthony PERARD

Changes to XEN_LDFLAGS may or may not apply to targets in for example "common/" depending on whether one runs make or make common/.

But arch.mk is loaded before doing any build, so changes to LDFLAGS there mean that the value of XEN_LDFLAGS won't depends on the initial target.

Quoted 7 lines

An explanation in the commit message would be useful. This one you provided looks good. So:

Can it be merged before the previous patch? If so, I can update the commit message and commit it.

Yes, that should be fine, thanks!

Signature · 1 line
Anthony PERARD
#27 lore raw

PATCH v7 11/51 build: move make option changes check earlier

In reply to Anthony PERARD

And thus avoiding checking for those variable over and over again.

Also, add "e.g." in the error messages to hint that "menuconfig" isn't the only way.

---

Notes:
v7:
- Add "e.g." into the error message to hint that menuconfig isn't the only way.

 xen/Makefile | 22 ++++++++++++++++++++++
 xen/Rules.mk | 22 ----------------------
 2 files changed, 22 insertions(+), 22 deletions(-)
xen/Makefile +22 -0
index f35a4d84f7cd..2c56546cd1dc 100644
@@ -56,6 +56,28 @@ include scripts/Kbuild.include
 ifneq ($(root-make-done),y)
 # section to run before calling Rules.mk, but only once.
 
+ifneq ($(origin crash_debug),undefined)
+$(error "You must use e.g. 'make menuconfig' to enable/disable crash_debug now.")
+endif
+ifeq ($(origin debug),command line)
+$(warning "You must use e.g. 'make menuconfig' to enable/disable debug now.")
+endif
+ifneq ($(origin frame_pointer),undefined)
+$(error "You must use e.g. 'make menuconfig' to enable/disable frame_pointer now.")
+endif
+ifneq ($(origin kexec),undefined)
+$(error "You must use e.g. 'make menuconfig' to enable/disable kexec now.")
+endif
+ifneq ($(origin lock_profile),undefined)
+$(error "You must use e.g. 'make menuconfig' to enable/disable lock_profile now.")
+endif
+ifneq ($(origin perfc),undefined)
+$(error "You must use e.g. 'make menuconfig' to enable/disable perfc now.")
+endif
+ifneq ($(origin verbose),undefined)
+$(error "You must use e.g. 'make menuconfig' to enable/disable verbose now.")
+endif
+
 # Beautify output
 # ---------------------------------------------------------------------------
 #
xen/Rules.mk +0 -22
index 48ae519d0153..c313486ce0f6 100644
@@ -9,28 +9,6 @@ include $(XEN_ROOT)/Config.mk
 include $(BASEDIR)/scripts/Kbuild.include
 
 
-ifneq ($(origin crash_debug),undefined)
-$(error "You must use 'make menuconfig' to enable/disable crash_debug now.")
-endif
-ifeq ($(origin debug),command line)
-$(warning "You must use 'make menuconfig' to enable/disable debug now.")
-endif
-ifneq ($(origin frame_pointer),undefined)
-$(error "You must use 'make menuconfig' to enable/disable frame_pointer now.")
-endif
-ifneq ($(origin kexec),undefined)
-$(error "You must use 'make menuconfig' to enable/disable kexec now.")
-endif
-ifneq ($(origin lock_profile),undefined)
-$(error "You must use 'make menuconfig' to enable/disable lock_profile now.")
-endif
-ifneq ($(origin perfc),undefined)
-$(error "You must use 'make menuconfig' to enable/disable perfc now.")
-endif
-ifneq ($(origin verbose),undefined)
-$(error "You must use 'make menuconfig' to enable/disable verbose now.")
-endif
-
 TARGET := $(BASEDIR)/xen
 
 # Note that link order matters!
Signature · 1 line
Anthony PERARD
#28 lore raw

PATCH v7 12/51 build: avoid building arm/arm/*/head.o twice

In reply to Anthony PERARD

head.o is been built twice, once because it is in $(ALL_OBJS) and a second time because it is in $(extra-y) and thus it is rebuilt when building "arch/arm/built_in.o".

Fix this by adding a dependency of "head.o" on the directory "arch/arm/".

Also, we should avoid building object that are in subdirectories, so move the declaration in there. This doesn't change anything as "arch/arm/built_in.o" depends on "arch/arm/$subarch/built_in.o" which depends on $(extra-y), so we still need to depend on "arch/arm/built_in.o".

---
 xen/arch/arm/Makefile       | 7 ++++++-
 xen/arch/arm/arm32/Makefile | 1 +
 xen/arch/arm/arm64/Makefile | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)
xen/arch/arm/Makefile +6 -1
index 3d0af8ebc93c..cc90d9796e6e 100644
@@ -64,7 +64,6 @@ obj-$(CONFIG_SBSA_VUART_CONSOLE) += vpl011.o
 obj-y += vsmc.o
 obj-y += vpsci.o
 obj-y += vuart.o
-extra-y += $(TARGET_SUBARCH)/head.o
 
 extra-y += xen.lds
 
@@ -76,6 +75,12 @@ 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
xen/arch/arm/arm32/Makefile +1 -0
index 96105d238307..3040eabce3ad 100644
@@ -11,3 +11,4 @@ obj-y += smpboot.o
 obj-y += traps.o
 obj-y += vfp.o
 
+extra-y += head.o
xen/arch/arm/arm64/Makefile +2 -0
index 40642ff57494..0bb284dedab2 100644
@@ -13,3 +13,5 @@ obj-y += smpboot.o
 obj-y += traps.o
 obj-y += vfp.o
 obj-y += vsysreg.o
+
+extra-y += head.o
Signature · 1 line
Anthony PERARD
#29 lore raw

Re: [XEN PATCH v7 12/51] build: avoid building arm/arm/*/head.o twice

Hi Anthony,

Quoted 4 lines · Anthony PERARD

head.o is been built twice, once because it is in $(ALL_OBJS) and a second time because it is in $(extra-y) and thus it is rebuilt when building "arch/arm/built_in.o".

Quoted 8 lines

Fix this by adding a dependency of "head.o" on the directory "arch/arm/".

Also, we should avoid building object that are in subdirectories, so move the declaration in there. This doesn't change anything as "arch/arm/built_in.o" depends on "arch/arm/$subarch/built_in.o" which depends on $(extra-y), so we still need to depend on "arch/arm/built_in.o".

head.o as to be right at the beginning of the binary. Will this still be guaranteed with this change?

Cheers,

Quoted 53 lines
---
  xen/arch/arm/Makefile       | 7 ++++++-
  xen/arch/arm/arm32/Makefile | 1 +
  xen/arch/arm/arm64/Makefile | 2 ++
  3 files changed, 9 insertions(+), 1 deletion(-)
xen/arch/arm/Makefile +6 -1
index 3d0af8ebc93c..cc90d9796e6e 100644
@@ -64,7 +64,6 @@ obj-$(CONFIG_SBSA_VUART_CONSOLE) += vpl011.o
  obj-y += vsmc.o
  obj-y += vpsci.o
  obj-y += vuart.o
-extra-y += $(TARGET_SUBARCH)/head.o
 
  extra-y += xen.lds
 
@@ -76,6 +75,12 @@ 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
xen/arch/arm/arm32/Makefile +1 -0
index 96105d238307..3040eabce3ad 100644
@@ -11,3 +11,4 @@ obj-y += smpboot.o
  obj-y += traps.o
  obj-y += vfp.o
 
+extra-y += head.o
xen/arch/arm/arm64/Makefile +2 -0
index 40642ff57494..0bb284dedab2 100644
@@ -13,3 +13,5 @@ obj-y += smpboot.o
  obj-y += traps.o
  obj-y += vfp.o
  obj-y += vsysreg.o
+
+extra-y += head.o
Signature · 1 line
Julien Grall
#30 lore raw

Re: [XEN PATCH v7 12/51] build: avoid building arm/arm/*/head.o twice

Quoted 10 lines · Julien Grall

Hi Anthony,

Quoted 7 lines · Anthony PERARD

head.o is been built twice, once because it is in $(ALL_OBJS) and a second time because it is in $(extra-y) and thus it is rebuilt when building "arch/arm/built_in.o".

Fix this by adding a dependency of "head.o" on the directory "arch/arm/".

Quoted 8 lines
Quoted 5 lines

Also, we should avoid building object that are in subdirectories, so move the declaration in there. This doesn't change anything as "arch/arm/built_in.o" depends on "arch/arm/$subarch/built_in.o" which depends on $(extra-y), so we still need to depend on "arch/arm/built_in.o".

head.o as to be right at the beginning of the binary. Will this still be guaranteed with this change?

I guess what you want to know is: no change to the final binary.

The layout of the final binary is defined by $(ALL_OBJS), which this patch doesn't change.

This patch only ask make that when it want to build "head.o", it need first to build "arm/built_in.o", then "head.o" exist so we ask make to not do anything in this Makefile.

Thanks,

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

Re: [XEN PATCH v7 12/51] build: avoid building arm/arm/*/head.o twice

Hi Anthony,

Quoted 20 lines · Anthony PERARD
Quoted 10 lines · Julien Grall

Hi Anthony,

Quoted 7 lines · Anthony PERARD

head.o is been built twice, once because it is in $(ALL_OBJS) and a second time because it is in $(extra-y) and thus it is rebuilt when building "arch/arm/built_in.o".

Fix this by adding a dependency of "head.o" on the directory "arch/arm/".

Quoted 8 lines
Quoted 5 lines

Also, we should avoid building object that are in subdirectories, so move the declaration in there. This doesn't change anything as "arch/arm/built_in.o" depends on "arch/arm/$subarch/built_in.o" which depends on $(extra-y), so we still need to depend on "arch/arm/built_in.o".

head.o as to be right at the beginning of the binary. Will this still be guaranteed with this change?

Quoted 8 lines

I guess what you want to know is: no change to the final binary.

The layout of the final binary is defined by $(ALL_OBJS), which this patch doesn't change.

This patch only ask make that when it want to build "head.o", it need first to build "arm/built_in.o", then "head.o" exist so we ask make to not do anything in this Makefile.

Cool. Thanks for the confirmation! You can add:

Cheers,

Signature · 1 line
Julien Grall
#32 lore raw

PATCH v7 13/51 build: convert binfile use to if_changed

In reply to Anthony PERARD

This will allow to detect command line changes and allow to regenerate the file in that case.

---

Notes:
v7:
- define $(cmd_binfile) in Rules.mk so we can use the same one in both common/ and xsm/flask/

 xen/Rules.mk           | 5 +++++
 xen/common/Makefile    | 5 +++--
 xen/xsm/flask/Makefile | 6 ++++--
 3 files changed, 12 insertions(+), 4 deletions(-)
xen/Rules.mk +5 -0
index c313486ce0f6..f449669475bd 100644
@@ -57,6 +57,11 @@ cmd_ar = rm -f $@; $(AR) cr $@ $(real-prereqs)
 quiet_cmd_objcopy = OBJCOPY $@
 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)
+
 define gendep
     ifneq ($(1),$(subst /,:,$(1)))
         DEPS += $(dir $(1)).$(notdir $(1)).d
xen/common/Makefile +3 -2
index 54de70d42278..141d7d40d3dc 100644
@@ -80,8 +80,9 @@ config.gz: $(CONF_FILE)
 
 config_data.o: config.gz
 
-config_data.S: $(BASEDIR)/tools/binfile
-	$(SHELL) $(BASEDIR)/tools/binfile $@ config.gz xen_config_data
+config_data.S: $(BASEDIR)/tools/binfile FORCE
+	$(call if_changed,binfile,config.gz xen_config_data)
+targets += config_data.S
 
 clean::
 	rm -f config_data.S config.gz 2>/dev/null
xen/xsm/flask/Makefile +4 -2
index 637159ad8276..f4d4038c01bd 100644
@@ -35,8 +35,10 @@ $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE
 obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
 flask-policy.o: policy.bin
 
-flask-policy.S: $(BASEDIR)/tools/binfile
-	$(SHELL) $(BASEDIR)/tools/binfile -i $@ policy.bin xsm_flask_init_policy
+flask-policy.S: BINFILE_FLAGS := -i
+flask-policy.S: $(BASEDIR)/tools/binfile FORCE
+	$(call if_changed,binfile,policy.bin xsm_flask_init_policy)
+targets += flask-policy.S
 
 FLASK_BUILD_DIR := $(CURDIR)
 POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)
Signature · 1 line
Anthony PERARD
#34 lore raw

PATCH v7 14/51 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:
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/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/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 +-
 330 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/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/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 8ebb51b6c5e8..bc964663d25c 100644
@@ -315,6 +315,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
@@ -322,13 +323,11 @@ 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/asm-offsets.s
 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 56d16e4328cf..d7041c3cc698 100644
@@ -245,7 +245,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
 
@@ -291,10 +290,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]>
@@ -320,8 +319,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]>
@@ -332,10 +331,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]>
@@ -411,10 +410,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..6668756ceb63 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/asm
 	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 2c56546cd1dc..da1b8ddb97ff 100644
@@ -164,7 +164,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
@@ -367,7 +367,7 @@ _clean: delete-unfresh-files
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \
 		-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
 
 .PHONY: _distclean
@@ -381,7 +381,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/; \
@@ -389,7 +388,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.
@@ -435,7 +434,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."; \
@@ -453,8 +452,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/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 a1ee3146efeb..ed7b4bd26eea 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 929227f5a3ac..5e1d38d6cd5b 100644
@@ -274,11 +274,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]
@@ -305,7 +305,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/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 375b94229e13..38d6caf2a430 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 958ba0cd9256..f3eeab132e08 100644
@@ -241,7 +241,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 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
#35 lore raw

Re: [XEN PATCH v7 14/51] xen: move include/asm-* to arch/*/include/asm

Quoted 7 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)"

Actually that misplaced entry isn't really that much VT-x related and hence would imo better be dropped from there. But I can see that such dropping would be less suitable of a change here.

tools/include/Makefile xen-dir: · line 33

Quoted 8 lines
tools/include/Makefile +1 -1
@@ -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/asm

I think this would now better be

	ln -s $(XEN_ROOT)/xen/arch/x86/include/asm xen/

matching what is visible in context.

xen/arch/riscv/arch.mk riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c · line 15

Quoted 7 lines
xen/arch/riscv/arch.mk +1 -0
@@ -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

I find it odd that this needed repeating in every arch.mk. Can't this be done once for all arches?

xen/common/page_alloc.c PAGE_LIST_HEAD(page_broken_list); · line 246

Quoted 10 lines
xen/common/page_alloc.c +1 -1
@@ -241,7 +241,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 asm/numa.h.
  */
 mfn_t first_valid_mfn = INVALID_MFN_INITIALIZER;

I'm afraid that in this case it is relevant that it's Arm's header, like ...

xen/include/xen/acpi.h line 45

Quoted 11 lines
xen/include/xen/acpi.h +3 -2
@@ -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.)

... you arrange for here.

Jan

#36 lore raw

Re: [XEN PATCH v7 14/51] xen: move include/asm-* to arch/*/include/asm

Quoted 12 lines · Jan Beulich

tools/include/Makefile xen-dir: · line 33

Quoted 8 lines · Anthony PERARD
tools/include/Makefile +1 -1
@@ -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/asm

I think this would now better be

Quoted 3 lines
	ln -s $(XEN_ROOT)/xen/arch/x86/include/asm xen/

matching what is visible in context.

I'll change it.

Quoted 10 lines

xen/arch/riscv/arch.mk riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c · line 15

Quoted 7 lines
xen/arch/riscv/arch.mk +1 -0
@@ -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

I find it odd that this needed repeating in every arch.mk. Can't this be done once for all arches?

I actually do that much later in the series with patch "build: Add headers path to CFLAGS once for all archs".

Quoted 4 lines
Quoted 4 lines
xen/common/page_alloc.c +0 -0
@@ -241,7 +241,7 @@ PAGE_LIST_HEAD(page_broken_list);
 
Quoted 9 lines

xen/common/page_alloc.c PAGE_LIST_HEAD(page_broken_list); · line 246

Quoted 6 lines
xen/common/page_alloc.c +1 -1
 /*
  * 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 asm/numa.h.
  */
 mfn_t first_valid_mfn = INVALID_MFN_INITIALIZER;

I'm afraid that in this case it is relevant that it's Arm's header, like ...

Will fix.

Thanks,

Signature · 1 line
Anthony PERARD
#37 lore raw

PATCH v7 15/51 build,riscv: tell the build system about riscv64/head.S

In reply to Anthony PERARD

This allows to make arch/riscv/riscv64/head.o.

Example of rune on a fresh copy of the repository:
make XEN_TARGET_ARCH=riscv64 CROSS_COMPILE=riscv64-linux-gnu- KBUILD_DEFCONFIG=tiny64_defconfig arch/riscv/riscv64/head.o

---
 xen/arch/riscv/riscv64/Makefile | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 xen/arch/riscv/riscv64/Makefile
xen/arch/riscv/riscv64/Makefile new file +1 -0
new file mode 100644
index 000000000000..15a4a65f6615
@@ -0,0 +1 @@
+extra-y += head.o
Signature · 1 line
Anthony PERARD
#38 lore raw

PATCH v7 16/51 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:
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.

 .gitignore   |  1 -
 xen/Makefile | 34 +++++++++++++++++-----------------
 2 files changed, 17 insertions(+), 18 deletions(-)
.gitignore +0 -1
index bc964663d25c..59a22d1685e2 100644
@@ -332,7 +332,6 @@ xen/include/compat/*
 xen/include/config/
 xen/include/generated/
 xen/include/public/public
-xen/include/xen/*.new
 xen/include/xen/acm_policy.h
 xen/include/xen/compile.h
 xen/include/xen/lib/x86/cpuid-autogen.h
xen/Makefile +17 -17
index da1b8ddb97ff..b408d35b4af0 100644
@@ -351,7 +351,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
@@ -368,7 +368,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
+	rm -f .banner include/xen/compile.h
 
 .PHONY: _distclean
 _distclean: clean
@@ -378,7 +378,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]); \
@@ -391,14 +391,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 \
@@ -413,9 +405,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' \
@@ -425,10 +419,16 @@ 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
#39 lore raw

Re: [XEN PATCH v7 16/51] build: generate "include/xen/compile.h" with if_changed

.gitignore xen/include/compat/* · line 335

Quoted 7 lines · Anthony PERARD
.gitignore +0 -1
@@ -332,7 +332,6 @@ xen/include/compat/*
 xen/include/config/
 xen/include/generated/
 xen/include/public/public
-xen/include/xen/*.new

While this indeed looks to only have been here for compile.h, I'm not convinced it is a good idea to delete the entry here. Does it cause any harm if left in place?

Quoted 12 lines
xen/Makefile +1 -1
@@ -351,7 +351,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

xen/Makefile _clean: delete-unfresh-files · line 371

Quoted 5 lines
xen/Makefile +1 -1
@@ -368,7 +368,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
+	rm -f .banner include/xen/compile.h

Isn't this redundant with ...

Quoted 7 lines
xen/Makefile +2 -1
@@ -425,10 +419,16 @@ 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; \

xen/Makefile include/xen/compile.h: include/xen/compile.h.in .banner · line 431

Quoted 10 lines
xen/Makefile +7 -2
+	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

... this? I would have hoped that $(targets) is included in the generic cleaning logic ...

Jan

#40 lore raw

Re: [XEN PATCH v7 16/51] build: generate "include/xen/compile.h" with if_changed

Quoted 12 lines · Jan Beulich

.gitignore xen/include/compat/* · line 335

Quoted 7 lines · Anthony PERARD
.gitignore +0 -1
@@ -332,7 +332,6 @@ xen/include/compat/*
 xen/include/config/
 xen/include/generated/
 xen/include/public/public
-xen/include/xen/*.new

While this indeed looks to only have been here for compile.h, I'm not convinced it is a good idea to delete the entry here. Does it cause any harm if left in place?

That's a complicated question. I would prefer to have in this file only artefacts of the build system but other developer and maintainer disagree. So it's fine I guess to leave the entry, it just hide any *.new file from git status and make it harder to commit them.

Quoted 11 lines

xen/Makefile _clean: delete-unfresh-files · line 371

Quoted 8 lines
xen/Makefile +1 -1
@@ -368,7 +368,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
+	rm -f .banner include/xen/compile.h

Isn't this redundant with ...

Quoted 11 lines

xen/Makefile include/xen/compile.h: include/xen/compile.h.in .banner · line 423

Quoted 8 lines
xen/Makefile +4 -2
@@ -425,10 +419,16 @@ include/xen/compile.h: include/xen/compile.h.in .banner
+
+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

... this? I would have hoped that $(targets) is included in the generic cleaning logic ...

Not yet. It's probably a good idea, I'll work on a patch.

Thanks,

Signature · 1 line
Anthony PERARD
#41 lore raw

PATCH v7 17/51 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-check-relocs) as the former might be a bit too generic.

---

Notes:
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 | 36 ++----------------------------------
 xen/arch/x86/arch.mk  | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 34 deletions(-)
xen/arch/x86/Makefile +2 -34
index 5e1d38d6cd5b..dfcbd01bb4ed 100644
@@ -123,41 +123,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 	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)
@@ -218,8 +184,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
#42 lore raw

Re: [XEN PATCH v7 17/51] build: set XEN_BUILD_EFI earlier

A general remark first: If I understand things correctly, a side effect of this change is to also address the issue that I'm trying to take care of in "x86/build: suppress EFI-related tool chain checks upon local $(MAKE) recursion". However, while that one's a reasonable backporting candidate, I don't think the one here is. Therefore I'd prefer my patch to go in ahead of this change of yours. Hence I wonder whether in return I couldn't ask you to review that one.

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 2 lines

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

While I don't mind the prefix addition, may I please ask that the rest of the name remain as is, i.e. $(efi-nr-fixups)? "nr" because that's what the variable holds, and "fixups" to distinguish from full-fledged relocations as well as to match commentary there.

Quoted 32 lines
xen/arch/x86/Makefile +0 -25
@@ -123,41 +123,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 	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

xen/arch/x86/Makefile $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 · line 127

Quoted 10 lines
xen/arch/x86/Makefile +0 -9
-# 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)

Is the remaining if(,) block still warranted? I.e. can't the single line

CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI

live without the surrounding conditional?

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

Nit: Unless there's a reason not to, please prefer := here (and in general).

Jan

#43 lore raw

Re: [XEN PATCH v7 17/51] build: set XEN_BUILD_EFI earlier

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

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

While I don't mind the prefix addition, may I please ask that the rest of the name remain as is, i.e. $(efi-nr-fixups)? "nr" because that's what the variable holds, and "fixups" to distinguish from full-fledged relocations as well as to match commentary there.

Will change.

Quoted 45 lines
Quoted 32 lines
xen/arch/x86/Makefile +0 -25
@@ -123,41 +123,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 	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

xen/arch/x86/Makefile $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 · line 127

Quoted 10 lines
xen/arch/x86/Makefile +0 -9
-# 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)

Is the remaining if(,) block still warranted? I.e. can't the single line

Quoted 3 lines

CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI

live without the surrounding conditional?

Let's see, $(efi-y) depends on CONFIG_PV_SHIM_EXCLUSIVE and sudo make install, but XEN_BUILD_EFI also depends on CONFIG_PV_SHIM_EXCLUSIVE and we don't want to build in sudo make install so CFLAGS shouldn't be used. So the single line without the if() block seems enough. I remove the surrounding conditional.

Thanks,

Signature · 1 line
Anthony PERARD
#44 lore raw

PATCH v7 18/51 build: fix $(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).

---
 xen/arch/arm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/Makefile +1 -1
index cc90d9796e6e..dc1d09c8b429 100644
@@ -93,7 +93,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
Reviewed-by on v7 18/51
#45 lore raw

Re: [XEN PATCH v7 18/51] build: fix $(TARGET).efi creation in arch/arm

Quoted 5 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).

As to the subject, I don't think "fix" is appropriate. How about "adjust" or "simplify" or some such?

Jan

#46 lore raw

Re: [XEN PATCH v7 18/51] build: fix $(TARGET).efi creation in arch/arm

Quoted 11 lines · Jan Beulich
Quoted 5 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).

As to the subject, I don't think "fix" is appropriate. How about "adjust" or "simplify" or some such?

"adjust" sound good, thanks.

Signature · 1 line
Anthony PERARD
#47 lore raw

PATCH v7 19/51 build: fix arch/x86/note.o rule

In reply to Anthony PERARD

Avoid different spelling for the location of "xen-syms", and simply use the dependency variable. This avoid the assumption about $(TARGET) value.

---

Notes:
v7:
- fix typo in title

 xen/arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/Makefile +1 -1
index dfcbd01bb4ed..29aa67ea371e 100644
@@ -164,7 +164,7 @@ $(TARGET)-syms: prelink.o xen.lds
 	rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*
 
 note.o: $(TARGET)-syms
-	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id  $(BASEDIR)/xen-syms [email protected]
+	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $< [email protected]
 	$(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 \
 		--rename-section=.data=.note.gnu.build-id -S [email protected] $@
 	rm -f [email protected]
Signature · 1 line
Anthony PERARD
#48 lore raw

PATCH v7 20/51 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 reason 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": $(TARGET), which is moved to the main Makefile.

---

Notes:
v7:
- new patch

 xen/Makefile | 69 ++++++----------------------------------------------
 xen/Rules.mk |  6 ++---
 xen/build.mk | 58 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 65 deletions(-)
 create mode 100644 xen/build.mk
xen/Makefile +7 -62
index b408d35b4af0..7f100845cdd0 100644
@@ -45,6 +45,8 @@ export KCONFIG_CONFIG ?= .config
 
 export CC CXX LD
 
+export TARGET := $(BASEDIR)/xen
+
 .PHONY: default
 default: build
 
@@ -279,11 +281,13 @@ 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
 
@@ -391,65 +395,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 +3 -3
index f449669475bd..a49ca4ceca39 100644
@@ -9,8 +9,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 +34,9 @@ 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
+mk-dir := .
+include $(if $(wildcard $(mk-dir)/build.mk),$(mk-dir)/build.mk,$(mk-dir)/Makefile)
 
 # Linking
 # ---------------------------------------------------------------------------
xen/build.mk new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
#49 lore raw

Re: [XEN PATCH v7 20/51] build: avoid re-executing the main Makefile by introducing build.mk

Quoted 4 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 reason with a Makefile used for several purpose, and it actually slow down the build process.

I'm struggling some with what you want to express here. What does "to reason" refer to?

Quoted 13 lines

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 3 lines

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

I'm having trouble identifying what this describes. Searching for $(TARGET) in the patch doesn't yield any obvious match. Thinking about it, do you perhaps mean the setting of that variable? Is moving that guaranteed to not leave the variable undefined? Or in other words is there no scenario at all where xen/Makefile might get bypassed? (Aiui building an individual .o, .i, or .s would continue to be fine, but it feels like something along these lines might get broken.)

xen/Makefile export CFLAGS_UBSAN · line 288

Quoted 12 lines
xen/Makefile +4 -3
@@ -279,11 +281,13 @@ 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): %: _%
+	@:

Isn't the conventional way to express "no commands" via

$(main-targets): %: _% ;

?

xen/Rules.mk include $(XEN_ROOT)/Config.mk · line 12

Quoted 9 lines
xen/Rules.mk +0 -2
@@ -9,8 +9,6 @@ include $(XEN_ROOT)/Config.mk
 include $(BASEDIR)/scripts/Kbuild.include
 
 
-TARGET := $(BASEDIR)/xen
-
 # Note that link order matters!

Could I talk you into removing yet another blank line at this occasion?

xen/Rules.mk SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \ · line 38

Quoted 7 lines
xen/Rules.mk +2 -1
@@ -36,7 +34,9 @@ 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
+mk-dir := .

What's the goal of this variable? All I can spot for now it that ...

xen/Rules.mk SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \ · line 39

Quoted 1 line
xen/Rules.mk +1 -0
+include $(if $(wildcard $(mk-dir)/build.mk),$(mk-dir)/build.mk,$(mk-dir)/Makefile)

... this is harder to read than

include $(if $(wildcard ./build.mk),./build.mk,./Makefile)

which could be further simplified to

include $(if $(wildcard build.mk),build.mk,Makefile)

and then maybe altered to

include $(firstword $(wildcard build.mk) Makefile)

Quoted 6 lines
xen/build.mk new file +3 -0
@@ -0,0 +1,58 @@
+quiet_cmd_banner = BANNER  $@
+define cmd_banner
+    if which figlet >/dev/null 2>&1 ; then \

xen/build.mk line 13

Quoted 10 lines
xen/build.mk new file +10 -0
+	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

To make the end of the rule more easily recognizable, may I ask that you either insert a blank line after the rule or that you move the += up immediately ahead of the construct?

Jan

#50 lore raw

Re: [XEN PATCH v7 20/51] build: avoid re-executing the main Makefile by introducing build.mk

Quoted 8 lines · Jan Beulich
Quoted 4 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 reason with a Makefile used for several purpose, and it actually slow down the build process.

I'm struggling some with what you want to express here. What does "to reason" refer to?

I guess "to reason with something" isn't an expression. I mean that the main Makefile is difficult to work with as it setup the build process for the rest of the build. And it is difficult to understand what is happening when it recursed into itself, and thus possibly re-executing part of the build process setup.

Quoted 17 lines
Quoted 13 lines

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 3 lines

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

Quoted 8 lines

I'm having trouble identifying what this describes. Searching for $(TARGET) in the patch doesn't yield any obvious match. Thinking about it, do you perhaps mean the setting of that variable? Is moving that guaranteed to not leave the variable undefined? Or in other words is there no scenario at all where xen/Makefile might get bypassed? (Aiui building an individual .o, .i, or .s would continue to be fine, but it feels like something along these lines might get broken.)

I mean that "xen/Rules.mk" will never "include" "xen/Makefile" after this patch, but the variable "TARGET" is only set in "xen/Rules.mk". But "xen/Makefile" still needs "TARGET" to be set so I moved the assignment of the variable from "xen/Rules.mk" into "xen/Makefile".

Quoted 15 lines

xen/Makefile export CFLAGS_UBSAN · line 288

Quoted 12 lines
xen/Makefile +4 -3
@@ -279,11 +281,13 @@ 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): %: _%
+	@:

Isn't the conventional way to express "no commands" via

Quoted 3 lines

$(main-targets): %: _% ;

?

I guess, I'll change it.

Quoted 11 lines

xen/Rules.mk include $(XEN_ROOT)/Config.mk · line 12

Quoted 9 lines
xen/Rules.mk +0 -2
@@ -9,8 +9,6 @@ include $(XEN_ROOT)/Config.mk
 include $(BASEDIR)/scripts/Kbuild.include
 
 
-TARGET := $(BASEDIR)/xen
-
 # Note that link order matters!

Could I talk you into removing yet another blank line at this occasion?

Will do.

Quoted 9 lines

xen/Rules.mk SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \ · line 38

Quoted 7 lines
xen/Rules.mk +2 -1
@@ -36,7 +34,9 @@ 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
+mk-dir := .

What's the goal of this variable? All I can spot for now it that ...

It's just me thinking ahead where a folling patch will just have to write "$mk-dir := $(src)", instead of editing the following line.

Quoted 6 lines

xen/Rules.mk SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \ · line 39

Quoted 1 line
xen/Rules.mk +1 -0
+include $(if $(wildcard $(mk-dir)/build.mk),$(mk-dir)/build.mk,$(mk-dir)/Makefile)

... this is harder to read than

include $(if $(wildcard ./build.mk),./build.mk,./Makefile)

Quoted 7 lines

which could be further simplified to

include $(if $(wildcard build.mk),build.mk,Makefile)

and then maybe altered to

include $(firstword $(wildcard build.mk) Makefile)

I can try with this last one, there is less repeating of "build.mk" so that sound like a good thing to do.

Quoted 12 lines
Quoted 12 lines
xen/build.mk new file +9 -0
@@ -0,0 +1,58 @@
+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
Quoted 8 lines

xen/build.mk line 13

Quoted 4 lines
xen/build.mk new file +4 -0
+
+.banner: tools/xen.flf FORCE
+	$(call if_changed,banner)
+targets += .banner

To make the end of the rule more easily recognizable, may I ask that you either insert a blank line after the rule or that you move the += up immediately ahead of the construct?

Will do.

Thanks,

Signature · 1 line
Anthony PERARD
#51 lore raw

Re: [XEN PATCH v7 20/51] build: avoid re-executing the main Makefile by introducing build.mk

Quoted 42 lines · Anthony PERARD
Quoted 8 lines · Jan Beulich
Quoted 4 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 reason with a Makefile used for several purpose, and it actually slow down the build process.

I'm struggling some with what you want to express here. What does "to reason" refer to?

I guess "to reason with something" isn't an expression. I mean that the main Makefile is difficult to work with as it setup the build process for the rest of the build. And it is difficult to understand what is happening when it recursed into itself, and thus possibly re-executing part of the build process setup.

Quoted 17 lines
Quoted 13 lines

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 3 lines

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

Quoted 8 lines

I'm having trouble identifying what this describes. Searching for $(TARGET) in the patch doesn't yield any obvious match. Thinking about it, do you perhaps mean the setting of that variable? Is moving that guaranteed to not leave the variable undefined? Or in other words is there no scenario at all where xen/Makefile might get bypassed? (Aiui building an individual .o, .i, or .s would continue to be fine, but it feels like something along these lines might get broken.)

Quoted 4 lines

I mean that "xen/Rules.mk" will never "include" "xen/Makefile" after this patch, but the variable "TARGET" is only set in "xen/Rules.mk". But "xen/Makefile" still needs "TARGET" to be set so I moved the assignment of the variable from "xen/Rules.mk" into "xen/Makefile".

Okay, thanks, this confirms the understanding I had developed; maybe you try to reword this some. What your reply doesn't address is my question, though.

Jan

#52 lore raw

Re: [XEN PATCH v7 20/51] build: avoid re-executing the main Makefile by introducing build.mk

Quoted 16 lines · Jan Beulich
Quoted 15 lines · Anthony PERARD
Quoted 13 lines · Jan Beulich
Quoted 3 lines · Anthony PERARD

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

I'm having trouble identifying what this describes. Searching for $(TARGET) in the patch doesn't yield any obvious match. Thinking about it, do you perhaps mean the setting of that variable? Is moving that guaranteed to not leave the variable undefined? Or in other words is there no scenario at all where xen/Makefile might get bypassed? (Aiui building an individual .o, .i, or .s would continue to be fine, but it feels like something along these lines might get broken.)

Quoted 8 lines
Quoted 4 lines

I mean that "xen/Rules.mk" will never "include" "xen/Makefile" after this patch, but the variable "TARGET" is only set in "xen/Rules.mk". But "xen/Makefile" still needs "TARGET" to be set so I moved the assignment of the variable from "xen/Rules.mk" into "xen/Makefile".

Okay, thanks, this confirms the understanding I had developed; maybe you try to reword this some. What your reply doesn't address is my question, though.

Which question, there seems to be 3 of them :-). Is it about xen/Makefile been bypassed?

Building anything in xen/ requires to first execute xen/Makefile as this is where variables like CFLAGS or XEN_ROOT are defined, and this includes single builds or building an individual .o.

Signature · 1 line
Anthony PERARD
#53 lore raw

Re: [XEN PATCH v7 20/51] build: avoid re-executing the main Makefile by introducing build.mk

Quoted 22 lines · Anthony PERARD
Quoted 21 lines · Jan Beulich
Quoted 19 lines · Anthony PERARD
Quoted 5 lines · Jan Beulich
Quoted 3 lines · Anthony PERARD

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

Quoted 8 lines

I'm having trouble identifying what this describes. Searching for $(TARGET) in the patch doesn't yield any obvious match. Thinking about it, do you perhaps mean the setting of that variable? Is moving that guaranteed to not leave the variable undefined? Or in other words is there no scenario at all where xen/Makefile might get bypassed? (Aiui building an individual .o, .i, or .s would continue to be fine, but it feels like something along these lines might get broken.)

I mean that "xen/Rules.mk" will never "include" "xen/Makefile" after this patch, but the variable "TARGET" is only set in "xen/Rules.mk". But "xen/Makefile" still needs "TARGET" to be set so I moved the assignment of the variable from "xen/Rules.mk" into "xen/Makefile".

Quoted 6 lines
Quoted 3 lines

Okay, thanks, this confirms the understanding I had developed; maybe you try to reword this some. What your reply doesn't address is my question, though.

Which question, there seems to be 3 of them :-). Is it about xen/Makefile been bypassed?

Yes, sorry for being imprecise.

Quoted 3 lines

Building anything in xen/ requires to first execute xen/Makefile as this is where variables like CFLAGS or XEN_ROOT are defined, and this includes single builds or building an individual .o.

Okay, thanks for confirming.

Jan

#54 lore raw

PATCH v7 21/51 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, the 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 using "$<" 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:
v7:
- change, now things are in build.mk: no more prepare phase needed

 xen/Makefile          | 15 ++++++++++++++-
 xen/Rules.mk          | 14 --------------
 xen/arch/arm/Makefile | 31 ++++---------------------------
 xen/arch/arm/arch.mk  |  2 ++
 xen/arch/x86/Makefile | 29 ++++++-----------------------
 xen/arch/x86/arch.mk  |  2 ++
 xen/build.mk          | 24 ++++++++++++++++++++++++
 7 files changed, 52 insertions(+), 65 deletions(-)
xen/Makefile +14 -1
index 7f100845cdd0..1dad20a95be6 100644
@@ -271,8 +271,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)
@@ -393,7 +406,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 -14
index a49ca4ceca39..2db13a8f9c54 100644
@@ -8,26 +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 dc1d09c8b429..067c0d9844e4 100644
@@ -73,14 +73,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
@@ -96,33 +88,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/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 29aa67ea371e..823f8fed4144 100644
@@ -126,37 +126,20 @@ ifneq ($(efi-y),)
 CFLAGS-$(XEN_BUILD_EFI) += -DXEN_BUILD_EFI
 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)
-# 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 $(@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 $(@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 \
@@ -209,7 +192,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
@@ -238,7 +221,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 98dd41d32118..61e0222f4a08 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 +24 -0
index 369e1fe5c698..9093d9f493bc 100644
@@ -56,3 +56,27 @@ arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
 	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
 	  echo ""; \
 	  echo "#endif") <$< >$@
+
+# 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: ;
+
+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
#55 lore raw

Re: [XEN PATCH v7 21/51] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile

Quoted 25 lines · Anthony PERARD
xen/Makefile +13 -0
@@ -271,8 +271,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)

xen/Makefile $(TARGET): FORCE · line 409

Quoted 5 lines
xen/Makefile +1 -1
@@ -393,7 +406,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 $@

This merely results in what was previously invoked from here now getting invoked from the very bottom of build.mk. I'm afraid I don't see why this is a useful change to make.

xen/build.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s · line 64

Quoted 12 lines
xen/build.mk +6 -0
@@ -56,3 +56,27 @@ arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
 	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
 	  echo ""; \
 	  echo "#endif") <$< >$@
+
+# 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: ;

This previously lived in an Arm-specific file. Moving this here in the given, still Arm-specific form is imo a no-go when done alongside all the other good changes you're making. Is there a reason this can't go into xen/arch/arm/arch.mk?

Jan

#56 lore raw

Re: [XEN PATCH v7 21/51] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile

Quoted 19 lines · Jan Beulich
Quoted 18 lines · Anthony PERARD
xen/Makefile +10 -0
@@ -271,8 +271,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 16 lines

xen/Makefile $(TARGET): FORCE · line 409

Quoted 12 lines
xen/Makefile +4 -1
+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)
@@ -393,7 +406,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 $@

This merely results in what was previously invoked from here now getting invoked from the very bottom of build.mk. I'm afraid I don't see why this is a useful change to make.

Would you rather have this following change?

    @@ -393,7 +406,8 @@ $(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 prelink.o
     	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@

That would probably be fine.

Quoted 9 lines
Quoted 9 lines
xen/build.mk +3 -0
@@ -56,3 +56,27 @@ arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
 	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
 	  echo ""; \
 	  echo "#endif") <$< >$@
+
+# 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
Quoted 8 lines

xen/build.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s · line 64

Quoted 3 lines
xen/build.mk +3 -0
+# build head.o
+arch/arm/$(TARGET_SUBARCH)/head.o: arch/arm/built_in.o
+arch/arm/$(TARGET_SUBARCH)/head.o: ;

This previously lived in an Arm-specific file. Moving this here in the given, still Arm-specific form is imo a no-go when done alongside all the other good changes you're making. Is there a reason this can't go into xen/arch/arm/arch.mk?

This is temporary and it is removed in patch
"build: build everything from the root dir, use obj=$subdir"
but I could move it to "arch/arm/Rules.mk" I think.

Thanks,

Signature · 1 line
Anthony PERARD
#57 lore raw

Re: [XEN PATCH v7 21/51] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile

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

xen/Makefile $(TARGET): FORCE · line 409

Quoted 6 lines · Anthony PERARD
xen/Makefile +1 -1
@@ -393,7 +406,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 $@

This merely results in what was previously invoked from here now getting invoked from the very bottom of build.mk. I'm afraid I don't see why this is a useful change to make.

Would you rather have this following change?

Quoted 8 lines
    @@ -393,7 +406,8 @@ $(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 prelink.o
     	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@

That would probably be fine.

Hmm, perhaps I'd prefer to avoid yet another $(MAKE) invocation. But your reply made me understand why you make the change: You need to add the prelink.o dependency to $(TARGET). That wasn't obvious to me when first reviewing the change.

Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
xen/build.mk +3 -0
@@ -56,3 +56,27 @@ arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
 	  sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \
 	  echo ""; \
 	  echo "#endif") <$< >$@
+
+# 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
Quoted 8 lines

xen/build.mk arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s · line 64

Quoted 3 lines
xen/build.mk +3 -0
+# build head.o
+arch/arm/$(TARGET_SUBARCH)/head.o: arch/arm/built_in.o
+arch/arm/$(TARGET_SUBARCH)/head.o: ;

This previously lived in an Arm-specific file. Moving this here in the given, still Arm-specific form is imo a no-go when done alongside all the other good changes you're making. Is there a reason this can't go into xen/arch/arm/arch.mk?

Quoted 3 lines

This is temporary and it is removed in patch
"build: build everything from the root dir, use obj=$subdir"
but I could move it to "arch/arm/Rules.mk" I think.

Moving there would be preferred; if that somehow doesn't work out, please mention the temporary nature in the description, or else I (or perhaps others) would ask the same question again on a future version of the series.

Jan

#58 lore raw

PATCH v7 22/51 build: clean common temporary files from root makefile

In reply to Anthony PERARD
---
 xen/Makefile               | 1 +
 xen/scripts/Makefile.clean | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
xen/Makefile +1 -0
index 1dad20a95be6..f07c9251c030 100644
@@ -382,6 +382,7 @@ _clean:
 	$(MAKE) $(clean) test
 	$(MAKE) $(kconfig) clean
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \
+		-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 arch/*/include/asm/asm-offsets.h
xen/scripts/Makefile.clean +0 -2
index 027c200c0efc..b6df9e861e6e 100644
@@ -14,10 +14,8 @@ include Makefile
 subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
               $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
 
-DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
 .PHONY: clean
 clean:: $(subdir-all)
-	rm -f *.o .*.o.tmp *~ core $(DEPS_RM)
 
 # Descending
 # ---------------------------------------------------------------------------
Signature · 1 line
Anthony PERARD
Reviewed-by on v7 22/51
#59 lore raw

Re: [XEN PATCH v7 22/51] build: clean common temporary files from root makefile

Quoted 1 line · Anthony PERARD

Trying to synthesize a description:

xen/Makefile _clean: · line 384

Quoted 6 lines
xen/Makefile +0 -0
@@ -382,6 +382,7 @@ _clean:
 	$(MAKE) $(clean) test
 	$(MAKE) $(kconfig) clean
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \

This was effectively redundant with ...

xen/scripts/Makefile.clean include Makefile · line 17

Quoted 13 lines
xen/Makefile +1 -0
+		-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 arch/*/include/asm/asm-offsets.h
xen/scripts/Makefile.clean +0 -1
index 027c200c0efc..b6df9e861e6e 100644
@@ -14,10 +14,8 @@ include Makefile
 subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
               $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
 
-DEPS_RM = $(DEPS) $(DEPS_INCLUDE)

... this and its use below.

xen/scripts/Makefile.clean include Makefile · line 20

Quoted 3 lines
xen/scripts/Makefile.clean +0 -1
 .PHONY: clean
 clean:: $(subdir-all)
-	rm -f *.o .*.o.tmp *~ core $(DEPS_RM)

With the command gone, I think the :: should also be converted (back) to just : then. Then

Assuming the patch is independent of the earlier still uncommitted ones (please confirm), I'd be happy to make the adjustment while committing
- as long as you agree, of course.

Jan

#60 lore raw

Re: [XEN PATCH v7 22/51] build: clean common temporary files from root makefile

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

Trying to synthesize a description:

xen/Makefile _clean: · line 384

Quoted 6 lines
xen/Makefile +0 -0
@@ -382,6 +382,7 @@ _clean:
 	$(MAKE) $(clean) test
 	$(MAKE) $(kconfig) clean
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \

This was effectively redundant with ...

xen/scripts/Makefile.clean include Makefile · line 17

Quoted 13 lines
xen/Makefile +1 -0
+		-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 arch/*/include/asm/asm-offsets.h
xen/scripts/Makefile.clean +0 -1
index 027c200c0efc..b6df9e861e6e 100644
@@ -14,10 +14,8 @@ include Makefile
 subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
               $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
 
-DEPS_RM = $(DEPS) $(DEPS_INCLUDE)

... this and its use below.

Quoted 6 lines

xen/scripts/Makefile.clean include Makefile · line 20

Quoted 3 lines
xen/scripts/Makefile.clean +0 -1
 .PHONY: clean
 clean:: $(subdir-all)
-	rm -f *.o .*.o.tmp *~ core $(DEPS_RM)

With the command gone, I think the :: should also be converted (back) to just : then. Then

"clean" has been a double-column rule for a long time. If we convert this rule to a single-column we need to convert all "clean" target to use single-column which would make this patch more complicated. So I don't think we should make this change.

Quoted 5 lines

Assuming the patch is independent of the earlier still uncommitted ones (please confirm), I'd be happy to make the adjustment while committing
- as long as you agree, of course.

The patch is independent of earlier one, although the context is changed in one patch so wouldn't apply cleaning without git helps. (context is changed in "xen: move include/asm-* to arch/*/include/asm")

Thanks,

Signature · 1 line
Anthony PERARD
#61 lore raw

Re: [XEN PATCH v7 22/51] build: clean common temporary files from root makefile

Quoted 38 lines · Anthony PERARD
Quoted 30 lines · Jan Beulich
Quoted 1 line · Anthony PERARD

Trying to synthesize a description:

xen/Makefile _clean: · line 384

Quoted 6 lines
xen/Makefile +0 -0
@@ -382,6 +382,7 @@ _clean:
 	$(MAKE) $(clean) test
 	$(MAKE) $(kconfig) clean
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \

This was effectively redundant with ...

xen/scripts/Makefile.clean include Makefile · line 17

Quoted 13 lines
xen/Makefile +1 -0
+		-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 arch/*/include/asm/asm-offsets.h
xen/scripts/Makefile.clean +0 -1
index 027c200c0efc..b6df9e861e6e 100644
@@ -14,10 +14,8 @@ include Makefile
 subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
               $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
 
-DEPS_RM = $(DEPS) $(DEPS_INCLUDE)

... this and its use below.

Quoted 6 lines

xen/scripts/Makefile.clean include Makefile · line 20

Quoted 3 lines
xen/scripts/Makefile.clean +0 -1
 .PHONY: clean
 clean:: $(subdir-all)
-	rm -f *.o .*.o.tmp *~ core $(DEPS_RM)

With the command gone, I think the :: should also be converted (back) to just : then. Then

Quoted 4 lines

"clean" has been a double-column rule for a long time. If we convert this rule to a single-column we need to convert all "clean" target to use single-column which would make this patch more complicated. So I don't think we should make this change.

Hmm, indeed make would complain in that case (I didn't mean to suggest to convert all clean-s to single-colon rules, but I was instead under the wrong impression that spelling out merely dependencies would be okay with single-colon rule). But then make's doc also says "Each double-colon rule should specify a recipe; if it does not, an implicit rule will be used if one applies." So perhaps, to avoid depending on the latter, an empty recipe should be added here (by adding a semicolon)?

Quoted 9 lines
Quoted 5 lines

Assuming the patch is independent of the earlier still uncommitted ones (please confirm), I'd be happy to make the adjustment while committing
- as long as you agree, of course.

The patch is independent of earlier one, although the context is changed in one patch so wouldn't apply cleaning without git helps. (context is changed in "xen: move include/asm-* to arch/*/include/asm")

That would be easy enough to adjust, I guess. But first we need to settle on the above.

Jan

#62 lore raw

Re: [XEN PATCH v7 22/51] build: clean common temporary files from root makefile

Quoted 44 lines · Jan Beulich
Quoted 38 lines · Anthony PERARD
Quoted 30 lines · Jan Beulich
Quoted 1 line · Anthony PERARD

Trying to synthesize a description:

xen/Makefile _clean: · line 384

Quoted 6 lines
xen/Makefile +0 -0
@@ -382,6 +382,7 @@ _clean:
 	$(MAKE) $(clean) test
 	$(MAKE) $(kconfig) clean
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \

This was effectively redundant with ...

xen/scripts/Makefile.clean include Makefile · line 17

Quoted 13 lines
xen/Makefile +1 -0
+		-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 arch/*/include/asm/asm-offsets.h
xen/scripts/Makefile.clean +0 -1
index 027c200c0efc..b6df9e861e6e 100644
@@ -14,10 +14,8 @@ include Makefile
 subdir-all := $(subdir-y) $(subdir-n) $(subdir-) \
               $(patsubst %/,%, $(filter %/, $(obj-y) $(obj-n) $(obj-)))
 
-DEPS_RM = $(DEPS) $(DEPS_INCLUDE)

... this and its use below.

Quoted 6 lines

xen/scripts/Makefile.clean include Makefile · line 20

Quoted 3 lines
xen/scripts/Makefile.clean +0 -1
 .PHONY: clean
 clean:: $(subdir-all)
-	rm -f *.o .*.o.tmp *~ core $(DEPS_RM)

With the command gone, I think the :: should also be converted (back) to just : then. Then

Quoted 4 lines

"clean" has been a double-column rule for a long time. If we convert this rule to a single-column we need to convert all "clean" target to use single-column which would make this patch more complicated. So I don't think we should make this change.

Quoted 8 lines

Hmm, indeed make would complain in that case (I didn't mean to suggest to convert all clean-s to single-colon rules, but I was instead under the wrong impression that spelling out merely dependencies would be okay with single-colon rule). But then make's doc also says "Each double-colon rule should specify a recipe; if it does not, an implicit rule will be used if one applies." So perhaps, to avoid depending on the latter, an empty recipe should be added here (by adding a semicolon)?

That sounds fine.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Assuming the patch is independent of the earlier still uncommitted ones (please confirm), I'd be happy to make the adjustment while committing
- as long as you agree, of course.

Quoted 6 lines
Quoted 3 lines

The patch is independent of earlier one, although the context is changed in one patch so wouldn't apply cleaning without git helps. (context is changed in "xen: move include/asm-* to arch/*/include/asm")

That would be easy enough to adjust, I guess. But first we need to settle on the above.

Thanks,

Signature · 1 line
Anthony PERARD
#63 lore raw

PATCH v7 23/51 build,include: remove arch-*/*.h public header listing from headers*.chk

In reply to Anthony PERARD

$(public-y) contains "public/arch-%" but when used by $(PUBLIC_HEADERS) $(public-y) is filtered-out by the pattern "public/arch-%". So $(public-y) content is never used.

---

Notes:
v7:
- new patch

 xen/include/Makefile | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
xen/include/Makefile +1 -4
index 95daa8a28975..65a938a66555 100644
@@ -39,9 +39,6 @@ cppflags-$(CONFIG_X86)    += -m32
 
 endif
 
-public-$(CONFIG_X86) := $(wildcard public/arch-x86/*.h public/arch-x86/*/*.h)
-public-$(CONFIG_ARM) := $(wildcard public/arch-arm/*.h public/arch-arm/*/*.h)
-
 .PHONY: all
 all: $(headers-y)
 
@@ -81,7 +78,7 @@ ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
 
 all: headers.chk headers99.chk headers++.chk
 
-PUBLIC_HEADERS := $(filter-out public/arch-% public/dom0_ops.h, $(wildcard public/*.h public/*/*.h) $(public-y))
+PUBLIC_HEADERS := $(filter-out public/arch-% public/dom0_ops.h, $(wildcard public/*.h public/*/*.h))
 
 PUBLIC_C99_HEADERS := public/io/9pfs.h public/io/pvcalls.h
 PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/xsm/% public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
Signature · 1 line
Anthony PERARD
#64 lore raw

Re: [XEN PATCH v7 23/51] build,include: remove arch-*/*.h public header listing from headers*.chk

Quoted 3 lines · Anthony PERARD

$(public-y) contains "public/arch-%" but when used by $(PUBLIC_HEADERS) $(public-y) is filtered-out by the pattern "public/arch-%". So $(public-y) content is never used.

It has been this way from its very introduction, and iirc $(public-y) was meant to be an abstract construct to which other pieces could get added in principle. I'm having a slight preference to keeping things as they are, unless you tell me that this is getting in the way of anything. And to be clear there as well - if there are no other reasons than pure cleanup, and if somebody else approved of the removal, I wouldn't object.

Jan

Quoted 22 lines
xen/include/Makefile +1 -4
@@ -39,9 +39,6 @@ cppflags-$(CONFIG_X86)    += -m32
 
 endif
 
-public-$(CONFIG_X86) := $(wildcard public/arch-x86/*.h public/arch-x86/*/*.h)
-public-$(CONFIG_ARM) := $(wildcard public/arch-arm/*.h public/arch-arm/*/*.h)
-
 .PHONY: all
 all: $(headers-y)
 
@@ -81,7 +78,7 @@ ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
 
 all: headers.chk headers99.chk headers++.chk
 
-PUBLIC_HEADERS := $(filter-out public/arch-% public/dom0_ops.h, $(wildcard public/*.h public/*/*.h) $(public-y))
+PUBLIC_HEADERS := $(filter-out public/arch-% public/dom0_ops.h, $(wildcard public/*.h public/*/*.h))
 
 PUBLIC_C99_HEADERS := public/io/9pfs.h public/io/pvcalls.h
 PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/xsm/% public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
#65 lore raw

PATCH v7 24/51 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.

---
 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                    | 40 ++++++++++-----------
 xen/scripts/Makefile.clean              |  5 ++-
 xen/xsm/flask/Makefile                  | 36 +++++++++----------
 xen/xsm/flask/policy/mkaccess_vector.sh |  7 ++--
 12 files changed, 101 insertions(+), 92 deletions(-)
xen/Rules.mk +4 -1
index 2db13a8f9c54..245efe705a1e 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
-mk-dir := .
+mk-dir := $(src)
 include $(if $(wildcard $(mk-dir)/build.mk),$(mk-dir)/build.mk,$(mk-dir)/Makefile)
 
 # Linking
xen/arch/arm/Makefile +7 -7
index 067c0d9844e4..9f9c73aa6c5d 100644
@@ -88,18 +88,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 \
@@ -109,13 +109,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 9b31bfcbfb8a..53d357489df2 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
 
 RELOC_DEPS = $(DEFS_H_DEPS) \
 	     $(BASEDIR)/include/generated/autoconf.h \
@@ -11,10 +11,10 @@ RELOC_DEPS = $(DEFS_H_DEPS) \
 	     $(BASEDIR)/include/xen/multiboot2.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)
-	$(MAKE) -f build32.mk $@ CMDLINE_DEPS="$(CMDLINE_DEPS)"
+$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS)
+	$(MAKE) -f build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
-reloc.S: reloc.c $(RELOC_DEPS)
-	$(MAKE) -f build32.mk $@ RELOC_DEPS="$(RELOC_DEPS)"
+$(obj)/reloc.S: $(src)/reloc.c $(RELOC_DEPS)
+	$(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 +20 -20
index 65a938a66555..69224e22a950 100644
@@ -40,53 +40,53 @@ cppflags-$(CONFIG_X86)    += -m32
 endif
 
 .PHONY: all
-all: $(headers-y)
+all: $(addprefix $(obj)/,$(headers-y))
 
-compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-build-header.py
-	$(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $@ >>[email protected]; \
+$(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]; \
 	mv -f [email protected] $@
 
-compat/%.i: compat/%.c Makefile
+$(obj)/compat/%.i: $(obj)/compat/%.c $(src)/Makefile
 	$(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $<
 
-compat/%.c: public/%.h xlat.lst Makefile $(BASEDIR)/tools/compat-build-source.py
+$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(src)/Makefile $(BASEDIR)/tools/compat-build-source.py
 	mkdir -p $(@D)
-	$(PYTHON) $(BASEDIR)/tools/compat-build-source.py xlat.lst <$< >[email protected]
+	$(PYTHON) $(BASEDIR)/tools/compat-build-source.py $(src)/xlat.lst <$< >[email protected]
 	mv -f [email protected] $@
 
-compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst $(BASEDIR)/tools/get-fields.sh Makefile
+$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(BASEDIR)/tools/get-fields.sh $(src)/Makefile
 	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]
 	mv -f [email protected] $@
 
-.PRECIOUS: compat/.xlat/%.lst
-compat/.xlat/%.lst: xlat.lst Makefile
+.PRECIOUS: $(obj)/compat/.xlat/%.lst
+$(obj)/compat/.xlat/%.lst: $(src)/xlat.lst $(src)/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],$@)
 
-xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:blank:]]+[^[:blank:]]+[[:blank:]]+,,p' xlat.lst | uniq)
+xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:blank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(src)/xlat.lst | uniq)
 xlat-y := $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y))
 
-compat/xlat.h: $(addprefix compat/.xlat/,$(xlat-y)) config/auto.conf Makefile
+$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) $(obj)/config/auto.conf $(src)/Makefile
 	cat $(filter %.h,$^) >[email protected]
 	mv -f [email protected] $@
 
 ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH))
 
-all: headers.chk headers99.chk headers++.chk
+all: $(obj)/headers.chk $(obj)/headers99.chk $(obj)/headers++.chk
 
-PUBLIC_HEADERS := $(filter-out public/arch-% public/dom0_ops.h, $(wildcard public/*.h public/*/*.h))
+PUBLIC_HEADERS := $(filter-out $(src)/public/arch-% $(src)/public/dom0_ops.h, $(wildcard $(src)/public/*.h $(src)/public/*/*.h))
 
-PUBLIC_C99_HEADERS := public/io/9pfs.h public/io/pvcalls.h
-PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/xsm/% public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
+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
 
-headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
+$(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(src)/Makefile
 	for i in $(filter %.h,$^); do \
 	    $(CC) -x c -ansi -Wall -Werror -include stdint.h \
 	          -S -o /dev/null $$i || exit 1; \
@@ -94,7 +94,7 @@ headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
 	done >[email protected]
 	mv [email protected] $@
 
-headers99.chk: $(PUBLIC_C99_HEADERS) Makefile
+$(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(src)/Makefile
 	rm -f [email protected]
 	$(foreach i, $(filter %.h,$^),                                        \
 	    echo "#include "\"$(i)\"                                          \
@@ -104,7 +104,7 @@ headers99.chk: $(PUBLIC_C99_HEADERS) Makefile
 	    || exit $$?; echo $(i) >> [email protected];)
 	mv [email protected] $@
 
-headers++.chk: $(PUBLIC_HEADERS) Makefile
+$(obj)/headers++.chk: $(PUBLIC_HEADERS) $(src)/Makefile
 	rm -f [email protected]
 	if ! $(CXX) -v >/dev/null 2>&1; then                                  \
 	    touch [email protected];                                                     \
@@ -113,7 +113,7 @@ headers++.chk: $(PUBLIC_HEADERS) Makefile
 	$(foreach i, $(filter %.h,$^),                                        \
 	    echo "#include "\"$(i)\"                                          \
 	    | $(CXX) -x c++ -std=gnu++98 -Wall -Werror -D__XEN_TOOLS__        \
-	      -include stdint.h -include public/xen.h                         \
+	      -include stdint.h -include $(src)/public/xen.h                  \
 	      $(foreach j, $($(i)-prereq), -include c$(j)) -S -o /dev/null -  \
 	    || exit $$?; echo $(i) >> [email protected];)
 	mv [email protected] $@
@@ -123,7 +123,7 @@ endif
 ifeq ($(XEN_TARGET_ARCH),x86_64)
 .PHONY: lib-x86-all
 lib-x86-all:
-	$(MAKE) -C xen/lib/x86 all
+	$(MAKE) -C $(obj)/xen/lib/x86 all
 
 all: lib-x86-all
 endif
xen/scripts/Makefile.clean +4 -1
index b6df9e861e6e..36b7e7e92f93 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 f4d4038c01bd..ab26b8682e46 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)
 	cmp -s $(POLICY_SRC) $@ || cp $(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 v7 24/51
#66 lore raw

Re: [XEN PATCH v7 24/51] build: prepare to always invoke $(MAKE) from xen/, use $(obj)

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 7 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.

Nevertheless a couple of remarks:

xen/arch/x86/Makefile note_file_option ?= $(note_file) · line 194

Quoted 7 lines
xen/arch/x86/Makefile +0 -0
[...]
@@ -192,25 +192,25 @@ note_file_option ?= $(note_file)
 
 ifeq ($(XEN_BUILD_PE),y)
 extra-y += efi.lds

What about this? Does this for some reason also fall into the "cannot be converted yet" group?

Quoted 5 lines
xen/arch/x86/Makefile +0 -1
@@ -222,14 +222,14 @@ $(TARGET).efi: FORCE
 endif
 
 # These should already have been rebuilt when building the prerequisite of "prelink.o"
-efi/buildid.o efi/relocs-dummy.o: ;

xen/arch/x86/Makefile $(TARGET).efi: FORCE · line 232

Quoted 10 lines
xen/arch/x86/Makefile +3 -2
+$(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ;
 
 .PHONY: include
 include: $(BASEDIR)/arch/x86/include/asm/asm-macros.h
 
-asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
+$(obj)/asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
-$(BASEDIR)/arch/x86/include/asm/asm-macros.h: asm-macros.i Makefile
+$(BASEDIR)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile

Isn't this $(obj)/include/asm/asm-macros.h ? And in general doesn't use of $(BASEDIR) need to go away then, e.g. ...

xen/arch/x86/boot/Makefile line 3

Quoted 7 lines
xen/arch/x86/boot/Makefile +1 -1
@@ -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

... here needing to become $(src)/../../../include/xen/stdbool.h ?

xen/scripts/Makefile.clean line 7

Quoted 8 lines
xen/scripts/Makefile.clean +2 -0
@@ -3,11 +3,14 @@
 # Cleaning up
 # ==========================================================================
 
+obj := .
+src := $(obj)

This repeats what is also getting added to Rules.mk. To prevent the two going out of sync, wouldn't they better live in a central place (e.g. scripts/defs.mk)?

Jan

#67 lore raw

Re: [XEN PATCH v7 24/51] build: prepare to always invoke $(MAKE) from xen/, use $(obj)

Quoted 26 lines · Jan Beulich
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 7 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.

Nevertheless a couple of remarks:

Quoted 5 lines
xen/arch/x86/Makefile +0 -0
[...]
@@ -192,25 +192,25 @@ note_file_option ?= $(note_file)
 
Quoted 5 lines

xen/arch/x86/Makefile note_file_option ?= $(note_file) · line 194

Quoted 2 lines
xen/arch/x86/Makefile +0 -0
 ifeq ($(XEN_BUILD_PE),y)
 extra-y += efi.lds

What about this? Does this for some reason also fall into the "cannot be converted yet" group?

$(extra-y) is treated the same way as $(obj-y), it is used to list item to build in the current subdirectory. So there is no need to add $(obj)/

Quoted 10 lines
Quoted 10 lines
xen/arch/x86/Makefile +1 -1
@@ -222,14 +222,14 @@ $(TARGET).efi: FORCE
 endif
 
 # These should already have been rebuilt when building the prerequisite of "prelink.o"
-efi/buildid.o efi/relocs-dummy.o: ;
+$(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ;
 
 .PHONY: include
 include: $(BASEDIR)/arch/x86/include/asm/asm-macros.h
 
Quoted 8 lines

xen/arch/x86/Makefile $(TARGET).efi: FORCE · line 232

Quoted 5 lines
xen/arch/x86/Makefile +2 -2
-asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
+$(obj)/asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
-$(BASEDIR)/arch/x86/include/asm/asm-macros.h: asm-macros.i Makefile
+$(BASEDIR)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile

Isn't this $(obj)/include/asm/asm-macros.h ? And in general doesn't use of $(BASEDIR) need to go away then, e.g. ...

I've limited this patch to add $(obj)/ and $(src)/ were needed, I think.

And yes, BASEDIR will need to go away.

Quoted 9 lines

xen/arch/x86/boot/Makefile line 3

Quoted 7 lines
xen/arch/x86/boot/Makefile +1 -1
@@ -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

... here needing to become $(src)/../../../include/xen/stdbool.h ?

BASEDIR will be dealt with later.

Quoted 6 lines
Quoted 6 lines
xen/scripts/Makefile.clean +0 -0
@@ -3,11 +3,14 @@
 # Cleaning up
 # ==========================================================================
 
Quoted 6 lines

xen/scripts/Makefile.clean line 7

Quoted 2 lines
xen/scripts/Makefile.clean +2 -0
+obj := .
+src := $(obj)

This repeats what is also getting added to Rules.mk. To prevent the two going out of sync, wouldn't they better live in a central place (e.g. scripts/defs.mk)?

It looks like they are the same but they are not, it doesn't matter if they go out of sync, and they actually do in my patch series.

Thanks,

Signature · 1 line
Anthony PERARD
#68 lore raw

Re: [XEN PATCH v7 24/51] build: prepare to always invoke $(MAKE) from xen/, use $(obj)

Quoted 21 lines · Anthony PERARD
Quoted 11 lines · Jan Beulich
Quoted 10 lines · Anthony PERARD
xen/arch/x86/Makefile +1 -1
@@ -222,14 +222,14 @@ $(TARGET).efi: FORCE
 endif
 
 # These should already have been rebuilt when building the prerequisite of "prelink.o"
-efi/buildid.o efi/relocs-dummy.o: ;
+$(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ;
 
 .PHONY: include
 include: $(BASEDIR)/arch/x86/include/asm/asm-macros.h
 
Quoted 8 lines

xen/arch/x86/Makefile $(TARGET).efi: FORCE · line 232

Quoted 5 lines
xen/arch/x86/Makefile +2 -2
-asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
+$(obj)/asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
-$(BASEDIR)/arch/x86/include/asm/asm-macros.h: asm-macros.i Makefile
+$(BASEDIR)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile

Isn't this $(obj)/include/asm/asm-macros.h ? And in general doesn't use of $(BASEDIR) need to go away then, e.g. ...

Quoted 3 lines

I've limited this patch to add $(obj)/ and $(src)/ were needed, I think.

And yes, BASEDIR will need to go away.

And replacing it here while you're touching the line anyway is not an option?

Quoted 13 lines
Quoted 6 lines
Quoted 6 lines
xen/scripts/Makefile.clean +0 -0
@@ -3,11 +3,14 @@
 # Cleaning up
 # ==========================================================================
 
Quoted 6 lines

xen/scripts/Makefile.clean line 7

Quoted 2 lines
xen/scripts/Makefile.clean +2 -0
+obj := .
+src := $(obj)

This repeats what is also getting added to Rules.mk. To prevent the two going out of sync, wouldn't they better live in a central place (e.g. scripts/defs.mk)?

Quoted 2 lines

It looks like they are the same but they are not, it doesn't matter if they go out of sync, and they actually do in my patch series.

How can them going out of sync be correct?

Jan

#69 lore raw

PATCH v7 25/51 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.

---
 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..563b323f0501 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
#70 lore raw

Re: [XEN PATCH v7 25/51] build: rework test/livepatch/Makefile

Quoted 21 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.

Quoted 7 lines

"$(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.

Just two and a half remarks; I'd really like the livepatch maintainers to properly review this change.

xen/scripts/Kbuild.include why = \ · line 152

Quoted 5 lines
xen/scripts/Kbuild.include +0 -0
@@ -151,3 +151,12 @@ why =                                                                        \
 
 echo-why = $(call escsq, $(strip $(why)))

Not the least seeing this in context, ...

xen/scripts/Kbuild.include why = \ · line 158

Quoted 6 lines
xen/scripts/Kbuild.include +5 -0
 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

... I would wish we wouldn't introduce further names with underscores in them when dashes are valid to be used.

xen/scripts/Kbuild.include why = \ · line 161

Quoted 3 lines
xen/scripts/Kbuild.include +3 -0
+$(foreach m, $(notdir $1), \
+	$(eval $(obj)/$m: \
+	$(addprefix $(obj)/, $(foreach s, $3, $($(m:%$(strip $2)=%$(s)))))))

I'd like to suggest to be consistent here: Either $(s) and then also $(m) in both places, or $m and then also $s.

xen/test/livepatch/Makefile xen_note.o: · line 153

Quoted 9 lines
xen/test/livepatch/Makefile +6 -0
[...]
+$(obj)/%.livepatch: FORCE
+	$(call if_changed,livepatch)
+
+$(call multi_depend, $(filter %.livepatch,$(extra-y)), .livepatch, -objs)
+targets += $(sort $(foreach m,$(basename $(notdir $(filter %.livepatch,$(extra-y)))), \
+    $($(m)-objs)))

I think it would help readability if the 2nd line was properly indented to reflect the pending open parentheses:

targets += $(sort $(foreach m,$(basename $(notdir $(filter %.livepatch,$(extra-y)))), \
                    $($(m)-objs)))

or (less desirable imo)

targets += $(sort \
             $(foreach m,$(basename $(notdir $(filter %.livepatch,$(extra-y)))), \
               $($(m)-objs)))

Jan

#71 lore raw

PATCH v7 26/51 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.

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.

---

Notes:
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                |  28 ++++----
 xen/Rules.mk                | 134 ++++++++++++++++++++++++------------
 xen/arch/arm/Makefile       |   4 +-
 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                |  16 +++--
 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 +-
 16 files changed, 153 insertions(+), 101 deletions(-)
xen/Makefile +16 -12
index f07c9251c030..eb9ea70aaa29 100644
@@ -20,6 +20,10 @@ export PYTHON		?= $(PYTHON_INTERPRETER)
 export BASEDIR := $(CURDIR)
 export XEN_ROOT := $(BASEDIR)/..
 
+srctree := .
+objtree := .
+export srctree objtree
+
 # Do not use make's built-in rules and variables
 MAKEFLAGS += -rR
 
@@ -45,7 +49,7 @@ export KCONFIG_CONFIG ?= .config
 
 export CC CXX LD
 
-export TARGET := $(BASEDIR)/xen
+export TARGET := xen
 
 .PHONY: default
 default: build
@@ -236,7 +240,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)
@@ -339,10 +343,10 @@ _install: $(TARGET)$(CONFIG_XEN_INSTALL_SUFFIX)
 
 .PHONY: tests
 tests:
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C test tests
+	$(MAKE) $(build)=test
 .PHONY: install-tests
 install-tests:
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C test install
+	$(MAKE) $(build)=test install
 
 .PHONY: _uninstall
 _uninstall: D=$(DESTDIR)
@@ -398,16 +402,16 @@ $(TARGET).gz: $(TARGET)
 
 $(TARGET): FORCE
 	$(MAKE) -C tools
-	$(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h
+	$(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 $@
+	$(MAKE) $(build)=include all
+	$(MAKE) $(build)=arch/$(TARGET_ARCH) include
+	$(MAKE) $(build)=. arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
+	$(MAKE) $(build)=. $@
 
 SUBDIRS = xsm arch/$(TARGET_ARCH) common drivers lib test
 define all_sources
@@ -454,13 +458,13 @@ _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)
+	$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
 %.o %.s: %.S FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $(*D) $(@F)
+	$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
 %/: FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o built_in_bin.o
+	$(MAKE) $(build)=$* need-builtin=1
 
 .PHONY: cloc
 cloc:
xen/Rules.mk +89 -45

237 lines not on this page · raw message

xen/arch/arm/Makefile +2 -2
index 9f9c73aa6c5d..a3204d22d17b 100644
@@ -93,12 +93,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/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 bb2da0d013fb..f60084eb73e7 100644
@@ -81,6 +81,9 @@ endif
 extra-y += asm-macros.i
 extra-y += xen.lds
 
+# Allows usercopy.c to includes itself
+$(obj)/usercopy.o: CFLAGS-y += -I.
+
 ifneq ($(CONFIG_HVM),y)
 $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif
@@ -132,13 +135,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 $(@D)/.$(@F).0.o
+	$(MAKE) $(build)=$(@D) $(@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 $(@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) \
@@ -202,14 +205,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 $(@D)/.$(@F).0r.o $(@D)/.$(@F).0s.o
+	$(MAKE) $(build)=$(@D) .$(@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 $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o
+	$(MAKE) $(build)=$(@D) .$(@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 61e0222f4a08..8bbf3e18e410 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-check-relocs := $(shell $(OBJDUMP) -p $(efi-check-o:.o=.efi) | grep '^[[:bla
 ifeq ($(efi-check-relocs),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 53d357489df2..2469ca7c4530 100644
@@ -1,8 +1,8 @@
 obj-bin-y += head.o
 
-DEFS_H_DEPS = $(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
+DEFS_H_DEPS = $(BASEDIR)/$(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) $(src)/video.h
+CMDLINE_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/$(src)/video.h
 
 RELOC_DEPS = $(DEFS_H_DEPS) \
 	     $(BASEDIR)/include/generated/autoconf.h \
@@ -14,7 +14,7 @@ RELOC_DEPS = $(DEFS_H_DEPS) \
 $(obj)/head.o: $(obj)/cmdline.S $(obj)/reloc.S
 
 $(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS)
-	$(MAKE) -f build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
+	$(MAKE) -f $(BASEDIR)/$(src)/build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
 $(obj)/reloc.S: $(src)/reloc.c $(RELOC_DEPS)
-	$(MAKE) -f build32.mk -C $(obj) $(@F) RELOC_DEPS="$(RELOC_DEPS)"
+	$(MAKE) -f $(BASEDIR)/$(src)/build32.mk -C $(obj) $(@F) RELOC_DEPS="$(RELOC_DEPS)"
xen/build.mk +10 -6
index 9093d9f493bc..c6c06d9f17f5 100644
@@ -57,11 +57,15 @@ arch/$(TARGET_ARCH)/include/asm/asm-offsets.h: asm-offsets.s
 	  echo ""; \
 	  echo "#endif") <$< >$@
 
-# 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: ;
+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
@@ -79,4 +83,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 69224e22a950..341196306abd 100644
@@ -58,7 +58,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
@@ -83,8 +83,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 563b323f0501..62c7caeba1d1 100644
@@ -59,6 +59,12 @@ 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))
 
+###
+# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
+# Usage:
+# $(Q)$(MAKE) $(build)=dir
+build := -f $(BASEDIR)/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 e59245323e92..52ee58a08c5f 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 ab26b8682e46..57190ff6c8ad 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 := $(BASEDIR)/$(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
#72 lore raw

Re: [XEN PATCH v7 26/51] build: build everything from the root dir, use obj=$subdir

Quoted 8 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".

How "good" are our chances that we hit a need-builtin variable from the environment? Its uses are simply using "ifdef".

Quoted 10 lines
xen/Rules.mk +1 -1
@@ -3,19 +3,29 @@
 # Makefile and are consumed by Rules.mk
 #
 
-obj := .
 src := $(obj)
 
+PHONY := __build

xen/Rules.mk line 18

Quoted 10 lines
xen/Rules.mk +5 -0
+__build:
+
 -include $(BASEDIR)/include/config/auto.conf
 
 include $(XEN_ROOT)/Config.mk
 include $(BASEDIR)/scripts/Kbuild.include
 
+ifndef obj
+$(warning kbuild: Rules.mk is included improperly)
+endif

Is there a particular reason for this to come only here, rather than before the include-s (e.g. right at where the assignment to the variable lived)?

Quoted 9 lines
xen/Rules.mk +0 -5
@@ -51,27 +61,54 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
 quiet_cmd_binfile = BINFILE $@
 cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
 
-define gendep
-    ifneq ($(1),$(subst /,:,$(1)))
-        DEPS += $(dir $(1)).$(notdir $(1)).d
-    endif
-endef

xen/Rules.mk cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@ · line 72

Quoted 10 lines
xen/Rules.mk +9 -1
-$(foreach o,$(filter-out %/,$(obj-y) $(obj-bin-y) $(extra-y)),$(eval $(call gendep,$(o))))
+# Figure out what we need to build from the various variables
+# ===========================================================================
+
+# Libraries are always collected in one lib file.
+# Filter out objects already built-in
+lib-y := $(filter-out $(obj-y), $(sort $(lib-y)))
+
+# Subdirectories we need to descend into
+subdir-y := $(subdir-y) $(patsubst %/,%,$(filter %/, $(obj-y)))

Deliberately or accidentally not += ?

Quoted 8 lines
xen/Rules.mk +0 -4
@@ -156,21 +192,13 @@ endif
 PHONY += FORCE
 FORCE:
 
-%/built_in.o %/lib.a: FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o
-
-%/built_in_bin.o: FORCE

xen/Rules.mk endif · line 199

Quoted 10 lines
xen/Rules.mk +1 -5
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in_bin.o
-
-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)
-        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(dot-target).tmp $@
+        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@

Are you sure about the $< => $(<F) transformation here? Previoiusly it was present only ...

xen/Rules.mk endif · line 201

Quoted 3 lines
xen/Rules.mk +1 -1
     else
-        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(dot-target).tmp $@
+        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@

... here.

xen/Rules.mk existing-targets := $(wildcard $(sort $(targets))) · line 295

Quoted 5 lines
xen/Rules.mk +1 -0
@@ -251,6 +292,9 @@ 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)

Nit: Preferably blanks on both sides of := or none at all, please.

xen/arch/x86/Makefile endif · line 84

Quoted 7 lines
xen/arch/x86/Makefile +1 -0
@@ -81,6 +81,9 @@ endif
 extra-y += asm-macros.i
 extra-y += xen.lds
 
+# Allows usercopy.c to includes itself

Nit: include

xen/arch/x86/Makefile endif · line 85

Quoted 1 line
xen/arch/x86/Makefile +1 -0
+$(obj)/usercopy.o: CFLAGS-y += -I.

This is ugly, but presumably unavoidable. Preferably I would see us the more specific -iquote though, assuming clang also supports it.

xen/arch/x86/boot/Makefile line 5

Quoted 10 lines
xen/arch/x86/boot/Makefile +2 -2
@@ -1,8 +1,8 @@
 obj-bin-y += head.o
 
-DEFS_H_DEPS = $(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
+DEFS_H_DEPS = $(BASEDIR)/$(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) $(src)/video.h
+CMDLINE_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/$(src)/video.h

Hmm, new uses of $(BASEDIR) (a few more further down). Why not $(srctree)?

Jan

#73 lore raw

Re: [XEN PATCH v7 26/51] build: build everything from the root dir, use obj=$subdir

Quoted 5 lines · Jan Beulich
Quoted 4 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.

Quoted 7 lines
Quoted 4 lines

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".

How "good" are our chances that we hit a need-builtin variable from the environment? Its uses are simply using "ifdef".

I think it would be low as Linux is using the same one. If it were define, I think that would mean building a few more object than expected which would not be used.

Quoted 17 lines
Quoted 17 lines
xen/Rules.mk +3 -1
@@ -3,19 +3,29 @@
 # Makefile and are consumed by Rules.mk
 #
 
-obj := .
 src := $(obj)
 
+PHONY := __build
+__build:
+
 -include $(BASEDIR)/include/config/auto.conf
 
 include $(XEN_ROOT)/Config.mk
 include $(BASEDIR)/scripts/Kbuild.include
 
Quoted 7 lines

xen/Rules.mk line 18

Quoted 3 lines
xen/Rules.mk +3 -0
+ifndef obj
+$(warning kbuild: Rules.mk is included improperly)
+endif

Is there a particular reason for this to come only here, rather than before the include-s (e.g. right at where the assignment to the variable lived)?

Probably not, Linux's Kbuild does check it quite late but I don't know the reason. I can move the check earlier.

Quoted 13 lines
Quoted 13 lines
xen/Rules.mk +3 -6
@@ -51,27 +61,54 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
 quiet_cmd_binfile = BINFILE $@
 cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
 
-define gendep
-    ifneq ($(1),$(subst /,:,$(1)))
-        DEPS += $(dir $(1)).$(notdir $(1)).d
-    endif
-endef
-$(foreach o,$(filter-out %/,$(obj-y) $(obj-bin-y) $(extra-y)),$(eval $(call gendep,$(o))))
+# Figure out what we need to build from the various variables
+# ===========================================================================
+
Quoted 8 lines

xen/Rules.mk cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@ · line 72

Quoted 6 lines
xen/Rules.mk +6 -0
+# Libraries are always collected in one lib file.
+# Filter out objects already built-in
+lib-y := $(filter-out $(obj-y), $(sort $(lib-y)))
+
+# Subdirectories we need to descend into
+subdir-y := $(subdir-y) $(patsubst %/,%,$(filter %/, $(obj-y)))

Deliberately or accidentally not += ?

Seems to be accidentally. Kbuild does a $(sort ) here, I should probably do the same, just to get rid of duplicates if they are any.

Quoted 13 lines
Quoted 13 lines
xen/Rules.mk +0 -8
@@ -156,21 +192,13 @@ endif
 PHONY += FORCE
 FORCE:
 
-%/built_in.o %/lib.a: FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o
-
-%/built_in_bin.o: FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in_bin.o
-
-SRCPATH := $(patsubst $(BASEDIR)/%,%,$(CURDIR))
-
 quiet_cmd_cc_o_c = CC      $@
Quoted 8 lines

xen/Rules.mk endif · line 199

Quoted 5 lines
xen/Rules.mk +1 -1
 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)
-        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(dot-target).tmp $@
+        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@

Are you sure about the $< => $(<F) transformation here? Previoiusly it was present only ...

I have to check again. Maybe $< didn't work and it's more obvious with this patch. Or maybe that depends on the version of clang.

Quoted 6 lines

xen/Rules.mk endif · line 201

Quoted 3 lines
xen/Rules.mk +1 -1
     else
-        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(dot-target).tmp $@
+        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@

... here.

Quoted 7 lines

xen/Rules.mk existing-targets := $(wildcard $(sort $(targets))) · line 295

Quoted 5 lines
xen/Rules.mk +1 -0
@@ -251,6 +292,9 @@ 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)

Nit: Preferably blanks on both sides of := or none at all, please.

Will fix.

Quoted 9 lines

xen/arch/x86/Makefile endif · line 84

Quoted 7 lines
xen/arch/x86/Makefile +1 -0
@@ -81,6 +81,9 @@ endif
 extra-y += asm-macros.i
 extra-y += xen.lds
 
+# Allows usercopy.c to includes itself

Nit: include

Indeed.

Quoted 4 lines

xen/arch/x86/Makefile endif · line 85

Quoted 1 line
xen/arch/x86/Makefile +1 -0
+$(obj)/usercopy.o: CFLAGS-y += -I.

This is ugly, but presumably unavoidable. Preferably I would see us the more specific -iquote though, assuming clang also supports it.

clang does have -iquote, so I guess it could be used. That would be the first use of -iquote so I hope nothing would break with it.

Quoted 5 lines
Quoted 5 lines
xen/arch/x86/boot/Makefile +0 -0
@@ -1,8 +1,8 @@
 obj-bin-y += head.o
 
Quoted 8 lines

xen/arch/x86/boot/Makefile line 5

Quoted 5 lines
xen/arch/x86/boot/Makefile +2 -2
-DEFS_H_DEPS = $(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
+DEFS_H_DEPS = $(BASEDIR)/$(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) $(src)/video.h
+CMDLINE_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/$(src)/video.h

Hmm, new uses of $(BASEDIR) (a few more further down). Why not $(srctree)?

I think I haven't introduce $(abs_srctree) yet, and this needs to be an absolute path (the path is also used by a make which run from a different current directory).

Thanks,

Signature · 1 line
Anthony PERARD
#74 lore raw

Re: [XEN PATCH v7 26/51] build: build everything from the root dir, use obj=$subdir

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

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)
(quoted diff) +1 -1
-        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(dot-target).tmp $@
+        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@
Quoted 5 lines
Quoted 2 lines

Are you sure about the $< => $(<F) transformation here? Previoiusly it was present only ...

I have to check again. Maybe $< didn't work and it's more obvious with this patch. Or maybe that depends on the version of clang.

With clang 12, the original line doesn't work for the few objects that are built from "subdir/source.c". I guess it is just by luck that they aren't any duplicated symbols.

Quoted 5 lines
Quoted 5 lines

xen/Rules.mk endif · line 201

Quoted 3 lines

else

xen/Rules.mk +1 -1
-        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(dot-target).tmp $@
+        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@

... here.

Signature · 1 line
Anthony PERARD
#75 lore raw

Re: [XEN PATCH v7 26/51] build: build everything from the root dir, use obj=$subdir

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

Review

Quoted 5 lines · Anthony PERARD

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)
(quoted diff) +1 -1
-        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(dot-target).tmp $@
+        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@

Are you sure about the $< => $(<F) transformation here? Previoiusly it was present only ...

Quoted 6 lines
Quoted 2 lines

I have to check again. Maybe $< didn't work and it's more obvious with this patch. Or maybe that depends on the version of clang.

With clang 12, the original line doesn't work for the few objects that are built from "subdir/source.c". I guess it is just by luck that they aren't any duplicated symbols.

Well, I recall that there was different behavior and hence different treatment was needed. If that's no longer the case with your changes, then that's certainly fine, but will want explaining in the description.

Jan

#76 lore raw

PATCH v7 27/51 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.

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

---
 .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 59a22d1685e2..550b38b9fa3c 100644
@@ -338,6 +338,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 eb9ea70aaa29..1b5517b02a8c 100644
@@ -187,6 +187,13 @@ endif
 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)"
 
@@ -400,7 +407,7 @@ $(TARGET).gz: $(TARGET)
 	gzip -n -f -9 < $< > [email protected]
 	mv [email protected] $@
 
-$(TARGET): FORCE
+$(TARGET): tools_fixdep FORCE
 	$(MAKE) -C tools
 	$(MAKE) $(build)=. include/xen/compile.h
 	[ -e arch/$(TARGET_ARCH)/efi ] && for f in $$(cd common/efi; echo *.[ch]); \
@@ -457,13 +464,13 @@ 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
 	$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
-%.o %.s: %.S FORCE
+%.o %.s: %.S tools_fixdep FORCE
 	$(MAKE) $(build)=$(*D) $(*D)/$(@F)
 
-%/: FORCE
+%/: tools_fixdep FORCE
 	$(MAKE) $(build)=$* need-builtin=1
 
 .PHONY: cloc
xen/Rules.mk +7 -10
index 2e1435ff4ada..9b8415160649 100644
@@ -148,8 +148,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
 
@@ -206,7 +206,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
 
@@ -217,7 +217,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  $@
@@ -247,13 +247,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     $@
@@ -292,9 +292,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 f60084eb73e7..05f1d12065a0 100644
@@ -248,7 +248,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 $@ $<
@@ -264,9 +264,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 c6c06d9f17f5..537c32f42d25 100644
@@ -37,6 +37,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner FORCE
 	$(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
 	$(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 62c7caeba1d1..aa3a8a1bd9e7 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
@@ -81,6 +80,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)
@@ -109,15 +110,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
Reviewed-by on v7 27/51
#77 lore raw

Re: [XEN PATCH v7 27/51] build: introduce if_changed_deps

Quoted 9 lines · 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.

Quoted 8 lines

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.

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

with a question:

Quoted 17 lines
xen/Makefile +7 -0
@@ -187,6 +187,13 @@ endif
 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)"
 

xen/Makefile $(TARGET).gz: $(TARGET) · line 411

Quoted 6 lines
xen/Makefile +1 -1
@@ -400,7 +407,7 @@ $(TARGET).gz: $(TARGET)
 	gzip -n -f -9 < $< > [email protected]
 	mv [email protected] $@
 
-$(TARGET): FORCE
+$(TARGET): tools_fixdep FORCE
 	$(MAKE) -C tools

Shouldn't this include building fixdep, in which case the extra dependency here is unnecessary? I can see that it's needed ...

xen/Makefile cscope: · line 468

Quoted 7 lines
xen/Makefile +1 -1
@@ -457,13 +464,13 @@ 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
 	$(MAKE) $(build)=$(*D) $(*D)/$(@F)

... in cases like this one.

Jan

#78 lore raw

Re: [XEN PATCH v7 27/51] build: introduce if_changed_deps

Quoted 11 lines · Jan Beulich

xen/Makefile $(TARGET).gz: $(TARGET) · line 411

Quoted 7 lines · Anthony PERARD
xen/Makefile +1 -1
@@ -400,7 +407,7 @@ $(TARGET).gz: $(TARGET)
 	gzip -n -f -9 < $< > [email protected]
 	mv [email protected] $@
 
-$(TARGET): FORCE
+$(TARGET): tools_fixdep FORCE
 	$(MAKE) -C tools

Shouldn't this include building fixdep, in which case the extra dependency here is unnecessary? I can see that it's needed ...

Indeed, we don't really needs "tools_fixdep" prerequisite because the first command of the recipe is going to build fixdep.

Thanks,

Signature · 1 line
Anthony PERARD
#79 lore raw

PATCH v7 28/51 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 9b8415160649..a62c761be8d1 100644
@@ -257,7 +257,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
Reviewed-by on v7 28/51
#80 lore raw

Re: [XEN PATCH v7 28/51] build: rename __LINKER__ to LINKER_SCRIPT

Quoted 5 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.

#81 lore raw

PATCH v7 29/51 build: add an other explicite rules to not build $(XEN_ROOT)/.config

In reply to Anthony PERARD

GNU Make will try to rebuild every Makefile included with the "include" directive, so everytime Config.mk is used, make will try to build ".config". This would normally not be an issue, unless we happen to have a rules which match. This is the case with Kconfig in xen/.

While we had a workaround in "xen/Makefile", this ".config" files becomes an issue again in "xen/tools/kconfig/Makefile". It has a target "%.config".

---
 xen/Rules.mk | 4 ++++
 1 file changed, 4 insertions(+)
xen/Rules.mk +4 -0
index a62c761be8d1..f1043a78a332 100644
@@ -11,6 +11,10 @@ __build:
 -include $(BASEDIR)/include/config/auto.conf
 
 include $(XEN_ROOT)/Config.mk
+
+# Don't try to remake this file included by Config.mk.
+$(XEN_ROOT)/.config: ;
+
 include $(BASEDIR)/scripts/Kbuild.include
 
 ifndef obj
Signature · 1 line
Anthony PERARD
#82 lore raw

Re: [XEN PATCH v7 29/51] build: add an other explicite rules to not build $(XEN_ROOT)/.config

Quoted 8 lines · Anthony PERARD

GNU Make will try to rebuild every Makefile included with the "include" directive, so everytime Config.mk is used, make will try to build ".config". This would normally not be an issue, unless we happen to have a rules which match. This is the case with Kconfig in xen/.

While we had a workaround in "xen/Makefile", this ".config" files becomes an issue again in "xen/tools/kconfig/Makefile". It has a target "%.config".

"we had" sounds like we don't have such anymore, but I don't think I've seen it go away. I'm also not convinced working around an isolated issue in xen/tools/kconfig/Makefile is appropriate to be done by adding stuff to Rules.mk.

Jan

#83 lore raw

PATCH v7 30/51 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.

---
 xen/Makefile                                 |  34 ++++--
 xen/Rules.mk                                 |  13 ++-
 xen/scripts/Kbuild.include                   |  31 ++++++
 xen/scripts/Makefile.clean                   |   9 ++
 xen/{tools/kconfig => scripts}/Makefile.host |   3 +
 xen/tools/kconfig/Makefile.kconfig           | 106 -------------------
 6 files changed, 78 insertions(+), 118 deletions(-)
 rename xen/{tools/kconfig => scripts}/Makefile.host (98%)
 delete mode 100644 xen/tools/kconfig/Makefile.kconfig
xen/Makefile +23 -11
index 1b5517b02a8c..0da08bc39930 100644
@@ -33,6 +33,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
@@ -156,6 +157,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 :=
@@ -194,22 +202,19 @@ 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
 # in tools/kconfig to make the *config target
 
-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: FORCE
-	$(MAKE) $(kconfig) $@
+%config: tools_fixdep FORCE
+	$(Q)$(MAKE) $(build)=tools/kconfig $@
 
 else # !config-build
 
@@ -219,9 +224,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
@@ -230,7 +241,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
@@ -391,9 +402,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 f1043a78a332..760ccff0e8f1 100644
@@ -94,6 +94,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)))
 
@@ -272,7 +279,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 aa3a8a1bd9e7..3e436639da1c 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 +9 -0
index 36b7e7e92f93..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)
+ifneq ($(strip $(__clean-files)),)
+	rm -rf $(__clean-files)
+endif
+	@:
 
 # Descending
 # ---------------------------------------------------------------------------
xen/scripts/Makefile.host renamed from xen/tools/kconfig/Makefile.host +3 -0
similarity index 98%
rename from xen/tools/kconfig/Makefile.host
rename to xen/scripts/Makefile.host
index 4c51c95d40f4..61c7bff7a9bb 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     $@
xen/tools/kconfig/Makefile.kconfig deleted +0 -106

106 lines not on this page · raw message

Signature · 1 line
Anthony PERARD
#85 lore raw

Re: [XEN PATCH v7 30/51] build: hook kconfig into xen build system

Quoted 8 lines · Jan Beulich
Quoted 5 lines · 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.

Thanks.

I'll be squashing the previous patch into this one i.e. adding "$(XEN_ROOT)/.config: ;" into tools/kconfig/Makefile (the previous patch was adding it into Rules.mk).

And will be adding the following into the commit message:

"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.

Signature · 1 line
Anthony PERARD
#86 lore raw

PATCH v7 31/51 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
#87 lore raw

PATCH v7 32/51 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 61c7bff7a9bb..9d3730d28950 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
Acked-by on v7 32/51
#88 lore raw

Re: [XEN PATCH v7 32/51] build: Remove KBUILD_ specific from Makefile.host

Quoted 8 lines · 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.

I wonder though whether their use of KBUILD_ prefixes doesn't match our XEN_ ones (e.g. KBUILD_CFLAGS vs XEN_CFLAGS), in which case replacing rather than stripping might be the way to go.

Jan

#89 lore raw

Re: [XEN PATCH v7 32/51] build: Remove KBUILD_ specific from Makefile.host

Quoted 8 lines · Jan Beulich
Quoted 7 lines · 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.

Quoted 7 lines
Quoted 1 line

I wonder though whether their use of KBUILD_ prefixes doesn't match our XEN_ ones (e.g. KBUILD_CFLAGS vs XEN_CFLAGS), in which case replacing rather than stripping might be the way to go.

Well, at the moment, HOSTCFLAGS is defined in Config.mk, and xen/ makes use of it. I don't think the other variable that I strip KBUILD_ from exist, so maybe for those, changing prefix for XEN_ would be fine. But for HOSTCFLAGS, I think we would want a new patch to set it in xen/Makefile, and use it in xen/. But I don't think we need to spend time on it at the moment.

Thanks,

Signature · 1 line
Anthony PERARD
#90 lore raw

PATCH v7 33/51 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 760ccff0e8f1..1e1839c4b629 100644
@@ -83,9 +83,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))
@@ -288,7 +296,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
#92 lore raw

PATCH v7 34/51 build: start building the tools with the main makefiles

In reply to Anthony PERARD

This will make out-of-tree build easier.

---
 xen/Makefile       |  8 ++++----
 xen/tools/Makefile | 17 ++---------------
 2 files changed, 6 insertions(+), 19 deletions(-)
xen/Makefile +4 -4
index 0da08bc39930..8381ffd5d168 100644
@@ -200,7 +200,7 @@ endif # root-make-done
 
 PHONY += tools_fixdep
 tools_fixdep:
-	$(MAKE) -C tools fixdep
+	$(MAKE) $(build)=tools tools/fixdep
 
 ifeq ($(config-build),y)
 # ===========================================================================
@@ -228,7 +228,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
+	$(MAKE) $(build)=tools tools/fixdep
 
 # Allow people to just run `make` as before and not force them to configure
 $(KCONFIG_CONFIG): tools/fixdep
@@ -391,7 +391,7 @@ _debug:
 
 .PHONY: _clean
 _clean:
-	$(MAKE) -C tools clean
+	$(MAKE) $(clean) tools
 	$(MAKE) $(clean) include
 	$(MAKE) $(clean) common
 	$(MAKE) $(clean) drivers
@@ -420,7 +420,7 @@ $(TARGET).gz: $(TARGET)
 	mv [email protected] $@
 
 $(TARGET): tools_fixdep FORCE
-	$(MAKE) -C tools
+	$(MAKE) $(build)=tools
 	$(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
#94 lore raw

PATCH v7 35/51 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 8381ffd5d168..28854d6cb29f 100644
@@ -293,6 +293,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 8bbf3e18e410..53b48ded28de 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
#96 lore raw

PATCH v7 36/51 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 05f1d12065a0..1ef2536ece26 100644
@@ -233,18 +233,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
@@ -258,7 +261,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
Acked-by on v7 36/51
#97 lore raw

Re: [XEN PATCH v7 36/51] build: generate x86's asm-macros.h with filechk

Quoted 9 lines · 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.

#98 lore raw

PATCH v7 37/51 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 28854d6cb29f..950bee10ba38 100644
@@ -410,7 +410,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 include/xen/compile.h
 
xen/arch/arm/Makefile +0 -1
index a3204d22d17b..e6eff291c5e5 100644
@@ -118,4 +118,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 1ef2536ece26..8d789d25a3ff 100644
@@ -261,9 +261,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 52ee58a08c5f..dee5fd78c188 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 57190ff6c8ad..8d18c7d4ae6f 100644
@@ -49,4 +49,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
#100 lore raw

PATCH v7 38/51 build: use main rune to build host binary x86's mkelf32 and mkreloc

In reply to Anthony PERARD
---
 xen/arch/x86/Makefile | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
xen/arch/x86/Makefile +6 -8
index 8d789d25a3ff..4ea8ade7202c 100644
@@ -81,6 +81,10 @@ endif
 extra-y += asm-macros.i
 extra-y += xen.lds
 
+hostprogs-y += boot/mkelf32
+HOSTCFLAGS_efi/mkreloc.o := -g
+hostprogs-y += efi/mkreloc
+
 # Allows usercopy.c to includes itself
 $(obj)/usercopy.o: CFLAGS-y += -I.
 
@@ -253,16 +257,10 @@ $(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 $@ $<
-
 .PHONY: clean
 clean::
-	rm -f *.lds boot/mkelf32
+	rm -f *.lds
 	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 $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi
 	rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin
Signature · 1 line
Anthony PERARD
Acked-by on v7 38/51
#101 lore raw

Re: [XEN PATCH v7 38/51] build: use main rune to build host binary x86's mkelf32 and mkreloc

Quoted 1 line · Anthony PERARD

xen/arch/x86/Makefile endif · line 85

Quoted 8 lines
xen/arch/x86/Makefile +2 -0
@@ -81,6 +81,10 @@ endif
 extra-y += asm-macros.i
 extra-y += xen.lds
 
+hostprogs-y += boot/mkelf32
+HOSTCFLAGS_efi/mkreloc.o := -g

To be honest I don't think this extra option would have been necessary to retain.

Jan

#102 lore raw

Re: [XEN PATCH v7 38/51] build: use main rune to build host binary x86's mkelf32 and mkreloc

Quoted 11 lines · Jan Beulich
Quoted 1 line · Anthony PERARD
Quoted 6 lines
xen/arch/x86/Makefile +0 -0
@@ -81,6 +81,10 @@ endif
 extra-y += asm-macros.i
 extra-y += xen.lds
 
Quoted 5 lines

xen/arch/x86/Makefile endif · line 85

Quoted 2 lines
xen/arch/x86/Makefile +2 -0
+hostprogs-y += boot/mkelf32
+HOSTCFLAGS_efi/mkreloc.o := -g

To be honest I don't think this extra option would have been necessary to retain.

Probably not, I'll remove it.

Thanks,

Signature · 1 line
Anthony PERARD
#103 lore raw

PATCH v7 39/51 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.

---
 xen/Rules.mk | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)
xen/Rules.mk +18 -3
index 1e1839c4b629..6877fcc2d6d8 100644
@@ -131,19 +131,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)
+
+$(non-init-objects): _c_flags += $(COV_FLAGS)
+
+# Reset COV_FLAGS in cases where an objects as another one as prerequisite
+$(nocov-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
+    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))
+
+$(non-init-objects): _c_flags += $(UBSAN_FLAGS)
+
+# Reset UBSAN_FLAGS in cases where an objects as another one as prerequisite
+$(noubsan-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
+    UBSAN_FLAGS :=
 endif
 
 ifeq ($(CONFIG_LTO),y)
@@ -172,6 +184,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
Reviewed-by on v7 39/51
#104 lore raw

Re: [XEN PATCH v7 39/51] build: rework coverage and ubsan CFLAGS handling

Quoted 8 lines · 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.

I think I understand what's going on, so

It would seem to me though that ...

Quoted 11 lines
xen/Rules.mk +2 -0
@@ -131,19 +131,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

xen/Rules.mk targets += $(targets-for-builtin) · line 147

Quoted 10 lines
xen/Rules.mk +6 -1
 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)
+
+$(non-init-objects): _c_flags += $(COV_FLAGS)
+
+# Reset COV_FLAGS in cases where an objects as another one as prerequisite
+$(nocov-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
+    COV_FLAGS :=

... pulling this and ...

xen/Rules.mk targets += $(targets-for-builtin) · line 158

Quoted 13 lines
xen/Rules.mk +7 -2
 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))
+
+$(non-init-objects): _c_flags += $(UBSAN_FLAGS)
+
+# Reset UBSAN_FLAGS in cases where an objects as another one as prerequisite
+$(noubsan-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
+    UBSAN_FLAGS :=

... this up ahead of their respective _c_flags assignments would be easier to follow, for being more logical (produce, then consume).

Also, as a nit: In the comments do you mean "... where an object has ..."?

Jan

#105 lore raw

PATCH v7 40/51 build: fix dependencies in arch/x86/boot

In reply to Anthony PERARD

Temporary fix the list of headers that cmdline.c and reloc.c depends on, until the next time the list is out of sync again.

Also, add the linker script to the list.

---
 xen/arch/x86/boot/Makefile   | 9 ++++++---
 xen/arch/x86/boot/build32.mk | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
xen/arch/x86/boot/Makefile +6 -3
index 2469ca7c4530..73a3b1514965 100644
@@ -2,19 +2,22 @@ obj-bin-y += head.o
 
 DEFS_H_DEPS = $(BASEDIR)/$(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/$(src)/video.h
+CMDLINE_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/$(src)/video.h \
+	       $(BASEDIR)/include/xen/kconfig.h \
+	       $(BASEDIR)/include/generated/autoconf.h
 
 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: $(obj)/cmdline.S $(obj)/reloc.S
 
-$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS)
+$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) $(src)/build32.lds
 	$(MAKE) -f $(BASEDIR)/$(src)/build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
 
-$(obj)/reloc.S: $(src)/reloc.c $(RELOC_DEPS)
+$(obj)/reloc.S: $(src)/reloc.c $(RELOC_DEPS) $(src)/build32.lds
 	$(MAKE) -f $(BASEDIR)/$(src)/build32.mk -C $(obj) $(@F) RELOC_DEPS="$(RELOC_DEPS)"
xen/arch/x86/boot/build32.mk +1 -1
index 8cd5403926a3..e90680cd9f52 100644
@@ -27,7 +27,7 @@ CFLAGS := $(filter-out -flto,$(CFLAGS))
 		done
 	$(OBJCOPY) -O binary -R .got.plt $< $@
 
-%.lnk: %.o
+%.lnk: %.o build32.lds
 	$(LD) $(LDFLAGS_DIRECT) -N -T build32.lds -o $@ $<
 
 %.o: %.c
Signature · 1 line
Anthony PERARD
Reviewed-by on v7 40/51
#106 lore raw

Re: [XEN PATCH v7 40/51] build: fix dependencies in arch/x86/boot

Quoted 6 lines · Anthony PERARD

Temporary fix the list of headers that cmdline.c and reloc.c depends on, until the next time the list is out of sync again.

Also, add the linker script to the list.

Afaict this is independent of all earlier patches, so I'll make an attempt at committing this soon.

xen/arch/x86/boot/Makefile obj-bin-y += head.o · line 7

Quoted 10 lines
xen/arch/x86/boot/Makefile +3 -1
@@ -2,19 +2,22 @@ obj-bin-y += head.o
 
 DEFS_H_DEPS = $(BASEDIR)/$(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
 
-CMDLINE_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/$(src)/video.h
+CMDLINE_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/$(src)/video.h \
+	       $(BASEDIR)/include/xen/kconfig.h \
+	       $(BASEDIR)/include/generated/autoconf.h

Especially with this now needed in two places, I think down the road (unless we'll get dependency tracking automated here, which a part of your description suggests is not going to happen soon) we want

kconfig.h := $(BASEDIR)/include/xen/kconfig.h \
             $(BASEDIR)/include/generated/autoconf.h

and then similarly ...

xen/arch/x86/boot/Makefile obj-bin-y += head.o · line 14

Quoted 6 lines
xen/arch/x86/boot/Makefile +1 -0
 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 \
multiboot.h := $(BASEDIR)/include/xen/multiboot.h \
               $(BASEDIR)/include/xen/const.h \

(and by implication I think DEFS_H_DEPS would better be renamed to deps.h as well).

Jan

#107 lore raw

PATCH v7 41/51 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. Thus we copy all the necessary flags from "Config.mk", and apply them only to "cmdline.o" and "reloc.o".

Specificaly 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 symbole 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.)

---
 xen/arch/x86/boot/Makefile   | 60 ++++++++++++++++++++++++++----------
 xen/arch/x86/boot/build32.mk | 40 ------------------------
 2 files changed, 44 insertions(+), 56 deletions(-)
 delete mode 100644 xen/arch/x86/boot/build32.mk
xen/arch/x86/boot/Makefile +44 -16
index 73a3b1514965..3580a9b656e8 100644
@@ -1,23 +1,51 @@
 obj-bin-y += head.o
+head-objs := cmdline.S reloc.S
 
-DEFS_H_DEPS = $(BASEDIR)/$(src)/defs.h $(BASEDIR)/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) $(BASEDIR)/$(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)
 
-$(obj)/head.o: $(obj)/cmdline.S $(obj)/reloc.S
+LDFLAGS_DIRECT_OpenBSD = _obsd
+LDFLAGS_DIRECT_FreeBSD = _fbsd
+$(head-objs:.S=.lnk): LDFLAGS_DIRECT := -melf_i386$(LDFLAGS_DIRECT_$(XEN_OS))
 
-$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) $(src)/build32.lds
-	$(MAKE) -f $(BASEDIR)/$(src)/build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
+CFLAGS_x86_32 := -m32 -march=i686
+CFLAGS_x86_32 += -fno-strict-aliasing
+CFLAGS_x86_32 += -std=gnu99
+CFLAGS_x86_32 += -Wall -Wstrict-prototypes
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wdeclaration-after-statement)
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wno-unused-but-set-variable)
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wno-unused-local-typedefs)
+$(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
+CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float
+CFLAGS_x86_32 += -I$(srctree)/include
 
-$(obj)/reloc.S: $(src)/reloc.c $(RELOC_DEPS) $(src)/build32.lds
-	$(MAKE) -f $(BASEDIR)/$(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
+
+$(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 \
+			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 $(src)/build32.lds
+	$(LD) $(LDFLAGS_DIRECT) -N -T $(filter %.lds,$^) -o $@ $<
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
#108 lore raw

Re: [XEN PATCH v7 41/51] build,x86: remove the need for build32.mk

xen/arch/x86/boot/Makefile line 6

Quoted 10 lines · Anthony PERARD
xen/arch/x86/boot/Makefile +4 -1
@@ -1,23 +1,51 @@
 obj-bin-y += head.o
+head-objs := cmdline.S reloc.S
 
-DEFS_H_DEPS = $(BASEDIR)/$(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
+nocov-y += $(head-objs:.S=.o)
+noubsan-y += $(head-objs:.S=.o)
+targets += $(head-objs:.S=.o)

This working right depends on targets initially getting set with := , because of ...

xen/arch/x86/boot/Makefile line 8

Quoted 4 lines
xen/arch/x86/boot/Makefile +1 -3
-CMDLINE_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/$(src)/video.h \
-	       $(BASEDIR)/include/xen/kconfig.h \
-	       $(BASEDIR)/include/generated/autoconf.h
+head-objs := $(addprefix $(obj)/, $(head-objs))

... this subsequent adjustment to the variable. Might it be more future proof for start with

head-srcs := cmdline.S reloc.S

and then derive head-objs only here?

xen/arch/x86/boot/Makefile line 13

Quoted 12 lines
xen/arch/x86/boot/Makefile +3 -8
-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)
 
-$(obj)/head.o: $(obj)/cmdline.S $(obj)/reloc.S
+LDFLAGS_DIRECT_OpenBSD = _obsd
+LDFLAGS_DIRECT_FreeBSD = _fbsd

This is somewhat ugly - it means needing to change things in two places when config/x86_32.mk would change (e.g. to add another build OS). How about ...

xen/arch/x86/boot/Makefile line 14

Quoted 1 line
xen/arch/x86/boot/Makefile +1 -0
+$(head-objs:.S=.lnk): LDFLAGS_DIRECT := -melf_i386$(LDFLAGS_DIRECT_$(XEN_OS))

... instead:

$(head-objs:.S=.lnk): LDFLAGS_DIRECT := $(subst x86_64,i386,$(LDFLAGS_DIRECT))

? Or if deemed still too broad

$(head-objs:.S=.lnk): LDFLAGS_DIRECT := $(subst elf_x86_64,elf_i386,$(LDFLAGS_DIRECT))

?

xen/arch/x86/boot/Makefile line 25

Quoted 12 lines
xen/arch/x86/boot/Makefile +10 -2
-$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) $(src)/build32.lds
-	$(MAKE) -f $(BASEDIR)/$(src)/build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
+CFLAGS_x86_32 := -m32 -march=i686
+CFLAGS_x86_32 += -fno-strict-aliasing
+CFLAGS_x86_32 += -std=gnu99
+CFLAGS_x86_32 += -Wall -Wstrict-prototypes
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wdeclaration-after-statement)
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wno-unused-but-set-variable)
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wno-unused-local-typedefs)
+$(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
+CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float
+CFLAGS_x86_32 += -I$(srctree)/include

I'm afraid I'm not convinced that having to keep this in sync with the original is in fair balance with the removal of build32.mk.

Jan

#109 lore raw

Re: [XEN PATCH v7 41/51] build,x86: remove the need for build32.mk

Quoted 7 lines · Jan Beulich
Quoted 6 lines · Anthony PERARD
xen/arch/x86/boot/Makefile +1 -0
@@ -1,23 +1,51 @@
 obj-bin-y += head.o
+head-objs := cmdline.S reloc.S
 
Quoted 7 lines

xen/arch/x86/boot/Makefile line 6

Quoted 4 lines
xen/arch/x86/boot/Makefile +3 -1
-DEFS_H_DEPS = $(BASEDIR)/$(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
+nocov-y += $(head-objs:.S=.o)
+noubsan-y += $(head-objs:.S=.o)
+targets += $(head-objs:.S=.o)

This working right depends on targets initially getting set with := , because of ...

They are because Rules.mk initialise those variables that way.

Quoted 11 lines

xen/arch/x86/boot/Makefile line 8

Quoted 4 lines
xen/arch/x86/boot/Makefile +1 -3
-CMDLINE_DEPS = $(DEFS_H_DEPS) $(BASEDIR)/$(src)/video.h \
-	       $(BASEDIR)/include/xen/kconfig.h \
-	       $(BASEDIR)/include/generated/autoconf.h
+head-objs := $(addprefix $(obj)/, $(head-objs))

... this subsequent adjustment to the variable. Might it be more future proof for start with

head-srcs := cmdline.S reloc.S

and then derive head-objs only here?

I'll give it a try.

Quoted 21 lines

xen/arch/x86/boot/Makefile line 13

Quoted 12 lines
xen/arch/x86/boot/Makefile +3 -8
-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)
 
-$(obj)/head.o: $(obj)/cmdline.S $(obj)/reloc.S
+LDFLAGS_DIRECT_OpenBSD = _obsd
+LDFLAGS_DIRECT_FreeBSD = _fbsd

This is somewhat ugly - it means needing to change things in two places when config/x86_32.mk would change (e.g. to add another build OS). How about ...

xen/arch/x86/boot/Makefile line 14

Quoted 1 line
xen/arch/x86/boot/Makefile +1 -0
+$(head-objs:.S=.lnk): LDFLAGS_DIRECT := -melf_i386$(LDFLAGS_DIRECT_$(XEN_OS))

... instead:

Quoted 7 lines

$(head-objs:.S=.lnk): LDFLAGS_DIRECT := $(subst x86_64,i386,$(LDFLAGS_DIRECT))

? Or if deemed still too broad

$(head-objs:.S=.lnk): LDFLAGS_DIRECT := $(subst elf_x86_64,elf_i386,$(LDFLAGS_DIRECT))

?

Sounds good, I'll do that.

Quoted 7 lines
Quoted 7 lines
xen/arch/x86/boot/Makefile +5 -2
-$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) $(src)/build32.lds
-	$(MAKE) -f $(BASEDIR)/$(src)/build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
+CFLAGS_x86_32 := -m32 -march=i686
+CFLAGS_x86_32 += -fno-strict-aliasing
+CFLAGS_x86_32 += -std=gnu99
+CFLAGS_x86_32 += -Wall -Wstrict-prototypes
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wdeclaration-after-statement)
Quoted 8 lines

xen/arch/x86/boot/Makefile line 25

Quoted 5 lines
xen/arch/x86/boot/Makefile +5 -0
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wno-unused-but-set-variable)
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wno-unused-local-typedefs)
+$(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
+CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float
+CFLAGS_x86_32 += -I$(srctree)/include

I'm afraid I'm not convinced that having to keep this in sync with the original is in fair balance with the removal of build32.mk.

Why would this needs to be kept in sync with the original? I would actually like to get rid of Config.mk, I don't see the point in sharing CFLAGS between a kernel and userspace binaries. Also, I hope one day that we can have the hypervisor in its own repo, and thus they won't be any Config.mk to keep in sync with.

The goal of this patch is less about removing build32.mk, and more about using the rest of the build system infrastructure to build those few 32bits objects, and been able to use the automatic dependencies generation and other things without having to duplicate them.

It probably make the build a bit faster as there is two less invocation of $(MAKE) (which parse Config.mk).

As for a possible change: instead of having those x86_32 flags in arch/x86/boot/, I could have them in arch/x86/arch.mk. Linux does something like that were it prepare REALMODE_CFLAGS.

I know it's a bit annoying to have another list x86_32 cflags, but I don't see how we can extract them from Config.mk (in a Makefile where we want to use both x86_32 and x86_64 flags).

Thanks,

Signature · 1 line
Anthony PERARD
#110 lore raw

Re: [XEN PATCH v7 41/51] build,x86: remove the need for build32.mk

Quoted 18 lines · Anthony PERARD
Quoted 16 lines · Jan Beulich

xen/arch/x86/boot/Makefile line 25

Quoted 12 lines · Anthony PERARD

-$(obj)/cmdline.S: $(src)/cmdline.c $(CMDLINE_DEPS) $(src)/build32.lds

xen/arch/x86/boot/Makefile +10 -1
-	$(MAKE) -f $(BASEDIR)/$(src)/build32.mk -C $(obj) $(@F) CMDLINE_DEPS="$(CMDLINE_DEPS)"
+CFLAGS_x86_32 := -m32 -march=i686
+CFLAGS_x86_32 += -fno-strict-aliasing
+CFLAGS_x86_32 += -std=gnu99
+CFLAGS_x86_32 += -Wall -Wstrict-prototypes
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wdeclaration-after-statement)
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wno-unused-but-set-variable)
+$(call cc-option-add,CFLAGS_x86_32,CC,-Wno-unused-local-typedefs)
+$(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
+CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float
+CFLAGS_x86_32 += -I$(srctree)/include

I'm afraid I'm not convinced that having to keep this in sync with the original is in fair balance with the removal of build32.mk.

Quoted 5 lines

Why would this needs to be kept in sync with the original? I would actually like to get rid of Config.mk, I don't see the point in sharing CFLAGS between a kernel and userspace binaries. Also, I hope one day that we can have the hypervisor in its own repo, and thus they won't be any Config.mk to keep in sync with.

My point wasn't about Config.mk as the reference in particular, but ...

Quoted 8 lines

The goal of this patch is less about removing build32.mk, and more about using the rest of the build system infrastructure to build those few 32bits objects, and been able to use the automatic dependencies generation and other things without having to duplicate them.

It probably make the build a bit faster as there is two less invocation of $(MAKE) (which parse Config.mk).

Quoted 7 lines

As for a possible change: instead of having those x86_32 flags in arch/x86/boot/, I could have them in arch/x86/arch.mk. Linux does something like that were it prepare REALMODE_CFLAGS.

I know it's a bit annoying to have another list x86_32 cflags, but I don't see how we can extract them from Config.mk (in a Makefile where we want to use both x86_32 and x86_64 flags).

... about the general (apparent) plan to have two sets of flags, which may not strictly _need_ to remain in sync, but better would. So while I appreciate the alternative of putting stuff in arch.mk, I'd still like to see common things like -W... to get probed for and added to whichever variable just once.

Jan

#111 lore raw

PATCH v7 42/51 build: grab common EFI source files in arch specific dir

In reply to Anthony PERARD

Rather than preparing the efi source file, we will copy them as needed from the build location.

Avoid the links as they seems fragile in out-of-tree builds. Also by making a copy, we don't need to figure out the relative path or we don't need to use absolute path.

---
 xen/Makefile              | 5 -----
 xen/arch/arm/efi/Makefile | 6 ++++++
 xen/arch/x86/efi/Makefile | 6 ++++++
 3 files changed, 12 insertions(+), 5 deletions(-)
xen/Makefile +0 -5
index 950bee10ba38..4c1dd9ce2ea1 100644
@@ -425,11 +425,6 @@ $(TARGET).gz: $(TARGET)
 $(TARGET): tools_fixdep FORCE
 	$(MAKE) $(build)=tools
 	$(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) $(build)=include all
 	$(MAKE) $(build)=arch/$(TARGET_ARCH) include
 	$(MAKE) $(build)=. arch/$(TARGET_ARCH)/include/asm/asm-offsets.h
xen/arch/arm/efi/Makefile +6 -0
index 1b1ed06feddc..36e15ac280cd 100644
@@ -1,4 +1,10 @@
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -I$(srctree)/common/efi
 
 obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o
 obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@
+
+.PRECIOUS: $(obj)/%.c
xen/arch/x86/efi/Makefile +6 -0
index ac815f02cb5e..da05935a9348 100644
@@ -1,4 +1,5 @@
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -I$(srctree)/common/efi
 
 quiet_cmd_objcopy_o_ihex = OBJCOPY $@
 cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@
@@ -19,3 +20,8 @@ obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
 obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
 extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
 nocov-$(XEN_BUILD_EFI) += stub.o
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@
+
+.PRECIOUS: $(obj)/%.c
Signature · 1 line
Anthony PERARD
#112 lore raw

Re: [XEN PATCH v7 42/51] build: grab common EFI source files in arch specific dir

Quoted 6 lines · Anthony PERARD

Rather than preparing the efi source file, we will copy them as needed from the build location.

Avoid the links as they seems fragile in out-of-tree builds. Also by making a copy, we don't need to figure out the relative path or we don't need to use absolute path.

I agree that symlinks wouldn't be nice for the out-of-tree build case. Otoh please see
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=8c6740616cd244e5763e974cb737affbe71db385
albeit I'll admit the situation was a little different there because it's pre-built files which get populated into the build tree.

xen/arch/arm/efi/Makefile line 2

Quoted 5 lines
xen/arch/arm/efi/Makefile +1 -0
@@ -1,4 +1,10 @@
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -I$(srctree)/common/efi

Perhaps another opportunity for -iquote?

xen/arch/arm/efi/Makefile line 8

Quoted 5 lines
xen/arch/arm/efi/Makefile +3 -0
 obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o
 obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@

In case both trees are on the same file system, trying to hardlink first would seem desirable. When copying, I think you should also pass -p.

Quoted 9 lines
xen/arch/x86/efi/Makefile +1 -0
@@ -1,4 +1,5 @@
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -I$(srctree)/common/efi
 
 quiet_cmd_objcopy_o_ihex = OBJCOPY $@
 cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@

xen/arch/x86/efi/Makefile obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y)) · line 27

Quoted 8 lines
xen/arch/x86/efi/Makefile +5 -0
@@ -19,3 +20,8 @@ obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
 obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
 extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
 nocov-$(XEN_BUILD_EFI) += stub.o
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@
+
+.PRECIOUS: $(obj)/%.c

Seeing you repeat everything here, despite it not being all this much I wonder if there wouldn't better be a makefile fragment in common/efi/ which all interested architectures' arch/<arch>/efi/Makefile would then include. This could then also subsume -fshort-wchar.

Jan

#113 lore raw

Re: [XEN PATCH v7 42/51] build: grab common EFI source files in arch specific dir

Quoted 8 lines · Jan Beulich

xen/arch/arm/efi/Makefile line 2

Quoted 5 lines · Anthony PERARD
xen/arch/arm/efi/Makefile +1 -0
@@ -1,4 +1,10 @@
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -I$(srctree)/common/efi

Perhaps another opportunity for -iquote?

Yes.

Quoted 8 lines

xen/arch/arm/efi/Makefile line 8

Quoted 5 lines
xen/arch/arm/efi/Makefile +3 -0
 obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o
 obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@

In case both trees are on the same file system, trying to hardlink first would seem desirable. When copying, I think you should also pass -p.

I don't know if doing an hardlink is a good thing to do, I'm not sure of the kind of issue this could bring. As for -p, I don't think it's a good idea to copy the mode, ownership, and timestamps of the source file, I'd rather have the timestamps that Make expect, e.i. "now".

Quoted 6 lines
Quoted 6 lines
xen/arch/x86/efi/Makefile +1 -0
@@ -1,4 +1,5 @@
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -I$(srctree)/common/efi
 
Quoted 16 lines

xen/arch/x86/efi/Makefile obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y)) · line 27

Quoted 11 lines
xen/arch/x86/efi/Makefile +5 -0
 quiet_cmd_objcopy_o_ihex = OBJCOPY $@
 cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@
@@ -19,3 +20,8 @@ obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
 obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
 extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
 nocov-$(XEN_BUILD_EFI) += stub.o
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@
+
+.PRECIOUS: $(obj)/%.c

Seeing you repeat everything here, despite it not being all this much I wonder if there wouldn't better be a makefile fragment in common/efi/ which all interested architectures' arch/<arch>/efi/Makefile would then include. This could then also subsume -fshort-wchar.

That sounds good, I'll look into that.

Thanks,

Signature · 1 line
Anthony PERARD
#114 lore raw

Re: [XEN PATCH v7 42/51] build: grab common EFI source files in arch specific dir

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

xen/arch/arm/efi/Makefile line 2

Quoted 5 lines · Anthony PERARD
xen/arch/arm/efi/Makefile +1 -0
@@ -1,4 +1,10 @@
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -I$(srctree)/common/efi

Perhaps another opportunity for -iquote?

Yes.

Quoted 8 lines

xen/arch/arm/efi/Makefile line 8

Quoted 5 lines
xen/arch/arm/efi/Makefile +3 -0
 obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o
 obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@

In case both trees are on the same file system, trying to hardlink first would seem desirable. When copying, I think you should also pass -p.

Quoted 4 lines

I don't know if doing an hardlink is a good thing to do, I'm not sure of the kind of issue this could bring. As for -p, I don't think it's a good idea to copy the mode, ownership, and timestamps of the source file, I'd rather have the timestamps that Make expect, e.i. "now".

Why would "now" be correct (or expected) in any way? The cloned file is no different from the original. Nevertheless I agree that -p is not ideal; it's just that the more fine grained option to preserve just the timestamp is non-standard afaik. You could try that first and fall back to -p ... Otherwise, failing hard linking and using "cp -p", I'm afraid I'd prefer symlinking despite the arguments against it that you name in the description.

Might be good to have someone else's view here as well.

Jan

#115 lore raw

Re: [XEN PATCH v7 42/51] build: grab common EFI source files in arch specific dir

Quoted 27 lines · Jan Beulich
Quoted 21 lines · Anthony PERARD
Quoted 8 lines · Jan Beulich

xen/arch/arm/efi/Makefile line 2

Quoted 5 lines · Anthony PERARD
xen/arch/arm/efi/Makefile +1 -0
@@ -1,4 +1,10 @@
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -I$(srctree)/common/efi

Perhaps another opportunity for -iquote?

Yes.

Quoted 8 lines

xen/arch/arm/efi/Makefile line 8

Quoted 5 lines
xen/arch/arm/efi/Makefile +3 -0
 obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o
 obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@

In case both trees are on the same file system, trying to hardlink first would seem desirable. When copying, I think you should also pass -p.

Quoted 4 lines

I don't know if doing an hardlink is a good thing to do, I'm not sure of the kind of issue this could bring. As for -p, I don't think it's a good idea to copy the mode, ownership, and timestamps of the source file, I'd rather have the timestamps that Make expect, e.i. "now".

Quoted 7 lines

Why would "now" be correct (or expected) in any way? The cloned file is no different from the original. Nevertheless I agree that -p is not ideal; it's just that the more fine grained option to preserve just the timestamp is non-standard afaik. You could try that first and fall back to -p ... Otherwise, failing hard linking and using "cp -p", I'm afraid I'd prefer symlinking despite the arguments against it that you name in the description.

I guess I'm missing something, is there a reason to keep/copy the timestamps of the original files?

Quoted 1 line

Might be good to have someone else's view here as well.

Indeed.

Signature · 1 line
Anthony PERARD
#116 lore raw

Re: [XEN PATCH v7 42/51] build: grab common EFI source files in arch specific dir

Quoted 36 lines · Anthony PERARD
Quoted 27 lines · Jan Beulich
Quoted 21 lines · Anthony PERARD
Quoted 8 lines · Jan Beulich

xen/arch/arm/efi/Makefile line 2

Quoted 5 lines · Anthony PERARD
xen/arch/arm/efi/Makefile +1 -0
@@ -1,4 +1,10 @@
 CFLAGS-y += -fshort-wchar
+CFLAGS-y += -I$(srctree)/common/efi

Perhaps another opportunity for -iquote?

Yes.

Quoted 8 lines

xen/arch/arm/efi/Makefile line 8

Quoted 5 lines
xen/arch/arm/efi/Makefile +3 -0
 obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o
 obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@

In case both trees are on the same file system, trying to hardlink first would seem desirable. When copying, I think you should also pass -p.

Quoted 4 lines

I don't know if doing an hardlink is a good thing to do, I'm not sure of the kind of issue this could bring. As for -p, I don't think it's a good idea to copy the mode, ownership, and timestamps of the source file, I'd rather have the timestamps that Make expect, e.i. "now".

Quoted 7 lines

Why would "now" be correct (or expected) in any way? The cloned file is no different from the original. Nevertheless I agree that -p is not ideal; it's just that the more fine grained option to preserve just the timestamp is non-standard afaik. You could try that first and fall back to -p ... Otherwise, failing hard linking and using "cp -p", I'm afraid I'd prefer symlinking despite the arguments against it that you name in the description.

Quoted 2 lines

I guess I'm missing something, is there a reason to keep/copy the timestamps of the original files?

Avoidance of confusion is my main aim here. I certainly would be puzzled to see what looks like a source file to have a time stamp much newer than expected.

Jan

#117 lore raw

Re: [XEN PATCH v7 42/51] build: grab common EFI source files in arch specific dir

Quoted 27 lines · Jan Beulich
Quoted 26 lines · Anthony PERARD
Quoted 24 lines · Jan Beulich
Quoted 11 lines · Anthony PERARD
Quoted 9 lines · Jan Beulich

xen/arch/arm/efi/Makefile line 8

Quoted 5 lines · Anthony PERARD

obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o obj-$(CONFIG_ACPI) += efi-dom0.init.o

xen/arch/arm/efi/Makefile +3 -0
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@

In case both trees are on the same file system, trying to hardlink first would seem desirable. When copying, I think you should also pass -p.

Quoted 4 lines

I don't know if doing an hardlink is a good thing to do, I'm not sure of the kind of issue this could bring. As for -p, I don't think it's a good idea to copy the mode, ownership, and timestamps of the source file, I'd rather have the timestamps that Make expect, e.i. "now".

Why would "now" be correct (or expected) in any way? The cloned file is no different from the original. Nevertheless I agree that -p is not ideal; it's just that the more fine grained option to preserve just the timestamp is non-standard afaik. You could try that first and fall back to -p ... Otherwise, failing hard linking and using "cp -p", I'm afraid I'd prefer symlinking despite the arguments against it that you name in the description.

Quoted 6 lines
Quoted 2 lines

I guess I'm missing something, is there a reason to keep/copy the timestamps of the original files?

Avoidance of confusion is my main aim here. I certainly would be puzzled to see what looks like a source file to have a time stamp much newer than expected.

So, there isn't really anything to do with the timestamps :-). I guess we could keep using symbolic links, but force update the link at every build.

I've tried that:

    $(obj)/%.c: $(abs_srctree)/common/efi/%.c FORCE
        $(Q)ln -nsf $< $@

and make seems happy. The link command run every time (due to adding FORCE), but the CC command isn't, so that seems good. The recipe that would run the CC command check if the prerequisite are newer than the target using $? so it doesn't matter if the rule that update the source file as run or not.

Thanks,

Signature · 1 line
Anthony PERARD
#118 lore raw

Re: [XEN PATCH v7 42/51] build: grab common EFI source files in arch specific dir

Quoted 40 lines · Anthony PERARD
Quoted 27 lines · Jan Beulich
Quoted 26 lines · Anthony PERARD
Quoted 24 lines · Jan Beulich
Quoted 11 lines · Anthony PERARD
Quoted 9 lines · Jan Beulich

Review

Quoted 5 lines · Anthony PERARD

obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o obj-$(CONFIG_ACPI) += efi-dom0.init.o

(quoted diff) +3 -0
+
+$(obj)/%.c: common/efi/%.c
+	$(Q)cp -f $< $@

In case both trees are on the same file system, trying to hardlink first would seem desirable. When copying, I think you should also pass -p.

Quoted 4 lines

I don't know if doing an hardlink is a good thing to do, I'm not sure of the kind of issue this could bring. As for -p, I don't think it's a good idea to copy the mode, ownership, and timestamps of the source file, I'd rather have the timestamps that Make expect, e.i. "now".

Why would "now" be correct (or expected) in any way? The cloned file is no different from the original. Nevertheless I agree that -p is not ideal; it's just that the more fine grained option to preserve just the timestamp is non-standard afaik. You could try that first and fall back to -p ... Otherwise, failing hard linking and using "cp -p", I'm afraid I'd prefer symlinking despite the arguments against it that you name in the description.

Quoted 6 lines
Quoted 2 lines

I guess I'm missing something, is there a reason to keep/copy the timestamps of the original files?

Avoidance of confusion is my main aim here. I certainly would be puzzled to see what looks like a source file to have a time stamp much newer than expected.

So, there isn't really anything to do with the timestamps :-). I guess we could keep using symbolic links, but force update the link at every build.

I've tried that:

Quoted 8 lines
    $(obj)/%.c: $(abs_srctree)/common/efi/%.c FORCE
        $(Q)ln -nsf $< $@

and make seems happy. The link command run every time (due to adding FORCE), but the CC command isn't, so that seems good. The recipe that would run the CC command check if the prerequisite are newer than the target using $? so it doesn't matter if the rule that update the source file as run or not.

Looks okay to me.

One additional consideration, though: Linux puts a "source" link in the build tree. If we did so as well, then that could be the only absolute symlink that's needed. Links like the one you suggest could be relative ones into source/. But I guess this could as well be left as a future exercise, in case anyone cares to limit the number of absolute symlinks.

Jan