All of lore.kernel.org
 help / color / mirror / Atom feed
* [XEN PATCH v6 00/31] xen: Build system improvements
@ 2021-07-01 14:09 Anthony PERARD
  2021-07-01 14:09 ` [XEN PATCH v6 01/31] build: fix %.s: %.S rule Anthony PERARD
                   ` (30 more replies)
  0 siblings, 31 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Tim Deegan, Konrad Rzeszutek Wilk,
	Petre Pircalabu, Daniel De Graaf, Jan Beulich, George Dunlap,
	Ian Jackson, Kevin Tian, Ross Lagerwall, Alexandru Isaila,
	Wei Liu, Bob Eshleman, Stefano Stabellini, Jun Nakajima,
	Lukasz Hawrylko, Roger Pau Monné,
	Paul Durrant, Tamas K Lengyel, Julien Grall, Alistair Francis,
	Connor Davis, Daniel P. Smith, Volodymyr Babchuk, Andrew Cooper

Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-system-xen-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/20200421161208.2429539-1-anthony.perard@citrix.com/
- 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 (31):
  build: fix %.s: %.S rule
  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: clean "lib.a"
  build: use $(kconfig) shortcut in clean rule
  build: fix clean targets when subdir-y is used
  build: use subdir-y in test/Makefile
  build,tools: have default rules depends on symbols
  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 include/arch-*/asm
  build: rework .banner generation
  build: generate "include/xen/compile.h" with filechk
  build: set XEN_BUILD_EFI earlier
  build: fix $(TARGET).efi creation in arch/arm
  build: fix arch/x86/node.o rule
  build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile
  build: remove unneeded deps of x86_emulate.o
  build: clean common temporary files from root makefile
  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,riscv: tell the build system about riscv64/head.S

 .gitignore                                    |   6 +-
 MAINTAINERS                                   |  36 +-
 tools/include/Makefile                        |   2 +-
 tools/misc/xen-access.c                       |   4 +-
 tools/tests/vhpet/Makefile                    |   2 +-
 xen/Makefile                                  | 209 ++++++---
 xen/Rules.mk                                  | 222 +++++-----
 xen/arch/arm/Makefile                         |  50 +--
 xen/arch/arm/README.LinuxPrimitives           |  10 +-
 xen/arch/arm/arch.mk                          |  13 +-
 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/smpboot.c                        |   2 +-
 xen/arch/arm/vpsci.c                          |   2 +-
 xen/arch/riscv/arch.mk                        |   3 +-
 xen/arch/riscv/riscv64/Makefile               |   1 +
 xen/arch/x86/Makefile                         | 105 ++---
 xen/arch/x86/Rules.mk                         |   4 +-
 xen/arch/x86/arch.mk                          |  16 +-
 xen/arch/x86/boot/Makefile                    |  14 +-
 xen/arch/x86/efi/Makefile                     |   6 +-
 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                  |   9 -
 xen/arch/x86/mm/hap/guest_walk.c              |   3 -
 xen/arch/x86/mm/hap/guest_walk_2level.c       |   2 +
 xen/arch/x86/mm/hap/guest_walk_3level.c       |   2 +
 xen/arch/x86/mm/hap/guest_walk_4level.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/common/Makefile                           |  12 +-
 xen/common/efi/runtime.c                      |  14 +-
 xen/common/libelf/Makefile                    |   4 +-
 xen/common/libfdt/Makefile                    |   6 +-
 xen/common/page_alloc.c                       |   2 +-
 xen/include/Makefile                          |  60 ++-
 xen/include/{asm-arm => arch-arm/asm}/acpi.h  |   0
 .../{asm-arm => arch-arm/asm}/alternative.h   |   0
 .../{asm-arm => arch-arm/asm}/altp2m.h        |   0
 .../{asm-arm => arch-arm/asm}/arm32/atomic.h  |   0
 .../{asm-arm => arch-arm/asm}/arm32/bitops.h  |   0
 .../{asm-arm => arch-arm/asm}/arm32/bug.h     |   0
 .../{asm-arm => arch-arm/asm}/arm32/cmpxchg.h |   0
 .../asm}/arm32/flushtlb.h                     |   0
 .../{asm-arm => arch-arm/asm}/arm32/insn.h    |   0
 .../{asm-arm => arch-arm/asm}/arm32/io.h      |   0
 .../{asm-arm => arch-arm/asm}/arm32/macros.h  |   0
 .../{asm-arm => arch-arm/asm}/arm32/mm.h      |   0
 .../{asm-arm => arch-arm/asm}/arm32/page.h    |   0
 .../asm}/arm32/processor.h                    |   0
 .../{asm-arm => arch-arm/asm}/arm32/sysregs.h |   0
 .../{asm-arm => arch-arm/asm}/arm32/system.h  |   0
 .../{asm-arm => arch-arm/asm}/arm32/traps.h   |   0
 .../{asm-arm => arch-arm/asm}/arm32/vfp.h     |   0
 .../{asm-arm => arch-arm/asm}/arm64/atomic.h  |   0
 .../{asm-arm => arch-arm/asm}/arm64/bitops.h  |   0
 .../{asm-arm => arch-arm/asm}/arm64/brk.h     |   0
 .../{asm-arm => arch-arm/asm}/arm64/bug.h     |   0
 .../{asm-arm => arch-arm/asm}/arm64/cmpxchg.h |   0
 .../{asm-arm => arch-arm/asm}/arm64/efibind.h |   0
 .../asm}/arm64/flushtlb.h                     |   0
 .../{asm-arm => arch-arm/asm}/arm64/hsr.h     |   0
 .../{asm-arm => arch-arm/asm}/arm64/insn.h    |   0
 .../{asm-arm => arch-arm/asm}/arm64/io.h      |   0
 .../{asm-arm => arch-arm/asm}/arm64/macros.h  |   0
 .../{asm-arm => arch-arm/asm}/arm64/mm.h      |   0
 .../{asm-arm => arch-arm/asm}/arm64/page.h    |   0
 .../asm}/arm64/processor.h                    |   0
 .../{asm-arm => arch-arm/asm}/arm64/sysregs.h |   0
 .../{asm-arm => arch-arm/asm}/arm64/system.h  |   0
 .../{asm-arm => arch-arm/asm}/arm64/traps.h   |   0
 .../{asm-arm => arch-arm/asm}/arm64/vfp.h     |   0
 .../{asm-arm => arch-arm/asm}/asm_defns.h     |   0
 .../{asm-arm => arch-arm/asm}/atomic.h        |   0
 .../{asm-arm => arch-arm/asm}/bitops.h        |   0
 xen/include/{asm-arm => arch-arm/asm}/bug.h   |   0
 .../{asm-arm => arch-arm/asm}/byteorder.h     |   0
 xen/include/{asm-arm => arch-arm/asm}/cache.h |   0
 .../{asm-arm => arch-arm/asm}/cadence-uart.h  |   0
 .../{asm-arm => arch-arm/asm}/config.h        |   0
 .../{asm-arm => arch-arm/asm}/cpregs.h        |   0
 .../{asm-arm => arch-arm/asm}/cpuerrata.h     |   0
 .../{asm-arm => arch-arm/asm}/cpufeature.h    |   0
 .../{asm-arm => arch-arm/asm}/current.h       |   0
 .../{asm-arm => arch-arm/asm}/debugger.h      |   0
 xen/include/{asm-arm => arch-arm/asm}/delay.h |   0
 xen/include/{asm-arm => arch-arm/asm}/desc.h  |   0
 .../{asm-arm => arch-arm/asm}/device.h        |   0
 xen/include/{asm-arm => arch-arm/asm}/div64.h |   0
 .../{asm-arm => arch-arm/asm}/domain.h        |   0
 .../{asm-arm => arch-arm/asm}/domain_build.h  |   0
 .../{asm-arm => arch-arm/asm}/early_printk.h  |   0
 .../{asm-arm => arch-arm/asm}/efibind.h       |   0
 xen/include/{asm-arm => arch-arm/asm}/elf.h   |   0
 xen/include/{asm-arm => arch-arm/asm}/event.h |   0
 .../asm}/exynos4210-uart.h                    |   0
 .../{asm-arm => arch-arm/asm}/flushtlb.h      |   0
 xen/include/{asm-arm => arch-arm/asm}/gic.h   |   0
 .../{asm-arm => arch-arm/asm}/gic_v3_defs.h   |   0
 .../{asm-arm => arch-arm/asm}/gic_v3_its.h    |   0
 .../{asm-arm => arch-arm/asm}/grant_table.h   |   0
 .../{asm-arm => arch-arm/asm}/guest_access.h  |   0
 .../{asm-arm => arch-arm/asm}/guest_atomics.h |   0
 .../{asm-arm => arch-arm/asm}/guest_walk.h    |   0
 .../{asm-arm => arch-arm/asm}/hardirq.h       |   0
 xen/include/{asm-arm => arch-arm/asm}/hsr.h   |   0
 .../{asm-arm => arch-arm/asm}/hypercall.h     |   0
 xen/include/{asm-arm => arch-arm/asm}/init.h  |   0
 xen/include/{asm-arm => arch-arm/asm}/insn.h  |   0
 xen/include/{asm-arm => arch-arm/asm}/io.h    |   0
 xen/include/{asm-arm => arch-arm/asm}/iocap.h |   0
 xen/include/{asm-arm => arch-arm/asm}/iommu.h |   0
 .../{asm-arm => arch-arm/asm}/iommu_fwspec.h  |   0
 xen/include/{asm-arm => arch-arm/asm}/ioreq.h |   0
 xen/include/{asm-arm => arch-arm/asm}/irq.h   |   0
 .../{asm-arm => arch-arm/asm}/kernel.h        |   0
 .../{asm-arm => arch-arm/asm}/livepatch.h     |   0
 xen/include/{asm-arm => arch-arm/asm}/lpae.h  |   0
 .../{asm-arm => arch-arm/asm}/macros.h        |   0
 .../{asm-arm => arch-arm/asm}/mem_access.h    |   0
 xen/include/{asm-arm => arch-arm/asm}/mm.h    |   0
 xen/include/{asm-arm => arch-arm/asm}/mmio.h  |   0
 .../{asm-arm => arch-arm/asm}/monitor.h       |   0
 .../{asm-arm => arch-arm/asm}/new_vgic.h      |   0
 .../{asm-arm => arch-arm/asm}/nospec.h        |   0
 xen/include/{asm-arm => arch-arm/asm}/numa.h  |   0
 xen/include/{asm-arm => arch-arm/asm}/p2m.h   |   0
 .../{asm-arm => arch-arm/asm}/page-bits.h     |   0
 xen/include/{asm-arm => arch-arm/asm}/page.h  |   0
 .../{asm-arm => arch-arm/asm}/paging.h        |   0
 xen/include/{asm-arm => arch-arm/asm}/pci.h   |   0
 .../{asm-arm => arch-arm/asm}/percpu.h        |   0
 xen/include/{asm-arm => arch-arm/asm}/perfc.h |   0
 .../{asm-arm => arch-arm/asm}/perfc_defn.h    |   0
 .../{asm-arm => arch-arm/asm}/pl011-uart.h    |   0
 .../{asm-arm => arch-arm/asm}/platform.h      |   0
 .../asm}/platforms/exynos5.h                  |   0
 .../asm}/platforms/midway.h                   |   0
 .../asm}/platforms/omap5.h                    |   0
 .../asm}/platforms/vexpress.h                 |   0
 .../asm}/platforms/xilinx-zynqmp-eemi.h       |   0
 .../{asm-arm => arch-arm/asm}/processor.h     |   0
 .../{asm-arm => arch-arm/asm}/procinfo.h      |   0
 xen/include/{asm-arm => arch-arm/asm}/psci.h  |   0
 .../{asm-arm => arch-arm/asm}/random.h        |   0
 xen/include/{asm-arm => arch-arm/asm}/regs.h  |   0
 .../{asm-arm => arch-arm/asm}/scif-uart.h     |   0
 xen/include/{asm-arm => arch-arm/asm}/setup.h |   0
 .../{asm-arm => arch-arm/asm}/short-desc.h    |   0
 xen/include/{asm-arm => arch-arm/asm}/smccc.h |   0
 xen/include/{asm-arm => arch-arm/asm}/smp.h   |   0
 .../{asm-arm => arch-arm/asm}/softirq.h       |   0
 .../{asm-arm => arch-arm/asm}/spinlock.h      |   0
 .../{asm-arm => arch-arm/asm}/string.h        |   0
 .../{asm-arm => arch-arm/asm}/sysregs.h       |   0
 .../{asm-arm => arch-arm/asm}/system.h        |   0
 .../{asm-arm => arch-arm/asm}/tee/optee_msg.h |   0
 .../asm}/tee/optee_rpc_cmd.h                  |   0
 .../{asm-arm => arch-arm/asm}/tee/optee_smc.h |   0
 .../{asm-arm => arch-arm/asm}/tee/tee.h       |   0
 xen/include/{asm-arm => arch-arm/asm}/time.h  |   0
 xen/include/{asm-arm => arch-arm/asm}/trace.h |   0
 xen/include/{asm-arm => arch-arm/asm}/traps.h |   0
 xen/include/{asm-arm => arch-arm/asm}/types.h |   0
 xen/include/{asm-arm => arch-arm/asm}/vfp.h   |   0
 .../{asm-arm => arch-arm/asm}/vgic-emul.h     |   0
 xen/include/{asm-arm => arch-arm/asm}/vgic.h  |   0
 .../{asm-arm => arch-arm/asm}/vm_event.h      |   0
 .../{asm-arm => arch-arm/asm}/vpl011.h        |   0
 xen/include/{asm-arm => arch-arm/asm}/vpsci.h |   0
 xen/include/{asm-arm => arch-arm/asm}/vreg.h  |   0
 .../{asm-arm => arch-arm/asm}/vtimer.h        |   0
 .../{asm-arm => arch-arm/asm}/xenoprof.h      |   0
 .../{asm-riscv => arch-riscv/asm}/config.h    |   0
 xen/include/{asm-x86 => arch-x86/asm}/acpi.h  |   0
 .../asm}/alternative-asm.h                    |   0
 .../{asm-x86 => arch-x86/asm}/alternative.h   |   0
 .../{asm-x86 => arch-x86/asm}/altp2m.h        |   0
 xen/include/{asm-x86 => arch-x86/asm}/amd.h   |   0
 xen/include/{asm-x86 => arch-x86/asm}/apic.h  |   0
 .../{asm-x86 => arch-x86/asm}/apicdef.h       |   0
 .../{asm-x86 => arch-x86/asm}/asm-defns.h     |   0
 .../{asm-x86 => arch-x86/asm}/asm_defns.h     |   0
 .../{asm-x86 => arch-x86/asm}/atomic.h        |   0
 .../{asm-x86 => arch-x86/asm}/bitops.h        |   0
 xen/include/{asm-x86 => arch-x86/asm}/bug.h   |   0
 .../{asm-x86 => arch-x86/asm}/byteorder.h     |   0
 .../{asm-x86 => arch-x86/asm}/bzimage.h       |   0
 xen/include/{asm-x86 => arch-x86/asm}/cache.h |   0
 .../{asm-x86 => arch-x86/asm}/compat.h        |   0
 .../{asm-x86 => arch-x86/asm}/config.h        |   0
 .../{asm-x86 => arch-x86/asm}/cpufeature.h    |   0
 .../{asm-x86 => arch-x86/asm}/cpufeatures.h   |   0
 .../{asm-x86 => arch-x86/asm}/cpufeatureset.h |   0
 xen/include/{asm-x86 => arch-x86/asm}/cpuid.h |   0
 .../{asm-x86 => arch-x86/asm}/cpuidle.h       |   0
 .../{asm-x86 => arch-x86/asm}/current.h       |   2 +-
 .../{asm-x86 => arch-x86/asm}/debugger.h      |   0
 .../{asm-x86 => arch-x86/asm}/debugreg.h      |   0
 xen/include/{asm-x86 => arch-x86/asm}/delay.h |   0
 xen/include/{asm-x86 => arch-x86/asm}/desc.h  |   0
 .../{asm-x86 => arch-x86/asm}/device.h        |   0
 xen/include/{asm-x86 => arch-x86/asm}/div64.h |   0
 .../{asm-x86 => arch-x86/asm}/dom0_build.h    |   0
 .../{asm-x86 => arch-x86/asm}/domain.h        |   2 +-
 xen/include/{asm-x86 => arch-x86/asm}/e820.h  |   0
 xen/include/{asm-x86 => arch-x86/asm}/edd.h   |   0
 .../{asm-x86 => arch-x86/asm}/efibind.h       |   0
 xen/include/{asm-x86 => arch-x86/asm}/elf.h   |   0
 xen/include/{asm-x86 => arch-x86/asm}/event.h |   0
 .../{asm-x86 => arch-x86/asm}/fixmap.h        |   0
 .../{asm-x86 => arch-x86/asm}/flushtlb.h      |   0
 .../{asm-x86 => arch-x86/asm}/genapic.h       |   0
 .../{asm-x86 => arch-x86/asm}/grant_table.h   |   0
 xen/include/{asm-x86 => arch-x86/asm}/guest.h |   0
 .../asm}/guest/hyperv-hcall.h                 |   0
 .../asm}/guest/hyperv-tlfs.h                  |   0
 .../{asm-x86 => arch-x86/asm}/guest/hyperv.h  |   0
 .../asm}/guest/hypervisor.h                   |   0
 .../asm}/guest/pvh-boot.h                     |   0
 .../asm}/guest/xen-hcall.h                    |   0
 .../{asm-x86 => arch-x86/asm}/guest/xen.h     |   0
 .../{asm-x86 => arch-x86/asm}/guest_access.h  |   0
 .../{asm-x86 => arch-x86/asm}/guest_atomics.h |   0
 .../{asm-x86 => arch-x86/asm}/guest_pt.h      |   0
 xen/include/{asm-x86 => arch-x86/asm}/hap.h   |   0
 .../{asm-x86 => arch-x86/asm}/hardirq.h       |   0
 xen/include/{asm-x86 => arch-x86/asm}/hpet.h  |   0
 .../{asm-x86 => arch-x86/asm}/hvm/asid.h      |   0
 .../{asm-x86 => arch-x86/asm}/hvm/cacheattr.h |   0
 .../{asm-x86 => arch-x86/asm}/hvm/domain.h    |   0
 .../{asm-x86 => arch-x86/asm}/hvm/emulate.h   |   0
 .../asm}/hvm/grant_table.h                    |   0
 .../asm}/hvm/guest_access.h                   |   0
 .../{asm-x86 => arch-x86/asm}/hvm/hvm.h       |   0
 .../{asm-x86 => arch-x86/asm}/hvm/io.h        |   0
 .../{asm-x86 => arch-x86/asm}/hvm/ioreq.h     |   0
 .../{asm-x86 => arch-x86/asm}/hvm/irq.h       |   0
 .../{asm-x86 => arch-x86/asm}/hvm/monitor.h   |   0
 .../{asm-x86 => arch-x86/asm}/hvm/nestedhvm.h |   0
 .../{asm-x86 => arch-x86/asm}/hvm/save.h      |   0
 .../{asm-x86 => arch-x86/asm}/hvm/support.h   |   0
 .../{asm-x86 => arch-x86/asm}/hvm/svm/asid.h  |   0
 .../asm}/hvm/svm/emulate.h                    |   0
 .../{asm-x86 => arch-x86/asm}/hvm/svm/intr.h  |   0
 .../asm}/hvm/svm/nestedsvm.h                  |   0
 .../{asm-x86 => arch-x86/asm}/hvm/svm/svm.h   |   0
 .../asm}/hvm/svm/svmdebug.h                   |   0
 .../{asm-x86 => arch-x86/asm}/hvm/svm/vmcb.h  |   0
 .../{asm-x86 => arch-x86/asm}/hvm/trace.h     |   0
 .../{asm-x86 => arch-x86/asm}/hvm/vcpu.h      |   0
 .../{asm-x86 => arch-x86/asm}/hvm/vioapic.h   |   0
 .../{asm-x86 => arch-x86/asm}/hvm/viridian.h  |   0
 .../{asm-x86 => arch-x86/asm}/hvm/vlapic.h    |   0
 .../{asm-x86 => arch-x86/asm}/hvm/vm_event.h  |   0
 .../{asm-x86 => arch-x86/asm}/hvm/vmx/vmcs.h  |   0
 .../{asm-x86 => arch-x86/asm}/hvm/vmx/vmx.h   |   0
 .../{asm-x86 => arch-x86/asm}/hvm/vmx/vvmx.h  |   0
 .../{asm-x86 => arch-x86/asm}/hvm/vpic.h      |   0
 .../{asm-x86 => arch-x86/asm}/hvm/vpt.h       |   0
 .../{asm-x86 => arch-x86/asm}/hypercall.h     |   0
 xen/include/{asm-x86 => arch-x86/asm}/i387.h  |   0
 xen/include/{asm-x86 => arch-x86/asm}/init.h  |   0
 .../{asm-x86 => arch-x86/asm}/invpcid.h       |   0
 xen/include/{asm-x86 => arch-x86/asm}/io.h    |   0
 .../{asm-x86 => arch-x86/asm}/io_apic.h       |   0
 xen/include/{asm-x86 => arch-x86/asm}/iocap.h |   0
 xen/include/{asm-x86 => arch-x86/asm}/iommu.h |   0
 xen/include/{asm-x86 => arch-x86/asm}/ioreq.h |   0
 xen/include/{asm-x86 => arch-x86/asm}/irq.h   |   0
 xen/include/{asm-x86 => arch-x86/asm}/ldt.h   |   0
 .../{asm-x86 => arch-x86/asm}/livepatch.h     |   0
 .../asm}/mach-default/bios_ebda.h             |   0
 .../asm}/mach-default/io_ports.h              |   0
 .../asm}/mach-default/irq_vectors.h           |   0
 .../asm}/mach-default/mach_mpparse.h          |   0
 .../asm}/mach-default/mach_mpspec.h           |   0
 .../asm}/mach-generic/mach_apic.h             |   0
 .../asm}/mach-generic/mach_mpparse.h          |   0
 .../{asm-x86 => arch-x86/asm}/machine_kexec.h |   0
 .../{asm-x86 => arch-x86/asm}/mc146818rtc.h   |   0
 xen/include/{asm-x86 => arch-x86/asm}/mce.h   |   0
 .../{asm-x86 => arch-x86/asm}/mem_access.h    |   0
 .../{asm-x86 => arch-x86/asm}/mem_paging.h    |   0
 .../{asm-x86 => arch-x86/asm}/mem_sharing.h   |   0
 .../{asm-x86 => arch-x86/asm}/microcode.h     |   0
 xen/include/{asm-x86 => arch-x86/asm}/mm.h    |   0
 .../{asm-x86 => arch-x86/asm}/monitor.h       |   0
 .../{asm-x86 => arch-x86/asm}/mpspec.h        |   0
 .../{asm-x86 => arch-x86/asm}/mpspec_def.h    |   0
 xen/include/{asm-x86 => arch-x86/asm}/msi.h   |   0
 .../{asm-x86 => arch-x86/asm}/msr-index.h     |   0
 xen/include/{asm-x86 => arch-x86/asm}/msr.h   |   0
 xen/include/{asm-x86 => arch-x86/asm}/mtrr.h  |   0
 .../{asm-x86 => arch-x86/asm}/multicall.h     |   0
 xen/include/{asm-x86 => arch-x86/asm}/mwait.h |   0
 xen/include/{asm-x86 => arch-x86/asm}/nmi.h   |   0
 xen/include/{asm-x86 => arch-x86/asm}/nops.h  |   0
 .../{asm-x86 => arch-x86/asm}/nospec.h        |   0
 xen/include/{asm-x86 => arch-x86/asm}/numa.h  |   0
 xen/include/{asm-x86 => arch-x86/asm}/p2m.h   |   0
 .../{asm-x86 => arch-x86/asm}/page-bits.h     |   0
 xen/include/{asm-x86 => arch-x86/asm}/page.h  |   0
 .../{asm-x86 => arch-x86/asm}/paging.h        |   0
 xen/include/{asm-x86 => arch-x86/asm}/pci.h   |   0
 .../{asm-x86 => arch-x86/asm}/percpu.h        |   0
 xen/include/{asm-x86 => arch-x86/asm}/perfc.h |   0
 .../{asm-x86 => arch-x86/asm}/perfc_defn.h    |   0
 .../{asm-x86 => arch-x86/asm}/processor.h     |   0
 xen/include/{asm-x86 => arch-x86/asm}/psr.h   |   0
 .../{asm-x86 => arch-x86/asm}/pv/domain.h     |   0
 .../asm}/pv/grant_table.h                     |   0
 xen/include/{asm-x86 => arch-x86/asm}/pv/mm.h |   0
 .../{asm-x86 => arch-x86/asm}/pv/shim.h       |   0
 .../{asm-x86 => arch-x86/asm}/pv/traps.h      |   0
 .../{asm-x86 => arch-x86/asm}/random.h        |   0
 xen/include/{asm-x86 => arch-x86/asm}/regs.h  |   0
 xen/include/{asm-x86 => arch-x86/asm}/setup.h |   0
 .../{asm-x86 => arch-x86/asm}/shadow.h        |   0
 .../{asm-x86 => arch-x86/asm}/shared.h        |   0
 xen/include/{asm-x86 => arch-x86/asm}/smp.h   |   0
 .../{asm-x86 => arch-x86/asm}/softirq.h       |   0
 .../{asm-x86 => arch-x86/asm}/spec_ctrl.h     |   0
 .../{asm-x86 => arch-x86/asm}/spec_ctrl_asm.h |   0
 .../{asm-x86 => arch-x86/asm}/spinlock.h      |   0
 .../{asm-x86 => arch-x86/asm}/string.h        |   0
 .../{asm-x86 => arch-x86/asm}/system.h        |   0
 xen/include/{asm-x86 => arch-x86/asm}/tboot.h |   0
 xen/include/{asm-x86 => arch-x86/asm}/time.h  |   0
 xen/include/{asm-x86 => arch-x86/asm}/trace.h |   0
 xen/include/{asm-x86 => arch-x86/asm}/traps.h |   0
 xen/include/{asm-x86 => arch-x86/asm}/types.h |   0
 .../{asm-x86 => arch-x86/asm}/uaccess.h       |   0
 .../{asm-x86 => arch-x86/asm}/unaligned.h     |   0
 .../{asm-x86 => arch-x86/asm}/vm_event.h      |   0
 xen/include/{asm-x86 => arch-x86/asm}/vpmu.h  |   0
 .../{asm-x86 => arch-x86/asm}/x86-defns.h     |   0
 .../{asm-x86 => arch-x86/asm}/x86-vendors.h   |   0
 .../asm}/x86_64/efibind.h                     |   0
 .../{asm-x86 => arch-x86/asm}/x86_64/elf.h    |   0
 .../{asm-x86 => arch-x86/asm}/x86_64/page.h   |   0
 .../{asm-x86 => arch-x86/asm}/x86_64/regs.h   |   0
 .../{asm-x86 => arch-x86/asm}/x86_64/system.h |   0
 .../asm}/x86_64/uaccess.h                     |   0
 .../{asm-x86 => arch-x86/asm}/x86_emulate.h   |   0
 .../{asm-x86 => arch-x86/asm}/xenoprof.h      |   0
 .../{asm-x86 => arch-x86/asm}/xstate.h        |   0
 xen/include/xen/acpi.h                        |   4 +-
 xen/include/xen/bitmap.h                      |   2 +-
 xen/scripts/Kbuild.include                    |  80 +++-
 xen/scripts/Makefile.clean                    |  20 +-
 xen/test/Makefile                             |  16 +-
 xen/test/livepatch/Makefile                   | 215 ++++------
 xen/tools/Makefile                            |   8 +-
 xen/tools/compat-build-header.py              |  44 +-
 xen/tools/compat-build-source.py              |   8 +-
 xen/tools/fixdep.c                            | 404 ++++++++++++++++++
 xen/tools/symbols.c                           |  18 +-
 xen/xsm/flask/Makefile                        |  40 +-
 xen/xsm/flask/policy/mkaccess_vector.sh       |   7 +-
 xen/xsm/flask/ss/Makefile                     |   2 +-
 369 files changed, 1122 insertions(+), 616 deletions(-)
 create mode 100644 xen/arch/riscv/riscv64/Makefile
 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_2level.c
 create mode 100644 xen/arch/x86/mm/hap/guest_walk_3level.c
 create mode 100644 xen/arch/x86/mm/hap/guest_walk_4level.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
 rename xen/include/{asm-arm => arch-arm/asm}/acpi.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/alternative.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/altp2m.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/atomic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/bitops.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/bug.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/cmpxchg.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/flushtlb.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/insn.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/io.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/macros.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/mm.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/page.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/processor.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/sysregs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/system.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/traps.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/vfp.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/atomic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/bitops.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/brk.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/bug.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/cmpxchg.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/efibind.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/flushtlb.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/hsr.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/insn.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/io.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/macros.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/mm.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/page.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/processor.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/sysregs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/system.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/traps.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/vfp.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/asm_defns.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/atomic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/bitops.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/bug.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/byteorder.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/cache.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/cadence-uart.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/config.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/cpregs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/cpuerrata.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/cpufeature.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/current.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/debugger.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/delay.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/desc.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/device.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/div64.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/domain.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/domain_build.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/early_printk.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/efibind.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/elf.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/event.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/exynos4210-uart.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/flushtlb.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/gic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/gic_v3_defs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/gic_v3_its.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/grant_table.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/guest_access.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/guest_atomics.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/guest_walk.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/hardirq.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/hsr.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/hypercall.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/init.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/insn.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/io.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/iocap.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/iommu.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/iommu_fwspec.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/ioreq.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/irq.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/kernel.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/livepatch.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/lpae.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/macros.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/mem_access.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/mm.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/mmio.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/monitor.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/new_vgic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/nospec.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/numa.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/p2m.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/page-bits.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/page.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/paging.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/pci.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/percpu.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/perfc.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/perfc_defn.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/pl011-uart.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platform.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platforms/exynos5.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platforms/midway.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platforms/omap5.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platforms/vexpress.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platforms/xilinx-zynqmp-eemi.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/processor.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/procinfo.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/psci.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/random.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/regs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/scif-uart.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/setup.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/short-desc.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/smccc.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/smp.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/softirq.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/spinlock.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/string.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/sysregs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/system.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/tee/optee_msg.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/tee/optee_rpc_cmd.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/tee/optee_smc.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/tee/tee.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/time.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/trace.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/traps.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/types.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vfp.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vgic-emul.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vgic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vm_event.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vpl011.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vpsci.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vreg.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vtimer.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/xenoprof.h (100%)
 rename xen/include/{asm-riscv => arch-riscv/asm}/config.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/acpi.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/alternative-asm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/alternative.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/altp2m.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/amd.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/apic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/apicdef.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/asm-defns.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/asm_defns.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/atomic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/bitops.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/bug.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/byteorder.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/bzimage.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cache.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/compat.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/config.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cpufeature.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cpufeatures.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cpufeatureset.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cpuid.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cpuidle.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/current.h (99%)
 rename xen/include/{asm-x86 => arch-x86/asm}/debugger.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/debugreg.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/delay.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/desc.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/device.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/div64.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/dom0_build.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/domain.h (99%)
 rename xen/include/{asm-x86 => arch-x86/asm}/e820.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/edd.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/efibind.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/elf.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/event.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/fixmap.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/flushtlb.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/genapic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/grant_table.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/hyperv-hcall.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/hyperv-tlfs.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/hyperv.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/hypervisor.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/pvh-boot.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/xen-hcall.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/xen.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest_access.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest_atomics.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest_pt.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hap.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hardirq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hpet.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/asid.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/cacheattr.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/domain.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/emulate.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/grant_table.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/guest_access.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/hvm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/io.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/ioreq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/irq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/monitor.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/nestedhvm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/save.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/support.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/asid.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/emulate.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/intr.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/nestedsvm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/svm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/svmdebug.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/vmcb.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/trace.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vcpu.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vioapic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/viridian.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vlapic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vm_event.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vmx/vmcs.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vmx/vmx.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vmx/vvmx.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vpic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vpt.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hypercall.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/i387.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/init.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/invpcid.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/io.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/io_apic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/iocap.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/iommu.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/ioreq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/irq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/ldt.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/livepatch.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-default/bios_ebda.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-default/io_ports.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-default/irq_vectors.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-default/mach_mpparse.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-default/mach_mpspec.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-generic/mach_apic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-generic/mach_mpparse.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/machine_kexec.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mc146818rtc.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mce.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mem_access.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mem_paging.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mem_sharing.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/microcode.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/monitor.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mpspec.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mpspec_def.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/msi.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/msr-index.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/msr.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mtrr.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/multicall.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mwait.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/nmi.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/nops.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/nospec.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/numa.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/p2m.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/page-bits.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/page.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/paging.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pci.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/percpu.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/perfc.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/perfc_defn.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/processor.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/psr.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pv/domain.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pv/grant_table.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pv/mm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pv/shim.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pv/traps.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/random.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/regs.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/setup.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/shadow.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/shared.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/smp.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/softirq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/spec_ctrl.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/spec_ctrl_asm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/spinlock.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/string.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/system.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/tboot.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/time.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/trace.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/traps.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/types.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/uaccess.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/unaligned.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/vm_event.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/vpmu.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86-defns.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86-vendors.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/efibind.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/elf.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/page.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/regs.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/system.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/uaccess.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_emulate.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/xenoprof.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/xstate.h (100%)
 create mode 100644 xen/tools/fixdep.c

-- 
Anthony PERARD



^ permalink raw reply	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 01/31] build: fix %.s: %.S rule
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-05 14:40   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 02/31] build: introduce cpp_flags macro Anthony PERARD
                   ` (29 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

Fixes: e321576f4047 ("xen/build: start using if_changed")
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

Notes:
    v6:
    - new patch

 xen/Rules.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index ceb3d204b84f..d65d6a48993b 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -227,8 +227,8 @@ cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(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_s_S = CPP     $@
-cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $<
+quiet_cmd_cpp_s_S = CPP     $@
+cmd_cpp_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $<
 
 %.i: %.c FORCE
 	$(call if_changed,cpp_i_c)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 02/31] build: introduce cpp_flags macro
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
  2021-07-01 14:09 ` [XEN PATCH v6 01/31] build: fix %.s: %.S rule Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 14:18   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 03/31] build: use if_changed on built_in.o Anthony PERARD
                   ` (28 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Roger Pau Monné,
	Tim Deegan

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

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

 xen/Rules.mk                    | 7 +++++--
 xen/arch/x86/mm/Makefile        | 2 +-
 xen/arch/x86/mm/hap/Makefile    | 2 +-
 xen/arch/x86/mm/shadow/Makefile | 2 +-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index d65d6a48993b..f778058f80a6 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -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)%,$(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)
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index b31041644fe8..2818c066f76a 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -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 $@
diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile
index 22e7ad54bd33..c6d296b51720 100644
--- a/xen/arch/x86/mm/hap/Makefile
+++ b/xen/arch/x86/mm/hap/Makefile
@@ -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 $@
diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makefile
index 770213fe9d84..fd64b4dda925 100644
--- a/xen/arch/x86/mm/shadow/Makefile
+++ b/xen/arch/x86/mm/shadow/Makefile
@@ -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 $@
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 03/31] build: use if_changed on built_in.o
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
  2021-07-01 14:09 ` [XEN PATCH v6 01/31] build: fix %.s: %.S rule Anthony PERARD
  2021-07-01 14:09 ` [XEN PATCH v6 02/31] build: introduce cpp_flags macro Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-08 12:03   ` Andrew Cooper
  2021-07-01 14:09 ` [XEN PATCH v6 04/31] build: use if_changed_rules with %.o:%.c targets Anthony PERARD
                   ` (27 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Jan Beulich, Andrew Cooper, George Dunlap,
	Ian Jackson, Julien Grall, Stefano Stabellini, Wei Liu

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.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---

Notes:
    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(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index f778058f80a6..6a0cdfde2eed 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -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 = LD      $@
+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)
 
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 04/31] build: use if_changed_rules with %.o:%.c targets
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (2 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 03/31] build: use if_changed on built_in.o Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-01 14:09 ` [XEN PATCH v6 05/31] build: factorise generation of the linker scripts Anthony PERARD
                   ` (26 subsequent siblings)
  30 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Jan Beulich, Andrew Cooper, George Dunlap,
	Ian Jackson, Julien Grall, Stefano Stabellini, Wei Liu

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.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/Rules.mk | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 6a0cdfde2eed..4adc90eec80d 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -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 $@
 
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 05/31] build: factorise generation of the linker scripts
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (3 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 04/31] build: use if_changed_rules with %.o:%.c targets Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 14:25   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 06/31] x86/mm: avoid building multiple .o from a single .c file Anthony PERARD
                   ` (25 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Volodymyr Babchuk, Roger Pau Monné

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.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

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(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 4adc90eec80d..f05b2d3f0399 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -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.
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 3d3b97b5b440..0edd9dee6f49 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -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))
 
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 2ec883456e48..08a4ec1944d3 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -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
@@ -240,6 +241,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)"
@@ -292,8 +294,8 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
 	$(call move-if-changed,$@.new,$@)
 
 efi.lds: AFLAGS-y += -DEFI
-xen.lds efi.lds: xen.lds.S
-	$(CPP) -P $(filter-out -Wa$(comma)%,$(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 $@ $<
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 06/31] x86/mm: avoid building multiple .o from a single .c file
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (4 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 05/31] build: factorise generation of the linker scripts Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 14:45   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 07/31] build,include: rework compat-build-source.py Anthony PERARD
                   ` (24 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Roger Pau Monné,
	Tim Deegan

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.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

Notes:
    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            |  9 ---------
 xen/arch/x86/mm/hap/guest_walk.c        |  3 ---
 xen/arch/x86/mm/hap/guest_walk_2level.c |  2 ++
 xen/arch/x86/mm/hap/guest_walk_3level.c |  2 ++
 xen/arch/x86/mm/hap/guest_walk_4level.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, 21 insertions(+), 64 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_2level.c
 create mode 100644 xen/arch/x86/mm/hap/guest_walk_3level.c
 create mode 100644 xen/arch/x86/mm/hap/guest_walk_4level.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

diff --git a/xen/Makefile b/xen/Makefile
index 89879fad4cb2..360b4a1d1867 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -476,17 +476,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))
diff --git a/xen/Rules.mk b/xen/Rules.mk
index f05b2d3f0399..ede408efc515 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -139,7 +139,7 @@ cpp_flags = $(filter-out -Wa$(comma)%,$(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
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 2818c066f76a..6b7882d992bb 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -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 $@
diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c
index 30d83cf1e0e6..b9f607272c39 100644
--- a/xen/arch/x86/mm/guest_walk.c
+++ b/xen/arch/x86/mm/guest_walk.c
@@ -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>
diff --git a/xen/arch/x86/mm/guest_walk_2.c b/xen/arch/x86/mm/guest_walk_2.c
new file mode 100644
index 000000000000..defcd59bc260
--- /dev/null
+++ b/xen/arch/x86/mm/guest_walk_2.c
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 2
+#include "guest_walk.c"
diff --git a/xen/arch/x86/mm/guest_walk_3.c b/xen/arch/x86/mm/guest_walk_3.c
new file mode 100644
index 000000000000..1c9eca37741e
--- /dev/null
+++ b/xen/arch/x86/mm/guest_walk_3.c
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 3
+#include "guest_walk.c"
diff --git a/xen/arch/x86/mm/guest_walk_4.c b/xen/arch/x86/mm/guest_walk_4.c
new file mode 100644
index 000000000000..aa3900338a2d
--- /dev/null
+++ b/xen/arch/x86/mm/guest_walk_4.c
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 4
+#include "guest_walk.c"
diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile
index c6d296b51720..32aef9b4ba26 100644
--- a/xen/arch/x86/mm/hap/Makefile
+++ b/xen/arch/x86/mm/hap/Makefile
@@ -4,12 +4,3 @@ obj-y += guest_walk_3level.o
 obj-y += guest_walk_4level.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 $@
diff --git a/xen/arch/x86/mm/hap/guest_walk.c b/xen/arch/x86/mm/hap/guest_walk.c
index f59ebc84a290..832a8058471e 100644
--- a/xen/arch/x86/mm/hap/guest_walk.c
+++ b/xen/arch/x86/mm/hap/guest_walk.c
@@ -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>
diff --git a/xen/arch/x86/mm/hap/guest_walk_2level.c b/xen/arch/x86/mm/hap/guest_walk_2level.c
new file mode 100644
index 000000000000..defcd59bc260
--- /dev/null
+++ b/xen/arch/x86/mm/hap/guest_walk_2level.c
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 2
+#include "guest_walk.c"
diff --git a/xen/arch/x86/mm/hap/guest_walk_3level.c b/xen/arch/x86/mm/hap/guest_walk_3level.c
new file mode 100644
index 000000000000..1c9eca37741e
--- /dev/null
+++ b/xen/arch/x86/mm/hap/guest_walk_3level.c
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 3
+#include "guest_walk.c"
diff --git a/xen/arch/x86/mm/hap/guest_walk_4level.c b/xen/arch/x86/mm/hap/guest_walk_4level.c
new file mode 100644
index 000000000000..aa3900338a2d
--- /dev/null
+++ b/xen/arch/x86/mm/hap/guest_walk_4level.c
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 4
+#include "guest_walk.c"
diff --git a/xen/arch/x86/mm/shadow/Makefile b/xen/arch/x86/mm/shadow/Makefile
index fd64b4dda925..b4a1620b6920 100644
--- a/xen/arch/x86/mm/shadow/Makefile
+++ b/xen/arch/x86/mm/shadow/Makefile
@@ -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 $@
diff --git a/xen/arch/x86/mm/shadow/guest_2.c b/xen/arch/x86/mm/shadow/guest_2.c
new file mode 100644
index 000000000000..288b229982b0
--- /dev/null
+++ b/xen/arch/x86/mm/shadow/guest_2.c
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 2
+#include "multi.c"
diff --git a/xen/arch/x86/mm/shadow/guest_3.c b/xen/arch/x86/mm/shadow/guest_3.c
new file mode 100644
index 000000000000..04e17b0b8adc
--- /dev/null
+++ b/xen/arch/x86/mm/shadow/guest_3.c
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 3
+#include "multi.c"
diff --git a/xen/arch/x86/mm/shadow/guest_4.c b/xen/arch/x86/mm/shadow/guest_4.c
new file mode 100644
index 000000000000..c0c5d3cb11ad
--- /dev/null
+++ b/xen/arch/x86/mm/shadow/guest_4.c
@@ -0,0 +1,2 @@
+#define GUEST_PAGING_LEVELS 4
+#include "multi.c"
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 8bb028c2e2fa..7207fcf9e75f 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -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>
diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index 0b124526165d..710e9785d348 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -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;
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 07/31] build,include: rework compat-build-source.py
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (5 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 06/31] x86/mm: avoid building multiple .o from a single .c file Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 14:58   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 08/31] build,include: rework compat-build-header.py Anthony PERARD
                   ` (23 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Jan Beulich, Andrew Cooper, George Dunlap,
	Ian Jackson, Julien Grall, Stefano Stabellini, Wei Liu

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.

Also remove dependency on Makefile as the file generation doesn't
depend on it anymore.

No changes in final compat/%.h headers.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
---

Notes:
    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             | 5 ++---
 xen/tools/compat-build-source.py | 8 +++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/include/Makefile b/xen/include/Makefile
index c8ca97eed0fc..be3b81485bdc 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -59,10 +59,9 @@ compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-build-header.py
 compat/%.i: compat/%.c 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
+compat/%.c: public/%.h xlat.lst $(BASEDIR)/tools/compat-build-source.py
 	mkdir -p $(@D)
-	grep -v 'DEFINE_XEN_GUEST_HANDLE(long)' $< | \
-	$(PYTHON) $(BASEDIR)/tools/compat-build-source.py >$@.new
+	$(PYTHON) $(BASEDIR)/tools/compat-build-source.py xlat.lst <$< >$@.new
 	mv -f $@.new $@
 
 compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst $(BASEDIR)/tools/get-fields.sh Makefile
diff --git a/xen/tools/compat-build-source.py b/xen/tools/compat-build-source.py
index 2bcaf27d05a3..274d6917ab7f 100755
--- a/xen/tools/compat-build-source.py
+++ b/xen/tools/compat-build-source.py
@@ -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())
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 08/31] build,include: rework compat-build-header.py
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (6 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 07/31] build,include: rework compat-build-source.py Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-01 14:09 ` [XEN PATCH v6 09/31] build: clean "lib.a" Anthony PERARD
                   ` (22 subsequent siblings)
  30 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Wei Liu, Andrew Cooper, George Dunlap,
	Ian Jackson, Jan Beulich, Julien Grall, Stefano Stabellini

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

Also remove dependency on Makefile as the file generation doesn't
depend on it anymore.

No change to the final generated headers.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Wei Liu <wl@xen.org>
---

Notes:
    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             | 11 ++------
 xen/tools/compat-build-header.py | 44 ++++++++++++++++++++++++++++++--
 2 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/xen/include/Makefile b/xen/include/Makefile
index be3b81485bdc..9feb57545ef1 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -45,15 +45,8 @@ public-$(CONFIG_ARM) := $(wildcard public/arch-arm/*.h public/arch-arm/*/*.h)
 .PHONY: all
 all: $(headers-y)
 
-compat/%.h: compat/%.i Makefile $(BASEDIR)/tools/compat-build-header.py
-	set -e; id=_$$(echo $@ | tr '[:lower:]-/.' '[:upper:]___'); \
-	echo "#ifndef $$id" >$@.new; \
-	echo "#define $$id" >>$@.new; \
-	echo "#include <xen/compat.h>" >>$@.new; \
-	$(if $(filter-out compat/arch-%.h,$@),echo "#include <$(patsubst compat/%,public/%,$@)>" >>$@.new;) \
-	grep -v '^# [0-9]' $< | \
-	$(PYTHON) $(BASEDIR)/tools/compat-build-header.py | uniq >>$@.new; \
-	echo "#endif /* $$id */" >>$@.new
+compat/%.h: compat/%.i $(BASEDIR)/tools/compat-build-header.py
+	$(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $@ >>$@.new; \
 	mv -f $@.new $@
 
 compat/%.i: compat/%.c Makefile
diff --git a/xen/tools/compat-build-header.py b/xen/tools/compat-build-header.py
index 065d3b1b6ee8..5f5474fba051 100755
--- a/xen/tools/compat-build-header.py
+++ b/xen/tools/compat-build-header.py
@@ -2,6 +2,12 @@
 
 import re,sys
 
+try:
+    maketrans = str.maketrans
+except AttributeError:
+    # For python2
+    from string import maketrans
+
 pats = [
  [ r"__InClUdE__(.*)", r"#include\1" ],
  [ r"__IfDeF__ (XEN_HAVE.*)", r"#ifdef \1" ],
@@ -23,7 +29,41 @@ pats = [
  [ r"(^|[^\w])long([^\w]|$$)", r"\1int\2" ]
 ];
 
+output_filename = sys.argv[1]
+
+# tr '[:lower:]-/.' '[:upper:]___'
+header_id = '_' + \
+    output_filename.upper().translate(maketrans('-/.','___'))
+
+header = """#ifndef {0}
+#define {0}
+#include <xen/compat.h>""".format(header_id)
+
+print(header)
+
+if not re.match("compat/arch-.*.h$", output_filename):
+    x = output_filename.replace("compat/","public/")
+    print('#include <%s>' % x)
+
+last_line_empty = False
 for line in sys.stdin.readlines():
+    line = line.rstrip()
+
+    # Remove linemarkers generated by the preprocessor.
+    if re.match(r"^# \d", line):
+        continue
+
+    # De-duplicate empty lines.
+    if len(line) == 0:
+        if not last_line_empty:
+            print(line)
+            last_line_empty = True
+        continue
+    else:
+        last_line_empty = False
+
     for pat in pats:
-        line = re.subn(pat[0], pat[1], line)[0]
-    print(line.rstrip())
+        line = re.sub(pat[0], pat[1], line)
+    print(line)
+
+print("#endif /* %s */" % header_id)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 09/31] build: clean "lib.a"
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (7 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 08/31] build,include: rework compat-build-header.py Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 15:03   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 10/31] build: use $(kconfig) shortcut in clean rule Anthony PERARD
                   ` (21 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index 360b4a1d1867..e4deceab2c9a 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -343,7 +343,7 @@ _clean: delete-unfresh-files
 	$(MAKE) $(clean) test
 	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) clean
 	find . \( -name "*.o" -o -name ".*.d" -o -name ".*.d2" \
-		-o -name "*.gcno" -o -name ".*.cmd" \) -exec rm -f {} \;
+		-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 .banner
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 10/31] build: use $(kconfig) shortcut in clean rule
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (8 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 09/31] build: clean "lib.a" Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 15:05   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 11/31] build: fix clean targets when subdir-y is used Anthony PERARD
                   ` (20 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index e4deceab2c9a..dae0247067ff 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -341,7 +341,7 @@ _clean: delete-unfresh-files
 	$(MAKE) $(clean) arch/riscv
 	$(MAKE) $(clean) arch/x86
 	$(MAKE) $(clean) test
-	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) clean
+	$(MAKE) $(kconfig) clean
 	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
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 11/31] build: fix clean targets when subdir-y is used
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (9 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 10/31] build: use $(kconfig) shortcut in clean rule Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 15:15   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 12/31] build: use subdir-y in test/Makefile Anthony PERARD
                   ` (19 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

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.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/scripts/Makefile.clean | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/xen/scripts/Makefile.clean b/xen/scripts/Makefile.clean
index 53379e6102cc..027c200c0efc 100644
--- a/xen/scripts/Makefile.clean
+++ b/xen/scripts/Makefile.clean
@@ -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)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 12/31] build: use subdir-y in test/Makefile
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (10 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 11/31] build: fix clean targets when subdir-y is used Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 15:26   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 13/31] build,tools: have default rules depends on symbols Anthony PERARD
                   ` (18 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

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

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/test/Makefile | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/xen/test/Makefile b/xen/test/Makefile
index aaa499664396..41e4d7bdb78b 100644
--- a/xen/test/Makefile
+++ b/xen/test/Makefile
@@ -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
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 13/31] build,tools: have default rules depends on symbols
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (11 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 12/31] build: use subdir-y in test/Makefile Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 15:28   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 14/31] build,arm: move LDFLAGS change to arch.mk Anthony PERARD
                   ` (17 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

No need to call $(MAKE) again.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/tools/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/tools/Makefile b/xen/tools/Makefile
index e940939d61f4..4e42163f981c 100644
--- a/xen/tools/Makefile
+++ b/xen/tools/Makefile
@@ -2,8 +2,7 @@
 include $(XEN_ROOT)/Config.mk
 
 .PHONY: default
-default:
-	$(MAKE) symbols
+default: symbols
 
 .PHONY: clean
 clean:
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 14/31] build,arm: move LDFLAGS change to arch.mk
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (12 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 13/31] build,tools: have default rules depends on symbols Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-01 14:09 ` [XEN PATCH v6 15/31] build: move make option changes check earlier Anthony PERARD
                   ` (16 subsequent siblings)
  30 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Stefano Stabellini, Julien Grall, Volodymyr Babchuk

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/arm/Makefile | 8 --------
 xen/arch/arm/arch.mk  | 8 ++++++++
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 0edd9dee6f49..3d0af8ebc93c 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -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
diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk
index 11caec86ba14..6a2982059486 100644
--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -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
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 15/31] build: move make option changes check earlier
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (13 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 14/31] build,arm: move LDFLAGS change to arch.mk Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 15:40   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 16/31] build: avoid building arm/arm/*/head.o twice Anthony PERARD
                   ` (15 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

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

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Makefile | 22 ++++++++++++++++++++++
 xen/Rules.mk | 22 ----------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index dae0247067ff..06d7bfab3e2c 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -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 '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
+
 # Beautify output
 # ---------------------------------------------------------------------------
 #
diff --git a/xen/Rules.mk b/xen/Rules.mk
index ede408efc515..894f2b83a04e 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -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!
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 16/31] build: avoid building arm/arm/*/head.o twice
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (14 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 15/31] build: move make option changes check earlier Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-01 14:09 ` [XEN PATCH v6 17/31] build: convert binfile use to if_changed Anthony PERARD
                   ` (14 subsequent siblings)
  30 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Stefano Stabellini, Julien Grall, Volodymyr Babchuk

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

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/arm/Makefile       | 7 ++++++-
 xen/arch/arm/arm32/Makefile | 1 +
 xen/arch/arm/arm64/Makefile | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 3d0af8ebc93c..cc90d9796e6e 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -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
diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile
index 96105d238307..3040eabce3ad 100644
--- a/xen/arch/arm/arm32/Makefile
+++ b/xen/arch/arm/arm32/Makefile
@@ -11,3 +11,4 @@ obj-y += smpboot.o
 obj-y += traps.o
 obj-y += vfp.o
 
+extra-y += head.o
diff --git a/xen/arch/arm/arm64/Makefile b/xen/arch/arm/arm64/Makefile
index 40642ff57494..0bb284dedab2 100644
--- a/xen/arch/arm/arm64/Makefile
+++ b/xen/arch/arm/arm64/Makefile
@@ -13,3 +13,5 @@ obj-y += smpboot.o
 obj-y += traps.o
 obj-y += vfp.o
 obj-y += vsysreg.o
+
+extra-y += head.o
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 17/31] build: convert binfile use to if_changed
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (15 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 16/31] build: avoid building arm/arm/*/head.o twice Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-07 15:48   ` Jan Beulich
  2021-07-01 14:09 ` [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm Anthony PERARD
                   ` (13 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Daniel De Graaf, Daniel P. Smith

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

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/common/Makefile    | 8 ++++++--
 xen/xsm/flask/Makefile | 8 ++++++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/xen/common/Makefile b/xen/common/Makefile
index 54de70d42278..93df3178b71f 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -80,8 +80,12 @@ config.gz: $(CONF_FILE)
 
 config_data.o: config.gz
 
-config_data.S: $(BASEDIR)/tools/binfile
-	$(SHELL) $(BASEDIR)/tools/binfile $@ config.gz xen_config_data
+quiet_cmd_binfile = BINFILE $@
+cmd_binfile = $(SHELL) $< $@ config.gz xen_config_data
+
+config_data.S: $(BASEDIR)/tools/binfile FORCE
+	$(call if_changed,binfile)
+targets += config_data.S
 
 clean::
 	rm -f config_data.S config.gz 2>/dev/null
diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index 637159ad8276..0ad15cb16606 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -35,8 +35,12 @@ $(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
+quiet_cmd_binfile = BINFILE $@
+cmd_binfile = $(SHELL) $< -i $@ policy.bin xsm_flask_init_policy
+
+flask-policy.S: $(BASEDIR)/tools/binfile FORCE
+	$(call if_changed,binfile)
+targets += flask-policy.S
 
 FLASK_BUILD_DIR := $(CURDIR)
 POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (16 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 17/31] build: convert binfile use to if_changed Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-07-01 17:24   ` Paul Durrant
                     ` (2 more replies)
  2021-07-01 14:09 ` [XEN PATCH v6 19/31] build: rework .banner generation Anthony PERARD
                   ` (12 subsequent siblings)
  30 siblings, 3 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Tamas K Lengyel, Alexandru Isaila, Petre Pircalabu,
	Volodymyr Babchuk, Roger Pau Monné,
	Konrad Rzeszutek Wilk, Ross Lagerwall, Paul Durrant,
	Jun Nakajima, Kevin Tian, Lukasz Hawrylko, Bob Eshleman,
	Alistair Francis, Connor Davis

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

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

Other possible locations that I could think of:
include/arch/*/asm
arch/*/include/asm
---
 .gitignore                                    |  5 ++-
 MAINTAINERS                                   | 36 +++++++++----------
 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 +-
 xen/arch/arm/smpboot.c                        |  2 +-
 xen/arch/arm/vpsci.c                          |  2 +-
 xen/arch/x86/Makefile                         |  6 ++--
 xen/arch/x86/arch.mk                          |  5 +--
 xen/common/efi/runtime.c                      | 14 ++++----
 xen/common/page_alloc.c                       |  2 +-
 xen/include/{asm-arm => arch-arm/asm}/acpi.h  |  0
 .../{asm-arm => arch-arm/asm}/alternative.h   |  0
 .../{asm-arm => arch-arm/asm}/altp2m.h        |  0
 .../{asm-arm => arch-arm/asm}/arm32/atomic.h  |  0
 .../{asm-arm => arch-arm/asm}/arm32/bitops.h  |  0
 .../{asm-arm => arch-arm/asm}/arm32/bug.h     |  0
 .../{asm-arm => arch-arm/asm}/arm32/cmpxchg.h |  0
 .../asm}/arm32/flushtlb.h                     |  0
 .../{asm-arm => arch-arm/asm}/arm32/insn.h    |  0
 .../{asm-arm => arch-arm/asm}/arm32/io.h      |  0
 .../{asm-arm => arch-arm/asm}/arm32/macros.h  |  0
 .../{asm-arm => arch-arm/asm}/arm32/mm.h      |  0
 .../{asm-arm => arch-arm/asm}/arm32/page.h    |  0
 .../asm}/arm32/processor.h                    |  0
 .../{asm-arm => arch-arm/asm}/arm32/sysregs.h |  0
 .../{asm-arm => arch-arm/asm}/arm32/system.h  |  0
 .../{asm-arm => arch-arm/asm}/arm32/traps.h   |  0
 .../{asm-arm => arch-arm/asm}/arm32/vfp.h     |  0
 .../{asm-arm => arch-arm/asm}/arm64/atomic.h  |  0
 .../{asm-arm => arch-arm/asm}/arm64/bitops.h  |  0
 .../{asm-arm => arch-arm/asm}/arm64/brk.h     |  0
 .../{asm-arm => arch-arm/asm}/arm64/bug.h     |  0
 .../{asm-arm => arch-arm/asm}/arm64/cmpxchg.h |  0
 .../{asm-arm => arch-arm/asm}/arm64/efibind.h |  0
 .../asm}/arm64/flushtlb.h                     |  0
 .../{asm-arm => arch-arm/asm}/arm64/hsr.h     |  0
 .../{asm-arm => arch-arm/asm}/arm64/insn.h    |  0
 .../{asm-arm => arch-arm/asm}/arm64/io.h      |  0
 .../{asm-arm => arch-arm/asm}/arm64/macros.h  |  0
 .../{asm-arm => arch-arm/asm}/arm64/mm.h      |  0
 .../{asm-arm => arch-arm/asm}/arm64/page.h    |  0
 .../asm}/arm64/processor.h                    |  0
 .../{asm-arm => arch-arm/asm}/arm64/sysregs.h |  0
 .../{asm-arm => arch-arm/asm}/arm64/system.h  |  0
 .../{asm-arm => arch-arm/asm}/arm64/traps.h   |  0
 .../{asm-arm => arch-arm/asm}/arm64/vfp.h     |  0
 .../{asm-arm => arch-arm/asm}/asm_defns.h     |  0
 .../{asm-arm => arch-arm/asm}/atomic.h        |  0
 .../{asm-arm => arch-arm/asm}/bitops.h        |  0
 xen/include/{asm-arm => arch-arm/asm}/bug.h   |  0
 .../{asm-arm => arch-arm/asm}/byteorder.h     |  0
 xen/include/{asm-arm => arch-arm/asm}/cache.h |  0
 .../{asm-arm => arch-arm/asm}/cadence-uart.h  |  0
 .../{asm-arm => arch-arm/asm}/config.h        |  0
 .../{asm-arm => arch-arm/asm}/cpregs.h        |  0
 .../{asm-arm => arch-arm/asm}/cpuerrata.h     |  0
 .../{asm-arm => arch-arm/asm}/cpufeature.h    |  0
 .../{asm-arm => arch-arm/asm}/current.h       |  0
 .../{asm-arm => arch-arm/asm}/debugger.h      |  0
 xen/include/{asm-arm => arch-arm/asm}/delay.h |  0
 xen/include/{asm-arm => arch-arm/asm}/desc.h  |  0
 .../{asm-arm => arch-arm/asm}/device.h        |  0
 xen/include/{asm-arm => arch-arm/asm}/div64.h |  0
 .../{asm-arm => arch-arm/asm}/domain.h        |  0
 .../{asm-arm => arch-arm/asm}/domain_build.h  |  0
 .../{asm-arm => arch-arm/asm}/early_printk.h  |  0
 .../{asm-arm => arch-arm/asm}/efibind.h       |  0
 xen/include/{asm-arm => arch-arm/asm}/elf.h   |  0
 xen/include/{asm-arm => arch-arm/asm}/event.h |  0
 .../asm}/exynos4210-uart.h                    |  0
 .../{asm-arm => arch-arm/asm}/flushtlb.h      |  0
 xen/include/{asm-arm => arch-arm/asm}/gic.h   |  0
 .../{asm-arm => arch-arm/asm}/gic_v3_defs.h   |  0
 .../{asm-arm => arch-arm/asm}/gic_v3_its.h    |  0
 .../{asm-arm => arch-arm/asm}/grant_table.h   |  0
 .../{asm-arm => arch-arm/asm}/guest_access.h  |  0
 .../{asm-arm => arch-arm/asm}/guest_atomics.h |  0
 .../{asm-arm => arch-arm/asm}/guest_walk.h    |  0
 .../{asm-arm => arch-arm/asm}/hardirq.h       |  0
 xen/include/{asm-arm => arch-arm/asm}/hsr.h   |  0
 .../{asm-arm => arch-arm/asm}/hypercall.h     |  0
 xen/include/{asm-arm => arch-arm/asm}/init.h  |  0
 xen/include/{asm-arm => arch-arm/asm}/insn.h  |  0
 xen/include/{asm-arm => arch-arm/asm}/io.h    |  0
 xen/include/{asm-arm => arch-arm/asm}/iocap.h |  0
 xen/include/{asm-arm => arch-arm/asm}/iommu.h |  0
 .../{asm-arm => arch-arm/asm}/iommu_fwspec.h  |  0
 xen/include/{asm-arm => arch-arm/asm}/ioreq.h |  0
 xen/include/{asm-arm => arch-arm/asm}/irq.h   |  0
 .../{asm-arm => arch-arm/asm}/kernel.h        |  0
 .../{asm-arm => arch-arm/asm}/livepatch.h     |  0
 xen/include/{asm-arm => arch-arm/asm}/lpae.h  |  0
 .../{asm-arm => arch-arm/asm}/macros.h        |  0
 .../{asm-arm => arch-arm/asm}/mem_access.h    |  0
 xen/include/{asm-arm => arch-arm/asm}/mm.h    |  0
 xen/include/{asm-arm => arch-arm/asm}/mmio.h  |  0
 .../{asm-arm => arch-arm/asm}/monitor.h       |  0
 .../{asm-arm => arch-arm/asm}/new_vgic.h      |  0
 .../{asm-arm => arch-arm/asm}/nospec.h        |  0
 xen/include/{asm-arm => arch-arm/asm}/numa.h  |  0
 xen/include/{asm-arm => arch-arm/asm}/p2m.h   |  0
 .../{asm-arm => arch-arm/asm}/page-bits.h     |  0
 xen/include/{asm-arm => arch-arm/asm}/page.h  |  0
 .../{asm-arm => arch-arm/asm}/paging.h        |  0
 xen/include/{asm-arm => arch-arm/asm}/pci.h   |  0
 .../{asm-arm => arch-arm/asm}/percpu.h        |  0
 xen/include/{asm-arm => arch-arm/asm}/perfc.h |  0
 .../{asm-arm => arch-arm/asm}/perfc_defn.h    |  0
 .../{asm-arm => arch-arm/asm}/pl011-uart.h    |  0
 .../{asm-arm => arch-arm/asm}/platform.h      |  0
 .../asm}/platforms/exynos5.h                  |  0
 .../asm}/platforms/midway.h                   |  0
 .../asm}/platforms/omap5.h                    |  0
 .../asm}/platforms/vexpress.h                 |  0
 .../asm}/platforms/xilinx-zynqmp-eemi.h       |  0
 .../{asm-arm => arch-arm/asm}/processor.h     |  0
 .../{asm-arm => arch-arm/asm}/procinfo.h      |  0
 xen/include/{asm-arm => arch-arm/asm}/psci.h  |  0
 .../{asm-arm => arch-arm/asm}/random.h        |  0
 xen/include/{asm-arm => arch-arm/asm}/regs.h  |  0
 .../{asm-arm => arch-arm/asm}/scif-uart.h     |  0
 xen/include/{asm-arm => arch-arm/asm}/setup.h |  0
 .../{asm-arm => arch-arm/asm}/short-desc.h    |  0
 xen/include/{asm-arm => arch-arm/asm}/smccc.h |  0
 xen/include/{asm-arm => arch-arm/asm}/smp.h   |  0
 .../{asm-arm => arch-arm/asm}/softirq.h       |  0
 .../{asm-arm => arch-arm/asm}/spinlock.h      |  0
 .../{asm-arm => arch-arm/asm}/string.h        |  0
 .../{asm-arm => arch-arm/asm}/sysregs.h       |  0
 .../{asm-arm => arch-arm/asm}/system.h        |  0
 .../{asm-arm => arch-arm/asm}/tee/optee_msg.h |  0
 .../asm}/tee/optee_rpc_cmd.h                  |  0
 .../{asm-arm => arch-arm/asm}/tee/optee_smc.h |  0
 .../{asm-arm => arch-arm/asm}/tee/tee.h       |  0
 xen/include/{asm-arm => arch-arm/asm}/time.h  |  0
 xen/include/{asm-arm => arch-arm/asm}/trace.h |  0
 xen/include/{asm-arm => arch-arm/asm}/traps.h |  0
 xen/include/{asm-arm => arch-arm/asm}/types.h |  0
 xen/include/{asm-arm => arch-arm/asm}/vfp.h   |  0
 .../{asm-arm => arch-arm/asm}/vgic-emul.h     |  0
 xen/include/{asm-arm => arch-arm/asm}/vgic.h  |  0
 .../{asm-arm => arch-arm/asm}/vm_event.h      |  0
 .../{asm-arm => arch-arm/asm}/vpl011.h        |  0
 xen/include/{asm-arm => arch-arm/asm}/vpsci.h |  0
 xen/include/{asm-arm => arch-arm/asm}/vreg.h  |  0
 .../{asm-arm => arch-arm/asm}/vtimer.h        |  0
 .../{asm-arm => arch-arm/asm}/xenoprof.h      |  0
 .../{asm-riscv => arch-riscv/asm}/config.h    |  0
 xen/include/{asm-x86 => arch-x86/asm}/acpi.h  |  0
 .../asm}/alternative-asm.h                    |  0
 .../{asm-x86 => arch-x86/asm}/alternative.h   |  0
 .../{asm-x86 => arch-x86/asm}/altp2m.h        |  0
 xen/include/{asm-x86 => arch-x86/asm}/amd.h   |  0
 xen/include/{asm-x86 => arch-x86/asm}/apic.h  |  0
 .../{asm-x86 => arch-x86/asm}/apicdef.h       |  0
 .../{asm-x86 => arch-x86/asm}/asm-defns.h     |  0
 .../{asm-x86 => arch-x86/asm}/asm_defns.h     |  0
 .../{asm-x86 => arch-x86/asm}/atomic.h        |  0
 .../{asm-x86 => arch-x86/asm}/bitops.h        |  0
 xen/include/{asm-x86 => arch-x86/asm}/bug.h   |  0
 .../{asm-x86 => arch-x86/asm}/byteorder.h     |  0
 .../{asm-x86 => arch-x86/asm}/bzimage.h       |  0
 xen/include/{asm-x86 => arch-x86/asm}/cache.h |  0
 .../{asm-x86 => arch-x86/asm}/compat.h        |  0
 .../{asm-x86 => arch-x86/asm}/config.h        |  0
 .../{asm-x86 => arch-x86/asm}/cpufeature.h    |  0
 .../{asm-x86 => arch-x86/asm}/cpufeatures.h   |  0
 .../{asm-x86 => arch-x86/asm}/cpufeatureset.h |  0
 xen/include/{asm-x86 => arch-x86/asm}/cpuid.h |  0
 .../{asm-x86 => arch-x86/asm}/cpuidle.h       |  0
 .../{asm-x86 => arch-x86/asm}/current.h       |  2 +-
 .../{asm-x86 => arch-x86/asm}/debugger.h      |  0
 .../{asm-x86 => arch-x86/asm}/debugreg.h      |  0
 xen/include/{asm-x86 => arch-x86/asm}/delay.h |  0
 xen/include/{asm-x86 => arch-x86/asm}/desc.h  |  0
 .../{asm-x86 => arch-x86/asm}/device.h        |  0
 xen/include/{asm-x86 => arch-x86/asm}/div64.h |  0
 .../{asm-x86 => arch-x86/asm}/dom0_build.h    |  0
 .../{asm-x86 => arch-x86/asm}/domain.h        |  2 +-
 xen/include/{asm-x86 => arch-x86/asm}/e820.h  |  0
 xen/include/{asm-x86 => arch-x86/asm}/edd.h   |  0
 .../{asm-x86 => arch-x86/asm}/efibind.h       |  0
 xen/include/{asm-x86 => arch-x86/asm}/elf.h   |  0
 xen/include/{asm-x86 => arch-x86/asm}/event.h |  0
 .../{asm-x86 => arch-x86/asm}/fixmap.h        |  0
 .../{asm-x86 => arch-x86/asm}/flushtlb.h      |  0
 .../{asm-x86 => arch-x86/asm}/genapic.h       |  0
 .../{asm-x86 => arch-x86/asm}/grant_table.h   |  0
 xen/include/{asm-x86 => arch-x86/asm}/guest.h |  0
 .../asm}/guest/hyperv-hcall.h                 |  0
 .../asm}/guest/hyperv-tlfs.h                  |  0
 .../{asm-x86 => arch-x86/asm}/guest/hyperv.h  |  0
 .../asm}/guest/hypervisor.h                   |  0
 .../asm}/guest/pvh-boot.h                     |  0
 .../asm}/guest/xen-hcall.h                    |  0
 .../{asm-x86 => arch-x86/asm}/guest/xen.h     |  0
 .../{asm-x86 => arch-x86/asm}/guest_access.h  |  0
 .../{asm-x86 => arch-x86/asm}/guest_atomics.h |  0
 .../{asm-x86 => arch-x86/asm}/guest_pt.h      |  0
 xen/include/{asm-x86 => arch-x86/asm}/hap.h   |  0
 .../{asm-x86 => arch-x86/asm}/hardirq.h       |  0
 xen/include/{asm-x86 => arch-x86/asm}/hpet.h  |  0
 .../{asm-x86 => arch-x86/asm}/hvm/asid.h      |  0
 .../{asm-x86 => arch-x86/asm}/hvm/cacheattr.h |  0
 .../{asm-x86 => arch-x86/asm}/hvm/domain.h    |  0
 .../{asm-x86 => arch-x86/asm}/hvm/emulate.h   |  0
 .../asm}/hvm/grant_table.h                    |  0
 .../asm}/hvm/guest_access.h                   |  0
 .../{asm-x86 => arch-x86/asm}/hvm/hvm.h       |  0
 .../{asm-x86 => arch-x86/asm}/hvm/io.h        |  0
 .../{asm-x86 => arch-x86/asm}/hvm/ioreq.h     |  0
 .../{asm-x86 => arch-x86/asm}/hvm/irq.h       |  0
 .../{asm-x86 => arch-x86/asm}/hvm/monitor.h   |  0
 .../{asm-x86 => arch-x86/asm}/hvm/nestedhvm.h |  0
 .../{asm-x86 => arch-x86/asm}/hvm/save.h      |  0
 .../{asm-x86 => arch-x86/asm}/hvm/support.h   |  0
 .../{asm-x86 => arch-x86/asm}/hvm/svm/asid.h  |  0
 .../asm}/hvm/svm/emulate.h                    |  0
 .../{asm-x86 => arch-x86/asm}/hvm/svm/intr.h  |  0
 .../asm}/hvm/svm/nestedsvm.h                  |  0
 .../{asm-x86 => arch-x86/asm}/hvm/svm/svm.h   |  0
 .../asm}/hvm/svm/svmdebug.h                   |  0
 .../{asm-x86 => arch-x86/asm}/hvm/svm/vmcb.h  |  0
 .../{asm-x86 => arch-x86/asm}/hvm/trace.h     |  0
 .../{asm-x86 => arch-x86/asm}/hvm/vcpu.h      |  0
 .../{asm-x86 => arch-x86/asm}/hvm/vioapic.h   |  0
 .../{asm-x86 => arch-x86/asm}/hvm/viridian.h  |  0
 .../{asm-x86 => arch-x86/asm}/hvm/vlapic.h    |  0
 .../{asm-x86 => arch-x86/asm}/hvm/vm_event.h  |  0
 .../{asm-x86 => arch-x86/asm}/hvm/vmx/vmcs.h  |  0
 .../{asm-x86 => arch-x86/asm}/hvm/vmx/vmx.h   |  0
 .../{asm-x86 => arch-x86/asm}/hvm/vmx/vvmx.h  |  0
 .../{asm-x86 => arch-x86/asm}/hvm/vpic.h      |  0
 .../{asm-x86 => arch-x86/asm}/hvm/vpt.h       |  0
 .../{asm-x86 => arch-x86/asm}/hypercall.h     |  0
 xen/include/{asm-x86 => arch-x86/asm}/i387.h  |  0
 xen/include/{asm-x86 => arch-x86/asm}/init.h  |  0
 .../{asm-x86 => arch-x86/asm}/invpcid.h       |  0
 xen/include/{asm-x86 => arch-x86/asm}/io.h    |  0
 .../{asm-x86 => arch-x86/asm}/io_apic.h       |  0
 xen/include/{asm-x86 => arch-x86/asm}/iocap.h |  0
 xen/include/{asm-x86 => arch-x86/asm}/iommu.h |  0
 xen/include/{asm-x86 => arch-x86/asm}/ioreq.h |  0
 xen/include/{asm-x86 => arch-x86/asm}/irq.h   |  0
 xen/include/{asm-x86 => arch-x86/asm}/ldt.h   |  0
 .../{asm-x86 => arch-x86/asm}/livepatch.h     |  0
 .../asm}/mach-default/bios_ebda.h             |  0
 .../asm}/mach-default/io_ports.h              |  0
 .../asm}/mach-default/irq_vectors.h           |  0
 .../asm}/mach-default/mach_mpparse.h          |  0
 .../asm}/mach-default/mach_mpspec.h           |  0
 .../asm}/mach-generic/mach_apic.h             |  0
 .../asm}/mach-generic/mach_mpparse.h          |  0
 .../{asm-x86 => arch-x86/asm}/machine_kexec.h |  0
 .../{asm-x86 => arch-x86/asm}/mc146818rtc.h   |  0
 xen/include/{asm-x86 => arch-x86/asm}/mce.h   |  0
 .../{asm-x86 => arch-x86/asm}/mem_access.h    |  0
 .../{asm-x86 => arch-x86/asm}/mem_paging.h    |  0
 .../{asm-x86 => arch-x86/asm}/mem_sharing.h   |  0
 .../{asm-x86 => arch-x86/asm}/microcode.h     |  0
 xen/include/{asm-x86 => arch-x86/asm}/mm.h    |  0
 .../{asm-x86 => arch-x86/asm}/monitor.h       |  0
 .../{asm-x86 => arch-x86/asm}/mpspec.h        |  0
 .../{asm-x86 => arch-x86/asm}/mpspec_def.h    |  0
 xen/include/{asm-x86 => arch-x86/asm}/msi.h   |  0
 .../{asm-x86 => arch-x86/asm}/msr-index.h     |  0
 xen/include/{asm-x86 => arch-x86/asm}/msr.h   |  0
 xen/include/{asm-x86 => arch-x86/asm}/mtrr.h  |  0
 .../{asm-x86 => arch-x86/asm}/multicall.h     |  0
 xen/include/{asm-x86 => arch-x86/asm}/mwait.h |  0
 xen/include/{asm-x86 => arch-x86/asm}/nmi.h   |  0
 xen/include/{asm-x86 => arch-x86/asm}/nops.h  |  0
 .../{asm-x86 => arch-x86/asm}/nospec.h        |  0
 xen/include/{asm-x86 => arch-x86/asm}/numa.h  |  0
 xen/include/{asm-x86 => arch-x86/asm}/p2m.h   |  0
 .../{asm-x86 => arch-x86/asm}/page-bits.h     |  0
 xen/include/{asm-x86 => arch-x86/asm}/page.h  |  0
 .../{asm-x86 => arch-x86/asm}/paging.h        |  0
 xen/include/{asm-x86 => arch-x86/asm}/pci.h   |  0
 .../{asm-x86 => arch-x86/asm}/percpu.h        |  0
 xen/include/{asm-x86 => arch-x86/asm}/perfc.h |  0
 .../{asm-x86 => arch-x86/asm}/perfc_defn.h    |  0
 .../{asm-x86 => arch-x86/asm}/processor.h     |  0
 xen/include/{asm-x86 => arch-x86/asm}/psr.h   |  0
 .../{asm-x86 => arch-x86/asm}/pv/domain.h     |  0
 .../asm}/pv/grant_table.h                     |  0
 xen/include/{asm-x86 => arch-x86/asm}/pv/mm.h |  0
 .../{asm-x86 => arch-x86/asm}/pv/shim.h       |  0
 .../{asm-x86 => arch-x86/asm}/pv/traps.h      |  0
 .../{asm-x86 => arch-x86/asm}/random.h        |  0
 xen/include/{asm-x86 => arch-x86/asm}/regs.h  |  0
 xen/include/{asm-x86 => arch-x86/asm}/setup.h |  0
 .../{asm-x86 => arch-x86/asm}/shadow.h        |  0
 .../{asm-x86 => arch-x86/asm}/shared.h        |  0
 xen/include/{asm-x86 => arch-x86/asm}/smp.h   |  0
 .../{asm-x86 => arch-x86/asm}/softirq.h       |  0
 .../{asm-x86 => arch-x86/asm}/spec_ctrl.h     |  0
 .../{asm-x86 => arch-x86/asm}/spec_ctrl_asm.h |  0
 .../{asm-x86 => arch-x86/asm}/spinlock.h      |  0
 .../{asm-x86 => arch-x86/asm}/string.h        |  0
 .../{asm-x86 => arch-x86/asm}/system.h        |  0
 xen/include/{asm-x86 => arch-x86/asm}/tboot.h |  0
 xen/include/{asm-x86 => arch-x86/asm}/time.h  |  0
 xen/include/{asm-x86 => arch-x86/asm}/trace.h |  0
 xen/include/{asm-x86 => arch-x86/asm}/traps.h |  0
 xen/include/{asm-x86 => arch-x86/asm}/types.h |  0
 .../{asm-x86 => arch-x86/asm}/uaccess.h       |  0
 .../{asm-x86 => arch-x86/asm}/unaligned.h     |  0
 .../{asm-x86 => arch-x86/asm}/vm_event.h      |  0
 xen/include/{asm-x86 => arch-x86/asm}/vpmu.h  |  0
 .../{asm-x86 => arch-x86/asm}/x86-defns.h     |  0
 .../{asm-x86 => arch-x86/asm}/x86-vendors.h   |  0
 .../asm}/x86_64/efibind.h                     |  0
 .../{asm-x86 => arch-x86/asm}/x86_64/elf.h    |  0
 .../{asm-x86 => arch-x86/asm}/x86_64/page.h   |  0
 .../{asm-x86 => arch-x86/asm}/x86_64/regs.h   |  0
 .../{asm-x86 => arch-x86/asm}/x86_64/system.h |  0
 .../asm}/x86_64/uaccess.h                     |  0
 .../{asm-x86 => arch-x86/asm}/x86_emulate.h   |  0
 .../{asm-x86 => arch-x86/asm}/xenoprof.h      |  0
 .../{asm-x86 => arch-x86/asm}/xstate.h        |  0
 xen/include/xen/acpi.h                        |  4 +--
 xen/include/xen/bitmap.h                      |  2 +-
 329 files changed, 59 insertions(+), 59 deletions(-)
 rename xen/include/{asm-arm => arch-arm/asm}/acpi.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/alternative.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/altp2m.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/atomic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/bitops.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/bug.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/cmpxchg.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/flushtlb.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/insn.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/io.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/macros.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/mm.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/page.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/processor.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/sysregs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/system.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/traps.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm32/vfp.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/atomic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/bitops.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/brk.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/bug.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/cmpxchg.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/efibind.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/flushtlb.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/hsr.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/insn.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/io.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/macros.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/mm.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/page.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/processor.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/sysregs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/system.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/traps.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/arm64/vfp.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/asm_defns.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/atomic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/bitops.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/bug.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/byteorder.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/cache.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/cadence-uart.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/config.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/cpregs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/cpuerrata.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/cpufeature.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/current.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/debugger.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/delay.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/desc.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/device.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/div64.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/domain.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/domain_build.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/early_printk.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/efibind.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/elf.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/event.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/exynos4210-uart.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/flushtlb.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/gic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/gic_v3_defs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/gic_v3_its.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/grant_table.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/guest_access.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/guest_atomics.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/guest_walk.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/hardirq.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/hsr.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/hypercall.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/init.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/insn.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/io.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/iocap.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/iommu.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/iommu_fwspec.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/ioreq.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/irq.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/kernel.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/livepatch.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/lpae.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/macros.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/mem_access.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/mm.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/mmio.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/monitor.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/new_vgic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/nospec.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/numa.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/p2m.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/page-bits.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/page.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/paging.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/pci.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/percpu.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/perfc.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/perfc_defn.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/pl011-uart.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platform.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platforms/exynos5.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platforms/midway.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platforms/omap5.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platforms/vexpress.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/platforms/xilinx-zynqmp-eemi.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/processor.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/procinfo.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/psci.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/random.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/regs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/scif-uart.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/setup.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/short-desc.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/smccc.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/smp.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/softirq.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/spinlock.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/string.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/sysregs.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/system.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/tee/optee_msg.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/tee/optee_rpc_cmd.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/tee/optee_smc.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/tee/tee.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/time.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/trace.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/traps.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/types.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vfp.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vgic-emul.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vgic.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vm_event.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vpl011.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vpsci.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vreg.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/vtimer.h (100%)
 rename xen/include/{asm-arm => arch-arm/asm}/xenoprof.h (100%)
 rename xen/include/{asm-riscv => arch-riscv/asm}/config.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/acpi.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/alternative-asm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/alternative.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/altp2m.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/amd.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/apic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/apicdef.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/asm-defns.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/asm_defns.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/atomic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/bitops.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/bug.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/byteorder.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/bzimage.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cache.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/compat.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/config.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cpufeature.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cpufeatures.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cpufeatureset.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cpuid.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/cpuidle.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/current.h (99%)
 rename xen/include/{asm-x86 => arch-x86/asm}/debugger.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/debugreg.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/delay.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/desc.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/device.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/div64.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/dom0_build.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/domain.h (99%)
 rename xen/include/{asm-x86 => arch-x86/asm}/e820.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/edd.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/efibind.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/elf.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/event.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/fixmap.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/flushtlb.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/genapic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/grant_table.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/hyperv-hcall.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/hyperv-tlfs.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/hyperv.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/hypervisor.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/pvh-boot.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/xen-hcall.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest/xen.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest_access.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest_atomics.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/guest_pt.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hap.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hardirq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hpet.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/asid.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/cacheattr.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/domain.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/emulate.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/grant_table.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/guest_access.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/hvm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/io.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/ioreq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/irq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/monitor.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/nestedhvm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/save.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/support.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/asid.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/emulate.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/intr.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/nestedsvm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/svm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/svmdebug.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/svm/vmcb.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/trace.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vcpu.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vioapic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/viridian.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vlapic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vm_event.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vmx/vmcs.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vmx/vmx.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vmx/vvmx.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vpic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hvm/vpt.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/hypercall.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/i387.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/init.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/invpcid.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/io.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/io_apic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/iocap.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/iommu.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/ioreq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/irq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/ldt.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/livepatch.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-default/bios_ebda.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-default/io_ports.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-default/irq_vectors.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-default/mach_mpparse.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-default/mach_mpspec.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-generic/mach_apic.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mach-generic/mach_mpparse.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/machine_kexec.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mc146818rtc.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mce.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mem_access.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mem_paging.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mem_sharing.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/microcode.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/monitor.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mpspec.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mpspec_def.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/msi.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/msr-index.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/msr.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mtrr.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/multicall.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/mwait.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/nmi.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/nops.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/nospec.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/numa.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/p2m.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/page-bits.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/page.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/paging.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pci.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/percpu.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/perfc.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/perfc_defn.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/processor.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/psr.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pv/domain.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pv/grant_table.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pv/mm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pv/shim.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/pv/traps.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/random.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/regs.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/setup.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/shadow.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/shared.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/smp.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/softirq.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/spec_ctrl.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/spec_ctrl_asm.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/spinlock.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/string.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/system.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/tboot.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/time.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/trace.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/traps.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/types.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/uaccess.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/unaligned.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/vm_event.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/vpmu.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86-defns.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86-vendors.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/efibind.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/elf.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/page.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/regs.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/system.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_64/uaccess.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/x86_emulate.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/xenoprof.h (100%)
 rename xen/include/{asm-x86 => arch-x86/asm}/xstate.h (100%)

diff --git a/.gitignore b/.gitignore
index 38a085e398e3..91ae22ae9216 100644
--- a/.gitignore
+++ b/.gitignore
@@ -328,9 +328,8 @@ 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/arch-*/asm/asm-offsets.h
+xen/include/arch-x86/asm/asm-macros.h
 xen/include/compat/*
 xen/include/config/
 xen/include/generated/
diff --git a/MAINTAINERS b/MAINTAINERS
index 8a52a03969fe..03a5553116a8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -245,7 +245,7 @@ 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/arch-arm/
 F:	xen/include/public/arch-arm/
 F:	xen/include/public/arch-arm.h
 
@@ -293,8 +293,8 @@ S:	Supported
 F:	xen/arch/x86/efi/
 F:	xen/common/efi/
 F:	xen/include/efi/
-F:	xen/include/asm-x86/efi*.h
-F:	xen/include/asm-x86/x86_*/efi*.h
+F:	xen/include/arch-x86/asm/efi*.h
+F:	xen/include/arch-x86/asm/x86_*/efi*.h
 
 GDBSX DEBUGGER
 M:	Elena Ufimtseva <elena.ufimtseva@oracle.com>
@@ -321,7 +321,7 @@ INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT)
 R:	Lukasz Hawrylko <lukasz.hawrylko@linux.intel.com>
 S:	Odd Fixes
 F:	xen/arch/x86/tboot.c
-F:	xen/include/asm-x86/tboot.h
+F:	xen/include/arch-x86/asm/tboot.h
 
 INTEL(R) VT FOR DIRECTED I/O (VT-D)
 M:	Kevin Tian <kevin.tian@intel.com>
@@ -334,7 +334,7 @@ M:	Kevin Tian <kevin.tian@intel.com>
 S:	Supported
 F:	xen/arch/x86/hvm/vmx/
 F:	xen/arch/x86/mm/p2m-ept.c
-F:	xen/include/asm-x86/hvm/vmx/
+F:	xen/include/arch-x86/asm/hvm/vmx/
 F:	xen/arch/x86/cpu/vpmu_intel.c
 
 IOMMU VENDOR INDEPENDENT CODE
@@ -399,7 +399,7 @@ F:	tools/misc/xen-livepatch.c
 F:	xen/arch/*/livepatch*
 F:	xen/arch/*/*/livepatch*
 F:	xen/common/livepatch*
-F:	xen/include/asm-*/livepatch.h
+F:	xen/include/arch-*/asm/livepatch.h
 F:	xen/include/xen/livepatch*
 F:	xen/test/livepatch/*
 
@@ -500,7 +500,7 @@ TEE MEDIATORS
 M:	Volodymyr Babchuk <volodymyr_babchuk@epam.com>
 S:	Supported
 F:	xen/arch/arm/tee/
-F:	xen/include/asm-arm/tee
+F:	xen/include/arch-arm/asm/tee
 
 TOOLSTACK
 M:	Ian Jackson <iwj@xenproject.org>
@@ -537,8 +537,8 @@ 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
+F:	xen/include/arch-x86/asm/hvm/monitor.h
+F:	xen/include/arch-x86/asm/hvm/vm_event.h
 
 VPCI
 M:	Roger Pau Monné <roger.pau@citrix.com>
@@ -564,7 +564,7 @@ R:	Wei Liu <wl@xen.org>
 S:	Supported
 L:	xen-devel@lists.xenproject.org
 F:	xen/arch/x86/
-F:	xen/include/asm-x86/
+F:	xen/include/arch-x86/
 F:	xen/include/public/arch-x86/
 F:	xen/include/xen/lib/x86
 F:	xen/lib/x86
@@ -584,10 +584,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/include/arch-x86/asm/hvm/emulate.h
+F:	xen/include/arch-x86/asm/hvm/io.h
+F:	xen/include/arch-x86/asm/hvm/ioreq.h
+F:	xen/include/arch-x86/asm/ioreq.h
 
 X86 MEMORY MANAGEMENT
 M:	Jan Beulich <jbeulich@suse.com>
@@ -619,10 +619,10 @@ M:	Wei Liu <wl@xen.org>
 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/include/arch-x86/asm/guest/hyperv.h
+F:	xen/include/arch-x86/asm/guest/hyperv-hcall.h
+F:	xen/include/arch-x86/asm/guest/hyperv-tlfs.h
+F:	xen/include/arch-x86/asm/hvm/viridian.h
 
 XENSTORE
 M:	Ian Jackson <iwj@xenproject.org>
diff --git a/tools/include/Makefile b/tools/include/Makefile
index 42605d46b937..85b105173741 100644
--- a/tools/include/Makefile
+++ b/tools/include/Makefile
@@ -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/include/arch-x86/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/
diff --git a/tools/misc/xen-access.c b/tools/misc/xen-access.c
index 4bbef0bd2e10..d87325800c5b 100644
--- a/tools/misc/xen-access.c
+++ b/tools/misc/xen-access.c
@@ -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/include/arch-x86/asm/processor.h */
 #define X86_TRAP_DEBUG  1
 #define X86_TRAP_INT3   3
 
-/* From xen/include/asm-x86/x86-defns.h */
+/* From xen/include/arch-x86/asm/x86-defns.h */
 #define X86_CR4_PGE        0x00000080 /* enable global pages */
 
 typedef struct vm_event {
diff --git a/tools/tests/vhpet/Makefile b/tools/tests/vhpet/Makefile
index cb88dd01c5f8..72f08dea22d8 100644
--- a/tools/tests/vhpet/Makefile
+++ b/tools/tests/vhpet/Makefile
@@ -32,7 +32,7 @@ distclean: clean
 .PHONY: install
 install:
 
-hpet.h: $(XEN_ROOT)/xen/include/asm-x86/hpet.h
+hpet.h: $(XEN_ROOT)/xen/include/arch-x86/asm/hpet.h
 	cp $< $@
 
 hpet.c: $(XEN_ROOT)/xen/arch/x86/hvm/hpet.c
diff --git a/xen/Makefile b/xen/Makefile
index 06d7bfab3e2c..7e3e4c42d77b 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -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)/include/arch-x86,".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 include/arch-*/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 include/arch-$(TARGET_ARCH)/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.
@@ -429,7 +428,7 @@ asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
 	$(call move-if-changed,$@.new,$@)
 
-include/asm-$(TARGET_ARCH)/asm-offsets.h: asm-offsets.s
+include/arch-$(TARGET_ARCH)/asm/asm-offsets.h: asm-offsets.s
 	@(set -e; \
 	  echo "/*"; \
 	  echo " * DO NOT MODIFY."; \
@@ -447,8 +446,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 include/arch-$(TARGET_ARCH) -name '*.h' -print; \
+      find include -name 'arch-*' -prune -o -name '*.h' -print; \
       find $(SUBDIRS) -name '*.[chS]' -print )
 endef
 
diff --git a/xen/arch/arm/README.LinuxPrimitives b/xen/arch/arm/README.LinuxPrimitives
index 664a9f89ed27..733cc22c2cd5 100644
--- a/xen/arch/arm/README.LinuxPrimitives
+++ b/xen/arch/arm/README.LinuxPrimitives
@@ -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/include/arch-arm/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/include/arch-arm/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/include/arch-arm/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/include/arch-arm/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/include/arch-arm/asm/arm32/atomic.h
 
 The following functions were taken from Linux:
     atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(),
diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk
index 6a2982059486..f54e602301be 100644
--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -2,6 +2,7 @@
 # arm-specific definitions
 
 CFLAGS += -I$(BASEDIR)/include
+CFLAGS += -I$(BASEDIR)/include/arch-$(TARGET_ARCH)
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index 7178865f48c3..5cd4f19aa199 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -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 arch-arm/asm/arm32/flushtlb.h for the explanation of the sequence. */
         dsb   nshst
         mcr   CP32(r0, TLBIALLH)
         dsb   nsh
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index aa1f88c76498..135fdccabdf0 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -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 arch-arm/asm/arm64/flushtlb.h for the explanation of the sequence. */
         dsb   nshst
         tlbi  alle2
         dsb   nsh
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index a1ee3146efeb..df10c617c8f7 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -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 include/arch-arm/asm/numa.h */
 nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
 
 /* Xen stack for bringing up the first CPU. */
diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c
index c1e250be5967..8b93fd2cd5b7 100644
--- a/xen/arch/arm/vpsci.c
+++ b/xen/arch/arm/vpsci.c
@@ -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 arch-arm/asm/vpsci.h) should be updated when
      * adding/removing a function. SCCC_SMCCC_*_REVISION should be
      * updated once per release.
      */
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 08a4ec1944d3..bb446a1b928d 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -275,11 +275,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)/include/arch-x86/asm/asm-macros.h
 
 asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
-$(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile
+$(BASEDIR)/include/arch-x86/asm/asm-macros.h: asm-macros.i Makefile
 	echo '#if 0' >$@.new
 	echo '.if 0' >>$@.new
 	echo '#endif' >>$@.new
@@ -306,7 +306,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)/include/arch-x86/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
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index ce0c1a0e7fb2..9f5fade39e91 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -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)/include/arch-$(TARGET_ARCH)
+CFLAGS += -I$(BASEDIR)/include/arch-x86/asm/mach-generic
+CFLAGS += -I$(BASEDIR)/include/arch-x86/asm/mach-default
 CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
 
 # Prevent floating-point variables from creeping into Xen.
diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index 375b94229e13..d54bae560487 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -12,13 +12,13 @@ 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,
-  * 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
-  * align the stack to 16 bytes even if putting a 16-byte aligned object
-  * there. Hence we need to force larger than 16-byte alignment, even if we
-  * don't strictly need that.
+  * boundary not evenly divisible by 16 (see arch-x86/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 align the stack to 16 bytes even if putting a 16-byte aligned
+  * object there. Hence we need to force larger than 16-byte alignment,
+  * even if we don't strictly need that.
   */
  unsigned long __aligned(32) cr3;
 #endif
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 958ba0cd9256..5cf9b3011cdb 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -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 arch-arm/asm/numa.h.
  */
 mfn_t first_valid_mfn = INVALID_MFN_INITIALIZER;
 
diff --git a/xen/include/asm-arm/acpi.h b/xen/include/arch-arm/asm/acpi.h
similarity index 100%
rename from xen/include/asm-arm/acpi.h
rename to xen/include/arch-arm/asm/acpi.h
diff --git a/xen/include/asm-arm/alternative.h b/xen/include/arch-arm/asm/alternative.h
similarity index 100%
rename from xen/include/asm-arm/alternative.h
rename to xen/include/arch-arm/asm/alternative.h
diff --git a/xen/include/asm-arm/altp2m.h b/xen/include/arch-arm/asm/altp2m.h
similarity index 100%
rename from xen/include/asm-arm/altp2m.h
rename to xen/include/arch-arm/asm/altp2m.h
diff --git a/xen/include/asm-arm/arm32/atomic.h b/xen/include/arch-arm/asm/arm32/atomic.h
similarity index 100%
rename from xen/include/asm-arm/arm32/atomic.h
rename to xen/include/arch-arm/asm/arm32/atomic.h
diff --git a/xen/include/asm-arm/arm32/bitops.h b/xen/include/arch-arm/asm/arm32/bitops.h
similarity index 100%
rename from xen/include/asm-arm/arm32/bitops.h
rename to xen/include/arch-arm/asm/arm32/bitops.h
diff --git a/xen/include/asm-arm/arm32/bug.h b/xen/include/arch-arm/asm/arm32/bug.h
similarity index 100%
rename from xen/include/asm-arm/arm32/bug.h
rename to xen/include/arch-arm/asm/arm32/bug.h
diff --git a/xen/include/asm-arm/arm32/cmpxchg.h b/xen/include/arch-arm/asm/arm32/cmpxchg.h
similarity index 100%
rename from xen/include/asm-arm/arm32/cmpxchg.h
rename to xen/include/arch-arm/asm/arm32/cmpxchg.h
diff --git a/xen/include/asm-arm/arm32/flushtlb.h b/xen/include/arch-arm/asm/arm32/flushtlb.h
similarity index 100%
rename from xen/include/asm-arm/arm32/flushtlb.h
rename to xen/include/arch-arm/asm/arm32/flushtlb.h
diff --git a/xen/include/asm-arm/arm32/insn.h b/xen/include/arch-arm/asm/arm32/insn.h
similarity index 100%
rename from xen/include/asm-arm/arm32/insn.h
rename to xen/include/arch-arm/asm/arm32/insn.h
diff --git a/xen/include/asm-arm/arm32/io.h b/xen/include/arch-arm/asm/arm32/io.h
similarity index 100%
rename from xen/include/asm-arm/arm32/io.h
rename to xen/include/arch-arm/asm/arm32/io.h
diff --git a/xen/include/asm-arm/arm32/macros.h b/xen/include/arch-arm/asm/arm32/macros.h
similarity index 100%
rename from xen/include/asm-arm/arm32/macros.h
rename to xen/include/arch-arm/asm/arm32/macros.h
diff --git a/xen/include/asm-arm/arm32/mm.h b/xen/include/arch-arm/asm/arm32/mm.h
similarity index 100%
rename from xen/include/asm-arm/arm32/mm.h
rename to xen/include/arch-arm/asm/arm32/mm.h
diff --git a/xen/include/asm-arm/arm32/page.h b/xen/include/arch-arm/asm/arm32/page.h
similarity index 100%
rename from xen/include/asm-arm/arm32/page.h
rename to xen/include/arch-arm/asm/arm32/page.h
diff --git a/xen/include/asm-arm/arm32/processor.h b/xen/include/arch-arm/asm/arm32/processor.h
similarity index 100%
rename from xen/include/asm-arm/arm32/processor.h
rename to xen/include/arch-arm/asm/arm32/processor.h
diff --git a/xen/include/asm-arm/arm32/sysregs.h b/xen/include/arch-arm/asm/arm32/sysregs.h
similarity index 100%
rename from xen/include/asm-arm/arm32/sysregs.h
rename to xen/include/arch-arm/asm/arm32/sysregs.h
diff --git a/xen/include/asm-arm/arm32/system.h b/xen/include/arch-arm/asm/arm32/system.h
similarity index 100%
rename from xen/include/asm-arm/arm32/system.h
rename to xen/include/arch-arm/asm/arm32/system.h
diff --git a/xen/include/asm-arm/arm32/traps.h b/xen/include/arch-arm/asm/arm32/traps.h
similarity index 100%
rename from xen/include/asm-arm/arm32/traps.h
rename to xen/include/arch-arm/asm/arm32/traps.h
diff --git a/xen/include/asm-arm/arm32/vfp.h b/xen/include/arch-arm/asm/arm32/vfp.h
similarity index 100%
rename from xen/include/asm-arm/arm32/vfp.h
rename to xen/include/arch-arm/asm/arm32/vfp.h
diff --git a/xen/include/asm-arm/arm64/atomic.h b/xen/include/arch-arm/asm/arm64/atomic.h
similarity index 100%
rename from xen/include/asm-arm/arm64/atomic.h
rename to xen/include/arch-arm/asm/arm64/atomic.h
diff --git a/xen/include/asm-arm/arm64/bitops.h b/xen/include/arch-arm/asm/arm64/bitops.h
similarity index 100%
rename from xen/include/asm-arm/arm64/bitops.h
rename to xen/include/arch-arm/asm/arm64/bitops.h
diff --git a/xen/include/asm-arm/arm64/brk.h b/xen/include/arch-arm/asm/arm64/brk.h
similarity index 100%
rename from xen/include/asm-arm/arm64/brk.h
rename to xen/include/arch-arm/asm/arm64/brk.h
diff --git a/xen/include/asm-arm/arm64/bug.h b/xen/include/arch-arm/asm/arm64/bug.h
similarity index 100%
rename from xen/include/asm-arm/arm64/bug.h
rename to xen/include/arch-arm/asm/arm64/bug.h
diff --git a/xen/include/asm-arm/arm64/cmpxchg.h b/xen/include/arch-arm/asm/arm64/cmpxchg.h
similarity index 100%
rename from xen/include/asm-arm/arm64/cmpxchg.h
rename to xen/include/arch-arm/asm/arm64/cmpxchg.h
diff --git a/xen/include/asm-arm/arm64/efibind.h b/xen/include/arch-arm/asm/arm64/efibind.h
similarity index 100%
rename from xen/include/asm-arm/arm64/efibind.h
rename to xen/include/arch-arm/asm/arm64/efibind.h
diff --git a/xen/include/asm-arm/arm64/flushtlb.h b/xen/include/arch-arm/asm/arm64/flushtlb.h
similarity index 100%
rename from xen/include/asm-arm/arm64/flushtlb.h
rename to xen/include/arch-arm/asm/arm64/flushtlb.h
diff --git a/xen/include/asm-arm/arm64/hsr.h b/xen/include/arch-arm/asm/arm64/hsr.h
similarity index 100%
rename from xen/include/asm-arm/arm64/hsr.h
rename to xen/include/arch-arm/asm/arm64/hsr.h
diff --git a/xen/include/asm-arm/arm64/insn.h b/xen/include/arch-arm/asm/arm64/insn.h
similarity index 100%
rename from xen/include/asm-arm/arm64/insn.h
rename to xen/include/arch-arm/asm/arm64/insn.h
diff --git a/xen/include/asm-arm/arm64/io.h b/xen/include/arch-arm/asm/arm64/io.h
similarity index 100%
rename from xen/include/asm-arm/arm64/io.h
rename to xen/include/arch-arm/asm/arm64/io.h
diff --git a/xen/include/asm-arm/arm64/macros.h b/xen/include/arch-arm/asm/arm64/macros.h
similarity index 100%
rename from xen/include/asm-arm/arm64/macros.h
rename to xen/include/arch-arm/asm/arm64/macros.h
diff --git a/xen/include/asm-arm/arm64/mm.h b/xen/include/arch-arm/asm/arm64/mm.h
similarity index 100%
rename from xen/include/asm-arm/arm64/mm.h
rename to xen/include/arch-arm/asm/arm64/mm.h
diff --git a/xen/include/asm-arm/arm64/page.h b/xen/include/arch-arm/asm/arm64/page.h
similarity index 100%
rename from xen/include/asm-arm/arm64/page.h
rename to xen/include/arch-arm/asm/arm64/page.h
diff --git a/xen/include/asm-arm/arm64/processor.h b/xen/include/arch-arm/asm/arm64/processor.h
similarity index 100%
rename from xen/include/asm-arm/arm64/processor.h
rename to xen/include/arch-arm/asm/arm64/processor.h
diff --git a/xen/include/asm-arm/arm64/sysregs.h b/xen/include/arch-arm/asm/arm64/sysregs.h
similarity index 100%
rename from xen/include/asm-arm/arm64/sysregs.h
rename to xen/include/arch-arm/asm/arm64/sysregs.h
diff --git a/xen/include/asm-arm/arm64/system.h b/xen/include/arch-arm/asm/arm64/system.h
similarity index 100%
rename from xen/include/asm-arm/arm64/system.h
rename to xen/include/arch-arm/asm/arm64/system.h
diff --git a/xen/include/asm-arm/arm64/traps.h b/xen/include/arch-arm/asm/arm64/traps.h
similarity index 100%
rename from xen/include/asm-arm/arm64/traps.h
rename to xen/include/arch-arm/asm/arm64/traps.h
diff --git a/xen/include/asm-arm/arm64/vfp.h b/xen/include/arch-arm/asm/arm64/vfp.h
similarity index 100%
rename from xen/include/asm-arm/arm64/vfp.h
rename to xen/include/arch-arm/asm/arm64/vfp.h
diff --git a/xen/include/asm-arm/asm_defns.h b/xen/include/arch-arm/asm/asm_defns.h
similarity index 100%
rename from xen/include/asm-arm/asm_defns.h
rename to xen/include/arch-arm/asm/asm_defns.h
diff --git a/xen/include/asm-arm/atomic.h b/xen/include/arch-arm/asm/atomic.h
similarity index 100%
rename from xen/include/asm-arm/atomic.h
rename to xen/include/arch-arm/asm/atomic.h
diff --git a/xen/include/asm-arm/bitops.h b/xen/include/arch-arm/asm/bitops.h
similarity index 100%
rename from xen/include/asm-arm/bitops.h
rename to xen/include/arch-arm/asm/bitops.h
diff --git a/xen/include/asm-arm/bug.h b/xen/include/arch-arm/asm/bug.h
similarity index 100%
rename from xen/include/asm-arm/bug.h
rename to xen/include/arch-arm/asm/bug.h
diff --git a/xen/include/asm-arm/byteorder.h b/xen/include/arch-arm/asm/byteorder.h
similarity index 100%
rename from xen/include/asm-arm/byteorder.h
rename to xen/include/arch-arm/asm/byteorder.h
diff --git a/xen/include/asm-arm/cache.h b/xen/include/arch-arm/asm/cache.h
similarity index 100%
rename from xen/include/asm-arm/cache.h
rename to xen/include/arch-arm/asm/cache.h
diff --git a/xen/include/asm-arm/cadence-uart.h b/xen/include/arch-arm/asm/cadence-uart.h
similarity index 100%
rename from xen/include/asm-arm/cadence-uart.h
rename to xen/include/arch-arm/asm/cadence-uart.h
diff --git a/xen/include/asm-arm/config.h b/xen/include/arch-arm/asm/config.h
similarity index 100%
rename from xen/include/asm-arm/config.h
rename to xen/include/arch-arm/asm/config.h
diff --git a/xen/include/asm-arm/cpregs.h b/xen/include/arch-arm/asm/cpregs.h
similarity index 100%
rename from xen/include/asm-arm/cpregs.h
rename to xen/include/arch-arm/asm/cpregs.h
diff --git a/xen/include/asm-arm/cpuerrata.h b/xen/include/arch-arm/asm/cpuerrata.h
similarity index 100%
rename from xen/include/asm-arm/cpuerrata.h
rename to xen/include/arch-arm/asm/cpuerrata.h
diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/arch-arm/asm/cpufeature.h
similarity index 100%
rename from xen/include/asm-arm/cpufeature.h
rename to xen/include/arch-arm/asm/cpufeature.h
diff --git a/xen/include/asm-arm/current.h b/xen/include/arch-arm/asm/current.h
similarity index 100%
rename from xen/include/asm-arm/current.h
rename to xen/include/arch-arm/asm/current.h
diff --git a/xen/include/asm-arm/debugger.h b/xen/include/arch-arm/asm/debugger.h
similarity index 100%
rename from xen/include/asm-arm/debugger.h
rename to xen/include/arch-arm/asm/debugger.h
diff --git a/xen/include/asm-arm/delay.h b/xen/include/arch-arm/asm/delay.h
similarity index 100%
rename from xen/include/asm-arm/delay.h
rename to xen/include/arch-arm/asm/delay.h
diff --git a/xen/include/asm-arm/desc.h b/xen/include/arch-arm/asm/desc.h
similarity index 100%
rename from xen/include/asm-arm/desc.h
rename to xen/include/arch-arm/asm/desc.h
diff --git a/xen/include/asm-arm/device.h b/xen/include/arch-arm/asm/device.h
similarity index 100%
rename from xen/include/asm-arm/device.h
rename to xen/include/arch-arm/asm/device.h
diff --git a/xen/include/asm-arm/div64.h b/xen/include/arch-arm/asm/div64.h
similarity index 100%
rename from xen/include/asm-arm/div64.h
rename to xen/include/arch-arm/asm/div64.h
diff --git a/xen/include/asm-arm/domain.h b/xen/include/arch-arm/asm/domain.h
similarity index 100%
rename from xen/include/asm-arm/domain.h
rename to xen/include/arch-arm/asm/domain.h
diff --git a/xen/include/asm-arm/domain_build.h b/xen/include/arch-arm/asm/domain_build.h
similarity index 100%
rename from xen/include/asm-arm/domain_build.h
rename to xen/include/arch-arm/asm/domain_build.h
diff --git a/xen/include/asm-arm/early_printk.h b/xen/include/arch-arm/asm/early_printk.h
similarity index 100%
rename from xen/include/asm-arm/early_printk.h
rename to xen/include/arch-arm/asm/early_printk.h
diff --git a/xen/include/asm-arm/efibind.h b/xen/include/arch-arm/asm/efibind.h
similarity index 100%
rename from xen/include/asm-arm/efibind.h
rename to xen/include/arch-arm/asm/efibind.h
diff --git a/xen/include/asm-arm/elf.h b/xen/include/arch-arm/asm/elf.h
similarity index 100%
rename from xen/include/asm-arm/elf.h
rename to xen/include/arch-arm/asm/elf.h
diff --git a/xen/include/asm-arm/event.h b/xen/include/arch-arm/asm/event.h
similarity index 100%
rename from xen/include/asm-arm/event.h
rename to xen/include/arch-arm/asm/event.h
diff --git a/xen/include/asm-arm/exynos4210-uart.h b/xen/include/arch-arm/asm/exynos4210-uart.h
similarity index 100%
rename from xen/include/asm-arm/exynos4210-uart.h
rename to xen/include/arch-arm/asm/exynos4210-uart.h
diff --git a/xen/include/asm-arm/flushtlb.h b/xen/include/arch-arm/asm/flushtlb.h
similarity index 100%
rename from xen/include/asm-arm/flushtlb.h
rename to xen/include/arch-arm/asm/flushtlb.h
diff --git a/xen/include/asm-arm/gic.h b/xen/include/arch-arm/asm/gic.h
similarity index 100%
rename from xen/include/asm-arm/gic.h
rename to xen/include/arch-arm/asm/gic.h
diff --git a/xen/include/asm-arm/gic_v3_defs.h b/xen/include/arch-arm/asm/gic_v3_defs.h
similarity index 100%
rename from xen/include/asm-arm/gic_v3_defs.h
rename to xen/include/arch-arm/asm/gic_v3_defs.h
diff --git a/xen/include/asm-arm/gic_v3_its.h b/xen/include/arch-arm/asm/gic_v3_its.h
similarity index 100%
rename from xen/include/asm-arm/gic_v3_its.h
rename to xen/include/arch-arm/asm/gic_v3_its.h
diff --git a/xen/include/asm-arm/grant_table.h b/xen/include/arch-arm/asm/grant_table.h
similarity index 100%
rename from xen/include/asm-arm/grant_table.h
rename to xen/include/arch-arm/asm/grant_table.h
diff --git a/xen/include/asm-arm/guest_access.h b/xen/include/arch-arm/asm/guest_access.h
similarity index 100%
rename from xen/include/asm-arm/guest_access.h
rename to xen/include/arch-arm/asm/guest_access.h
diff --git a/xen/include/asm-arm/guest_atomics.h b/xen/include/arch-arm/asm/guest_atomics.h
similarity index 100%
rename from xen/include/asm-arm/guest_atomics.h
rename to xen/include/arch-arm/asm/guest_atomics.h
diff --git a/xen/include/asm-arm/guest_walk.h b/xen/include/arch-arm/asm/guest_walk.h
similarity index 100%
rename from xen/include/asm-arm/guest_walk.h
rename to xen/include/arch-arm/asm/guest_walk.h
diff --git a/xen/include/asm-arm/hardirq.h b/xen/include/arch-arm/asm/hardirq.h
similarity index 100%
rename from xen/include/asm-arm/hardirq.h
rename to xen/include/arch-arm/asm/hardirq.h
diff --git a/xen/include/asm-arm/hsr.h b/xen/include/arch-arm/asm/hsr.h
similarity index 100%
rename from xen/include/asm-arm/hsr.h
rename to xen/include/arch-arm/asm/hsr.h
diff --git a/xen/include/asm-arm/hypercall.h b/xen/include/arch-arm/asm/hypercall.h
similarity index 100%
rename from xen/include/asm-arm/hypercall.h
rename to xen/include/arch-arm/asm/hypercall.h
diff --git a/xen/include/asm-arm/init.h b/xen/include/arch-arm/asm/init.h
similarity index 100%
rename from xen/include/asm-arm/init.h
rename to xen/include/arch-arm/asm/init.h
diff --git a/xen/include/asm-arm/insn.h b/xen/include/arch-arm/asm/insn.h
similarity index 100%
rename from xen/include/asm-arm/insn.h
rename to xen/include/arch-arm/asm/insn.h
diff --git a/xen/include/asm-arm/io.h b/xen/include/arch-arm/asm/io.h
similarity index 100%
rename from xen/include/asm-arm/io.h
rename to xen/include/arch-arm/asm/io.h
diff --git a/xen/include/asm-arm/iocap.h b/xen/include/arch-arm/asm/iocap.h
similarity index 100%
rename from xen/include/asm-arm/iocap.h
rename to xen/include/arch-arm/asm/iocap.h
diff --git a/xen/include/asm-arm/iommu.h b/xen/include/arch-arm/asm/iommu.h
similarity index 100%
rename from xen/include/asm-arm/iommu.h
rename to xen/include/arch-arm/asm/iommu.h
diff --git a/xen/include/asm-arm/iommu_fwspec.h b/xen/include/arch-arm/asm/iommu_fwspec.h
similarity index 100%
rename from xen/include/asm-arm/iommu_fwspec.h
rename to xen/include/arch-arm/asm/iommu_fwspec.h
diff --git a/xen/include/asm-arm/ioreq.h b/xen/include/arch-arm/asm/ioreq.h
similarity index 100%
rename from xen/include/asm-arm/ioreq.h
rename to xen/include/arch-arm/asm/ioreq.h
diff --git a/xen/include/asm-arm/irq.h b/xen/include/arch-arm/asm/irq.h
similarity index 100%
rename from xen/include/asm-arm/irq.h
rename to xen/include/arch-arm/asm/irq.h
diff --git a/xen/include/asm-arm/kernel.h b/xen/include/arch-arm/asm/kernel.h
similarity index 100%
rename from xen/include/asm-arm/kernel.h
rename to xen/include/arch-arm/asm/kernel.h
diff --git a/xen/include/asm-arm/livepatch.h b/xen/include/arch-arm/asm/livepatch.h
similarity index 100%
rename from xen/include/asm-arm/livepatch.h
rename to xen/include/arch-arm/asm/livepatch.h
diff --git a/xen/include/asm-arm/lpae.h b/xen/include/arch-arm/asm/lpae.h
similarity index 100%
rename from xen/include/asm-arm/lpae.h
rename to xen/include/arch-arm/asm/lpae.h
diff --git a/xen/include/asm-arm/macros.h b/xen/include/arch-arm/asm/macros.h
similarity index 100%
rename from xen/include/asm-arm/macros.h
rename to xen/include/arch-arm/asm/macros.h
diff --git a/xen/include/asm-arm/mem_access.h b/xen/include/arch-arm/asm/mem_access.h
similarity index 100%
rename from xen/include/asm-arm/mem_access.h
rename to xen/include/arch-arm/asm/mem_access.h
diff --git a/xen/include/asm-arm/mm.h b/xen/include/arch-arm/asm/mm.h
similarity index 100%
rename from xen/include/asm-arm/mm.h
rename to xen/include/arch-arm/asm/mm.h
diff --git a/xen/include/asm-arm/mmio.h b/xen/include/arch-arm/asm/mmio.h
similarity index 100%
rename from xen/include/asm-arm/mmio.h
rename to xen/include/arch-arm/asm/mmio.h
diff --git a/xen/include/asm-arm/monitor.h b/xen/include/arch-arm/asm/monitor.h
similarity index 100%
rename from xen/include/asm-arm/monitor.h
rename to xen/include/arch-arm/asm/monitor.h
diff --git a/xen/include/asm-arm/new_vgic.h b/xen/include/arch-arm/asm/new_vgic.h
similarity index 100%
rename from xen/include/asm-arm/new_vgic.h
rename to xen/include/arch-arm/asm/new_vgic.h
diff --git a/xen/include/asm-arm/nospec.h b/xen/include/arch-arm/asm/nospec.h
similarity index 100%
rename from xen/include/asm-arm/nospec.h
rename to xen/include/arch-arm/asm/nospec.h
diff --git a/xen/include/asm-arm/numa.h b/xen/include/arch-arm/asm/numa.h
similarity index 100%
rename from xen/include/asm-arm/numa.h
rename to xen/include/arch-arm/asm/numa.h
diff --git a/xen/include/asm-arm/p2m.h b/xen/include/arch-arm/asm/p2m.h
similarity index 100%
rename from xen/include/asm-arm/p2m.h
rename to xen/include/arch-arm/asm/p2m.h
diff --git a/xen/include/asm-arm/page-bits.h b/xen/include/arch-arm/asm/page-bits.h
similarity index 100%
rename from xen/include/asm-arm/page-bits.h
rename to xen/include/arch-arm/asm/page-bits.h
diff --git a/xen/include/asm-arm/page.h b/xen/include/arch-arm/asm/page.h
similarity index 100%
rename from xen/include/asm-arm/page.h
rename to xen/include/arch-arm/asm/page.h
diff --git a/xen/include/asm-arm/paging.h b/xen/include/arch-arm/asm/paging.h
similarity index 100%
rename from xen/include/asm-arm/paging.h
rename to xen/include/arch-arm/asm/paging.h
diff --git a/xen/include/asm-arm/pci.h b/xen/include/arch-arm/asm/pci.h
similarity index 100%
rename from xen/include/asm-arm/pci.h
rename to xen/include/arch-arm/asm/pci.h
diff --git a/xen/include/asm-arm/percpu.h b/xen/include/arch-arm/asm/percpu.h
similarity index 100%
rename from xen/include/asm-arm/percpu.h
rename to xen/include/arch-arm/asm/percpu.h
diff --git a/xen/include/asm-arm/perfc.h b/xen/include/arch-arm/asm/perfc.h
similarity index 100%
rename from xen/include/asm-arm/perfc.h
rename to xen/include/arch-arm/asm/perfc.h
diff --git a/xen/include/asm-arm/perfc_defn.h b/xen/include/arch-arm/asm/perfc_defn.h
similarity index 100%
rename from xen/include/asm-arm/perfc_defn.h
rename to xen/include/arch-arm/asm/perfc_defn.h
diff --git a/xen/include/asm-arm/pl011-uart.h b/xen/include/arch-arm/asm/pl011-uart.h
similarity index 100%
rename from xen/include/asm-arm/pl011-uart.h
rename to xen/include/arch-arm/asm/pl011-uart.h
diff --git a/xen/include/asm-arm/platform.h b/xen/include/arch-arm/asm/platform.h
similarity index 100%
rename from xen/include/asm-arm/platform.h
rename to xen/include/arch-arm/asm/platform.h
diff --git a/xen/include/asm-arm/platforms/exynos5.h b/xen/include/arch-arm/asm/platforms/exynos5.h
similarity index 100%
rename from xen/include/asm-arm/platforms/exynos5.h
rename to xen/include/arch-arm/asm/platforms/exynos5.h
diff --git a/xen/include/asm-arm/platforms/midway.h b/xen/include/arch-arm/asm/platforms/midway.h
similarity index 100%
rename from xen/include/asm-arm/platforms/midway.h
rename to xen/include/arch-arm/asm/platforms/midway.h
diff --git a/xen/include/asm-arm/platforms/omap5.h b/xen/include/arch-arm/asm/platforms/omap5.h
similarity index 100%
rename from xen/include/asm-arm/platforms/omap5.h
rename to xen/include/arch-arm/asm/platforms/omap5.h
diff --git a/xen/include/asm-arm/platforms/vexpress.h b/xen/include/arch-arm/asm/platforms/vexpress.h
similarity index 100%
rename from xen/include/asm-arm/platforms/vexpress.h
rename to xen/include/arch-arm/asm/platforms/vexpress.h
diff --git a/xen/include/asm-arm/platforms/xilinx-zynqmp-eemi.h b/xen/include/arch-arm/asm/platforms/xilinx-zynqmp-eemi.h
similarity index 100%
rename from xen/include/asm-arm/platforms/xilinx-zynqmp-eemi.h
rename to xen/include/arch-arm/asm/platforms/xilinx-zynqmp-eemi.h
diff --git a/xen/include/asm-arm/processor.h b/xen/include/arch-arm/asm/processor.h
similarity index 100%
rename from xen/include/asm-arm/processor.h
rename to xen/include/arch-arm/asm/processor.h
diff --git a/xen/include/asm-arm/procinfo.h b/xen/include/arch-arm/asm/procinfo.h
similarity index 100%
rename from xen/include/asm-arm/procinfo.h
rename to xen/include/arch-arm/asm/procinfo.h
diff --git a/xen/include/asm-arm/psci.h b/xen/include/arch-arm/asm/psci.h
similarity index 100%
rename from xen/include/asm-arm/psci.h
rename to xen/include/arch-arm/asm/psci.h
diff --git a/xen/include/asm-arm/random.h b/xen/include/arch-arm/asm/random.h
similarity index 100%
rename from xen/include/asm-arm/random.h
rename to xen/include/arch-arm/asm/random.h
diff --git a/xen/include/asm-arm/regs.h b/xen/include/arch-arm/asm/regs.h
similarity index 100%
rename from xen/include/asm-arm/regs.h
rename to xen/include/arch-arm/asm/regs.h
diff --git a/xen/include/asm-arm/scif-uart.h b/xen/include/arch-arm/asm/scif-uart.h
similarity index 100%
rename from xen/include/asm-arm/scif-uart.h
rename to xen/include/arch-arm/asm/scif-uart.h
diff --git a/xen/include/asm-arm/setup.h b/xen/include/arch-arm/asm/setup.h
similarity index 100%
rename from xen/include/asm-arm/setup.h
rename to xen/include/arch-arm/asm/setup.h
diff --git a/xen/include/asm-arm/short-desc.h b/xen/include/arch-arm/asm/short-desc.h
similarity index 100%
rename from xen/include/asm-arm/short-desc.h
rename to xen/include/arch-arm/asm/short-desc.h
diff --git a/xen/include/asm-arm/smccc.h b/xen/include/arch-arm/asm/smccc.h
similarity index 100%
rename from xen/include/asm-arm/smccc.h
rename to xen/include/arch-arm/asm/smccc.h
diff --git a/xen/include/asm-arm/smp.h b/xen/include/arch-arm/asm/smp.h
similarity index 100%
rename from xen/include/asm-arm/smp.h
rename to xen/include/arch-arm/asm/smp.h
diff --git a/xen/include/asm-arm/softirq.h b/xen/include/arch-arm/asm/softirq.h
similarity index 100%
rename from xen/include/asm-arm/softirq.h
rename to xen/include/arch-arm/asm/softirq.h
diff --git a/xen/include/asm-arm/spinlock.h b/xen/include/arch-arm/asm/spinlock.h
similarity index 100%
rename from xen/include/asm-arm/spinlock.h
rename to xen/include/arch-arm/asm/spinlock.h
diff --git a/xen/include/asm-arm/string.h b/xen/include/arch-arm/asm/string.h
similarity index 100%
rename from xen/include/asm-arm/string.h
rename to xen/include/arch-arm/asm/string.h
diff --git a/xen/include/asm-arm/sysregs.h b/xen/include/arch-arm/asm/sysregs.h
similarity index 100%
rename from xen/include/asm-arm/sysregs.h
rename to xen/include/arch-arm/asm/sysregs.h
diff --git a/xen/include/asm-arm/system.h b/xen/include/arch-arm/asm/system.h
similarity index 100%
rename from xen/include/asm-arm/system.h
rename to xen/include/arch-arm/asm/system.h
diff --git a/xen/include/asm-arm/tee/optee_msg.h b/xen/include/arch-arm/asm/tee/optee_msg.h
similarity index 100%
rename from xen/include/asm-arm/tee/optee_msg.h
rename to xen/include/arch-arm/asm/tee/optee_msg.h
diff --git a/xen/include/asm-arm/tee/optee_rpc_cmd.h b/xen/include/arch-arm/asm/tee/optee_rpc_cmd.h
similarity index 100%
rename from xen/include/asm-arm/tee/optee_rpc_cmd.h
rename to xen/include/arch-arm/asm/tee/optee_rpc_cmd.h
diff --git a/xen/include/asm-arm/tee/optee_smc.h b/xen/include/arch-arm/asm/tee/optee_smc.h
similarity index 100%
rename from xen/include/asm-arm/tee/optee_smc.h
rename to xen/include/arch-arm/asm/tee/optee_smc.h
diff --git a/xen/include/asm-arm/tee/tee.h b/xen/include/arch-arm/asm/tee/tee.h
similarity index 100%
rename from xen/include/asm-arm/tee/tee.h
rename to xen/include/arch-arm/asm/tee/tee.h
diff --git a/xen/include/asm-arm/time.h b/xen/include/arch-arm/asm/time.h
similarity index 100%
rename from xen/include/asm-arm/time.h
rename to xen/include/arch-arm/asm/time.h
diff --git a/xen/include/asm-arm/trace.h b/xen/include/arch-arm/asm/trace.h
similarity index 100%
rename from xen/include/asm-arm/trace.h
rename to xen/include/arch-arm/asm/trace.h
diff --git a/xen/include/asm-arm/traps.h b/xen/include/arch-arm/asm/traps.h
similarity index 100%
rename from xen/include/asm-arm/traps.h
rename to xen/include/arch-arm/asm/traps.h
diff --git a/xen/include/asm-arm/types.h b/xen/include/arch-arm/asm/types.h
similarity index 100%
rename from xen/include/asm-arm/types.h
rename to xen/include/arch-arm/asm/types.h
diff --git a/xen/include/asm-arm/vfp.h b/xen/include/arch-arm/asm/vfp.h
similarity index 100%
rename from xen/include/asm-arm/vfp.h
rename to xen/include/arch-arm/asm/vfp.h
diff --git a/xen/include/asm-arm/vgic-emul.h b/xen/include/arch-arm/asm/vgic-emul.h
similarity index 100%
rename from xen/include/asm-arm/vgic-emul.h
rename to xen/include/arch-arm/asm/vgic-emul.h
diff --git a/xen/include/asm-arm/vgic.h b/xen/include/arch-arm/asm/vgic.h
similarity index 100%
rename from xen/include/asm-arm/vgic.h
rename to xen/include/arch-arm/asm/vgic.h
diff --git a/xen/include/asm-arm/vm_event.h b/xen/include/arch-arm/asm/vm_event.h
similarity index 100%
rename from xen/include/asm-arm/vm_event.h
rename to xen/include/arch-arm/asm/vm_event.h
diff --git a/xen/include/asm-arm/vpl011.h b/xen/include/arch-arm/asm/vpl011.h
similarity index 100%
rename from xen/include/asm-arm/vpl011.h
rename to xen/include/arch-arm/asm/vpl011.h
diff --git a/xen/include/asm-arm/vpsci.h b/xen/include/arch-arm/asm/vpsci.h
similarity index 100%
rename from xen/include/asm-arm/vpsci.h
rename to xen/include/arch-arm/asm/vpsci.h
diff --git a/xen/include/asm-arm/vreg.h b/xen/include/arch-arm/asm/vreg.h
similarity index 100%
rename from xen/include/asm-arm/vreg.h
rename to xen/include/arch-arm/asm/vreg.h
diff --git a/xen/include/asm-arm/vtimer.h b/xen/include/arch-arm/asm/vtimer.h
similarity index 100%
rename from xen/include/asm-arm/vtimer.h
rename to xen/include/arch-arm/asm/vtimer.h
diff --git a/xen/include/asm-arm/xenoprof.h b/xen/include/arch-arm/asm/xenoprof.h
similarity index 100%
rename from xen/include/asm-arm/xenoprof.h
rename to xen/include/arch-arm/asm/xenoprof.h
diff --git a/xen/include/asm-riscv/config.h b/xen/include/arch-riscv/asm/config.h
similarity index 100%
rename from xen/include/asm-riscv/config.h
rename to xen/include/arch-riscv/asm/config.h
diff --git a/xen/include/asm-x86/acpi.h b/xen/include/arch-x86/asm/acpi.h
similarity index 100%
rename from xen/include/asm-x86/acpi.h
rename to xen/include/arch-x86/asm/acpi.h
diff --git a/xen/include/asm-x86/alternative-asm.h b/xen/include/arch-x86/asm/alternative-asm.h
similarity index 100%
rename from xen/include/asm-x86/alternative-asm.h
rename to xen/include/arch-x86/asm/alternative-asm.h
diff --git a/xen/include/asm-x86/alternative.h b/xen/include/arch-x86/asm/alternative.h
similarity index 100%
rename from xen/include/asm-x86/alternative.h
rename to xen/include/arch-x86/asm/alternative.h
diff --git a/xen/include/asm-x86/altp2m.h b/xen/include/arch-x86/asm/altp2m.h
similarity index 100%
rename from xen/include/asm-x86/altp2m.h
rename to xen/include/arch-x86/asm/altp2m.h
diff --git a/xen/include/asm-x86/amd.h b/xen/include/arch-x86/asm/amd.h
similarity index 100%
rename from xen/include/asm-x86/amd.h
rename to xen/include/arch-x86/asm/amd.h
diff --git a/xen/include/asm-x86/apic.h b/xen/include/arch-x86/asm/apic.h
similarity index 100%
rename from xen/include/asm-x86/apic.h
rename to xen/include/arch-x86/asm/apic.h
diff --git a/xen/include/asm-x86/apicdef.h b/xen/include/arch-x86/asm/apicdef.h
similarity index 100%
rename from xen/include/asm-x86/apicdef.h
rename to xen/include/arch-x86/asm/apicdef.h
diff --git a/xen/include/asm-x86/asm-defns.h b/xen/include/arch-x86/asm/asm-defns.h
similarity index 100%
rename from xen/include/asm-x86/asm-defns.h
rename to xen/include/arch-x86/asm/asm-defns.h
diff --git a/xen/include/asm-x86/asm_defns.h b/xen/include/arch-x86/asm/asm_defns.h
similarity index 100%
rename from xen/include/asm-x86/asm_defns.h
rename to xen/include/arch-x86/asm/asm_defns.h
diff --git a/xen/include/asm-x86/atomic.h b/xen/include/arch-x86/asm/atomic.h
similarity index 100%
rename from xen/include/asm-x86/atomic.h
rename to xen/include/arch-x86/asm/atomic.h
diff --git a/xen/include/asm-x86/bitops.h b/xen/include/arch-x86/asm/bitops.h
similarity index 100%
rename from xen/include/asm-x86/bitops.h
rename to xen/include/arch-x86/asm/bitops.h
diff --git a/xen/include/asm-x86/bug.h b/xen/include/arch-x86/asm/bug.h
similarity index 100%
rename from xen/include/asm-x86/bug.h
rename to xen/include/arch-x86/asm/bug.h
diff --git a/xen/include/asm-x86/byteorder.h b/xen/include/arch-x86/asm/byteorder.h
similarity index 100%
rename from xen/include/asm-x86/byteorder.h
rename to xen/include/arch-x86/asm/byteorder.h
diff --git a/xen/include/asm-x86/bzimage.h b/xen/include/arch-x86/asm/bzimage.h
similarity index 100%
rename from xen/include/asm-x86/bzimage.h
rename to xen/include/arch-x86/asm/bzimage.h
diff --git a/xen/include/asm-x86/cache.h b/xen/include/arch-x86/asm/cache.h
similarity index 100%
rename from xen/include/asm-x86/cache.h
rename to xen/include/arch-x86/asm/cache.h
diff --git a/xen/include/asm-x86/compat.h b/xen/include/arch-x86/asm/compat.h
similarity index 100%
rename from xen/include/asm-x86/compat.h
rename to xen/include/arch-x86/asm/compat.h
diff --git a/xen/include/asm-x86/config.h b/xen/include/arch-x86/asm/config.h
similarity index 100%
rename from xen/include/asm-x86/config.h
rename to xen/include/arch-x86/asm/config.h
diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/arch-x86/asm/cpufeature.h
similarity index 100%
rename from xen/include/asm-x86/cpufeature.h
rename to xen/include/arch-x86/asm/cpufeature.h
diff --git a/xen/include/asm-x86/cpufeatures.h b/xen/include/arch-x86/asm/cpufeatures.h
similarity index 100%
rename from xen/include/asm-x86/cpufeatures.h
rename to xen/include/arch-x86/asm/cpufeatures.h
diff --git a/xen/include/asm-x86/cpufeatureset.h b/xen/include/arch-x86/asm/cpufeatureset.h
similarity index 100%
rename from xen/include/asm-x86/cpufeatureset.h
rename to xen/include/arch-x86/asm/cpufeatureset.h
diff --git a/xen/include/asm-x86/cpuid.h b/xen/include/arch-x86/asm/cpuid.h
similarity index 100%
rename from xen/include/asm-x86/cpuid.h
rename to xen/include/arch-x86/asm/cpuid.h
diff --git a/xen/include/asm-x86/cpuidle.h b/xen/include/arch-x86/asm/cpuidle.h
similarity index 100%
rename from xen/include/asm-x86/cpuidle.h
rename to xen/include/arch-x86/asm/cpuidle.h
diff --git a/xen/include/asm-x86/current.h b/xen/include/arch-x86/asm/current.h
similarity index 99%
rename from xen/include/asm-x86/current.h
rename to xen/include/arch-x86/asm/current.h
index a74ad4bc4c44..c0f949eb2a19 100644
--- a/xen/include/asm-x86/current.h
+++ b/xen/include/arch-x86/asm/current.h
@@ -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 arch-x86/asm/spec_ctrl_asm.h for usage. */
     unsigned int shadow_spec_ctrl;
     uint8_t      xen_spec_ctrl;
     uint8_t      spec_ctrl_flags;
diff --git a/xen/include/asm-x86/debugger.h b/xen/include/arch-x86/asm/debugger.h
similarity index 100%
rename from xen/include/asm-x86/debugger.h
rename to xen/include/arch-x86/asm/debugger.h
diff --git a/xen/include/asm-x86/debugreg.h b/xen/include/arch-x86/asm/debugreg.h
similarity index 100%
rename from xen/include/asm-x86/debugreg.h
rename to xen/include/arch-x86/asm/debugreg.h
diff --git a/xen/include/asm-x86/delay.h b/xen/include/arch-x86/asm/delay.h
similarity index 100%
rename from xen/include/asm-x86/delay.h
rename to xen/include/arch-x86/asm/delay.h
diff --git a/xen/include/asm-x86/desc.h b/xen/include/arch-x86/asm/desc.h
similarity index 100%
rename from xen/include/asm-x86/desc.h
rename to xen/include/arch-x86/asm/desc.h
diff --git a/xen/include/asm-x86/device.h b/xen/include/arch-x86/asm/device.h
similarity index 100%
rename from xen/include/asm-x86/device.h
rename to xen/include/arch-x86/asm/device.h
diff --git a/xen/include/asm-x86/div64.h b/xen/include/arch-x86/asm/div64.h
similarity index 100%
rename from xen/include/asm-x86/div64.h
rename to xen/include/arch-x86/asm/div64.h
diff --git a/xen/include/asm-x86/dom0_build.h b/xen/include/arch-x86/asm/dom0_build.h
similarity index 100%
rename from xen/include/asm-x86/dom0_build.h
rename to xen/include/arch-x86/asm/dom0_build.h
diff --git a/xen/include/asm-x86/domain.h b/xen/include/arch-x86/asm/domain.h
similarity index 99%
rename from xen/include/asm-x86/domain.h
rename to xen/include/arch-x86/asm/domain.h
index 92d54de0b9a1..85ad302c0e92 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/arch-x86/asm/domain.h
@@ -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 include/arch-x86/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 */
diff --git a/xen/include/asm-x86/e820.h b/xen/include/arch-x86/asm/e820.h
similarity index 100%
rename from xen/include/asm-x86/e820.h
rename to xen/include/arch-x86/asm/e820.h
diff --git a/xen/include/asm-x86/edd.h b/xen/include/arch-x86/asm/edd.h
similarity index 100%
rename from xen/include/asm-x86/edd.h
rename to xen/include/arch-x86/asm/edd.h
diff --git a/xen/include/asm-x86/efibind.h b/xen/include/arch-x86/asm/efibind.h
similarity index 100%
rename from xen/include/asm-x86/efibind.h
rename to xen/include/arch-x86/asm/efibind.h
diff --git a/xen/include/asm-x86/elf.h b/xen/include/arch-x86/asm/elf.h
similarity index 100%
rename from xen/include/asm-x86/elf.h
rename to xen/include/arch-x86/asm/elf.h
diff --git a/xen/include/asm-x86/event.h b/xen/include/arch-x86/asm/event.h
similarity index 100%
rename from xen/include/asm-x86/event.h
rename to xen/include/arch-x86/asm/event.h
diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/arch-x86/asm/fixmap.h
similarity index 100%
rename from xen/include/asm-x86/fixmap.h
rename to xen/include/arch-x86/asm/fixmap.h
diff --git a/xen/include/asm-x86/flushtlb.h b/xen/include/arch-x86/asm/flushtlb.h
similarity index 100%
rename from xen/include/asm-x86/flushtlb.h
rename to xen/include/arch-x86/asm/flushtlb.h
diff --git a/xen/include/asm-x86/genapic.h b/xen/include/arch-x86/asm/genapic.h
similarity index 100%
rename from xen/include/asm-x86/genapic.h
rename to xen/include/arch-x86/asm/genapic.h
diff --git a/xen/include/asm-x86/grant_table.h b/xen/include/arch-x86/asm/grant_table.h
similarity index 100%
rename from xen/include/asm-x86/grant_table.h
rename to xen/include/arch-x86/asm/grant_table.h
diff --git a/xen/include/asm-x86/guest.h b/xen/include/arch-x86/asm/guest.h
similarity index 100%
rename from xen/include/asm-x86/guest.h
rename to xen/include/arch-x86/asm/guest.h
diff --git a/xen/include/asm-x86/guest/hyperv-hcall.h b/xen/include/arch-x86/asm/guest/hyperv-hcall.h
similarity index 100%
rename from xen/include/asm-x86/guest/hyperv-hcall.h
rename to xen/include/arch-x86/asm/guest/hyperv-hcall.h
diff --git a/xen/include/asm-x86/guest/hyperv-tlfs.h b/xen/include/arch-x86/asm/guest/hyperv-tlfs.h
similarity index 100%
rename from xen/include/asm-x86/guest/hyperv-tlfs.h
rename to xen/include/arch-x86/asm/guest/hyperv-tlfs.h
diff --git a/xen/include/asm-x86/guest/hyperv.h b/xen/include/arch-x86/asm/guest/hyperv.h
similarity index 100%
rename from xen/include/asm-x86/guest/hyperv.h
rename to xen/include/arch-x86/asm/guest/hyperv.h
diff --git a/xen/include/asm-x86/guest/hypervisor.h b/xen/include/arch-x86/asm/guest/hypervisor.h
similarity index 100%
rename from xen/include/asm-x86/guest/hypervisor.h
rename to xen/include/arch-x86/asm/guest/hypervisor.h
diff --git a/xen/include/asm-x86/guest/pvh-boot.h b/xen/include/arch-x86/asm/guest/pvh-boot.h
similarity index 100%
rename from xen/include/asm-x86/guest/pvh-boot.h
rename to xen/include/arch-x86/asm/guest/pvh-boot.h
diff --git a/xen/include/asm-x86/guest/xen-hcall.h b/xen/include/arch-x86/asm/guest/xen-hcall.h
similarity index 100%
rename from xen/include/asm-x86/guest/xen-hcall.h
rename to xen/include/arch-x86/asm/guest/xen-hcall.h
diff --git a/xen/include/asm-x86/guest/xen.h b/xen/include/arch-x86/asm/guest/xen.h
similarity index 100%
rename from xen/include/asm-x86/guest/xen.h
rename to xen/include/arch-x86/asm/guest/xen.h
diff --git a/xen/include/asm-x86/guest_access.h b/xen/include/arch-x86/asm/guest_access.h
similarity index 100%
rename from xen/include/asm-x86/guest_access.h
rename to xen/include/arch-x86/asm/guest_access.h
diff --git a/xen/include/asm-x86/guest_atomics.h b/xen/include/arch-x86/asm/guest_atomics.h
similarity index 100%
rename from xen/include/asm-x86/guest_atomics.h
rename to xen/include/arch-x86/asm/guest_atomics.h
diff --git a/xen/include/asm-x86/guest_pt.h b/xen/include/arch-x86/asm/guest_pt.h
similarity index 100%
rename from xen/include/asm-x86/guest_pt.h
rename to xen/include/arch-x86/asm/guest_pt.h
diff --git a/xen/include/asm-x86/hap.h b/xen/include/arch-x86/asm/hap.h
similarity index 100%
rename from xen/include/asm-x86/hap.h
rename to xen/include/arch-x86/asm/hap.h
diff --git a/xen/include/asm-x86/hardirq.h b/xen/include/arch-x86/asm/hardirq.h
similarity index 100%
rename from xen/include/asm-x86/hardirq.h
rename to xen/include/arch-x86/asm/hardirq.h
diff --git a/xen/include/asm-x86/hpet.h b/xen/include/arch-x86/asm/hpet.h
similarity index 100%
rename from xen/include/asm-x86/hpet.h
rename to xen/include/arch-x86/asm/hpet.h
diff --git a/xen/include/asm-x86/hvm/asid.h b/xen/include/arch-x86/asm/hvm/asid.h
similarity index 100%
rename from xen/include/asm-x86/hvm/asid.h
rename to xen/include/arch-x86/asm/hvm/asid.h
diff --git a/xen/include/asm-x86/hvm/cacheattr.h b/xen/include/arch-x86/asm/hvm/cacheattr.h
similarity index 100%
rename from xen/include/asm-x86/hvm/cacheattr.h
rename to xen/include/arch-x86/asm/hvm/cacheattr.h
diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/arch-x86/asm/hvm/domain.h
similarity index 100%
rename from xen/include/asm-x86/hvm/domain.h
rename to xen/include/arch-x86/asm/hvm/domain.h
diff --git a/xen/include/asm-x86/hvm/emulate.h b/xen/include/arch-x86/asm/hvm/emulate.h
similarity index 100%
rename from xen/include/asm-x86/hvm/emulate.h
rename to xen/include/arch-x86/asm/hvm/emulate.h
diff --git a/xen/include/asm-x86/hvm/grant_table.h b/xen/include/arch-x86/asm/hvm/grant_table.h
similarity index 100%
rename from xen/include/asm-x86/hvm/grant_table.h
rename to xen/include/arch-x86/asm/hvm/grant_table.h
diff --git a/xen/include/asm-x86/hvm/guest_access.h b/xen/include/arch-x86/asm/hvm/guest_access.h
similarity index 100%
rename from xen/include/asm-x86/hvm/guest_access.h
rename to xen/include/arch-x86/asm/hvm/guest_access.h
diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/arch-x86/asm/hvm/hvm.h
similarity index 100%
rename from xen/include/asm-x86/hvm/hvm.h
rename to xen/include/arch-x86/asm/hvm/hvm.h
diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/arch-x86/asm/hvm/io.h
similarity index 100%
rename from xen/include/asm-x86/hvm/io.h
rename to xen/include/arch-x86/asm/hvm/io.h
diff --git a/xen/include/asm-x86/hvm/ioreq.h b/xen/include/arch-x86/asm/hvm/ioreq.h
similarity index 100%
rename from xen/include/asm-x86/hvm/ioreq.h
rename to xen/include/arch-x86/asm/hvm/ioreq.h
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/arch-x86/asm/hvm/irq.h
similarity index 100%
rename from xen/include/asm-x86/hvm/irq.h
rename to xen/include/arch-x86/asm/hvm/irq.h
diff --git a/xen/include/asm-x86/hvm/monitor.h b/xen/include/arch-x86/asm/hvm/monitor.h
similarity index 100%
rename from xen/include/asm-x86/hvm/monitor.h
rename to xen/include/arch-x86/asm/hvm/monitor.h
diff --git a/xen/include/asm-x86/hvm/nestedhvm.h b/xen/include/arch-x86/asm/hvm/nestedhvm.h
similarity index 100%
rename from xen/include/asm-x86/hvm/nestedhvm.h
rename to xen/include/arch-x86/asm/hvm/nestedhvm.h
diff --git a/xen/include/asm-x86/hvm/save.h b/xen/include/arch-x86/asm/hvm/save.h
similarity index 100%
rename from xen/include/asm-x86/hvm/save.h
rename to xen/include/arch-x86/asm/hvm/save.h
diff --git a/xen/include/asm-x86/hvm/support.h b/xen/include/arch-x86/asm/hvm/support.h
similarity index 100%
rename from xen/include/asm-x86/hvm/support.h
rename to xen/include/arch-x86/asm/hvm/support.h
diff --git a/xen/include/asm-x86/hvm/svm/asid.h b/xen/include/arch-x86/asm/hvm/svm/asid.h
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/asid.h
rename to xen/include/arch-x86/asm/hvm/svm/asid.h
diff --git a/xen/include/asm-x86/hvm/svm/emulate.h b/xen/include/arch-x86/asm/hvm/svm/emulate.h
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/emulate.h
rename to xen/include/arch-x86/asm/hvm/svm/emulate.h
diff --git a/xen/include/asm-x86/hvm/svm/intr.h b/xen/include/arch-x86/asm/hvm/svm/intr.h
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/intr.h
rename to xen/include/arch-x86/asm/hvm/svm/intr.h
diff --git a/xen/include/asm-x86/hvm/svm/nestedsvm.h b/xen/include/arch-x86/asm/hvm/svm/nestedsvm.h
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/nestedsvm.h
rename to xen/include/arch-x86/asm/hvm/svm/nestedsvm.h
diff --git a/xen/include/asm-x86/hvm/svm/svm.h b/xen/include/arch-x86/asm/hvm/svm/svm.h
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/svm.h
rename to xen/include/arch-x86/asm/hvm/svm/svm.h
diff --git a/xen/include/asm-x86/hvm/svm/svmdebug.h b/xen/include/arch-x86/asm/hvm/svm/svmdebug.h
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/svmdebug.h
rename to xen/include/arch-x86/asm/hvm/svm/svmdebug.h
diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/arch-x86/asm/hvm/svm/vmcb.h
similarity index 100%
rename from xen/include/asm-x86/hvm/svm/vmcb.h
rename to xen/include/arch-x86/asm/hvm/svm/vmcb.h
diff --git a/xen/include/asm-x86/hvm/trace.h b/xen/include/arch-x86/asm/hvm/trace.h
similarity index 100%
rename from xen/include/asm-x86/hvm/trace.h
rename to xen/include/arch-x86/asm/hvm/trace.h
diff --git a/xen/include/asm-x86/hvm/vcpu.h b/xen/include/arch-x86/asm/hvm/vcpu.h
similarity index 100%
rename from xen/include/asm-x86/hvm/vcpu.h
rename to xen/include/arch-x86/asm/hvm/vcpu.h
diff --git a/xen/include/asm-x86/hvm/vioapic.h b/xen/include/arch-x86/asm/hvm/vioapic.h
similarity index 100%
rename from xen/include/asm-x86/hvm/vioapic.h
rename to xen/include/arch-x86/asm/hvm/vioapic.h
diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/arch-x86/asm/hvm/viridian.h
similarity index 100%
rename from xen/include/asm-x86/hvm/viridian.h
rename to xen/include/arch-x86/asm/hvm/viridian.h
diff --git a/xen/include/asm-x86/hvm/vlapic.h b/xen/include/arch-x86/asm/hvm/vlapic.h
similarity index 100%
rename from xen/include/asm-x86/hvm/vlapic.h
rename to xen/include/arch-x86/asm/hvm/vlapic.h
diff --git a/xen/include/asm-x86/hvm/vm_event.h b/xen/include/arch-x86/asm/hvm/vm_event.h
similarity index 100%
rename from xen/include/asm-x86/hvm/vm_event.h
rename to xen/include/arch-x86/asm/hvm/vm_event.h
diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/arch-x86/asm/hvm/vmx/vmcs.h
similarity index 100%
rename from xen/include/asm-x86/hvm/vmx/vmcs.h
rename to xen/include/arch-x86/asm/hvm/vmx/vmcs.h
diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/arch-x86/asm/hvm/vmx/vmx.h
similarity index 100%
rename from xen/include/asm-x86/hvm/vmx/vmx.h
rename to xen/include/arch-x86/asm/hvm/vmx/vmx.h
diff --git a/xen/include/asm-x86/hvm/vmx/vvmx.h b/xen/include/arch-x86/asm/hvm/vmx/vvmx.h
similarity index 100%
rename from xen/include/asm-x86/hvm/vmx/vvmx.h
rename to xen/include/arch-x86/asm/hvm/vmx/vvmx.h
diff --git a/xen/include/asm-x86/hvm/vpic.h b/xen/include/arch-x86/asm/hvm/vpic.h
similarity index 100%
rename from xen/include/asm-x86/hvm/vpic.h
rename to xen/include/arch-x86/asm/hvm/vpic.h
diff --git a/xen/include/asm-x86/hvm/vpt.h b/xen/include/arch-x86/asm/hvm/vpt.h
similarity index 100%
rename from xen/include/asm-x86/hvm/vpt.h
rename to xen/include/arch-x86/asm/hvm/vpt.h
diff --git a/xen/include/asm-x86/hypercall.h b/xen/include/arch-x86/asm/hypercall.h
similarity index 100%
rename from xen/include/asm-x86/hypercall.h
rename to xen/include/arch-x86/asm/hypercall.h
diff --git a/xen/include/asm-x86/i387.h b/xen/include/arch-x86/asm/i387.h
similarity index 100%
rename from xen/include/asm-x86/i387.h
rename to xen/include/arch-x86/asm/i387.h
diff --git a/xen/include/asm-x86/init.h b/xen/include/arch-x86/asm/init.h
similarity index 100%
rename from xen/include/asm-x86/init.h
rename to xen/include/arch-x86/asm/init.h
diff --git a/xen/include/asm-x86/invpcid.h b/xen/include/arch-x86/asm/invpcid.h
similarity index 100%
rename from xen/include/asm-x86/invpcid.h
rename to xen/include/arch-x86/asm/invpcid.h
diff --git a/xen/include/asm-x86/io.h b/xen/include/arch-x86/asm/io.h
similarity index 100%
rename from xen/include/asm-x86/io.h
rename to xen/include/arch-x86/asm/io.h
diff --git a/xen/include/asm-x86/io_apic.h b/xen/include/arch-x86/asm/io_apic.h
similarity index 100%
rename from xen/include/asm-x86/io_apic.h
rename to xen/include/arch-x86/asm/io_apic.h
diff --git a/xen/include/asm-x86/iocap.h b/xen/include/arch-x86/asm/iocap.h
similarity index 100%
rename from xen/include/asm-x86/iocap.h
rename to xen/include/arch-x86/asm/iocap.h
diff --git a/xen/include/asm-x86/iommu.h b/xen/include/arch-x86/asm/iommu.h
similarity index 100%
rename from xen/include/asm-x86/iommu.h
rename to xen/include/arch-x86/asm/iommu.h
diff --git a/xen/include/asm-x86/ioreq.h b/xen/include/arch-x86/asm/ioreq.h
similarity index 100%
rename from xen/include/asm-x86/ioreq.h
rename to xen/include/arch-x86/asm/ioreq.h
diff --git a/xen/include/asm-x86/irq.h b/xen/include/arch-x86/asm/irq.h
similarity index 100%
rename from xen/include/asm-x86/irq.h
rename to xen/include/arch-x86/asm/irq.h
diff --git a/xen/include/asm-x86/ldt.h b/xen/include/arch-x86/asm/ldt.h
similarity index 100%
rename from xen/include/asm-x86/ldt.h
rename to xen/include/arch-x86/asm/ldt.h
diff --git a/xen/include/asm-x86/livepatch.h b/xen/include/arch-x86/asm/livepatch.h
similarity index 100%
rename from xen/include/asm-x86/livepatch.h
rename to xen/include/arch-x86/asm/livepatch.h
diff --git a/xen/include/asm-x86/mach-default/bios_ebda.h b/xen/include/arch-x86/asm/mach-default/bios_ebda.h
similarity index 100%
rename from xen/include/asm-x86/mach-default/bios_ebda.h
rename to xen/include/arch-x86/asm/mach-default/bios_ebda.h
diff --git a/xen/include/asm-x86/mach-default/io_ports.h b/xen/include/arch-x86/asm/mach-default/io_ports.h
similarity index 100%
rename from xen/include/asm-x86/mach-default/io_ports.h
rename to xen/include/arch-x86/asm/mach-default/io_ports.h
diff --git a/xen/include/asm-x86/mach-default/irq_vectors.h b/xen/include/arch-x86/asm/mach-default/irq_vectors.h
similarity index 100%
rename from xen/include/asm-x86/mach-default/irq_vectors.h
rename to xen/include/arch-x86/asm/mach-default/irq_vectors.h
diff --git a/xen/include/asm-x86/mach-default/mach_mpparse.h b/xen/include/arch-x86/asm/mach-default/mach_mpparse.h
similarity index 100%
rename from xen/include/asm-x86/mach-default/mach_mpparse.h
rename to xen/include/arch-x86/asm/mach-default/mach_mpparse.h
diff --git a/xen/include/asm-x86/mach-default/mach_mpspec.h b/xen/include/arch-x86/asm/mach-default/mach_mpspec.h
similarity index 100%
rename from xen/include/asm-x86/mach-default/mach_mpspec.h
rename to xen/include/arch-x86/asm/mach-default/mach_mpspec.h
diff --git a/xen/include/asm-x86/mach-generic/mach_apic.h b/xen/include/arch-x86/asm/mach-generic/mach_apic.h
similarity index 100%
rename from xen/include/asm-x86/mach-generic/mach_apic.h
rename to xen/include/arch-x86/asm/mach-generic/mach_apic.h
diff --git a/xen/include/asm-x86/mach-generic/mach_mpparse.h b/xen/include/arch-x86/asm/mach-generic/mach_mpparse.h
similarity index 100%
rename from xen/include/asm-x86/mach-generic/mach_mpparse.h
rename to xen/include/arch-x86/asm/mach-generic/mach_mpparse.h
diff --git a/xen/include/asm-x86/machine_kexec.h b/xen/include/arch-x86/asm/machine_kexec.h
similarity index 100%
rename from xen/include/asm-x86/machine_kexec.h
rename to xen/include/arch-x86/asm/machine_kexec.h
diff --git a/xen/include/asm-x86/mc146818rtc.h b/xen/include/arch-x86/asm/mc146818rtc.h
similarity index 100%
rename from xen/include/asm-x86/mc146818rtc.h
rename to xen/include/arch-x86/asm/mc146818rtc.h
diff --git a/xen/include/asm-x86/mce.h b/xen/include/arch-x86/asm/mce.h
similarity index 100%
rename from xen/include/asm-x86/mce.h
rename to xen/include/arch-x86/asm/mce.h
diff --git a/xen/include/asm-x86/mem_access.h b/xen/include/arch-x86/asm/mem_access.h
similarity index 100%
rename from xen/include/asm-x86/mem_access.h
rename to xen/include/arch-x86/asm/mem_access.h
diff --git a/xen/include/asm-x86/mem_paging.h b/xen/include/arch-x86/asm/mem_paging.h
similarity index 100%
rename from xen/include/asm-x86/mem_paging.h
rename to xen/include/arch-x86/asm/mem_paging.h
diff --git a/xen/include/asm-x86/mem_sharing.h b/xen/include/arch-x86/asm/mem_sharing.h
similarity index 100%
rename from xen/include/asm-x86/mem_sharing.h
rename to xen/include/arch-x86/asm/mem_sharing.h
diff --git a/xen/include/asm-x86/microcode.h b/xen/include/arch-x86/asm/microcode.h
similarity index 100%
rename from xen/include/asm-x86/microcode.h
rename to xen/include/arch-x86/asm/microcode.h
diff --git a/xen/include/asm-x86/mm.h b/xen/include/arch-x86/asm/mm.h
similarity index 100%
rename from xen/include/asm-x86/mm.h
rename to xen/include/arch-x86/asm/mm.h
diff --git a/xen/include/asm-x86/monitor.h b/xen/include/arch-x86/asm/monitor.h
similarity index 100%
rename from xen/include/asm-x86/monitor.h
rename to xen/include/arch-x86/asm/monitor.h
diff --git a/xen/include/asm-x86/mpspec.h b/xen/include/arch-x86/asm/mpspec.h
similarity index 100%
rename from xen/include/asm-x86/mpspec.h
rename to xen/include/arch-x86/asm/mpspec.h
diff --git a/xen/include/asm-x86/mpspec_def.h b/xen/include/arch-x86/asm/mpspec_def.h
similarity index 100%
rename from xen/include/asm-x86/mpspec_def.h
rename to xen/include/arch-x86/asm/mpspec_def.h
diff --git a/xen/include/asm-x86/msi.h b/xen/include/arch-x86/asm/msi.h
similarity index 100%
rename from xen/include/asm-x86/msi.h
rename to xen/include/arch-x86/asm/msi.h
diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/arch-x86/asm/msr-index.h
similarity index 100%
rename from xen/include/asm-x86/msr-index.h
rename to xen/include/arch-x86/asm/msr-index.h
diff --git a/xen/include/asm-x86/msr.h b/xen/include/arch-x86/asm/msr.h
similarity index 100%
rename from xen/include/asm-x86/msr.h
rename to xen/include/arch-x86/asm/msr.h
diff --git a/xen/include/asm-x86/mtrr.h b/xen/include/arch-x86/asm/mtrr.h
similarity index 100%
rename from xen/include/asm-x86/mtrr.h
rename to xen/include/arch-x86/asm/mtrr.h
diff --git a/xen/include/asm-x86/multicall.h b/xen/include/arch-x86/asm/multicall.h
similarity index 100%
rename from xen/include/asm-x86/multicall.h
rename to xen/include/arch-x86/asm/multicall.h
diff --git a/xen/include/asm-x86/mwait.h b/xen/include/arch-x86/asm/mwait.h
similarity index 100%
rename from xen/include/asm-x86/mwait.h
rename to xen/include/arch-x86/asm/mwait.h
diff --git a/xen/include/asm-x86/nmi.h b/xen/include/arch-x86/asm/nmi.h
similarity index 100%
rename from xen/include/asm-x86/nmi.h
rename to xen/include/arch-x86/asm/nmi.h
diff --git a/xen/include/asm-x86/nops.h b/xen/include/arch-x86/asm/nops.h
similarity index 100%
rename from xen/include/asm-x86/nops.h
rename to xen/include/arch-x86/asm/nops.h
diff --git a/xen/include/asm-x86/nospec.h b/xen/include/arch-x86/asm/nospec.h
similarity index 100%
rename from xen/include/asm-x86/nospec.h
rename to xen/include/arch-x86/asm/nospec.h
diff --git a/xen/include/asm-x86/numa.h b/xen/include/arch-x86/asm/numa.h
similarity index 100%
rename from xen/include/asm-x86/numa.h
rename to xen/include/arch-x86/asm/numa.h
diff --git a/xen/include/asm-x86/p2m.h b/xen/include/arch-x86/asm/p2m.h
similarity index 100%
rename from xen/include/asm-x86/p2m.h
rename to xen/include/arch-x86/asm/p2m.h
diff --git a/xen/include/asm-x86/page-bits.h b/xen/include/arch-x86/asm/page-bits.h
similarity index 100%
rename from xen/include/asm-x86/page-bits.h
rename to xen/include/arch-x86/asm/page-bits.h
diff --git a/xen/include/asm-x86/page.h b/xen/include/arch-x86/asm/page.h
similarity index 100%
rename from xen/include/asm-x86/page.h
rename to xen/include/arch-x86/asm/page.h
diff --git a/xen/include/asm-x86/paging.h b/xen/include/arch-x86/asm/paging.h
similarity index 100%
rename from xen/include/asm-x86/paging.h
rename to xen/include/arch-x86/asm/paging.h
diff --git a/xen/include/asm-x86/pci.h b/xen/include/arch-x86/asm/pci.h
similarity index 100%
rename from xen/include/asm-x86/pci.h
rename to xen/include/arch-x86/asm/pci.h
diff --git a/xen/include/asm-x86/percpu.h b/xen/include/arch-x86/asm/percpu.h
similarity index 100%
rename from xen/include/asm-x86/percpu.h
rename to xen/include/arch-x86/asm/percpu.h
diff --git a/xen/include/asm-x86/perfc.h b/xen/include/arch-x86/asm/perfc.h
similarity index 100%
rename from xen/include/asm-x86/perfc.h
rename to xen/include/arch-x86/asm/perfc.h
diff --git a/xen/include/asm-x86/perfc_defn.h b/xen/include/arch-x86/asm/perfc_defn.h
similarity index 100%
rename from xen/include/asm-x86/perfc_defn.h
rename to xen/include/arch-x86/asm/perfc_defn.h
diff --git a/xen/include/asm-x86/processor.h b/xen/include/arch-x86/asm/processor.h
similarity index 100%
rename from xen/include/asm-x86/processor.h
rename to xen/include/arch-x86/asm/processor.h
diff --git a/xen/include/asm-x86/psr.h b/xen/include/arch-x86/asm/psr.h
similarity index 100%
rename from xen/include/asm-x86/psr.h
rename to xen/include/arch-x86/asm/psr.h
diff --git a/xen/include/asm-x86/pv/domain.h b/xen/include/arch-x86/asm/pv/domain.h
similarity index 100%
rename from xen/include/asm-x86/pv/domain.h
rename to xen/include/arch-x86/asm/pv/domain.h
diff --git a/xen/include/asm-x86/pv/grant_table.h b/xen/include/arch-x86/asm/pv/grant_table.h
similarity index 100%
rename from xen/include/asm-x86/pv/grant_table.h
rename to xen/include/arch-x86/asm/pv/grant_table.h
diff --git a/xen/include/asm-x86/pv/mm.h b/xen/include/arch-x86/asm/pv/mm.h
similarity index 100%
rename from xen/include/asm-x86/pv/mm.h
rename to xen/include/arch-x86/asm/pv/mm.h
diff --git a/xen/include/asm-x86/pv/shim.h b/xen/include/arch-x86/asm/pv/shim.h
similarity index 100%
rename from xen/include/asm-x86/pv/shim.h
rename to xen/include/arch-x86/asm/pv/shim.h
diff --git a/xen/include/asm-x86/pv/traps.h b/xen/include/arch-x86/asm/pv/traps.h
similarity index 100%
rename from xen/include/asm-x86/pv/traps.h
rename to xen/include/arch-x86/asm/pv/traps.h
diff --git a/xen/include/asm-x86/random.h b/xen/include/arch-x86/asm/random.h
similarity index 100%
rename from xen/include/asm-x86/random.h
rename to xen/include/arch-x86/asm/random.h
diff --git a/xen/include/asm-x86/regs.h b/xen/include/arch-x86/asm/regs.h
similarity index 100%
rename from xen/include/asm-x86/regs.h
rename to xen/include/arch-x86/asm/regs.h
diff --git a/xen/include/asm-x86/setup.h b/xen/include/arch-x86/asm/setup.h
similarity index 100%
rename from xen/include/asm-x86/setup.h
rename to xen/include/arch-x86/asm/setup.h
diff --git a/xen/include/asm-x86/shadow.h b/xen/include/arch-x86/asm/shadow.h
similarity index 100%
rename from xen/include/asm-x86/shadow.h
rename to xen/include/arch-x86/asm/shadow.h
diff --git a/xen/include/asm-x86/shared.h b/xen/include/arch-x86/asm/shared.h
similarity index 100%
rename from xen/include/asm-x86/shared.h
rename to xen/include/arch-x86/asm/shared.h
diff --git a/xen/include/asm-x86/smp.h b/xen/include/arch-x86/asm/smp.h
similarity index 100%
rename from xen/include/asm-x86/smp.h
rename to xen/include/arch-x86/asm/smp.h
diff --git a/xen/include/asm-x86/softirq.h b/xen/include/arch-x86/asm/softirq.h
similarity index 100%
rename from xen/include/asm-x86/softirq.h
rename to xen/include/arch-x86/asm/softirq.h
diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/arch-x86/asm/spec_ctrl.h
similarity index 100%
rename from xen/include/asm-x86/spec_ctrl.h
rename to xen/include/arch-x86/asm/spec_ctrl.h
diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/arch-x86/asm/spec_ctrl_asm.h
similarity index 100%
rename from xen/include/asm-x86/spec_ctrl_asm.h
rename to xen/include/arch-x86/asm/spec_ctrl_asm.h
diff --git a/xen/include/asm-x86/spinlock.h b/xen/include/arch-x86/asm/spinlock.h
similarity index 100%
rename from xen/include/asm-x86/spinlock.h
rename to xen/include/arch-x86/asm/spinlock.h
diff --git a/xen/include/asm-x86/string.h b/xen/include/arch-x86/asm/string.h
similarity index 100%
rename from xen/include/asm-x86/string.h
rename to xen/include/arch-x86/asm/string.h
diff --git a/xen/include/asm-x86/system.h b/xen/include/arch-x86/asm/system.h
similarity index 100%
rename from xen/include/asm-x86/system.h
rename to xen/include/arch-x86/asm/system.h
diff --git a/xen/include/asm-x86/tboot.h b/xen/include/arch-x86/asm/tboot.h
similarity index 100%
rename from xen/include/asm-x86/tboot.h
rename to xen/include/arch-x86/asm/tboot.h
diff --git a/xen/include/asm-x86/time.h b/xen/include/arch-x86/asm/time.h
similarity index 100%
rename from xen/include/asm-x86/time.h
rename to xen/include/arch-x86/asm/time.h
diff --git a/xen/include/asm-x86/trace.h b/xen/include/arch-x86/asm/trace.h
similarity index 100%
rename from xen/include/asm-x86/trace.h
rename to xen/include/arch-x86/asm/trace.h
diff --git a/xen/include/asm-x86/traps.h b/xen/include/arch-x86/asm/traps.h
similarity index 100%
rename from xen/include/asm-x86/traps.h
rename to xen/include/arch-x86/asm/traps.h
diff --git a/xen/include/asm-x86/types.h b/xen/include/arch-x86/asm/types.h
similarity index 100%
rename from xen/include/asm-x86/types.h
rename to xen/include/arch-x86/asm/types.h
diff --git a/xen/include/asm-x86/uaccess.h b/xen/include/arch-x86/asm/uaccess.h
similarity index 100%
rename from xen/include/asm-x86/uaccess.h
rename to xen/include/arch-x86/asm/uaccess.h
diff --git a/xen/include/asm-x86/unaligned.h b/xen/include/arch-x86/asm/unaligned.h
similarity index 100%
rename from xen/include/asm-x86/unaligned.h
rename to xen/include/arch-x86/asm/unaligned.h
diff --git a/xen/include/asm-x86/vm_event.h b/xen/include/arch-x86/asm/vm_event.h
similarity index 100%
rename from xen/include/asm-x86/vm_event.h
rename to xen/include/arch-x86/asm/vm_event.h
diff --git a/xen/include/asm-x86/vpmu.h b/xen/include/arch-x86/asm/vpmu.h
similarity index 100%
rename from xen/include/asm-x86/vpmu.h
rename to xen/include/arch-x86/asm/vpmu.h
diff --git a/xen/include/asm-x86/x86-defns.h b/xen/include/arch-x86/asm/x86-defns.h
similarity index 100%
rename from xen/include/asm-x86/x86-defns.h
rename to xen/include/arch-x86/asm/x86-defns.h
diff --git a/xen/include/asm-x86/x86-vendors.h b/xen/include/arch-x86/asm/x86-vendors.h
similarity index 100%
rename from xen/include/asm-x86/x86-vendors.h
rename to xen/include/arch-x86/asm/x86-vendors.h
diff --git a/xen/include/asm-x86/x86_64/efibind.h b/xen/include/arch-x86/asm/x86_64/efibind.h
similarity index 100%
rename from xen/include/asm-x86/x86_64/efibind.h
rename to xen/include/arch-x86/asm/x86_64/efibind.h
diff --git a/xen/include/asm-x86/x86_64/elf.h b/xen/include/arch-x86/asm/x86_64/elf.h
similarity index 100%
rename from xen/include/asm-x86/x86_64/elf.h
rename to xen/include/arch-x86/asm/x86_64/elf.h
diff --git a/xen/include/asm-x86/x86_64/page.h b/xen/include/arch-x86/asm/x86_64/page.h
similarity index 100%
rename from xen/include/asm-x86/x86_64/page.h
rename to xen/include/arch-x86/asm/x86_64/page.h
diff --git a/xen/include/asm-x86/x86_64/regs.h b/xen/include/arch-x86/asm/x86_64/regs.h
similarity index 100%
rename from xen/include/asm-x86/x86_64/regs.h
rename to xen/include/arch-x86/asm/x86_64/regs.h
diff --git a/xen/include/asm-x86/x86_64/system.h b/xen/include/arch-x86/asm/x86_64/system.h
similarity index 100%
rename from xen/include/asm-x86/x86_64/system.h
rename to xen/include/arch-x86/asm/x86_64/system.h
diff --git a/xen/include/asm-x86/x86_64/uaccess.h b/xen/include/arch-x86/asm/x86_64/uaccess.h
similarity index 100%
rename from xen/include/asm-x86/x86_64/uaccess.h
rename to xen/include/arch-x86/asm/x86_64/uaccess.h
diff --git a/xen/include/asm-x86/x86_emulate.h b/xen/include/arch-x86/asm/x86_emulate.h
similarity index 100%
rename from xen/include/asm-x86/x86_emulate.h
rename to xen/include/arch-x86/asm/x86_emulate.h
diff --git a/xen/include/asm-x86/xenoprof.h b/xen/include/arch-x86/asm/xenoprof.h
similarity index 100%
rename from xen/include/asm-x86/xenoprof.h
rename to xen/include/arch-x86/asm/xenoprof.h
diff --git a/xen/include/asm-x86/xstate.h b/xen/include/arch-x86/asm/xstate.h
similarity index 100%
rename from xen/include/asm-x86/xstate.h
rename to xen/include/arch-x86/asm/xstate.h
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
index 088c238a504a..e03ae4e74ee3 100644
--- a/xen/include/xen/acpi.h
+++ b/xen/include/xen/acpi.h
@@ -40,8 +40,8 @@
 #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/asm/fixmap.h
+ * or arch-arm/asm/config.h, 64 pages(256KB) is large enough for most cases.)
  */
 #define NUM_FIXMAP_ACPI_PAGES  64
 
diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h
index 634a259645fb..6d69c72c2e03 100644
--- a/xen/include/xen/bitmap.h
+++ b/xen/include/xen/bitmap.h
@@ -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 include/arch-<arch>/asm/bitops.h headers
  * and other arch/<arch> specific files.
  *
  * See lib/bitmap.c for more details.
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 19/31] build: rework .banner generation
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (17 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm Anthony PERARD
@ 2021-07-01 14:09 ` Anthony PERARD
  2021-08-05  7:09   ` Jan Beulich
  2021-07-01 14:10 ` [XEN PATCH v6 20/31] build: generate "include/xen/compile.h" with filechk Anthony PERARD
                   ` (11 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:09 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

Avoid depending on Makefile but still allow to rebuild the banner when
$(XEN_FULLVERSION) changes.

Also add a dependency on tools/xen.flf, even if not expected to
change.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Makefile | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 7e3e4c42d77b..267ae77aef7a 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -399,13 +399,19 @@ delete-unfresh-files:
 		rm -f include/xen/compile.h; \
 	fi
 
-.banner: Makefile
-	@if which figlet >/dev/null 2>&1 ; then \
-		echo " Xen $(XEN_FULLVERSION)" | figlet -f tools/xen.flf > $@.tmp; \
-	else \
-		echo " Xen $(XEN_FULLVERSION)" > $@.tmp; \
-	fi
-	@mv -f $@.tmp $@
+quiet_cmd_banner = BANNER  $@
+define cmd_banner
+    if which figlet >/dev/null 2>&1 ; then \
+	echo " Xen $(XEN_FULLVERSION)" | figlet -f $< > $@.tmp; \
+    else \
+	echo " Xen $(XEN_FULLVERSION)" > $@.tmp; \
+    fi; \
+    mv -f $@.tmp $@
+endef
+
+.banner: tools/xen.flf FORCE
+	$(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
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 20/31] build: generate "include/xen/compile.h" with filechk
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (18 preceding siblings ...)
  2021-07-01 14:09 ` [XEN PATCH v6 19/31] build: rework .banner generation Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-08-05  7:20   ` Jan Beulich
  2021-07-01 14:10 ` [XEN PATCH v6 21/31] build: set XEN_BUILD_EFI earlier Anthony PERARD
                   ` (10 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

This will always try regenerate the content of compile.h, but if it
didn't change the file isn't updated.

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

This patch imports the macro 'filechk' from Linux v5.12.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Makefile               | 51 +++++++++++++++++++-------------------
 xen/scripts/Kbuild.include | 31 +++++++++++++++++++++++
 2 files changed, 56 insertions(+), 26 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 267ae77aef7a..4c4990a753df 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -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 include/arch-*/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 < $< > $@.new
 	mv $@.new $@
 
-$(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 include/arch-$(TARGET_ARCH)/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,22 +405,29 @@ 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' \
-	    -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' \
-	    < include/xen/compile.h.in > $@.new
+# Don't refresh this files during e.g., 'sudo make install'
+define filechk_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' \
+	< $<; \
+    sed -rf tools/process-banner.sed < .banner; \
+    else \
+	cat $@; \
+    fi
+endef
+
+include/xen/compile.h: include/xen/compile.h.in .banner FORCE
 	@cat .banner
-	@sed -rf tools/process-banner.sed < .banner >> $@.new
-	@mv -f $@.new $@
+	$(call filechk,compile.h)
 
 asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include
index 83c7e1457baa..838c9440f35e 100644
--- a/xen/scripts/Kbuild.include
+++ b/xen/scripts/Kbuild.include
@@ -26,6 +26,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) ); }' \
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 21/31] build: set XEN_BUILD_EFI earlier
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (19 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 20/31] build: generate "include/xen/compile.h" with filechk Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-08-05  7:27   ` Jan Beulich
  2021-07-01 14:10 ` [XEN PATCH v6 22/31] build: fix $(TARGET).efi creation in arch/arm Anthony PERARD
                   ` (9 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Jan Beulich, Andrew Cooper, Roger Pau Monné,
	Wei Liu, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini

We are going to need the variable XEN_BUILD_EFI earlier.

This early check is using "try-run" to allow to have a temporary
output file in case it is needed for $(CC) to build the *.c file.

The "efi/check.o" file is still needed in "arch/x86/Makefile" so the
check is currently duplicated.

This patch imports the macro "try-run" from Linux v5.12.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/x86/Makefile      |  2 +-
 xen/arch/x86/arch.mk       |  5 +++++
 xen/scripts/Kbuild.include | 17 +++++++++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index bb446a1b928d..d3e38e4e9f02 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -126,7 +126,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 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)
+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.
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 9f5fade39e91..5a4a1704636f 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -60,5 +60,10 @@ ifeq ($(CONFIG_UBSAN),y)
 $(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
 endif
 
+ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
+# Check if the compiler supports the MS ABI.
+export XEN_BUILD_EFI := $(call try-run,$(CC) $(CFLAGS) -c arch/x86/efi/check.c -o "$$TMPO",y)
+endif
+
 # Set up the assembler include path properly for older toolchains.
 CFLAGS += -Wa,-I$(BASEDIR)/include
diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include
index 838c9440f35e..5fe13a7c5abd 100644
--- a/xen/scripts/Kbuild.include
+++ b/xen/scripts/Kbuild.include
@@ -57,6 +57,23 @@ define filechk
 	fi
 endef
 
+# output directory for tests below
+TMPOUT = .tmp_$$$$
+
+# try-run
+# Usage: option = $(call try-run, $(CC)...-o "$$TMP",option-ok,otherwise)
+# Exit code chooses option. "$$TMP" serves as a temporary file and is
+# automatically cleaned up.
+try-run = $(shell set -e;		\
+	TMP=$(TMPOUT)/tmp;		\
+	TMPO=$(TMPOUT)/tmp.o;		\
+	mkdir -p $(TMPOUT);		\
+	trap "rm -rf $(TMPOUT)" EXIT;	\
+	if ($(1)) >/dev/null 2>&1;	\
+	then echo "$(2)";		\
+	else echo "$(3)";		\
+	fi)
+
 # 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) ); }' \
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 22/31] build: fix $(TARGET).efi creation in arch/arm
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (20 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 21/31] build: set XEN_BUILD_EFI earlier Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-07-01 14:10 ` [XEN PATCH v6 23/31] build: fix arch/x86/node.o rule Anthony PERARD
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Stefano Stabellini, Julien Grall, Volodymyr Babchuk

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

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/arm/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index cc90d9796e6e..dc1d09c8b429 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -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) $@.efi
 endif
 
 ifeq ($(CONFIG_LTO),y)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 23/31] build: fix arch/x86/node.o rule
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (21 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 22/31] build: fix $(TARGET).efi creation in arch/arm Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-07-07 16:04   ` Jan Beulich
  2021-07-01 14:10 ` [XEN PATCH v6 24/31] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile Anthony PERARD
                   ` (7 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Jan Beulich, Andrew Cooper, Roger Pau Monné,
	Wei Liu

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

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/x86/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index d3e38e4e9f02..d84062f48dfa 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -199,7 +199,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 $@.bin
+	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $< $@.bin
 	$(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 \
 		--rename-section=.data=.note.gnu.build-id -S $@.bin $@
 	rm -f $@.bin
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 24/31] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (22 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 23/31] build: fix arch/x86/node.o rule Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-07-01 14:10 ` [XEN PATCH v6 25/31] build: remove unneeded deps of x86_emulate.o Anthony PERARD
                   ` (6 subsequent siblings)
  30 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Volodymyr Babchuk, Roger Pau Monné

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.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Makefile          | 41 ++++++++++++++++++++++++++++++++++++++++-
 xen/Rules.mk          | 13 -------------
 xen/arch/arm/Makefile | 31 ++++---------------------------
 xen/arch/arm/arch.mk  |  2 ++
 xen/arch/x86/Makefile | 27 +++++----------------------
 xen/arch/x86/arch.mk  |  2 ++
 6 files changed, 53 insertions(+), 63 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 4c4990a753df..fd002ecd52d0 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -269,8 +269,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)
@@ -378,7 +391,8 @@ $(TARGET).gz: $(TARGET)
 	gzip -n -f -9 < $< > $@.new
 	mv $@.new $@
 
-$(TARGET): FORCE
+PHONY += prepare
+prepare:
 	$(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]); \
@@ -389,6 +403,31 @@ $(TARGET): FORCE
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C include
 	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) include
 	$(MAKE) -f $(BASEDIR)/Rules.mk include/arch-$(TARGET_ARCH)/asm/asm-offsets.h
+
+$(ALL_OBJS) $(ALL_LIBS): prepare
+
+# 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) $@
 
 quiet_cmd_banner = BANNER  $@
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 894f2b83a04e..530aefa43ad9 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -11,25 +11,12 @@ 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
-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)) \
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index dc1d09c8b429..067c0d9844e4 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -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) $@.efi
 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 \
diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk
index f54e602301be..8a2b202f698e 100644
--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -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)
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index d84062f48dfa..3bd302d28ccf 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -161,37 +161,20 @@ endif # $(XEN_BUILD_PE)
 
 endif # $(efi-y)
 
-ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
-
-ifeq ($(CONFIG_LTO),y)
-# 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 \
@@ -242,7 +225,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
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 5a4a1704636f..c95caa303db8 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -67,3 +67,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)
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 25/31] build: remove unneeded deps of x86_emulate.o
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (23 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 24/31] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-08-06 16:06   ` Jan Beulich
  2021-07-01 14:10 ` [XEN PATCH v6 26/31] build: clean common temporary files from root makefile Anthony PERARD
                   ` (5 subsequent siblings)
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Jan Beulich, Andrew Cooper, Roger Pau Monné,
	Wei Liu

Those two dependencies already exist so make doesn't need to know
about them. The dependency will be generated by $(CC).

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/x86/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 3bd302d28ccf..fc719247eac9 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -84,7 +84,6 @@ extra-y += xen.lds
 ifneq ($(CONFIG_HVM),y)
 x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif
-x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
 
 efi-y := $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \
                       -O $(BASEDIR)/include/xen/compile.h ]; then \
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 26/31] build: clean common temporary files from root makefile
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (24 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 25/31] build: remove unneeded deps of x86_emulate.o Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-07-01 14:10 ` [XEN PATCH v6 27/31] build: prepare to always invoke $(MAKE) from xen/, use $(obj) Anthony PERARD
                   ` (4 subsequent siblings)
  30 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Makefile               | 1 +
 xen/scripts/Makefile.clean | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index fd002ecd52d0..6aac68750b4d 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -378,6 +378,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 include/arch-*/asm/asm-offsets.h
diff --git a/xen/scripts/Makefile.clean b/xen/scripts/Makefile.clean
index 027c200c0efc..b6df9e861e6e 100644
--- a/xen/scripts/Makefile.clean
+++ b/xen/scripts/Makefile.clean
@@ -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
 # ---------------------------------------------------------------------------
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 27/31] build: prepare to always invoke $(MAKE) from xen/, use $(obj)
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (25 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 26/31] build: clean common temporary files from root makefile Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-07-01 14:10 ` [XEN PATCH v6 28/31] build: rework test/livepatch/Makefile Anthony PERARD
                   ` (3 subsequent siblings)
  30 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Volodymyr Babchuk, Roger Pau Monné,
	Daniel De Graaf, Daniel P. Smith

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.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Rules.mk                            |  5 ++-
 xen/arch/arm/Makefile                   | 14 +++---
 xen/arch/x86/Makefile                   | 60 ++++++++++++-------------
 xen/arch/x86/boot/Makefile              | 14 +++---
 xen/arch/x86/efi/Makefile               |  6 +--
 xen/common/Makefile                     |  8 ++--
 xen/common/libelf/Makefile              |  4 +-
 xen/common/libfdt/Makefile              |  6 +--
 xen/include/Makefile                    | 44 +++++++++---------
 xen/scripts/Makefile.clean              |  5 ++-
 xen/xsm/flask/Makefile                  | 34 +++++++-------
 xen/xsm/flask/policy/mkaccess_vector.sh |  7 ++-
 12 files changed, 108 insertions(+), 99 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 530aefa43ad9..0f8d90844455 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -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
@@ -23,7 +26,7 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \
                                             rodata.cst$(a)) \
                          $(foreach r,rel rel.ro,data.$(r).local)
 
-include Makefile
+include $(src)/Makefile
 
 # Linking
 # ---------------------------------------------------------------------------
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 067c0d9844e4..9f9c73aa6c5d 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -88,18 +88,18 @@ ifeq ($(CONFIG_ARM_64),y)
 	ln -sf $(@F) $@.efi
 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
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index fc719247eac9..2cc67d6e0e84 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -82,7 +82,7 @@ extra-y += asm-macros.i
 extra-y += xen.lds
 
 ifneq ($(CONFIG_HVM),y)
-x86_emulate.o: CFLAGS-y += -Wno-unused-label
+$(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
 endif
 
 efi-y := $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \
@@ -113,8 +113,8 @@ syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS) :=
 syms-warn-dup-$(CONFIG_ENFORCE_UNIQUE_SYMBOLS) := --error-dup
 
 $(TARGET): TMP = $(@D)/.$(@F).elf32
-$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
-	./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET) \
+$(TARGET): $(TARGET)-syms $(efi-y) $(obj)/boot/mkelf32
+	$(obj)/boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TMP) $(XEN_IMG_OFFSET) \
 	               `$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$$/0x\1/p'`
 	od -t x4 -N 8192 $(TMP)  | grep 1badb002 > /dev/null || \
 		{ echo "No Multiboot1 header found" >&2; false; }
@@ -125,29 +125,29 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
 ifneq ($(efi-y),)
 
 # Check if the compiler supports the MS ABI.
-XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c efi/check.c -o efi/check.o 2>/dev/null && echo y)
+XEN_BUILD_EFI := $(shell $(CC) $(XEN_CFLAGS) -c $(src)/efi/check.c -o $(obj)/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))
+XEN_BUILD_PE := $(if $(XEN_BUILD_EFI),$(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o $(obj)/efi/check.efi $(obj)/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)
+XEN_BUILD_PE := $(call ld-option,$(EFI_LDFLAGS) --image-base=0x100000000 -o $(obj)/efi/check.efi $(obj)/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)
+nr-fixups := $(shell $(OBJDUMP) -p $(obj)/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
+MKRELOC := $(obj)/efi/mkreloc
+relocs-dummy := $(obj)/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.
@@ -160,27 +160,27 @@ endif # $(XEN_BUILD_PE)
 
 endif # $(efi-y)
 
-$(TARGET)-syms: $(BASEDIR)/prelink.o xen.lds
-	$(LD) $(XEN_LDFLAGS) -T xen.lds -N $< $(build_id_linker) \
+$(TARGET)-syms: $(BASEDIR)/prelink.o $(obj)/xen.lds
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
 	$(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 $< $(build_id_linker) \
+	$(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
-	$(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 \
 		>$(@D)/$(@F).map
 	rm -f $(@D)/.$(@F).[0-9]* $(@D)/..$(@F).[0-9]*
 
-note.o: $(TARGET)-syms
+$(obj)/note.o: $(TARGET)-syms
 	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $< $@.bin
 	$(OBJCOPY) -I binary -O elf64-x86-64 -B i386:x86-64 \
 		--rename-section=.data=.note.gnu.build-id -S $@.bin $@
@@ -199,23 +199,23 @@ ifdef SOURCE_DATE_EPOCH
 EFI_LDFLAGS += --no-insert-timestamp
 endif
 
-$(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p')
+$(TARGET).efi: VIRT_BASE = 0x$(shell $(NM) $(obj)/efi/relocs-dummy.o | sed -n 's, A VIRT_START$$,,p')
 ifeq ($(MKRELOC),:)
 $(TARGET).efi: ALT_BASE :=
 else
-$(TARGET).efi: ALT_BASE = 0x$(shell $(NM) efi/relocs-dummy.o | sed -n 's, A ALT_START$$,,p')
+$(TARGET).efi: ALT_BASE = 0x$(shell $(NM) $(obj)/efi/relocs-dummy.o | sed -n 's, A ALT_START$$,,p')
 endif
 
 ifneq ($(build_id_linker),)
 ifeq ($(call ld-ver-build-id,$(LD) $(filter -m%,$(EFI_LDFLAGS))),y)
 CFLAGS-y += -DBUILD_ID_EFI
 EFI_LDFLAGS += $(build_id_linker)
-note_file := efi/buildid.o
+note_file := $(obj)/efi/buildid.o
 # NB: this must be the last input in the linker call, because inputs following
 # the -b option will all be treated as being in the specified format.
 note_file_option := -b pe-x86-64 $(note_file)
 else
-note_file := note.o
+note_file := $(obj)/note.o
 endif
 else
 note_file :=
@@ -224,25 +224,25 @@ note_file_option ?= $(note_file)
 
 ifeq ($(XEN_BUILD_PE),y)
 extra-y += efi.lds
-$(TARGET).efi: $(BASEDIR)/prelink.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
+$(TARGET).efi: $(BASEDIR)/prelink.o $(note_file) $(obj)/efi.lds $(obj)/efi/relocs-dummy.o $(obj)/efi/mkreloc
 ifeq ($(CONFIG_DEBUG_INFO),y)
 	$(if $(filter --strip-debug,$(EFI_LDFLAGS)),echo,:) "Will strip debug info from $(@F)"
 endif
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
-	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< $(relocs-dummy) \
+	          $(LD) $(call EFI_LDFLAGS,$(base)) -T $(obj)/efi.lds -N $< $(relocs-dummy) \
 	                $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o $(@D)/.$(@F).$(base).0 &&) :
 	$(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
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
-	          $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< \
+	          $(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
-	$(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T efi.lds -N $< \
+	$(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds -N $< \
 	                $(@D)/.$(@F).1r.o $(@D)/.$(@F).1s.o $(note_file_option) -o $@
 	$(NM) -pa --format=sysv $(@D)/$(@F) \
 		| $(BASEDIR)/tools/symbols --all-symbols --xensyms --sysv --sort >$(@D)/$(@F).map
@@ -253,15 +253,15 @@ $(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
-efi/buildid.o efi/relocs-dummy.o: ;
+$(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o
+$(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ;
 
 .PHONY: include
 include: $(BASEDIR)/include/arch-x86/asm/asm-macros.h
 
-asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
+$(obj)/asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
 
-$(BASEDIR)/include/arch-x86/asm/asm-macros.h: asm-macros.i Makefile
+$(BASEDIR)/include/arch-x86/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile
 	echo '#if 0' >$@.new
 	echo '.if 0' >>$@.new
 	echo '#endif' >>$@.new
@@ -275,14 +275,14 @@ $(BASEDIR)/include/arch-x86/asm/asm-macros.h: asm-macros.i Makefile
 	echo '#endif' >>$@.new
 	$(call move-if-changed,$@.new,$@)
 
-efi.lds: AFLAGS-y += -DEFI
-xen.lds efi.lds: xen.lds.S FORCE
+$(obj)/efi.lds: AFLAGS-y += -DEFI
+$(obj)/xen.lds $(obj)/efi.lds: $(src)/xen.lds.S FORCE
 	$(call if_changed,cpp_lds_S)
 
-boot/mkelf32: boot/mkelf32.c
+$(obj)/boot/mkelf32: $(src)/boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
 
-efi/mkreloc: efi/mkreloc.c
+$(obj)/efi/mkreloc: $(src)/efi/mkreloc.c
 	$(HOSTCC) $(HOSTCFLAGS) -g -o $@ $<
 
 .PHONY: clean
diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 9b31bfcbfb8a..53d357489df2 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -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)"
diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 87b927ed865b..ac815f02cb5e 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -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))
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 93df3178b71f..0d5509583427 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -75,15 +75,15 @@ 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
 
 quiet_cmd_binfile = BINFILE $@
-cmd_binfile = $(SHELL) $< $@ config.gz xen_config_data
+cmd_binfile = $(SHELL) $< $@ $(obj)/config.gz xen_config_data
 
-config_data.S: $(BASEDIR)/tools/binfile FORCE
+$(obj)/config_data.S: $(BASEDIR)/tools/binfile FORCE
 	$(call if_changed,binfile)
 targets += config_data.S
 
diff --git a/xen/common/libelf/Makefile b/xen/common/libelf/Makefile
index a92326c982e9..8a4522e4e141 100644
--- a/xen/common/libelf/Makefile
+++ b/xen/common/libelf/Makefile
@@ -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)
diff --git a/xen/common/libfdt/Makefile b/xen/common/libfdt/Makefile
index 6bd207cf8ffa..6708af12e583 100644
--- a/xen/common/libfdt/Makefile
+++ b/xen/common/libfdt/Makefile
@@ -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)
diff --git a/xen/include/Makefile b/xen/include/Makefile
index 9feb57545ef1..a969e76ddcad 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -39,57 +39,57 @@ 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)
+public-$(CONFIG_X86) := $(wildcard $(src)/public/arch-x86/*.h $(src)/public/arch-x86/*/*.h)
+public-$(CONFIG_ARM) := $(wildcard $(src)/public/arch-arm/*.h $(src)/public/arch-arm/*/*.h)
 
 .PHONY: all
-all: $(headers-y)
+all: $(addprefix $(obj)/,$(headers-y))
 
-compat/%.h: compat/%.i $(BASEDIR)/tools/compat-build-header.py
-	$(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $@ >>$@.new; \
+$(obj)/compat/%.h: $(obj)/compat/%.i $(BASEDIR)/tools/compat-build-header.py
+	$(PYTHON) $(BASEDIR)/tools/compat-build-header.py <$< $(patsubst $(obj)/%,%,$@) >>$@.new; \
 	mv -f $@.new $@
 
-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 $(BASEDIR)/tools/compat-build-source.py
+$(obj)/compat/%.c: $(src)/public/%.h $(src)/xlat.lst $(BASEDIR)/tools/compat-build-source.py
 	mkdir -p $(@D)
-	$(PYTHON) $(BASEDIR)/tools/compat-build-source.py xlat.lst <$< >$@.new
+	$(PYTHON) $(BASEDIR)/tools/compat-build-source.py $(src)/xlat.lst <$< >$@.new
 	mv -f $@.new $@
 
-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 >$@.new
 	mv -f $@.new $@
 
-.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' >$@.new
 	$(call move-if-changed,$@.new,$@)
 
-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,$^) >$@.new
 	mv -f $@.new $@
 
 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-y))
+PUBLIC_HEADERS := $(filter-out $(src)/public/arch-% $(src)/public/dom0_ops.h, $(wildcard $(src)/public/*.h $(src)/public/*/*.h) $(public-y))
 
-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; \
@@ -97,7 +97,7 @@ headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
 	done >$@.new
 	mv $@.new $@
 
-headers99.chk: $(PUBLIC_C99_HEADERS) Makefile
+$(obj)/headers99.chk: $(PUBLIC_C99_HEADERS) $(src)/Makefile
 	rm -f $@.new
 	$(foreach i, $(filter %.h,$^),                                        \
 	    echo "#include "\"$(i)\"                                          \
@@ -107,7 +107,7 @@ headers99.chk: $(PUBLIC_C99_HEADERS) Makefile
 	    || exit $$?; echo $(i) >> $@.new;)
 	mv $@.new $@
 
-headers++.chk: $(PUBLIC_HEADERS) Makefile
+$(obj)/headers++.chk: $(PUBLIC_HEADERS) $(src)/Makefile
 	rm -f $@.new
 	if ! $(CXX) -v >/dev/null 2>&1; then                                  \
 	    touch $@.new;                                                     \
@@ -116,7 +116,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) >> $@.new;)
 	mv $@.new $@
@@ -126,7 +126,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
diff --git a/xen/scripts/Makefile.clean b/xen/scripts/Makefile.clean
index b6df9e861e6e..36b7e7e92f93 100644
--- a/xen/scripts/Makefile.clean
+++ b/xen/scripts/Makefile.clean
@@ -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
 # ==========================================================================
diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index 0ad15cb16606..3ea726d66f8b 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -4,48 +4,48 @@ 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
 
 quiet_cmd_binfile = BINFILE $@
-cmd_binfile = $(SHELL) $< -i $@ policy.bin xsm_flask_init_policy
+cmd_binfile = $(SHELL) $< -i $@ $(obj)/policy.bin xsm_flask_init_policy
 
-flask-policy.S: $(BASEDIR)/tools/binfile FORCE
+$(obj)/flask-policy.S: $(BASEDIR)/tools/binfile FORCE
 	$(call if_changed,binfile)
 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) $@
 
diff --git a/xen/xsm/flask/policy/mkaccess_vector.sh b/xen/xsm/flask/policy/mkaccess_vector.sh
index 942ede4713f1..ad9772193bff 100755
--- a/xen/xsm/flask/policy/mkaccess_vector.sh
+++ b/xen/xsm/flask/policy/mkaccess_vector.sh
@@ -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	{
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 28/31] build: rework test/livepatch/Makefile
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (26 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 27/31] build: prepare to always invoke $(MAKE) from xen/, use $(obj) Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-07-01 14:10 ` [XEN PATCH v6 29/31] build: build everything from the root dir, use obj=$subdir Anthony PERARD
                   ` (2 subsequent siblings)
  30 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Konrad Rzeszutek Wilk, Ross Lagerwall

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 $@.bin 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.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/scripts/Kbuild.include  |   9 ++
 xen/test/livepatch/Makefile | 213 ++++++++++++++----------------------
 2 files changed, 91 insertions(+), 131 deletions(-)

diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include
index 5fe13a7c5abd..7cb55b181dcb 100644
--- a/xen/scripts/Kbuild.include
+++ b/xen/scripts/Kbuild.include
@@ -199,3 +199,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
diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile
index 148dddb90473..e59245323e92 100644
--- a/xen/test/livepatch/Makefile
+++ b/xen/test/livepatch/Makefile
@@ -12,81 +12,29 @@ 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
-
-LIVEPATCH := xen_hello_world.livepatch
-LIVEPATCH_BYE := xen_bye_world.livepatch
-LIVEPATCH_REPLACE := xen_replace_world.livepatch
-LIVEPATCH_NOP := xen_nop.livepatch
-LIVEPATCH_NO_XEN_BUILDID := xen_no_xen_buildid.livepatch
-LIVEPATCH_PREPOST_HOOKS := xen_prepost_hooks.livepatch
-LIVEPATCH_PREPOST_HOOKS_FAIL := xen_prepost_hooks_fail.livepatch
-LIVEPATCH_ACTION_HOOKS := xen_action_hooks.livepatch
-LIVEPATCH_ACTION_HOOKS_NOFUNC := xen_action_hooks_nofunc.livepatch
-LIVEPATCH_ACTION_HOOKS_MARKER:= xen_action_hooks_marker.livepatch
-LIVEPATCH_ACTION_HOOKS_NOAPPLY:= xen_action_hooks_noapply.livepatch
-LIVEPATCH_ACTION_HOOKS_NOREVERT:= xen_action_hooks_norevert.livepatch
-LIVEPATCH_EXPECTATIONS:= xen_expectations.livepatch
-LIVEPATCH_EXPECTATIONS_FAIL:= xen_expectations_fail.livepatch
-
-LIVEPATCHES += $(LIVEPATCH)
-LIVEPATCHES += $(LIVEPATCH_BYE)
-LIVEPATCHES += $(LIVEPATCH_REPLACE)
-LIVEPATCHES += $(LIVEPATCH_NOP)
-LIVEPATCHES += $(LIVEPATCH_NO_XEN_BUILDID)
-LIVEPATCHES += $(LIVEPATCH_PREPOST_HOOKS)
-LIVEPATCHES += $(LIVEPATCH_PREPOST_HOOKS_FAIL)
-LIVEPATCHES += $(LIVEPATCH_ACTION_HOOKS)
-LIVEPATCHES += $(LIVEPATCH_ACTION_HOOKS_NOFUNC)
-LIVEPATCHES += $(LIVEPATCH_ACTION_HOOKS_MARKER)
-LIVEPATCHES += $(LIVEPATCH_ACTION_HOOKS_NOAPPLY)
-LIVEPATCHES += $(LIVEPATCH_ACTION_HOOKS_NOREVERT)
-LIVEPATCHES += $(LIVEPATCH_EXPECTATIONS)
-LIVEPATCHES += $(LIVEPATCH_EXPECTATIONS_FAIL)
-
-LIVEPATCH_DEBUG_DIR ?= $(DEBUG_DIR)/xen-livepatch
-
 build default: livepatch
 
-install: livepatch
-	$(INSTALL_DIR) $(DESTDIR)$(LIVEPATCH_DEBUG_DIR)
-	$(INSTALL_DATA) $(LIVEPATCHES) $(DESTDIR)$(LIVEPATCH_DEBUG_DIR)
-
-uninstall:
-	cd $(DESTDIR)$(LIVEPATCH_DEBUG_DIR) && rm -f $(LIVEPATCHES)
-
-.PHONY: clean
-clean::
-	rm -f *.o .*.o.d *.livepatch config.h expect_config.h
+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
 
 #
 # To compute these values we need the binary files: xen-syms
 # and xen_hello_world_func.o to be already compiled.
 #
-.PHONY: config.h
-config.h: OLD_CODE_SZ=$(call CODE_SZ,$(BASEDIR)/xen-syms,xen_extra_version)
-config.h: NEW_CODE_SZ=$(call CODE_SZ,$<,xen_hello_world)
-config.h: MINOR_VERSION_SZ=$(call CODE_SZ,$(BASEDIR)/xen-syms,xen_minor_version)
-config.h: MINOR_VERSION_ADDR=$(call CODE_ADDR,$(BASEDIR)/xen-syms,xen_minor_version)
-config.h: xen_hello_world_func.o
+$(obj)/config.h: $(obj)/xen_hello_world_func.o
 	(set -e; \
-	 echo "#define NEW_CODE_SZ $(NEW_CODE_SZ)"; \
-	 echo "#define MINOR_VERSION_SZ $(MINOR_VERSION_SZ)"; \
-	 echo "#define MINOR_VERSION_ADDR $(MINOR_VERSION_ADDR)"; \
-	 echo "#define OLD_CODE_SZ $(OLD_CODE_SZ)") > $@
+	 echo "#define NEW_CODE_SZ $(call CODE_SZ,$<,xen_hello_world)"; \
+	 echo "#define MINOR_VERSION_SZ $(call CODE_SZ,$(BASEDIR)/xen-syms,xen_minor_version)"; \
+	 echo "#define MINOR_VERSION_ADDR $(call CODE_ADDR,$(BASEDIR)/xen-syms,xen_minor_version)"; \
+	 echo "#define OLD_CODE_SZ $(call CODE_SZ,$(BASEDIR)/xen-syms,xen_extra_version)") > $@
 
-xen_hello_world.o: config.h
-
-.PHONY: $(LIVEPATCH)
-$(LIVEPATCH): xen_hello_world_func.o xen_hello_world.o note.o xen_note.o modinfo.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH) $^
-
-.PHONY: modinfo.o
-modinfo.o:
+$(obj)/modinfo.o:
 	(set -e; \
 	 printf "LIVEPATCH_RULEZ\0") > $@.bin
 	$(OBJCOPY) $(OBJCOPY_MAGIC) \
 		   --rename-section=.data=.modinfo,alloc,load,readonly,data,contents -S $@.bin $@
-	#rm -f $@.bin
+	rm -f $@.bin
 
 #
 # This target is only accessible if CONFIG_LIVEPATCH is defined, which
@@ -97,9 +45,8 @@ modinfo.o:
 # not be built (it is for EFI builds), and that we do not have
 # the note.o.bin to muck with (as it gets deleted)
 #
-.PHONY: note.o
-note.o:
-	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $(BASEDIR)/xen-syms $@.bin
+$(obj)/note.o: $(BASEDIR)/xen-syms
+	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $< $@.bin
 	$(OBJCOPY) $(OBJCOPY_MAGIC) \
 		   --rename-section=.data=.livepatch.depends,alloc,load,readonly,data,contents -S $@.bin $@
 	rm -f $@.bin
@@ -108,9 +55,8 @@ note.o:
 # Append .livepatch.xen_depends section
 # with Xen build-id derived from xen-syms.
 #
-.PHONY: xen_note.o
-xen_note.o:
-	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $(BASEDIR)/xen-syms $@.bin
+$(obj)/xen_note.o: $(BASEDIR)/xen-syms
+	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $< $@.bin
 	$(OBJCOPY) $(OBJCOPY_MAGIC) \
 		   --rename-section=.data=.livepatch.xen_depends,alloc,load,readonly,data,contents -S $@.bin $@
 	rm -f $@.bin
@@ -119,102 +65,107 @@ xen_note.o:
 # Extract the build-id of the xen_hello_world.livepatch
 # (which xen_bye_world will depend on).
 #
-.PHONY: hello_world_note.o
-hello_world_note.o: $(LIVEPATCH)
-	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $(LIVEPATCH) $@.bin
+$(obj)/hello_world_note.o: $(obj)/xen_hello_world.livepatch
+	$(OBJCOPY) -O binary --only-section=.note.gnu.build-id $< $@.bin
 	$(OBJCOPY) $(OBJCOPY_MAGIC) \
 		   --rename-section=.data=.livepatch.depends,alloc,load,readonly,data,contents -S $@.bin $@
 	rm -f $@.bin
 
-xen_bye_world.o: config.h
 
-.PHONY: $(LIVEPATCH_BYE)
-$(LIVEPATCH_BYE): xen_bye_world_func.o xen_bye_world.o hello_world_note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_BYE) $^
+extra-y += xen_bye_world.livepatch
+xen_bye_world-objs := xen_bye_world_func.o xen_bye_world.o hello_world_note.o xen_note.o
+$(obj)/xen_bye_world.o: $(obj)/config.h
 
-xen_replace_world.o: config.h
 
-.PHONY: $(LIVEPATCH_REPLACE)
-$(LIVEPATCH_REPLACE): xen_replace_world_func.o xen_replace_world.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_REPLACE) $^
+extra-y += xen_replace_world.livepatch
+xen_replace_world-objs := xen_replace_world_func.o xen_replace_world.o note.o xen_note.o
+$(obj)/xen_replace_world.o: $(obj)/config.h
 
-xen_nop.o: config.h
 
-.PHONY: $(LIVEPATCH_NOP)
-$(LIVEPATCH_NOP): xen_nop.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_NOP) $^
+extra-y += xen_nop.livepatch
+xen_nop-objs := xen_nop.o note.o xen_note.o
+$(obj)/xen_nop.o: $(obj)/config.h
 
 # This one always fails upon upload, because it deliberately
 # does not have a .livepatch.xen_depends (xen_note.o) section.
-xen_no_xen_buildid.o: config.h
-
-.PHONY: $(LIVEPATCH_NO_XEN_BUILDID)
-$(LIVEPATCH_NO_XEN_BUILDID): xen_nop.o note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_NO_XEN_BUILDID) $^
+extra-y += xen_no_xen_buildid.livepatch
+xen_no_xen_buildid-objs := xen_nop.o note.o
 
-xen_prepost_hooks.o: config.h
+$(obj)/xen_prepost_hooks.o: $(obj)/config.h
 
-.PHONY: $(LIVEPATCH_PREPOST_HOOKS)
-$(LIVEPATCH_PREPOST_HOOKS): xen_prepost_hooks.o xen_hello_world_func.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_PREPOST_HOOKS) $^
+extra-y += xen_prepost_hooks.livepatch
+xen_prepost_hooks-objs := xen_prepost_hooks.o xen_hello_world_func.o note.o xen_note.o
 
-xen_prepost_hooks_fail.o: config.h
+$(obj)/xen_prepost_hooks_fail.o: $(obj)/config.h
 
-.PHONY: $(LIVEPATCH_PREPOST_HOOKS_FAIL)
-$(LIVEPATCH_PREPOST_HOOKS_FAIL): xen_prepost_hooks_fail.o xen_hello_world_func.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_PREPOST_HOOKS_FAIL) $^
+extra-y += xen_prepost_hooks_fail.livepatch
+xen_prepost_hooks_fail-objs := xen_prepost_hooks_fail.o xen_hello_world_func.o note.o xen_note.o
 
-xen_action_hooks.o: config.h
+$(obj)/xen_action_hooks.o: $(obj)/config.h
 
-.PHONY: $(LIVEPATCH_ACTION_HOOKS)
-$(LIVEPATCH_ACTION_HOOKS): xen_action_hooks.o xen_hello_world_func.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_ACTION_HOOKS) $^
+extra-y += xen_action_hooks.livepatch
+xen_action_hooks-objs := xen_action_hooks.o xen_hello_world_func.o note.o xen_note.o
 
-xen_action_hooks_nofunc.o: config.h
+$(obj)/xen_action_hooks_nofunc.o: $(obj)/config.h
 
-.PHONY: $(LIVEPATCH_ACTION_HOOKS_NOFUNC)
-$(LIVEPATCH_ACTION_HOOKS_NOFUNC): xen_action_hooks_nofunc.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_ACTION_HOOKS_NOFUNC) $^
+extra-y += xen_action_hooks_nofunc.livepatch
+xen_action_hooks_nofunc-objs := xen_action_hooks_nofunc.o note.o xen_note.o
 
-xen_action_hooks_marker.o: config.h
+$(obj)/xen_action_hooks_marker.o: $(obj)/config.h
 
-.PHONY: $(LIVEPATCH_ACTION_HOOKS_MARKER)
-$(LIVEPATCH_ACTION_HOOKS_MARKER): xen_action_hooks_marker.o xen_hello_world_func.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_ACTION_HOOKS_MARKER) $^
+extra-y += xen_action_hooks_marker.livepatch
+xen_action_hooks_marker-objs := xen_action_hooks_marker.o xen_hello_world_func.o note.o xen_note.o
 
-xen_action_hooks_noapply.o: config.h
+$(obj)/xen_action_hooks_noapply.o: $(obj)/config.h
 
-.PHONY: $(LIVEPATCH_ACTION_HOOKS_NOAPPLY)
-$(LIVEPATCH_ACTION_HOOKS_NOAPPLY): xen_action_hooks_marker.o xen_hello_world_func.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_ACTION_HOOKS_NOAPPLY) $^
+extra-y += xen_action_hooks_noapply.livepatch
+xen_action_hooks_noapply-objs := xen_action_hooks_marker.o xen_hello_world_func.o note.o xen_note.o
 
-xen_action_hooks_norevert.o: config.h
+$(obj)/xen_action_hooks_norevert.o: $(obj)/config.h
 
-.PHONY: $(LIVEPATCH_ACTION_HOOKS_NOREVERT)
-$(LIVEPATCH_ACTION_HOOKS_NOREVERT): xen_action_hooks_marker.o xen_hello_world_func.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_ACTION_HOOKS_NOREVERT) $^
+extra-y += xen_action_hooks_norevert.livepatch
+xen_action_hooks_norevert-objs := xen_action_hooks_marker.o xen_hello_world_func.o note.o xen_note.o
 
 EXPECT_BYTES_COUNT := 8
 CODE_GET_EXPECT=$(shell $(OBJDUMP) -d --insn-width=1 $(1) | sed -n -e '/<'$(2)'>:$$/,/^$$/ p' | tail -n +2 | head -n $(EXPECT_BYTES_COUNT) | awk '{$$0=$$2; printf "%s", substr($$0,length-1)}' | sed 's/.\{2\}/0x&,/g' | sed 's/^/{/;s/,$$/}/g')
-.PHONY: expect_config.h
-expect_config.h: EXPECT_BYTES=$(call CODE_GET_EXPECT,$(BASEDIR)/xen-syms,xen_extra_version)
-expect_config.h:
+$(obj)/expect_config.h: $(BASEDIR)/xen-syms
 	(set -e; \
-	 echo "#define EXPECT_BYTES $(EXPECT_BYTES)"; \
+	 echo "#define EXPECT_BYTES $(call CODE_GET_EXPECT,$<,xen_extra_version)"; \
          echo "#define EXPECT_BYTES_COUNT $(EXPECT_BYTES_COUNT)") > $@
 
-xen_expectations.o: expect_config.h
+$(obj)/xen_expectations.o: $(obj)/expect_config.h
 
-.PHONY: $(LIVEPATCH_EXPECTATIONS)
-$(LIVEPATCH_EXPECTATIONS): xen_expectations.o xen_hello_world_func.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_EXPECTATIONS) $^
+extra-y += xen_expectations.livepatch
+xen_expectations-objs := xen_expectations.o xen_hello_world_func.o note.o xen_note.o
 
-.PHONY: $(LIVEPATCH_EXPECTATIONS_FAIL)
-$(LIVEPATCH_EXPECTATIONS_FAIL): xen_expectations_fail.o xen_hello_world_func.o note.o xen_note.o
-	$(LD) $(LDFLAGS) $(build_id_linker) -r -o $(LIVEPATCH_EXPECTATIONS_FAIL) $^
+extra-y += xen_expectations_fail.livepatch
+xen_expectations_fail-objs := xen_expectations_fail.o xen_hello_world_func.o note.o xen_note.o
+
+
+quiet_cmd_livepatch = LD      $@
+cmd_livepatch = $(LD) $(XEN_LDFLAGS) $(build_id_linker) -r -o $@ $(real-prereqs)
+
+$(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)))
+
+LIVEPATCHES := $(filter %.livepatch,$(extra-y))
+
+LIVEPATCH_DEBUG_DIR ?= $(DEBUG_DIR)/xen-livepatch
 
 .PHONY: livepatch
-livepatch: $(LIVEPATCH) $(LIVEPATCH_BYE) $(LIVEPATCH_REPLACE) $(LIVEPATCH_NOP) $(LIVEPATCH_NO_XEN_BUILDID) \
-           $(LIVEPATCH_PREPOST_HOOKS) $(LIVEPATCH_PREPOST_HOOKS_FAIL) $(LIVEPATCH_ACTION_HOOKS) \
-           $(LIVEPATCH_ACTION_HOOKS_NOFUNC) $(LIVEPATCH_ACTION_HOOKS_MARKER) $(LIVEPATCH_ACTION_HOOKS_NOAPPLY) \
-           $(LIVEPATCH_ACTION_HOOKS_NOREVERT) $(LIVEPATCH_EXPECTATIONS) $(LIVEPATCH_EXPECTATIONS_FAIL)
+livepatch: $(LIVEPATCHES)
+
+install: $(addprefix $(obj)/,$(LIVEPATCHES))
+	$(INSTALL_DIR) $(DESTDIR)$(LIVEPATCH_DEBUG_DIR)
+	$(INSTALL_DATA) $(addprefix $(obj)/,$(LIVEPATCHES)) $(DESTDIR)$(LIVEPATCH_DEBUG_DIR)
+
+uninstall:
+	cd $(DESTDIR)$(LIVEPATCH_DEBUG_DIR) && rm -f $(LIVEPATCHES)
+
+.PHONY: clean
+clean::
+	rm -f *.o .*.o.d *.livepatch config.h expect_config.h
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 29/31] build: build everything from the root dir, use obj=$subdir
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (27 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 28/31] build: rework test/livepatch/Makefile Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-07-01 17:49   ` Bob Eshleman
  2021-07-01 14:10 ` [XEN PATCH v6 30/31] build: introduce if_changed_deps Anthony PERARD
  2021-07-01 14:10 ` [XEN PATCH v6 31/31] build,riscv: tell the build system about riscv64/head.S Anthony PERARD
  30 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Volodymyr Babchuk, Bob Eshleman, Alistair Francis, Connor Davis,
	Roger Pau Monné,
	Konrad Rzeszutek Wilk, Ross Lagerwall, Daniel De Graaf,
	Daniel P. Smith

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.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Makefile                |  46 ++++++++-----
 xen/Rules.mk                | 131 +++++++++++++++++++++++-------------
 xen/arch/arm/Makefile       |   4 +-
 xen/arch/arm/arch.mk        |   4 +-
 xen/arch/riscv/arch.mk      |   3 +-
 xen/arch/x86/Makefile       |  13 ++--
 xen/arch/x86/Rules.mk       |   4 +-
 xen/arch/x86/arch.mk        |  10 +--
 xen/arch/x86/boot/Makefile  |   8 +--
 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 +-
 15 files changed, 151 insertions(+), 101 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index 6aac68750b4d..71f098cd6374 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -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
 
@@ -234,7 +238,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 $(objtree)/include/xen/config.h
 CFLAGS-$(CONFIG_DEBUG_INFO) += -g
 
 ifneq ($(CONFIG_CC_IS_CLANG),y)
@@ -295,7 +299,7 @@ endif # need-config
 .PHONY: build install uninstall clean distclean MAP
 build install uninstall debug clean distclean MAP::
 ifneq ($(XEN_TARGET_ARCH),x86_32)
-	$(MAKE) -f Rules.mk _$@
+	$(MAKE) $(build)=. _$@
 else
 	echo "*** Xen x86/32 target no longer supported!"
 endif
@@ -335,10 +339,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)
@@ -395,23 +399,26 @@ $(TARGET).gz: $(TARGET)
 PHONY += prepare
 prepare:
 	$(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 include/arch-$(TARGET_ARCH)/asm/asm-offsets.h
+	$(MAKE) $(build)=include all
+	$(MAKE) $(build)=arch/$(TARGET_ARCH) include
+	$(MAKE) $(build)=. include/arch-$(TARGET_ARCH)/asm/asm-offsets.h
+
+# The actual objects are generated when descending,
+# make sure no implicit rule kicks in
+$(sort $(ALL_OBJS) $(ALL_LIBS)): descend ;
 
-$(ALL_OBJS) $(ALL_LIBS): prepare
+build-dirs := $(patsubst %/built_in.o,%,$(filter %/built_in.o,$(ALL_OBJS) $(ALL_LIBS)))
 
-# 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: ;
+PHONY += descend $(build-dirs)
+descend: $(build-dirs)
+$(build-dirs): prepare
+	$(MAKE) $(build)=$@ need-builtin=1
 
 ifeq ($(CONFIG_LTO),y)
 # Gather all LTO objects together
@@ -429,7 +436,7 @@ endif
 targets += prelink.o
 
 $(TARGET): prelink.o FORCE
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C arch/$(TARGET_ARCH) $@
+	$(MAKE) $(build)=arch/$(TARGET_ARCH) $@
 
 quiet_cmd_banner = BANNER  $@
 define cmd_banner
@@ -533,14 +540,17 @@ cscope:
 _MAP:
 	$(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map
 
+# Avoid those single target rules when Makefile is included by Rules.mk
+ifndef obj
 %.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
+endif
 
 .PHONY: cloc
 cloc:
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 0f8d90844455..4b3abf0ea880 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -3,20 +3,27 @@
 # 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
 
+ifndef obj
+$(warning kbuild: Makefile.build is included improperly)
+endif
 
-TARGET := $(BASEDIR)/xen
+TARGET := xen
 
 # Initialise some variables
+obj-y :=
 lib-y :=
 targets :=
+subdir-y :=
 CFLAGS-y :=
 AFLAGS-y :=
 
@@ -47,27 +54,52 @@ cmd_ar = rm -f $@; $(AR) cr $@ $(real-prereqs)
 quiet_cmd_objcopy = OBJCOPY $@
 cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
 
-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
+# ===========================================================================
+
+# 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)))
 
 # Handle objects in subdirs
-# ---------------------------------------------------------------------------
-# o if we encounter foo/ in $(obj-y), replace it by foo/built_in.o
-#   and add the directory to the list of dirs to descend into: $(subdir-y)
-subdir-y := $(subdir-y) $(filter %/, $(obj-y))
+# - if we encounter foo/ in $(obj-y), replace it by foo/built_in.o
+ifdef need-builtin
 obj-y    := $(patsubst %/, %/built_in.o, $(obj-y))
+else
+obj-y    := $(filter-out %/, $(obj-y))
+endif
 
-# $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
-# tell kbuild to descend
-subdir-obj-y := $(filter %/built_in.o, $(obj-y))
+# Add subdir path
 
-# Libraries are always collected in one lib file.
-# Filter out objects already built-in
-lib-y := $(filter-out $(obj-y), $(sort $(lib-y)))
+extra-y         := $(addprefix $(obj)/,$(extra-y))
+targets         := $(addprefix $(obj)/,$(targets))
+lib-y           := $(addprefix $(obj)/,$(lib-y))
+obj-y           := $(addprefix $(obj)/,$(obj-y))
+obj-bin-y       := $(addprefix $(obj)/,$(obj-bin-y))
+subdir-y        := $(addprefix $(obj)/,$(subdir-y))
+
+# subdir-builtin may contain duplications. Use $(sort ...)
+subdir-builtin := $(sort $(filter %/built_in.o, $(obj-y)))
+
+targets-for-builtin := $(extra-y)
+
+ifneq ($(strip $(lib-y)),)
+    targets-for-builtin += $(obj)/lib.a
+endif
+
+ifdef need-builtin
+    targets-for-builtin += $(obj)/built_in.o
+    ifneq ($(strip $(obj-bin-y)),)
+        ifeq ($(CONFIG_LTO),y)
+            targets-for-builtin += $(obj)/built_in_bin.o
+        endif
+    endif
+endif
+
+targets += $(targets-for-builtin)
 
 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS-y += -DINIT_SECTIONS_ONLY
 
@@ -119,29 +151,28 @@ quiet_cmd_cc_builtin = LD      $@
 cmd_cc_builtin = \
     $(CC) $(XEN_CFLAGS) -c -x c /dev/null -o $@
 
+# To build objects in subdirs, we need to descend into the directories
+$(subdir-builtin): $(obj)/%/built_in.o: $(obj)/% ;
+
 quiet_cmd_ld_builtin = LD      $@
 ifeq ($(CONFIG_LTO),y)
 cmd_ld_builtin = \
-    $(LD_LTO) -r -o $@ $(filter $(obj-y),$(real-prereqs))
+    $(LD_LTO) -r -o $@ $(real-prereqs)
 else
 cmd_ld_builtin = \
-    $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter $(obj-y),$(real-prereqs))
+    $(LD) $(XEN_LDFLAGS) -r -o $@ $(real-prereqs)
 endif
 
-built_in.o: $(obj-y) $(if $(strip $(lib-y)),lib.a) $(extra-y) FORCE
+$(obj)/built_in.o: $(obj-y) FORCE
 	$(call if_changed,$(if $(strip $(obj-y)),ld_builtin,cc_builtin))
 
-lib.a: $(lib-y) FORCE
+$(obj)/lib.a: $(lib-y) FORCE
 	$(call if_changed,ar)
 
-targets += built_in.o
-ifneq ($(strip $(lib-y)),)
-targets += lib.a
-endif
-targets += $(filter-out $(subdir-obj-y), $(obj-y) $(lib-y)) $(extra-y)
-targets += $(MAKECMDGOALS)
+targets += $(filter-out $(subdir-builtin), $(obj-y))
+targets += $(lib-y) $(MAKECMDGOALS)
 
-built_in_bin.o: $(obj-bin-y) $(extra-y)
+$(obj)/built_in_bin.o: $(obj-bin-y)
 ifeq ($(strip $(obj-bin-y)),)
 	$(CC) $(a_flags) -c -x assembler /dev/null -o $@
 else
@@ -152,21 +183,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      $@
 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 $@
     else
-        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(dot-target).tmp $@
+        cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@
     endif
     cmd_objcopy_fix_sym += && rm -f $(dot-target).tmp
 else
@@ -178,13 +201,13 @@ define rule_cc_o_c
     $(call cmd,objcopy_fix_sym)
 endef
 
-%.o: %.c FORCE
+$(obj)/%.o: $(src)/%.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
 quiet_cmd_cc_o_S = CC      $@
 cmd_cc_o_S = $(CC) $(a_flags) -c $< -o $@
 
-%.o: %.S FORCE
+$(obj)/%.o: $(src)/%.S FORCE
 	$(call if_changed,cc_o_S)
 
 
@@ -202,7 +225,7 @@ define cmd_obj_init_o
     $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
 endef
 
-$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE
+$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): $(obj)/%.init.o: $(obj)/%.o FORCE
 	$(call if_changed,obj_init_o)
 
 quiet_cmd_cpp_i_c = CPP     $@
@@ -214,19 +237,21 @@ cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
 quiet_cmd_cpp_s_S = CPP     $@
 cmd_cpp_s_S = $(CPP) $(call cpp_flags,$(a_flags)) -MQ $@ -o $@ $<
 
-%.i: %.c FORCE
+$(obj)/%.i: $(src)/%.c FORCE
 	$(call if_changed,cpp_i_c)
 
-%.s: %.c FORCE
+$(obj)/%.s: $(src)/%.c FORCE
 	$(call if_changed,cc_s_c)
 
-%.s: %.S FORCE
+$(obj)/%.s: $(src)/%.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 $@ $<
 
+targets := $(filter-out $(PHONY), $(targets))
+
 # Add intermediate targets:
 # When building objects with specific suffix patterns, add intermediate
 # targets that the final targets are derived from.
@@ -236,7 +261,18 @@ intermediate_targets = $(foreach sfx, $(2), \
 # %.init.o <- %.o
 targets += $(call intermediate_targets, .init.o, .o)
 
--include $(DEPS_INCLUDE)
+# Build
+# ---------------------------------------------------------------------------
+
+__build: $(targets-for-builtin) $(subdir-y)
+	@:
+
+# Descending
+# ---------------------------------------------------------------------------
+
+PHONY += $(subdir-y)
+$(subdir-y):
+	$(Q)$(MAKE) $(build)=$@ need-builtin=$(if $(filter $@/built_in.o, $(subdir-builtin)),1)
 
 # Read all saved command lines and dependencies for the $(targets) we
 # may be building above, using $(if_changed{,_dep}). As an
@@ -247,6 +283,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)
+-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)
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 9f9c73aa6c5d..a3204d22d17b 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -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) \
diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk
index 8a2b202f698e..0a6ae6c2fe60 100644
--- a/xen/arch/arm/arch.mk
+++ b/xen/arch/arm/arch.mk
@@ -1,8 +1,8 @@
 ########################################
 # arm-specific definitions
 
-CFLAGS += -I$(BASEDIR)/include
-CFLAGS += -I$(BASEDIR)/include/arch-$(TARGET_ARCH)
+CFLAGS += -I$(srctree)/include
+CFLAGS += -I$(srctree)/include/arch-$(TARGET_ARCH)
 
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 53dadb897591..8aa2206184fa 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -11,4 +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$(srctree)/include
+CFLAGS += -I$(srctree)/include/arch-$(TARGET_ARCH)
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 2cc67d6e0e84..c5e87f3db35b 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -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
@@ -166,13 +169,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) \
@@ -234,14 +237,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) \
@@ -253,7 +256,7 @@ $(TARGET).efi: FORCE
 	echo '$(if $(filter y,$(XEN_BUILD_EFI)),xen.efi generation,EFI support) disabled'
 endif
 
-$(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: $(BASEDIR)/arch/x86/efi/built_in.o
+$(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: arch/x86/efi/built_in.o
 $(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ;
 
 .PHONY: include
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index 56fe22c979ea..2d12c2dca208 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -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)
diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index c95caa303db8..3f181f616188 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -3,10 +3,10 @@
 
 export XEN_IMG_OFFSET := 0x200000
 
-CFLAGS += -I$(BASEDIR)/include
-CFLAGS += -I$(BASEDIR)/include/arch-$(TARGET_ARCH)
-CFLAGS += -I$(BASEDIR)/include/arch-x86/asm/mach-generic
-CFLAGS += -I$(BASEDIR)/include/arch-x86/asm/mach-default
+CFLAGS += -I$(srctree)/include
+CFLAGS += -I$(srctree)/include/arch-$(TARGET_ARCH)
+CFLAGS += -I$(srctree)/include/arch-x86/asm/mach-generic
+CFLAGS += -I$(srctree)/include/arch-x86/asm/mach-default
 CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
 
 # Prevent floating-point variables from creeping into Xen.
@@ -66,6 +66,6 @@ export XEN_BUILD_EFI := $(call try-run,$(CC) $(CFLAGS) -c arch/x86/efi/check.c -
 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)
diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 53d357489df2..2469ca7c4530 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -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)"
diff --git a/xen/include/Makefile b/xen/include/Makefile
index a969e76ddcad..b318bdaab094 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -61,7 +61,7 @@ $(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(BASEDIR)/
 	export PYTHON=$(PYTHON); \
 	while read what name; do \
 		$(SHELL) $(BASEDIR)/tools/get-fields.sh "$$what" compat_$$name $< || exit $$?; \
-	done <$(patsubst compat/%,compat/.xlat/%,$(basename $<)).lst >$@.new
+	done <$(patsubst $(obj)/compat/%,$(obj)/compat/.xlat/%,$(basename $<)).lst >$@.new
 	mv -f $@.new $@
 
 .PRECIOUS: $(obj)/compat/.xlat/%.lst
@@ -86,8 +86,8 @@ PUBLIC_HEADERS := $(filter-out $(src)/public/arch-% $(src)/public/dom0_ops.h, $(
 PUBLIC_C99_HEADERS := $(src)/public/io/9pfs.h $(src)/public/io/pvcalls.h
 PUBLIC_ANSI_HEADERS := $(filter-out $(src)/public/%ctl.h $(src)/public/xsm/% $(src)/public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
 
-public/io/9pfs.h-prereq := string
-public/io/pvcalls.h-prereq := string
+$(src)/public/io/9pfs.h-prereq := string
+$(src)/public/io/pvcalls.h-prereq := string
 
 $(obj)/headers.chk: $(PUBLIC_ANSI_HEADERS) $(src)/Makefile
 	for i in $(filter %.h,$^); do \
diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include
index 7cb55b181dcb..788929cdca38 100644
--- a/xen/scripts/Kbuild.include
+++ b/xen/scripts/Kbuild.include
@@ -107,6 +107,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
diff --git a/xen/test/Makefile b/xen/test/Makefile
index 41e4d7bdb78b..080763c80766 100644
--- a/xen/test/Makefile
+++ b/xen/test/Makefile
@@ -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
diff --git a/xen/test/livepatch/Makefile b/xen/test/livepatch/Makefile
index e59245323e92..52ee58a08c5f 100644
--- a/xen/test/livepatch/Makefile
+++ b/xen/test/livepatch/Makefile
@@ -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)
diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index 3ea726d66f8b..267ca5c47437 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -42,7 +42,7 @@ $(obj)/flask-policy.S: $(BASEDIR)/tools/binfile FORCE
 	$(call if_changed,binfile)
 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
diff --git a/xen/xsm/flask/ss/Makefile b/xen/xsm/flask/ss/Makefile
index d32b9e07138e..efd21f138df3 100644
--- a/xen/xsm/flask/ss/Makefile
+++ b/xen/xsm/flask/ss/Makefile
@@ -8,4 +8,4 @@ obj-y += services.o
 obj-y += conditional.o
 obj-y += mls.o
 
-CFLAGS-y += -I../include
+CFLAGS-y += -Ixsm/flask/include
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 30/31] build: introduce if_changed_deps
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (28 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 29/31] build: build everything from the root dir, use obj=$subdir Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-07-01 14:10 ` [XEN PATCH v6 31/31] build,riscv: tell the build system about riscv64/head.S Anthony PERARD
  30 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel
  Cc: Anthony PERARD, Andrew Cooper, George Dunlap, Ian Jackson,
	Jan Beulich, Julien Grall, Stefano Stabellini, Wei Liu,
	Roger Pau Monné

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.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 .gitignore                 |   1 +
 xen/Makefile               |  16 +-
 xen/Rules.mk               |  17 +-
 xen/arch/x86/Makefile      |   8 +-
 xen/scripts/Kbuild.include |  17 +-
 xen/tools/Makefile         |   7 +-
 xen/tools/fixdep.c         | 404 +++++++++++++++++++++++++++++++++++++
 7 files changed, 441 insertions(+), 29 deletions(-)
 create mode 100644 xen/tools/fixdep.c

diff --git a/.gitignore b/.gitignore
index 91ae22ae9216..1c9c8a47aac6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -341,6 +341,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
diff --git a/xen/Makefile b/xen/Makefile
index 71f098cd6374..d8dedca206a1 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -185,6 +185,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)"
 
@@ -397,7 +404,7 @@ $(TARGET).gz: $(TARGET)
 	mv $@.new $@
 
 PHONY += prepare
-prepare:
+prepare: tools_fixdep
 	$(MAKE) -C tools
 	$(MAKE) $(build)=. include/xen/compile.h
 	[ -e arch/$(TARGET_ARCH)/efi ] && for f in $$(cd common/efi; echo *.[ch]); \
@@ -476,6 +483,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner FORCE
 	@cat .banner
 	$(call filechk,compile.h)
 
+-include $(wildcard .asm-offsets.s.d)
 asm-offsets.s: arch/$(TARGET_ARCH)/$(TARGET_SUBARCH)/asm-offsets.c
 	$(CC) $(filter-out -Wa$(comma)% -flto,$(c_flags)) -S -g0 -o $@.new -MQ $@ $<
 	$(call move-if-changed,$@.new,$@)
@@ -542,13 +550,13 @@ _MAP:
 
 # Avoid those single target rules when Makefile is included by Rules.mk
 ifndef obj
-%.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
 endif
 
diff --git a/xen/Rules.mk b/xen/Rules.mk
index 4b3abf0ea880..f2af4a6e0644 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -139,8 +139,8 @@ cpp_flags = $(filter-out -Wa$(comma)%,$(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
 
@@ -197,7 +197,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
 
@@ -208,7 +208,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  $@
@@ -238,13 +238,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     $@
@@ -283,9 +283,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)
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index c5e87f3db35b..bcb140756b98 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -280,7 +280,7 @@ $(BASEDIR)/include/arch-x86/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 $@ $<
@@ -296,9 +296,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
diff --git a/xen/scripts/Kbuild.include b/xen/scripts/Kbuild.include
index 788929cdca38..b56bbc4300f0 100644
--- a/xen/scripts/Kbuild.include
+++ b/xen/scripts/Kbuild.include
@@ -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
@@ -129,6 +128,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)
@@ -157,15 +158,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
diff --git a/xen/tools/Makefile b/xen/tools/Makefile
index 4e42163f981c..722f3664549d 100644
--- a/xen/tools/Makefile
+++ b/xen/tools/Makefile
@@ -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 $@ $<
diff --git a/xen/tools/fixdep.c b/xen/tools/fixdep.c
new file mode 100644
index 000000000000..d98540552941
--- /dev/null
+++ b/xen/tools/fixdep.c
@@ -0,0 +1,404 @@
+/*
+ * "Optimize" a list of dependencies as spit out by gcc -MD
+ * for the kernel build
+ * ===========================================================================
+ *
+ * Author       Kai Germaschewski
+ * Copyright    2002 by Kai Germaschewski  <kai.germaschewski@gmx.de>
+ *
+ * This software may be used and distributed according to the terms
+ * of the GNU General Public License, incorporated herein by reference.
+ *
+ *
+ * Introduction:
+ *
+ * gcc produces a very nice and correct list of dependencies which
+ * tells make when to remake a file.
+ *
+ * To use this list as-is however has the drawback that virtually
+ * every file in the kernel includes autoconf.h.
+ *
+ * If the user re-runs make *config, autoconf.h will be
+ * regenerated.  make notices that and will rebuild every file which
+ * includes autoconf.h, i.e. basically all files. This is extremely
+ * annoying if the user just changed CONFIG_HIS_DRIVER from n to m.
+ *
+ * So we play the same trick that "mkdep" played before. We replace
+ * the dependency on autoconf.h by a dependency on every config
+ * option which is mentioned in any of the listed prerequisites.
+ *
+ * kconfig populates a tree in include/config/ with an empty file
+ * for each config symbol and when the configuration is updated
+ * the files representing changed config options are touched
+ * which then let make pick up the changes and the files that use
+ * the config symbols are rebuilt.
+ *
+ * So if the user changes his CONFIG_HIS_DRIVER option, only the objects
+ * which depend on "include/config/his/driver.h" will be rebuilt,
+ * so most likely only his driver ;-)
+ *
+ * The idea above dates, by the way, back to Michael E Chastain, AFAIK.
+ *
+ * So to get dependencies right, there are two issues:
+ * o if any of the files the compiler read changed, we need to rebuild
+ * o if the command line given to the compile the file changed, we
+ *   better rebuild as well.
+ *
+ * The former is handled by using the -MD output, the later by saving
+ * the command line used to compile the old object and comparing it
+ * to the one we would now use.
+ *
+ * Again, also this idea is pretty old and has been discussed on
+ * kbuild-devel a long time ago. I don't have a sensibly working
+ * internet connection right now, so I rather don't mention names
+ * without double checking.
+ *
+ * This code here has been based partially based on mkdep.c, which
+ * says the following about its history:
+ *
+ *   Copyright abandoned, Michael Chastain, <mailto:mec@shout.net>.
+ *   This is a C version of syncdep.pl by Werner Almesberger.
+ *
+ *
+ * It is invoked as
+ *
+ *   fixdep <depfile> <target> <cmdline>
+ *
+ * and will read the dependency file <depfile>
+ *
+ * The transformed dependency snipped is written to stdout.
+ *
+ * It first generates a line
+ *
+ *   cmd_<target> = <cmdline>
+ *
+ * and then basically copies the .<target>.d file to stdout, in the
+ * process filtering out the dependency on autoconf.h and adding
+ * dependencies on include/config/my/option.h for every
+ * CONFIG_MY_OPTION encountered in any of the prerequisites.
+ *
+ * We don't even try to really parse the header files, but
+ * merely grep, i.e. if CONFIG_FOO is mentioned in a comment, it will
+ * be picked up as well. It's not a problem with respect to
+ * correctness, since that can only give too many dependencies, thus
+ * we cannot miss a rebuild. Since people tend to not mention totally
+ * unrelated CONFIG_ options all over the place, it's not an
+ * efficiency problem either.
+ *
+ * (Note: it'd be easy to port over the complete mkdep state machine,
+ *  but I don't think the added complexity is worth it)
+ */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+
+static void usage(void)
+{
+	fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n");
+	exit(1);
+}
+
+/*
+ * In the intended usage of this program, the stdout is redirected to .*.cmd
+ * files. The return value of printf() and putchar() must be checked to catch
+ * any error, e.g. "No space left on device".
+ */
+static void xprintf(const char *format, ...)
+{
+	va_list ap;
+	int ret;
+
+	va_start(ap, format);
+	ret = vprintf(format, ap);
+	if (ret < 0) {
+		perror("fixdep");
+		exit(1);
+	}
+	va_end(ap);
+}
+
+static void xputchar(int c)
+{
+	int ret;
+
+	ret = putchar(c);
+	if (ret == EOF) {
+		perror("fixdep");
+		exit(1);
+	}
+}
+
+/*
+ * Print out a dependency path from a symbol name
+ */
+static void print_dep(const char *m, int slen, const char *dir)
+{
+	int c, prev_c = '/', i;
+
+	xprintf("    $(wildcard %s/", dir);
+	for (i = 0; i < slen; i++) {
+		c = m[i];
+		if (c == '_')
+			c = '/';
+		else
+			c = tolower(c);
+		if (c != '/' || prev_c != '/')
+			xputchar(c);
+		prev_c = c;
+	}
+	xprintf(".h) \\\n");
+}
+
+struct item {
+	struct item	*next;
+	unsigned int	len;
+	unsigned int	hash;
+	char		name[];
+};
+
+#define HASHSZ 256
+static struct item *hashtab[HASHSZ];
+
+static unsigned int strhash(const char *str, unsigned int sz)
+{
+	/* fnv32 hash */
+	unsigned int i, hash = 2166136261U;
+
+	for (i = 0; i < sz; i++)
+		hash = (hash ^ str[i]) * 0x01000193;
+	return hash;
+}
+
+/*
+ * Lookup a value in the configuration string.
+ */
+static int is_defined_config(const char *name, int len, unsigned int hash)
+{
+	struct item *aux;
+
+	for (aux = hashtab[hash % HASHSZ]; aux; aux = aux->next) {
+		if (aux->hash == hash && aux->len == len &&
+		    memcmp(aux->name, name, len) == 0)
+			return 1;
+	}
+	return 0;
+}
+
+/*
+ * Add a new value to the configuration string.
+ */
+static void define_config(const char *name, int len, unsigned int hash)
+{
+	struct item *aux = malloc(sizeof(*aux) + len);
+
+	if (!aux) {
+		perror("fixdep:malloc");
+		exit(1);
+	}
+	memcpy(aux->name, name, len);
+	aux->len = len;
+	aux->hash = hash;
+	aux->next = hashtab[hash % HASHSZ];
+	hashtab[hash % HASHSZ] = aux;
+}
+
+/*
+ * Record the use of a CONFIG_* word.
+ */
+static void use_config(const char *m, int slen)
+{
+	unsigned int hash = strhash(m, slen);
+
+	if (is_defined_config(m, slen, hash))
+	    return;
+
+	define_config(m, slen, hash);
+	print_dep(m, slen, "include/config");
+}
+
+/* test if s ends in sub */
+static int str_ends_with(const char *s, int slen, const char *sub)
+{
+	int sublen = strlen(sub);
+
+	if (sublen > slen)
+		return 0;
+
+	return !memcmp(s + slen - sublen, sub, sublen);
+}
+
+static void parse_config_file(const char *p)
+{
+	const char *q, *r;
+	const char *start = p;
+
+	while ((p = strstr(p, "CONFIG_"))) {
+		if (p > start && (isalnum(p[-1]) || p[-1] == '_')) {
+			p += 7;
+			continue;
+		}
+		p += 7;
+		q = p;
+		while (isalnum(*q) || *q == '_')
+			q++;
+		if (str_ends_with(p, q - p, "_MODULE"))
+			r = q - 7;
+		else
+			r = q;
+		if (r > p)
+			use_config(p, r - p);
+		p = q;
+	}
+}
+
+static void *read_file(const char *filename)
+{
+	struct stat st;
+	int fd;
+	char *buf;
+
+	fd = open(filename, O_RDONLY);
+	if (fd < 0) {
+		fprintf(stderr, "fixdep: error opening file: ");
+		perror(filename);
+		exit(2);
+	}
+	if (fstat(fd, &st) < 0) {
+		fprintf(stderr, "fixdep: error fstat'ing file: ");
+		perror(filename);
+		exit(2);
+	}
+	buf = malloc(st.st_size + 1);
+	if (!buf) {
+		perror("fixdep: malloc");
+		exit(2);
+	}
+	if (read(fd, buf, st.st_size) != st.st_size) {
+		perror("fixdep: read");
+		exit(2);
+	}
+	buf[st.st_size] = '\0';
+	close(fd);
+
+	return buf;
+}
+
+/* Ignore certain dependencies */
+static int is_ignored_file(const char *s, int len)
+{
+	return str_ends_with(s, len, "include/generated/autoconf.h") ||
+	       str_ends_with(s, len, "include/generated/autoksyms.h");
+}
+
+/*
+ * Important: The below generated source_foo.o and deps_foo.o variable
+ * assignments are parsed not only by make, but also by the rather simple
+ * parser in scripts/mod/sumversion.c.
+ */
+static void parse_dep_file(char *m, const char *target)
+{
+	char *p;
+	int is_last, is_target;
+	int saw_any_target = 0;
+	int is_first_dep = 0;
+	void *buf;
+
+	while (1) {
+		/* Skip any "white space" */
+		while (*m == ' ' || *m == '\\' || *m == '\n')
+			m++;
+
+		if (!*m)
+			break;
+
+		/* Find next "white space" */
+		p = m;
+		while (*p && *p != ' ' && *p != '\\' && *p != '\n')
+			p++;
+		is_last = (*p == '\0');
+		/* Is the token we found a target name? */
+		is_target = (*(p-1) == ':');
+		/* Don't write any target names into the dependency file */
+		if (is_target) {
+			/* The /next/ file is the first dependency */
+			is_first_dep = 1;
+		} else if (!is_ignored_file(m, p - m)) {
+			*p = '\0';
+
+			/*
+			 * Do not list the source file as dependency, so that
+			 * kbuild is not confused if a .c file is rewritten
+			 * into .S or vice versa. Storing it in source_* is
+			 * needed for modpost to compute srcversions.
+			 */
+			if (is_first_dep) {
+				/*
+				 * If processing the concatenation of multiple
+				 * dependency files, only process the first
+				 * target name, which will be the original
+				 * source name, and ignore any other target
+				 * names, which will be intermediate temporary
+				 * files.
+				 */
+				if (!saw_any_target) {
+					saw_any_target = 1;
+					xprintf("source_%s := %s\n\n",
+						target, m);
+					xprintf("deps_%s := \\\n", target);
+				}
+				is_first_dep = 0;
+			} else {
+				xprintf("  %s \\\n", m);
+			}
+
+			buf = read_file(m);
+			parse_config_file(buf);
+			free(buf);
+		}
+
+		if (is_last)
+			break;
+
+		/*
+		 * Start searching for next token immediately after the first
+		 * "whitespace" character that follows this token.
+		 */
+		m = p + 1;
+	}
+
+	if (!saw_any_target) {
+		fprintf(stderr, "fixdep: parse error; no targets found\n");
+		exit(1);
+	}
+
+	xprintf("\n%s: $(deps_%s)\n\n", target, target);
+	xprintf("$(deps_%s):\n", target);
+}
+
+int main(int argc, char *argv[])
+{
+	const char *depfile, *target, *cmdline;
+	void *buf;
+
+	if (argc != 4)
+		usage();
+
+	depfile = argv[1];
+	target = argv[2];
+	cmdline = argv[3];
+
+	xprintf("cmd_%s := %s\n\n", target, cmdline);
+
+	buf = read_file(depfile);
+	parse_dep_file(buf, target);
+	free(buf);
+
+	return 0;
+}
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* [XEN PATCH v6 31/31] build,riscv: tell the build system about riscv64/head.S
  2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
                   ` (29 preceding siblings ...)
  2021-07-01 14:10 ` [XEN PATCH v6 30/31] build: introduce if_changed_deps Anthony PERARD
@ 2021-07-01 14:10 ` Anthony PERARD
  2021-07-01 17:52   ` Bob Eshleman
                     ` (2 more replies)
  30 siblings, 3 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-01 14:10 UTC (permalink / raw)
  To: xen-devel; +Cc: Anthony PERARD, Bob Eshleman, Alistair Francis, Connor Davis

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

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/arch/riscv/riscv64/Makefile | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 xen/arch/riscv/riscv64/Makefile

diff --git a/xen/arch/riscv/riscv64/Makefile b/xen/arch/riscv/riscv64/Makefile
new file mode 100644
index 000000000000..15a4a65f6615
--- /dev/null
+++ b/xen/arch/riscv/riscv64/Makefile
@@ -0,0 +1 @@
+extra-y += head.o
-- 
Anthony PERARD



^ permalink raw reply related	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm
  2021-07-01 14:09 ` [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm Anthony PERARD
@ 2021-07-01 17:24   ` Paul Durrant
  2021-07-01 17:26   ` Bob Eshleman
  2021-08-05  7:04   ` Jan Beulich
  2 siblings, 0 replies; 82+ messages in thread
From: Paul Durrant @ 2021-07-01 17:24 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Jan Beulich,
	Julien Grall, Stefano Stabellini, Wei Liu, Tamas K Lengyel,
	Alexandru Isaila, Petre Pircalabu, Volodymyr Babchuk,
	Roger Pau Monné,
	Konrad Rzeszutek Wilk, Ross Lagerwall, Jun Nakajima, Kevin Tian,
	Lukasz Hawrylko, Bob Eshleman, Alistair Francis, Connor Davis

On 01/07/2021 15:09, Anthony PERARD wrote:
> This avoid the need to create the symbolic link "include/asm".
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Acked-by: Paul Durrant <paul@xen.org>


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm
  2021-07-01 14:09 ` [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm Anthony PERARD
  2021-07-01 17:24   ` Paul Durrant
@ 2021-07-01 17:26   ` Bob Eshleman
  2021-08-05  7:04   ` Jan Beulich
  2 siblings, 0 replies; 82+ messages in thread
From: Bob Eshleman @ 2021-07-01 17:26 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Jan Beulich,
	Julien Grall, Stefano Stabellini, Wei Liu, Tamas K Lengyel,
	Alexandru Isaila, Petre Pircalabu, Volodymyr Babchuk,
	Roger Pau Monné,
	Konrad Rzeszutek Wilk, Ross Lagerwall, Paul Durrant,
	Jun Nakajima, Kevin Tian, Lukasz Hawrylko, Alistair Francis,
	Connor Davis

Hey Anthony,

> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8a52a03969fe..03a5553116a8 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> -F:	xen/include/asm-arm/
> +F:	xen/include/arch-arm/

... snip ...

> -F:	xen/include/asm-x86/
> +F:	xen/include/arch-x86/


It looks like riscv will also need the same in its "xen/include/asm-riscv/" F entry.


Thanks

-- 
Bobby Eshleman
SE at Vates SAS


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 29/31] build: build everything from the root dir, use obj=$subdir
  2021-07-01 14:10 ` [XEN PATCH v6 29/31] build: build everything from the root dir, use obj=$subdir Anthony PERARD
@ 2021-07-01 17:49   ` Bob Eshleman
  0 siblings, 0 replies; 82+ messages in thread
From: Bob Eshleman @ 2021-07-01 17:49 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Jan Beulich,
	Julien Grall, Stefano Stabellini, Wei Liu, Volodymyr Babchuk,
	Alistair Francis, Connor Davis, Roger Pau Monné,
	Konrad Rzeszutek Wilk, Ross Lagerwall, Daniel De Graaf,
	Daniel P. Smith

On 7/1/21 7:10 AM, Anthony PERARD wrote:
> 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.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Acked-by: Bob Eshleman <bobbyeshleman@gmail.com>

Thanks,
Bobby


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 31/31] build,riscv: tell the build system about riscv64/head.S
  2021-07-01 14:10 ` [XEN PATCH v6 31/31] build,riscv: tell the build system about riscv64/head.S Anthony PERARD
@ 2021-07-01 17:52   ` Bob Eshleman
  2021-07-02  4:45   ` Alistair Francis
  2021-07-10  0:50   ` Connor Davis
  2 siblings, 0 replies; 82+ messages in thread
From: Bob Eshleman @ 2021-07-01 17:52 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel; +Cc: Alistair Francis, Connor Davis

On 7/1/21 7:10 AM, Anthony PERARD wrote:
> 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
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>  xen/arch/riscv/riscv64/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>  create mode 100644 xen/arch/riscv/riscv64/Makefile
> 
> diff --git a/xen/arch/riscv/riscv64/Makefile b/xen/arch/riscv/riscv64/Makefile
> new file mode 100644
> index 000000000000..15a4a65f6615
> --- /dev/null
> +++ b/xen/arch/riscv/riscv64/Makefile
> @@ -0,0 +1 @@
> +extra-y += head.o
> 

Acked-by: Bob Eshleman <bobbyeshleman@gmail.com>

-- 
Bobby Eshleman
SE at Vates SAS


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 31/31] build,riscv: tell the build system about riscv64/head.S
  2021-07-01 14:10 ` [XEN PATCH v6 31/31] build,riscv: tell the build system about riscv64/head.S Anthony PERARD
  2021-07-01 17:52   ` Bob Eshleman
@ 2021-07-02  4:45   ` Alistair Francis
  2021-07-10  0:50   ` Connor Davis
  2 siblings, 0 replies; 82+ messages in thread
From: Alistair Francis @ 2021-07-02  4:45 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: open list:X86, Bob Eshleman, Alistair Francis, Connor Davis

On Fri, Jul 2, 2021 at 12:22 AM Anthony PERARD
<anthony.perard@citrix.com> wrote:
>
> 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
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  xen/arch/riscv/riscv64/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>  create mode 100644 xen/arch/riscv/riscv64/Makefile
>
> diff --git a/xen/arch/riscv/riscv64/Makefile b/xen/arch/riscv/riscv64/Makefile
> new file mode 100644
> index 000000000000..15a4a65f6615
> --- /dev/null
> +++ b/xen/arch/riscv/riscv64/Makefile
> @@ -0,0 +1 @@
> +extra-y += head.o
> --
> Anthony PERARD
>
>


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 01/31] build: fix %.s: %.S rule
  2021-07-01 14:09 ` [XEN PATCH v6 01/31] build: fix %.s: %.S rule Anthony PERARD
@ 2021-07-05 14:40   ` Jan Beulich
  0 siblings, 0 replies; 82+ messages in thread
From: Jan Beulich @ 2021-07-05 14:40 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> Fixes: e321576f4047 ("xen/build: start using if_changed")
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 02/31] build: introduce cpp_flags macro
  2021-07-01 14:09 ` [XEN PATCH v6 02/31] build: introduce cpp_flags macro Anthony PERARD
@ 2021-07-07 14:18   ` Jan Beulich
  2021-07-12 10:53     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 14:18 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Roger Pau Monné,
	Tim Deegan, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> 
> Notes:
>     v6:
>     - switch to a macro as suggested
>       which allows to be used with both a_flags and c_flags
>     
>     v5:
>     - new patch
> 
>  xen/Rules.mk                    | 7 +++++--
>  xen/arch/x86/mm/Makefile        | 2 +-
>  xen/arch/x86/mm/hap/Makefile    | 2 +-
>  xen/arch/x86/mm/shadow/Makefile | 2 +-
>  4 files changed, 8 insertions(+), 5 deletions(-)

There are two further uses, one in xen/Makefile and one in
xen/x86/Makefile. I think both want replacing too, and the
former suggests you also want to strip -flto alongside -Wa,%.
I can accept the use in xen/include/Makefile not getting
touched, as it also removes an -include option at the same
time.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 05/31] build: factorise generation of the linker scripts
  2021-07-01 14:09 ` [XEN PATCH v6 05/31] build: factorise generation of the linker scripts Anthony PERARD
@ 2021-07-07 14:25   ` Jan Beulich
  2021-07-12 11:02     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 14:25 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Volodymyr Babchuk,
	Roger Pau Monné,
	xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> 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.

I'm not really happy about this, not the least because the symbol's name
doesn't fit its purpose (we're not linking, but producing a linker script
at that stage), but well ...

> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 06/31] x86/mm: avoid building multiple .o from a single .c file
  2021-07-01 14:09 ` [XEN PATCH v6 06/31] x86/mm: avoid building multiple .o from a single .c file Anthony PERARD
@ 2021-07-07 14:45   ` Jan Beulich
  2021-07-12 12:49     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 14:45 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Roger Pau Monné,
	Tim Deegan, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> 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.

While I have to admit that I'm not really happy about these extra new
files, I can see that one might view this as the less bad of two
evils.

>  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            |  9 ---------
>  xen/arch/x86/mm/hap/guest_walk.c        |  3 ---
>  xen/arch/x86/mm/hap/guest_walk_2level.c |  2 ++
>  xen/arch/x86/mm/hap/guest_walk_3level.c |  2 ++
>  xen/arch/x86/mm/hap/guest_walk_4level.c |  2 ++

Is there a particular reason you've kept the "level" in these three
file names? Preferably with them shortened (and ideally dashes used
everywhere in the new file names instead of underscores)
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 07/31] build,include: rework compat-build-source.py
  2021-07-01 14:09 ` [XEN PATCH v6 07/31] build,include: rework compat-build-source.py Anthony PERARD
@ 2021-07-07 14:58   ` Jan Beulich
  2021-07-12 14:35     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 14:58 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> 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.
> 
> Also remove dependency on Makefile as the file generation doesn't
> depend on it anymore.

Did it before any more? In the subsequent patch I can see more of
a reason to drop the dependency, but neither there nor here I'm
really convinced: In general I think every generate file would
better depend on the makefile containing the rule used for its
building, as a change to that rule means the target wants
rebuilding. Therefore for the moment ...

> No changes in final compat/%.h headers.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>

... this holds only with the dependency kept in place. But I'll
be happy to get convinced otherwise.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 09/31] build: clean "lib.a"
  2021-07-01 14:09 ` [XEN PATCH v6 09/31] build: clean "lib.a" Anthony PERARD
@ 2021-07-07 15:03   ` Jan Beulich
  2021-07-12 14:42     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 15:03 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Hmm, I was clearly under the impression (or at least assuming)
that $(targets) would be included in what gets cleaned by the
general rule. But it looks I was wrong with this:
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 10/31] build: use $(kconfig) shortcut in clean rule
  2021-07-01 14:09 ` [XEN PATCH v6 10/31] build: use $(kconfig) shortcut in clean rule Anthony PERARD
@ 2021-07-07 15:05   ` Jan Beulich
  0 siblings, 0 replies; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 15:05 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 11/31] build: fix clean targets when subdir-y is used
  2021-07-01 14:09 ` [XEN PATCH v6 11/31] build: fix clean targets when subdir-y is used Anthony PERARD
@ 2021-07-07 15:15   ` Jan Beulich
  2021-07-12 14:54     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 15:15 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> 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.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

> --- a/xen/scripts/Makefile.clean
> +++ b/xen/scripts/Makefile.clean
> @@ -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-)))

Isn't this a normalization which also wants doing in xen/Rules.mk for
subdir-y? Or perhaps this is part of one of the subsequent patches
already?

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 12/31] build: use subdir-y in test/Makefile
  2021-07-01 14:09 ` [XEN PATCH v6 12/31] build: use subdir-y in test/Makefile Anthony PERARD
@ 2021-07-07 15:26   ` Jan Beulich
  2021-07-12 15:22     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 15:26 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> --- a/xen/test/Makefile
> +++ b/xen/test/Makefile
> @@ -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

As per xen/Rules.mk having

subdir-y := $(subdir-y) $(filter %/, $(obj-y))
obj-y    := $(patsubst %/, %/built_in.o, $(obj-y))
...
subdir-obj-y := $(filter %/built_in.o, $(obj-y))

this will result in building of livepatch/built_in.o afaict. Is
this an intended but benign side effect?

>  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

And then why can't the generic recursion rule in xen/Rules.mk
not also be used for the "build" target? (I guess "install" and
"uninstall" need to remain separate, and don't think I know what
"subtree-force-update" is about.)

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 13/31] build,tools: have default rules depends on symbols
  2021-07-01 14:09 ` [XEN PATCH v6 13/31] build,tools: have default rules depends on symbols Anthony PERARD
@ 2021-07-07 15:28   ` Jan Beulich
  0 siblings, 0 replies; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 15:28 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> No need to call $(MAKE) again.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 15/31] build: move make option changes check earlier
  2021-07-01 14:09 ` [XEN PATCH v6 15/31] build: move make option changes check earlier Anthony PERARD
@ 2021-07-07 15:40   ` Jan Beulich
  2021-07-12 16:21     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 15:40 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> And thus avoiding checking for those variable over and over again.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
in its present shape since all you do is move existing logic. But I
wonder if I could talk you into ...

> --- a/xen/Makefile
> +++ b/xen/Makefile
> @@ -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 '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

... doing away with the misleading mentioning of just "menuconfig" here.
There are various other *config targets, many of which are also suitable
for the purpose. Personally I've used menuconfig (in Linux) the last
time perhaps 15 years ago, and hence I have almost forgotten about its
existence. IOW at the very least I'd see us insert "e.g." everywhere.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 17/31] build: convert binfile use to if_changed
  2021-07-01 14:09 ` [XEN PATCH v6 17/31] build: convert binfile use to if_changed Anthony PERARD
@ 2021-07-07 15:48   ` Jan Beulich
  2021-07-12 16:32     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 15:48 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Daniel De Graaf, Daniel P. Smith,
	xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> --- a/xen/common/Makefile
> +++ b/xen/common/Makefile
> @@ -80,8 +80,12 @@ config.gz: $(CONF_FILE)
>  
>  config_data.o: config.gz
>  
> -config_data.S: $(BASEDIR)/tools/binfile
> -	$(SHELL) $(BASEDIR)/tools/binfile $@ config.gz xen_config_data
> +quiet_cmd_binfile = BINFILE $@
> +cmd_binfile = $(SHELL) $< $@ config.gz xen_config_data

This is an abuse of $< which I consider overly confusing:
$(BASEDIR)/tools/binfile is not the input file to the rule. Instead
the script generates an assembly file "out of thin air", with not
input files at all. The rule and ...

> +config_data.S: $(BASEDIR)/tools/binfile FORCE

... dependency shouldn't give a different impression. What would
be nice (without having checked how difficult this might be) would
be if quiet_cmd_binfile and cmd_binfile could move to xen/Rules.mk
and merely be used from here (and the other location, where the
same concern obviously applies).

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 23/31] build: fix arch/x86/node.o rule
  2021-07-01 14:10 ` [XEN PATCH v6 23/31] build: fix arch/x86/node.o rule Anthony PERARD
@ 2021-07-07 16:04   ` Jan Beulich
  0 siblings, 0 replies; 82+ messages in thread
From: Jan Beulich @ 2021-07-07 16:04 UTC (permalink / raw)
  To: Anthony PERARD; +Cc: Andrew Cooper, Roger Pau Monné, Wei Liu, xen-devel

On 01.07.2021 16:10, Anthony PERARD wrote:
> Avoid different spelling for the location of "xen-syms", and simply
> use the dependency variable. This avoid the assumption about $(TARGET)
> value.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
with s/node/note/ in the title (I was very curious what this patch was
about, and hence peeked ahead in the series).

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 03/31] build: use if_changed on built_in.o
  2021-07-01 14:09 ` [XEN PATCH v6 03/31] build: use if_changed on built_in.o Anthony PERARD
@ 2021-07-08 12:03   ` Andrew Cooper
  2021-07-12 11:08     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Andrew Cooper @ 2021-07-08 12:03 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel
  Cc: Jan Beulich, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu

On 01/07/2021 15:09, Anthony PERARD wrote:
> diff --git a/xen/Rules.mk b/xen/Rules.mk
> index f778058f80a6..6a0cdfde2eed 100644
> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -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 = LD      $@

s/LD/CC/

~Andrew


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 31/31] build,riscv: tell the build system about riscv64/head.S
  2021-07-01 14:10 ` [XEN PATCH v6 31/31] build,riscv: tell the build system about riscv64/head.S Anthony PERARD
  2021-07-01 17:52   ` Bob Eshleman
  2021-07-02  4:45   ` Alistair Francis
@ 2021-07-10  0:50   ` Connor Davis
  2 siblings, 0 replies; 82+ messages in thread
From: Connor Davis @ 2021-07-10  0:50 UTC (permalink / raw)
  To: Anthony PERARD, xen-devel; +Cc: Bob Eshleman, Alistair Francis



On 7/1/21 8:10 AM, Anthony PERARD wrote:
> 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
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
>   xen/arch/riscv/riscv64/Makefile | 1 +
>   1 file changed, 1 insertion(+)
>   create mode 100644 xen/arch/riscv/riscv64/Makefile
>
> diff --git a/xen/arch/riscv/riscv64/Makefile b/xen/arch/riscv/riscv64/Makefile
> new file mode 100644
> index 000000000000..15a4a65f6615
> --- /dev/null
> +++ b/xen/arch/riscv/riscv64/Makefile
> @@ -0,0 +1 @@
> +extra-y += head.o
Acked-by: Connor Davis <connojdavis@gmail.com>


- Connor


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 02/31] build: introduce cpp_flags macro
  2021-07-07 14:18   ` Jan Beulich
@ 2021-07-12 10:53     ` Anthony PERARD
  0 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-12 10:53 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Roger Pau Monné,
	Tim Deegan, xen-devel

On Wed, Jul 07, 2021 at 04:18:18PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> >  xen/Rules.mk                    | 7 +++++--
> >  xen/arch/x86/mm/Makefile        | 2 +-
> >  xen/arch/x86/mm/hap/Makefile    | 2 +-
> >  xen/arch/x86/mm/shadow/Makefile | 2 +-
> >  4 files changed, 8 insertions(+), 5 deletions(-)
> 
> There are two further uses, one in xen/Makefile and one in
> xen/x86/Makefile. I think both want replacing too, and the
> former suggests you also want to strip -flto alongside -Wa,%.
> I can accept the use in xen/include/Makefile not getting
> touched, as it also removes an -include option at the same
> time.

Sounds good, I'll filter -flto and convert "asm-offsets.s" and
"xen.lds".

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 05/31] build: factorise generation of the linker scripts
  2021-07-07 14:25   ` Jan Beulich
@ 2021-07-12 11:02     ` Anthony PERARD
  2021-07-13  7:28       ` Jan Beulich
  0 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-12 11:02 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Volodymyr Babchuk,
	Roger Pau Monné,
	xen-devel

On Wed, Jul 07, 2021 at 04:25:33PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> > 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.
> 
> I'm not really happy about this, not the least because the symbol's name
> doesn't fit its purpose (we're not linking, but producing a linker script
> at that stage), but well ...

Also, the leading "__" is probably a bad idea as I think it's reserved?

I'll look at adding creating a patch which would rename that to
LINKER_SCRIPT which seems more appropriate.

> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 03/31] build: use if_changed on built_in.o
  2021-07-08 12:03   ` Andrew Cooper
@ 2021-07-12 11:08     ` Anthony PERARD
  0 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-12 11:08 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: xen-devel, Jan Beulich, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu

On Thu, Jul 08, 2021 at 01:03:46PM +0100, Andrew Cooper wrote:
> On 01/07/2021 15:09, Anthony PERARD wrote:
> > diff --git a/xen/Rules.mk b/xen/Rules.mk
> > index f778058f80a6..6a0cdfde2eed 100644
> > --- a/xen/Rules.mk
> > +++ b/xen/Rules.mk
> > @@ -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 = LD      $@
> 
> s/LD/CC/

Will fix that.

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 06/31] x86/mm: avoid building multiple .o from a single .c file
  2021-07-07 14:45   ` Jan Beulich
@ 2021-07-12 12:49     ` Anthony PERARD
  2021-07-13  7:32       ` Jan Beulich
  0 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-12 12:49 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Roger Pau Monné,
	Tim Deegan, xen-devel

On Wed, Jul 07, 2021 at 04:45:11PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> >  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            |  9 ---------
> >  xen/arch/x86/mm/hap/guest_walk.c        |  3 ---
> >  xen/arch/x86/mm/hap/guest_walk_2level.c |  2 ++
> >  xen/arch/x86/mm/hap/guest_walk_3level.c |  2 ++
> >  xen/arch/x86/mm/hap/guest_walk_4level.c |  2 ++
> 
> Is there a particular reason you've kept the "level" in these three
> file names? Preferably with them shortened (and ideally dashes used
> everywhere in the new file names instead of underscores)

I had no reason to rename them. (Also, renaming them makes the patch
bigger ;-) as we would rename the objects files.)

But I can rename as part of the patch. Should I rename all of them (mm
hap and shadow) to "guest-walk-$level.c" ? Or just "guest-$level.c" like
in shadow/ ? On the other hand, it would probably be helpful to have the same
basename for both the source and the .c that includes the source (e.g.
"guest_walk.c" and "guest_walk_2.c" have "guest_walk" in common). So if
we were to replace underscores by dashes, we should probably rename
"guest_walk.c" to "guest-walk.c" as well.

So I'll remove the "level" from the filenames in hap/ to start with in
an update to this patch, it it worth it to do more that that?

> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 07/31] build,include: rework compat-build-source.py
  2021-07-07 14:58   ` Jan Beulich
@ 2021-07-12 14:35     ` Anthony PERARD
  2021-07-13  7:37       ` Jan Beulich
  0 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-12 14:35 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On Wed, Jul 07, 2021 at 04:58:29PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> > 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.
> > 
> > Also remove dependency on Makefile as the file generation doesn't
> > depend on it anymore.
> 
> Did it before any more?

Kind of, yes, there is "grep -v" that makes the Makefile part of the
script that generates the target.

> In the subsequent patch I can see more of
> a reason to drop the dependency, but neither there nor here I'm
> really convinced: In general I think every generate file would
> better depend on the makefile containing the rule used for its
> building, as a change to that rule means the target wants
> rebuilding.

Does that mean that nearly every single targets should depends on a
"Makefile" or on "Rules.mk" ? :-)

As for the current target "compat/%.c", with this patch applied, the
only few things that the content of the file depends on is the script,
the first dependency, and "xlat.lst" (also a dependency). So the
Makefile doesn't play a role into what get's into the target, the
"mkdir" and the "mv" don't really matter. If the rule where to be
changed in a way that changed the content of the target, that would be
wrong in my opinion, the change should be done in the script.
If someone wanted to rewrite the script in a different language and thus
renaming the script, that would be fine too as make would notice that
the new script is newer that the target (as the file for the script as
just been created).

But, I guess we could start to use the "if_changed" macro here to
detected rule changes.

I really don't like when a target depends on a "Makefile" because that
means the target gets rebuilt for unrelated reason so I'd like to avoid
dependency on it when possible.

> Therefore for the moment ...
>
> > Acked-by: Jan Beulich <jbeulich@suse.com>
> 
> ... this holds only with the dependency kept in place. But I'll
> be happy to get convinced otherwise.

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 09/31] build: clean "lib.a"
  2021-07-07 15:03   ` Jan Beulich
@ 2021-07-12 14:42     ` Anthony PERARD
  0 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-12 14:42 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On Wed, Jul 07, 2021 at 05:03:12PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Hmm, I was clearly under the impression (or at least assuming)
> that $(targets) would be included in what gets cleaned by the
> general rule.

Unfortunately, that not true for two reasons, the first is that `make
clean` doesn't actually remove anything from $(targets), but that could
be changed as Linux does remove files listed in $(targets). The second is
that `make clean` doesn't actually use anything from "Rules.mk" and
doesn't include it, so when running `make clean`, "lib.a" is never in
$(targets).

> Acked-by: Jan Beulich <jbeulich@suse.com>

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 11/31] build: fix clean targets when subdir-y is used
  2021-07-07 15:15   ` Jan Beulich
@ 2021-07-12 14:54     ` Anthony PERARD
  0 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-12 14:54 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On Wed, Jul 07, 2021 at 05:15:44PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> > 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.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks.

> > --- a/xen/scripts/Makefile.clean
> > +++ b/xen/scripts/Makefile.clean
> > @@ -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-)))
> 
> Isn't this a normalization which also wants doing in xen/Rules.mk for
> subdir-y? Or perhaps this is part of one of the subsequent patches
> already?

Indeed, a similar change is done as part of
    build: build everything from the root dir, use obj=$subdir

Cheers,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 12/31] build: use subdir-y in test/Makefile
  2021-07-07 15:26   ` Jan Beulich
@ 2021-07-12 15:22     ` Anthony PERARD
  2021-07-13  7:41       ` Jan Beulich
  0 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-12 15:22 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On Wed, Jul 07, 2021 at 05:26:13PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> > --- a/xen/test/Makefile
> > +++ b/xen/test/Makefile
> > @@ -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
> 
> As per xen/Rules.mk having
> 
> subdir-y := $(subdir-y) $(filter %/, $(obj-y))
> obj-y    := $(patsubst %/, %/built_in.o, $(obj-y))
> ...
> subdir-obj-y := $(filter %/built_in.o, $(obj-y))
> 
> this will result in building of livepatch/built_in.o afaict. Is
> this an intended but benign side effect?

Actually, nothing in Rules.mk is using $(subdir-y) other than updating
it with possible subdir from $(obj-y).
Recursion into a subdir only happen if it is listed in $(obj-y) and thus
should be part of a built_in.o. Rules.mk doesn't have a mean to recurs
otherwise.

So nothing is actually going to try to build livepatch/build_in.o due to
$(subdir-y).

> >  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
> 
> And then why can't the generic recursion rule in xen/Rules.mk
> not also be used for the "build" target? (I guess "install" and
> "uninstall" need to remain separate, and don't think I know what
> "subtree-force-update" is about.)

There's some more changed in a later patch[1] to Rules.mk which would
make it possible to remove the need for a "build" target and I actually
remove the "build" target as well as the "subtree-force-update" target.
Some more changes in tests/livepatch/ are done in patch[2] which
actually allow to remove the "build" target.

    [1] build: build everything from the root dir, use obj=$subdir
    [2] build: rework test/livepatch/Makefile

I think the "subtree-force-update" target as to do with having the same
logic to deal with $(SUBDIRS) as the logic in tools/ and the top
makefile, but might not have been actually hooked up.

Cheers,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 15/31] build: move make option changes check earlier
  2021-07-07 15:40   ` Jan Beulich
@ 2021-07-12 16:21     ` Anthony PERARD
  2021-07-13  7:42       ` Jan Beulich
  0 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-12 16:21 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On Wed, Jul 07, 2021 at 05:40:02PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> > And thus avoiding checking for those variable over and over again.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>
> in its present shape since all you do is move existing logic. But I
> wonder if I could talk you into ...
> 
> > +ifneq ($(origin verbose),undefined)
> > +$(error "You must use 'make menuconfig' to enable/disable verbose now.")
> > +endif
> 
> ... doing away with the misleading mentioning of just "menuconfig" here.
> There are various other *config targets, many of which are also suitable
> for the purpose. Personally I've used menuconfig (in Linux) the last
> time perhaps 15 years ago, and hence I have almost forgotten about its
> existence. IOW at the very least I'd see us insert "e.g." everywhere.

Hopefully, no one ever hits those error anymore, it's been 5 years it
seems since the changes has been made.

But I can write instead:
    "You must use e.g. 'make menuconfig' to enable/disable verbose now."
or maybe:
    "You must use Kconfig with e.g. 'make menuconfig' to enable/disable verbose now."
    ?

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 17/31] build: convert binfile use to if_changed
  2021-07-07 15:48   ` Jan Beulich
@ 2021-07-12 16:32     ` Anthony PERARD
  2021-07-13  7:51       ` Jan Beulich
  0 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-12 16:32 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Daniel De Graaf, Daniel P. Smith,
	xen-devel

On Wed, Jul 07, 2021 at 05:48:57PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> > --- a/xen/common/Makefile
> > +++ b/xen/common/Makefile
> > @@ -80,8 +80,12 @@ config.gz: $(CONF_FILE)
> >  
> >  config_data.o: config.gz
> >  
> > -config_data.S: $(BASEDIR)/tools/binfile
> > -	$(SHELL) $(BASEDIR)/tools/binfile $@ config.gz xen_config_data
> > +quiet_cmd_binfile = BINFILE $@
> > +cmd_binfile = $(SHELL) $< $@ config.gz xen_config_data
> 
> This is an abuse of $< which I consider overly confusing:
> $(BASEDIR)/tools/binfile is not the input file to the rule. Instead
> the script generates an assembly file "out of thin air", with not
> input files at all. The rule and ...
> 
> > +config_data.S: $(BASEDIR)/tools/binfile FORCE
> 
> ... dependency shouldn't give a different impression. What would
> be nice (without having checked how difficult this might be) would
> be if quiet_cmd_binfile and cmd_binfile could move to xen/Rules.mk
> and merely be used from here (and the other location, where the
> same concern obviously applies).

I've though of having cmd_binfile in Rules.mk, but it's made more
complicated by having a "-i" flag used in flask/.

So one things I've writen was:

config_data.S: $(BASEDIR)/tools/binfile FORCE
       $(call if_changed,binfile,,config.gz xen_config_data)
flask-policy.S: $(BASEDIR)/tools/binfile FORCE
       $(call if_changed,binfile,-i,policy.bin xsm_flask_init_policy)

with:
cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(2) $@ $(3)

I thought this would be confusing, so I avoid it.
But maybe with the lists of flags at the end, it would be better:
   $(call if_changed,binfile,policy.bin xsm_flask_init_policy,-i)

Still want to move cmd_binfile to Rules.mk?

But I can at least spell "tools/binfile" instead of using $<.

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 05/31] build: factorise generation of the linker scripts
  2021-07-12 11:02     ` Anthony PERARD
@ 2021-07-13  7:28       ` Jan Beulich
  0 siblings, 0 replies; 82+ messages in thread
From: Jan Beulich @ 2021-07-13  7:28 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Volodymyr Babchuk,
	Roger Pau Monné,
	xen-devel

On 12.07.2021 13:02, Anthony PERARD wrote:
> On Wed, Jul 07, 2021 at 04:25:33PM +0200, Jan Beulich wrote:
>> On 01.07.2021 16:09, Anthony PERARD wrote:
>>> 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.
>>
>> I'm not really happy about this, not the least because the symbol's name
>> doesn't fit its purpose (we're not linking, but producing a linker script
>> at that stage), but well ...
> 
> Also, the leading "__" is probably a bad idea as I think it's reserved?

I guess that's intentional in this case, matching in particular
__ASSEMBLY__.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 06/31] x86/mm: avoid building multiple .o from a single .c file
  2021-07-12 12:49     ` Anthony PERARD
@ 2021-07-13  7:32       ` Jan Beulich
  0 siblings, 0 replies; 82+ messages in thread
From: Jan Beulich @ 2021-07-13  7:32 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Roger Pau Monné,
	Tim Deegan, xen-devel

On 12.07.2021 14:49, Anthony PERARD wrote:
> On Wed, Jul 07, 2021 at 04:45:11PM +0200, Jan Beulich wrote:
>> On 01.07.2021 16:09, Anthony PERARD wrote:
>>>  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            |  9 ---------
>>>  xen/arch/x86/mm/hap/guest_walk.c        |  3 ---
>>>  xen/arch/x86/mm/hap/guest_walk_2level.c |  2 ++
>>>  xen/arch/x86/mm/hap/guest_walk_3level.c |  2 ++
>>>  xen/arch/x86/mm/hap/guest_walk_4level.c |  2 ++
>>
>> Is there a particular reason you've kept the "level" in these three
>> file names? Preferably with them shortened (and ideally dashes used
>> everywhere in the new file names instead of underscores)
> 
> I had no reason to rename them. (Also, renaming them makes the patch
> bigger ;-) as we would rename the objects files.)
> 
> But I can rename as part of the patch. Should I rename all of them (mm
> hap and shadow) to "guest-walk-$level.c" ? Or just "guest-$level.c" like
> in shadow/ ? On the other hand, it would probably be helpful to have the same
> basename for both the source and the .c that includes the source (e.g.
> "guest_walk.c" and "guest_walk_2.c" have "guest_walk" in common). So if
> we were to replace underscores by dashes, we should probably rename
> "guest_walk.c" to "guest-walk.c" as well.
> 
> So I'll remove the "level" from the filenames in hap/ to start with in
> an update to this patch, it it worth it to do more that that?

I'd be okay with just the removal of "level"; switching to dashes would
be nice imo, but I can see this being controversial - as you say, names
would go slightly out of sync, and whether renaming the base files is
warranted is hard to say. I'd be personally in favor, but I can see why
people may prefer not to have those extra renames in here.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 07/31] build,include: rework compat-build-source.py
  2021-07-12 14:35     ` Anthony PERARD
@ 2021-07-13  7:37       ` Jan Beulich
  0 siblings, 0 replies; 82+ messages in thread
From: Jan Beulich @ 2021-07-13  7:37 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 12.07.2021 16:35, Anthony PERARD wrote:
> On Wed, Jul 07, 2021 at 04:58:29PM +0200, Jan Beulich wrote:
>> On 01.07.2021 16:09, Anthony PERARD wrote:
>>> 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.
>>>
>>> Also remove dependency on Makefile as the file generation doesn't
>>> depend on it anymore.
>>
>> Did it before any more?
> 
> Kind of, yes, there is "grep -v" that makes the Makefile part of the
> script that generates the target.
> 
>> In the subsequent patch I can see more of
>> a reason to drop the dependency, but neither there nor here I'm
>> really convinced: In general I think every generate file would
>> better depend on the makefile containing the rule used for its
>> building, as a change to that rule means the target wants
>> rebuilding.
> 
> Does that mean that nearly every single targets should depends on a
> "Makefile" or on "Rules.mk" ? :-)

Well, yes, I indeed think so.

> As for the current target "compat/%.c", with this patch applied, the
> only few things that the content of the file depends on is the script,
> the first dependency, and "xlat.lst" (also a dependency). So the
> Makefile doesn't play a role into what get's into the target, the
> "mkdir" and the "mv" don't really matter. If the rule where to be
> changed in a way that changed the content of the target, that would be
> wrong in my opinion, the change should be done in the script.
> If someone wanted to rewrite the script in a different language and thus
> renaming the script, that would be fine too as make would notice that
> the new script is newer that the target (as the file for the script as
> just been created).

Right, but e.g. adding an option to the scrip invocation would then
not trigger a rebuild.

> But, I guess we could start to use the "if_changed" macro here to
> detected rule changes.
> 
> I really don't like when a target depends on a "Makefile" because that
> means the target gets rebuilt for unrelated reason so I'd like to avoid
> dependency on it when possible.

I can see the background of this viewpoint, but personally I think the
extra rebuilds are the price to pay to not have any rebuilds skipped
when they would be needed. Overall it is my understanding that to get
this more fine grained is what if_changed is for.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 12/31] build: use subdir-y in test/Makefile
  2021-07-12 15:22     ` Anthony PERARD
@ 2021-07-13  7:41       ` Jan Beulich
  2021-07-13 14:35         ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-13  7:41 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 12.07.2021 17:22, Anthony PERARD wrote:
> On Wed, Jul 07, 2021 at 05:26:13PM +0200, Jan Beulich wrote:
>> On 01.07.2021 16:09, Anthony PERARD wrote:
>>> --- a/xen/test/Makefile
>>> +++ b/xen/test/Makefile
>>> @@ -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
>>
>> As per xen/Rules.mk having
>>
>> subdir-y := $(subdir-y) $(filter %/, $(obj-y))
>> obj-y    := $(patsubst %/, %/built_in.o, $(obj-y))
>> ...
>> subdir-obj-y := $(filter %/built_in.o, $(obj-y))
>>
>> this will result in building of livepatch/built_in.o afaict. Is
>> this an intended but benign side effect?
> 
> Actually, nothing in Rules.mk is using $(subdir-y) other than updating
> it with possible subdir from $(obj-y).
> Recursion into a subdir only happen if it is listed in $(obj-y) and thus
> should be part of a built_in.o. Rules.mk doesn't have a mean to recurs
> otherwise.
> 
> So nothing is actually going to try to build livepatch/build_in.o due to
> $(subdir-y).

Question then is: Isn't this actually a bug?

>>>  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
>>
>> And then why can't the generic recursion rule in xen/Rules.mk
>> not also be used for the "build" target? (I guess "install" and
>> "uninstall" need to remain separate, and don't think I know what
>> "subtree-force-update" is about.)
> 
> There's some more changed in a later patch[1] to Rules.mk which would
> make it possible to remove the need for a "build" target and I actually
> remove the "build" target as well as the "subtree-force-update" target.
> Some more changes in tests/livepatch/ are done in patch[2] which
> actually allow to remove the "build" target.
> 
>     [1] build: build everything from the root dir, use obj=$subdir
>     [2] build: rework test/livepatch/Makefile
> 
> I think the "subtree-force-update" target as to do with having the same
> logic to deal with $(SUBDIRS) as the logic in tools/ and the top
> makefile, but might not have been actually hooked up.

Okay, I guess I need to get further through the series to see the final
effects.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 15/31] build: move make option changes check earlier
  2021-07-12 16:21     ` Anthony PERARD
@ 2021-07-13  7:42       ` Jan Beulich
  0 siblings, 0 replies; 82+ messages in thread
From: Jan Beulich @ 2021-07-13  7:42 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 12.07.2021 18:21, Anthony PERARD wrote:
> On Wed, Jul 07, 2021 at 05:40:02PM +0200, Jan Beulich wrote:
>> On 01.07.2021 16:09, Anthony PERARD wrote:
>>> And thus avoiding checking for those variable over and over again.
>>>
>>> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
>>
>> Acked-by: Jan Beulich <jbeulich@suse.com>
>> in its present shape since all you do is move existing logic. But I
>> wonder if I could talk you into ...
>>
>>> +ifneq ($(origin verbose),undefined)
>>> +$(error "You must use 'make menuconfig' to enable/disable verbose now.")
>>> +endif
>>
>> ... doing away with the misleading mentioning of just "menuconfig" here.
>> There are various other *config targets, many of which are also suitable
>> for the purpose. Personally I've used menuconfig (in Linux) the last
>> time perhaps 15 years ago, and hence I have almost forgotten about its
>> existence. IOW at the very least I'd see us insert "e.g." everywhere.
> 
> Hopefully, no one ever hits those error anymore, it's been 5 years it
> seems since the changes has been made.
> 
> But I can write instead:
>     "You must use e.g. 'make menuconfig' to enable/disable verbose now."
> or maybe:
>     "You must use Kconfig with e.g. 'make menuconfig' to enable/disable verbose now."
>     ?

Either would be fine with me, with a slight preference to the shorter
form.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 17/31] build: convert binfile use to if_changed
  2021-07-12 16:32     ` Anthony PERARD
@ 2021-07-13  7:51       ` Jan Beulich
  2021-07-13 14:58         ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-07-13  7:51 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Daniel De Graaf, Daniel P. Smith,
	xen-devel

On 12.07.2021 18:32, Anthony PERARD wrote:
> On Wed, Jul 07, 2021 at 05:48:57PM +0200, Jan Beulich wrote:
>> On 01.07.2021 16:09, Anthony PERARD wrote:
>>> --- a/xen/common/Makefile
>>> +++ b/xen/common/Makefile
>>> @@ -80,8 +80,12 @@ config.gz: $(CONF_FILE)
>>>  
>>>  config_data.o: config.gz
>>>  
>>> -config_data.S: $(BASEDIR)/tools/binfile
>>> -	$(SHELL) $(BASEDIR)/tools/binfile $@ config.gz xen_config_data
>>> +quiet_cmd_binfile = BINFILE $@
>>> +cmd_binfile = $(SHELL) $< $@ config.gz xen_config_data
>>
>> This is an abuse of $< which I consider overly confusing:
>> $(BASEDIR)/tools/binfile is not the input file to the rule. Instead
>> the script generates an assembly file "out of thin air", with not
>> input files at all. The rule and ...
>>
>>> +config_data.S: $(BASEDIR)/tools/binfile FORCE
>>
>> ... dependency shouldn't give a different impression. What would
>> be nice (without having checked how difficult this might be) would
>> be if quiet_cmd_binfile and cmd_binfile could move to xen/Rules.mk
>> and merely be used from here (and the other location, where the
>> same concern obviously applies).
> 
> I've though of having cmd_binfile in Rules.mk, but it's made more
> complicated by having a "-i" flag used in flask/.
> 
> So one things I've writen was:
> 
> config_data.S: $(BASEDIR)/tools/binfile FORCE
>        $(call if_changed,binfile,,config.gz xen_config_data)
> flask-policy.S: $(BASEDIR)/tools/binfile FORCE
>        $(call if_changed,binfile,-i,policy.bin xsm_flask_init_policy)
> 
> with:
> cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(2) $@ $(3)
> 
> I thought this would be confusing, so I avoid it.

Indeed that's why I did write "without having checked how difficult
this might be", because I definitely didn't want to suggest such
anomalies to get introduced. It's unhelpful that options have to
come first.

> But maybe with the lists of flags at the end, it would be better:
>    $(call if_changed,binfile,policy.bin xsm_flask_init_policy,-i)

Yes, this is a little better imo, but still not pretty.

> Still want to move cmd_binfile to Rules.mk?

I'd still like it to be moved, but without resulting in a rule
that's not consistent with others. Maybe we should have a
BINFILE_FLAGS variable (paralleling e.g. CFLAGS)?

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 12/31] build: use subdir-y in test/Makefile
  2021-07-13  7:41       ` Jan Beulich
@ 2021-07-13 14:35         ` Anthony PERARD
  0 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-07-13 14:35 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On Tue, Jul 13, 2021 at 09:41:03AM +0200, Jan Beulich wrote:
> On 12.07.2021 17:22, Anthony PERARD wrote:
> > On Wed, Jul 07, 2021 at 05:26:13PM +0200, Jan Beulich wrote:
> >> On 01.07.2021 16:09, Anthony PERARD wrote:
> >>> --- a/xen/test/Makefile
> >>> +++ b/xen/test/Makefile
> >>> @@ -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
> >>
> >> As per xen/Rules.mk having
> >>
> >> subdir-y := $(subdir-y) $(filter %/, $(obj-y))
> >> obj-y    := $(patsubst %/, %/built_in.o, $(obj-y))
> >> ...
> >> subdir-obj-y := $(filter %/built_in.o, $(obj-y))
> >>
> >> this will result in building of livepatch/built_in.o afaict. Is
> >> this an intended but benign side effect?
> > 
> > Actually, nothing in Rules.mk is using $(subdir-y) other than updating
> > it with possible subdir from $(obj-y).
> > Recursion into a subdir only happen if it is listed in $(obj-y) and thus
> > should be part of a built_in.o. Rules.mk doesn't have a mean to recurs
> > otherwise.
> > 
> > So nothing is actually going to try to build livepatch/build_in.o due to
> > $(subdir-y).
> 
> Question then is: Isn't this actually a bug?

No, "obj-y += livepatch/" need to be used instead, to build "livepatch/built_in.o".
Because "$(obj-y)" are objects to be included in a "built_in.o".

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 17/31] build: convert binfile use to if_changed
  2021-07-13  7:51       ` Jan Beulich
@ 2021-07-13 14:58         ` Anthony PERARD
  2021-07-13 15:33           ` Jan Beulich
  0 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-07-13 14:58 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Daniel De Graaf, Daniel P. Smith,
	xen-devel

On Tue, Jul 13, 2021 at 09:51:45AM +0200, Jan Beulich wrote:
> On 12.07.2021 18:32, Anthony PERARD wrote:
> > On Wed, Jul 07, 2021 at 05:48:57PM +0200, Jan Beulich wrote:
> >> On 01.07.2021 16:09, Anthony PERARD wrote:
> >>> --- a/xen/common/Makefile
> >>> +++ b/xen/common/Makefile
> >>> @@ -80,8 +80,12 @@ config.gz: $(CONF_FILE)
> >>>  
> >>>  config_data.o: config.gz
> >>>  
> >>> -config_data.S: $(BASEDIR)/tools/binfile
> >>> -	$(SHELL) $(BASEDIR)/tools/binfile $@ config.gz xen_config_data
> >>> +quiet_cmd_binfile = BINFILE $@
> >>> +cmd_binfile = $(SHELL) $< $@ config.gz xen_config_data
> >>
> >> This is an abuse of $< which I consider overly confusing:
> >> $(BASEDIR)/tools/binfile is not the input file to the rule. Instead
> >> the script generates an assembly file "out of thin air", with not
> >> input files at all. The rule and ...
> >>
> >>> +config_data.S: $(BASEDIR)/tools/binfile FORCE
> >>
> >> ... dependency shouldn't give a different impression. What would
> >> be nice (without having checked how difficult this might be) would
> >> be if quiet_cmd_binfile and cmd_binfile could move to xen/Rules.mk
> >> and merely be used from here (and the other location, where the
> >> same concern obviously applies).
> > 
> > I've though of having cmd_binfile in Rules.mk, but it's made more
> > complicated by having a "-i" flag used in flask/.
> > 
> > So one things I've writen was:
> > 
> > config_data.S: $(BASEDIR)/tools/binfile FORCE
> >        $(call if_changed,binfile,,config.gz xen_config_data)
> > flask-policy.S: $(BASEDIR)/tools/binfile FORCE
> >        $(call if_changed,binfile,-i,policy.bin xsm_flask_init_policy)
> > 
> > with:
> > cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(2) $@ $(3)
> > 
> > I thought this would be confusing, so I avoid it.
> 
> Indeed that's why I did write "without having checked how difficult
> this might be", because I definitely didn't want to suggest such
> anomalies to get introduced. It's unhelpful that options have to
> come first.
> 
> > But maybe with the lists of flags at the end, it would be better:
> >    $(call if_changed,binfile,policy.bin xsm_flask_init_policy,-i)
> 
> Yes, this is a little better imo, but still not pretty.
> 
> > Still want to move cmd_binfile to Rules.mk?
> 
> I'd still like it to be moved, but without resulting in a rule
> that's not consistent with others. Maybe we should have a
> BINFILE_FLAGS variable (paralleling e.g. CFLAGS)?

Sound good.

    cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(BINFILE_FLAGS) $@ $(2)

    flask-policy.S: BINFILE_FLAGS := -i
    flask-policy.S: $(BASEDIR)/tools/binfile FORCE
           $(call if_changed,binfile,policy.bin xsm_flask_init_policy)

Would the above be OK?
Otherwise, maybe you'll prefer the following:

    flask-policy.S: BINFILE_FLAGS = -i $@ policy.bin xsm_flask_init_policy
    flask-policy.S: $(BASEDIR)/tools/binfile FORCE
           $(call if_changed,binfile)

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 17/31] build: convert binfile use to if_changed
  2021-07-13 14:58         ` Anthony PERARD
@ 2021-07-13 15:33           ` Jan Beulich
  0 siblings, 0 replies; 82+ messages in thread
From: Jan Beulich @ 2021-07-13 15:33 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Daniel De Graaf, Daniel P. Smith,
	xen-devel

On 13.07.2021 16:58, Anthony PERARD wrote:
> On Tue, Jul 13, 2021 at 09:51:45AM +0200, Jan Beulich wrote:
>> On 12.07.2021 18:32, Anthony PERARD wrote:
>>> On Wed, Jul 07, 2021 at 05:48:57PM +0200, Jan Beulich wrote:
>>>> On 01.07.2021 16:09, Anthony PERARD wrote:
>>>>> --- a/xen/common/Makefile
>>>>> +++ b/xen/common/Makefile
>>>>> @@ -80,8 +80,12 @@ config.gz: $(CONF_FILE)
>>>>>  
>>>>>  config_data.o: config.gz
>>>>>  
>>>>> -config_data.S: $(BASEDIR)/tools/binfile
>>>>> -	$(SHELL) $(BASEDIR)/tools/binfile $@ config.gz xen_config_data
>>>>> +quiet_cmd_binfile = BINFILE $@
>>>>> +cmd_binfile = $(SHELL) $< $@ config.gz xen_config_data
>>>>
>>>> This is an abuse of $< which I consider overly confusing:
>>>> $(BASEDIR)/tools/binfile is not the input file to the rule. Instead
>>>> the script generates an assembly file "out of thin air", with not
>>>> input files at all. The rule and ...
>>>>
>>>>> +config_data.S: $(BASEDIR)/tools/binfile FORCE
>>>>
>>>> ... dependency shouldn't give a different impression. What would
>>>> be nice (without having checked how difficult this might be) would
>>>> be if quiet_cmd_binfile and cmd_binfile could move to xen/Rules.mk
>>>> and merely be used from here (and the other location, where the
>>>> same concern obviously applies).
>>>
>>> I've though of having cmd_binfile in Rules.mk, but it's made more
>>> complicated by having a "-i" flag used in flask/.
>>>
>>> So one things I've writen was:
>>>
>>> config_data.S: $(BASEDIR)/tools/binfile FORCE
>>>        $(call if_changed,binfile,,config.gz xen_config_data)
>>> flask-policy.S: $(BASEDIR)/tools/binfile FORCE
>>>        $(call if_changed,binfile,-i,policy.bin xsm_flask_init_policy)
>>>
>>> with:
>>> cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(2) $@ $(3)
>>>
>>> I thought this would be confusing, so I avoid it.
>>
>> Indeed that's why I did write "without having checked how difficult
>> this might be", because I definitely didn't want to suggest such
>> anomalies to get introduced. It's unhelpful that options have to
>> come first.
>>
>>> But maybe with the lists of flags at the end, it would be better:
>>>    $(call if_changed,binfile,policy.bin xsm_flask_init_policy,-i)
>>
>> Yes, this is a little better imo, but still not pretty.
>>
>>> Still want to move cmd_binfile to Rules.mk?
>>
>> I'd still like it to be moved, but without resulting in a rule
>> that's not consistent with others. Maybe we should have a
>> BINFILE_FLAGS variable (paralleling e.g. CFLAGS)?
> 
> Sound good.
> 
>     cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
> 
>     flask-policy.S: BINFILE_FLAGS := -i
>     flask-policy.S: $(BASEDIR)/tools/binfile FORCE
>            $(call if_changed,binfile,policy.bin xsm_flask_init_policy)
> 
> Would the above be OK?
> Otherwise, maybe you'll prefer the following:
> 
>     flask-policy.S: BINFILE_FLAGS = -i $@ policy.bin xsm_flask_init_policy
>     flask-policy.S: $(BASEDIR)/tools/binfile FORCE
>            $(call if_changed,binfile)

I think I like the former better than the latter, but I could live
with either.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm
  2021-07-01 14:09 ` [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm Anthony PERARD
  2021-07-01 17:24   ` Paul Durrant
  2021-07-01 17:26   ` Bob Eshleman
@ 2021-08-05  7:04   ` Jan Beulich
  2021-08-09 13:20     ` Anthony PERARD
  2 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-08-05  7:04 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Tamas K Lengyel, Alexandru Isaila,
	Petre Pircalabu, Volodymyr Babchuk, Roger Pau Monné,
	Konrad Rzeszutek Wilk, Ross Lagerwall, Paul Durrant,
	Jun Nakajima, Kevin Tian, Lukasz Hawrylko, Bob Eshleman,
	Alistair Francis, Connor Davis, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> This avoid the need to create the symbolic link "include/asm".
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> 
> Other possible locations that I could think of:
> include/arch/*/asm
> arch/*/include/asm

I thought it was always the plan to follow Linux (and kind of XTF) in
this regard, using the latter of these options?

> --- a/xen/include/xen/bitmap.h
> +++ b/xen/include/xen/bitmap.h
> @@ -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 include/arch-<arch>/asm/bitops.h headers

Then, just to take this as an example, referring to just asm/bitops.h
in comments might be enough (limiting churn on some of the ones that
you're altering)?

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 19/31] build: rework .banner generation
  2021-07-01 14:09 ` [XEN PATCH v6 19/31] build: rework .banner generation Anthony PERARD
@ 2021-08-05  7:09   ` Jan Beulich
  2021-08-09 13:31     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-08-05  7:09 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 01.07.2021 16:09, Anthony PERARD wrote:
> Avoid depending on Makefile but still allow to rebuild the banner when
> $(XEN_FULLVERSION) changes.
> 
> Also add a dependency on tools/xen.flf, even if not expected to
> change.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

This looks to be independent of earlier patches in this series? If so,
I'd be happy to commit without waiting for earlier patches to get
review comments addressed.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 20/31] build: generate "include/xen/compile.h" with filechk
  2021-07-01 14:10 ` [XEN PATCH v6 20/31] build: generate "include/xen/compile.h" with filechk Anthony PERARD
@ 2021-08-05  7:20   ` Jan Beulich
  2021-08-09 14:27     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-08-05  7:20 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On 01.07.2021 16:10, Anthony PERARD wrote:
> This will always try regenerate the content of compile.h, but if it
> didn't change the file isn't updated.
> 
> Also, 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.
> 
> This patch imports the macro 'filechk' from Linux v5.12.

Would you mind clarifying why $(if_changed ...) cannot be used here
(unlike for .banner in the earlier patch)?

> @@ -413,22 +405,29 @@ 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' \
> -	    -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' \
> -	    < include/xen/compile.h.in > $@.new
> +# Don't refresh this files during e.g., 'sudo make install'
> +define filechk_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' \
> +	< $<; \
> +    sed -rf tools/process-banner.sed < .banner; \
> +    else \
> +	cat $@; \
> +    fi

Just like "cat" I think the "sed" invocations should be indented deeper
than if/else/fi.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 21/31] build: set XEN_BUILD_EFI earlier
  2021-07-01 14:10 ` [XEN PATCH v6 21/31] build: set XEN_BUILD_EFI earlier Anthony PERARD
@ 2021-08-05  7:27   ` Jan Beulich
  2021-08-09 15:59     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-08-05  7:27 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, Roger Pau Monné,
	Wei Liu, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, xen-devel

On 01.07.2021 16:10, Anthony PERARD wrote:
> We are going to need the variable XEN_BUILD_EFI earlier.
> 
> This early check is using "try-run" to allow to have a temporary
> output file in case it is needed for $(CC) to build the *.c file.
> 
> The "efi/check.o" file is still needed in "arch/x86/Makefile" so the
> check is currently duplicated.

Why is this? Can't you ...

> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -126,7 +126,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
>  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)
> +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

... use here what you ...

> --- a/xen/arch/x86/arch.mk
> +++ b/xen/arch/x86/arch.mk
> @@ -60,5 +60,10 @@ ifeq ($(CONFIG_UBSAN),y)
>  $(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
>  endif
>  
> +ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
> +# Check if the compiler supports the MS ABI.
> +export XEN_BUILD_EFI := $(call try-run,$(CC) $(CFLAGS) -c arch/x86/efi/check.c -o "$$TMPO",y)
> +endif

... export here?

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 25/31] build: remove unneeded deps of x86_emulate.o
  2021-07-01 14:10 ` [XEN PATCH v6 25/31] build: remove unneeded deps of x86_emulate.o Anthony PERARD
@ 2021-08-06 16:06   ` Jan Beulich
  2021-08-09 16:02     ` Anthony PERARD
  0 siblings, 1 reply; 82+ messages in thread
From: Jan Beulich @ 2021-08-06 16:06 UTC (permalink / raw)
  To: Anthony PERARD; +Cc: Andrew Cooper, Roger Pau Monné, Wei Liu, xen-devel

On 01.07.2021 16:10, Anthony PERARD wrote:
> Those two dependencies already exist so make doesn't need to know
> about them. The dependency will be generated by $(CC).
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Unless I'm mistaken this was actually an omission by 68b1230ae393
("Auto-build dependency files in hypervisor build tree"), which
would again suggest this can go in independently of all of the
earlier patches? In any event

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan

> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -84,7 +84,6 @@ extra-y += xen.lds
>  ifneq ($(CONFIG_HVM),y)
>  x86_emulate.o: CFLAGS-y += -Wno-unused-label
>  endif
> -x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
>  
>  efi-y := $(shell if [ ! -r $(BASEDIR)/include/xen/compile.h -o \
>                        -O $(BASEDIR)/include/xen/compile.h ]; then \
> 



^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm
  2021-08-05  7:04   ` Jan Beulich
@ 2021-08-09 13:20     ` Anthony PERARD
  0 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-08-09 13:20 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, Tamas K Lengyel, Alexandru Isaila,
	Petre Pircalabu, Volodymyr Babchuk, Roger Pau Monné,
	Konrad Rzeszutek Wilk, Ross Lagerwall, Paul Durrant,
	Jun Nakajima, Kevin Tian, Lukasz Hawrylko, Bob Eshleman,
	Alistair Francis, Connor Davis, xen-devel

On Thu, Aug 05, 2021 at 09:04:18AM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> > This avoid the need to create the symbolic link "include/asm".
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> > ---
> > 
> > Other possible locations that I could think of:
> > include/arch/*/asm
> > arch/*/include/asm
> 
> I thought it was always the plan to follow Linux (and kind of XTF) in
> this regard, using the latter of these options?

I'm not sure what the plan was, but putting the arch specific headers
in arch/ sound good. I'll rework the patch.

> > --- a/xen/include/xen/bitmap.h
> > +++ b/xen/include/xen/bitmap.h
> > @@ -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 include/arch-<arch>/asm/bitops.h headers
> 
> Then, just to take this as an example, referring to just asm/bitops.h
> in comments might be enough (limiting churn on some of the ones that
> you're altering)?

Sound good.

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 19/31] build: rework .banner generation
  2021-08-05  7:09   ` Jan Beulich
@ 2021-08-09 13:31     ` Anthony PERARD
  0 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-08-09 13:31 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On Thu, Aug 05, 2021 at 09:09:13AM +0200, Jan Beulich wrote:
> On 01.07.2021 16:09, Anthony PERARD wrote:
> > Avoid depending on Makefile but still allow to rebuild the banner when
> > $(XEN_FULLVERSION) changes.
> > 
> > Also add a dependency on tools/xen.flf, even if not expected to
> > change.
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 
> This looks to be independent of earlier patches in this series? If so,

Yes, it's independent.

> I'd be happy to commit without waiting for earlier patches to get
> review comments addressed.

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 20/31] build: generate "include/xen/compile.h" with filechk
  2021-08-05  7:20   ` Jan Beulich
@ 2021-08-09 14:27     ` Anthony PERARD
  0 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-08-09 14:27 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, Wei Liu, xen-devel

On Thu, Aug 05, 2021 at 09:20:10AM +0200, Jan Beulich wrote:
> On 01.07.2021 16:10, Anthony PERARD wrote:
> > This will always try regenerate the content of compile.h, but if it
> > didn't change the file isn't updated.
> > 
> > Also, 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.
> > 
> > This patch imports the macro 'filechk' from Linux v5.12.
> 
> Would you mind clarifying why $(if_changed ...) cannot be used here
> (unlike for .banner in the earlier patch)?

if_changed can be used instead of filechk. I probably use "filechk"
because I was looking for an excuse to use it, so I've used it here.

filechk advantage over if_changed is that the output of the command is
compared so there is no need to have an extra dependency (.*.cmd) file
generated. That probably mostly an advantage when the generated file
changed often, or when the command is simple enough.

But it seems that "filechk" is only used once in this patch series, in
this patch. So I can rework the patch to use "if_changed" instead, that
would avoid the need to import another macro from Linux, and avoid the
weird need to have the command "cat" the target when update isn't
wanted.

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 21/31] build: set XEN_BUILD_EFI earlier
  2021-08-05  7:27   ` Jan Beulich
@ 2021-08-09 15:59     ` Anthony PERARD
  2021-08-10  7:44       ` Jan Beulich
  0 siblings, 1 reply; 82+ messages in thread
From: Anthony PERARD @ 2021-08-09 15:59 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Andrew Cooper, Roger Pau Monné,
	Wei Liu, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, xen-devel

On Thu, Aug 05, 2021 at 09:27:18AM +0200, Jan Beulich wrote:
> On 01.07.2021 16:10, Anthony PERARD wrote:
> > We are going to need the variable XEN_BUILD_EFI earlier.
> > 
> > This early check is using "try-run" to allow to have a temporary
> > output file in case it is needed for $(CC) to build the *.c file.
> > 
> > The "efi/check.o" file is still needed in "arch/x86/Makefile" so the
> > check is currently duplicated.
> 
> Why is this? Can't you ...
> 
> > --- a/xen/arch/x86/Makefile
> > +++ b/xen/arch/x86/Makefile
> > @@ -126,7 +126,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
> >  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)
> > +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
> 
> ... use here what you ...
> 
> > --- a/xen/arch/x86/arch.mk
> > +++ b/xen/arch/x86/arch.mk
> > @@ -60,5 +60,10 @@ ifeq ($(CONFIG_UBSAN),y)
> >  $(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
> >  endif
> >  
> > +ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
> > +# Check if the compiler supports the MS ABI.
> > +export XEN_BUILD_EFI := $(call try-run,$(CC) $(CFLAGS) -c arch/x86/efi/check.c -o "$$TMPO",y)
> > +endif
> 
> ... export here?

The problem with the check for EFI support is that there several step,
with a step depending on the binary produced by the previous one.

XEN_BUILD_EFI
    In addition to check "__ms_abi__" attribute is supported by $CC, the
    file "efi/check.o" is produced.
XEN_BUILD_PE
    It is using "efi/check.o" to check for PE support and produce
    "efi/check.efi".
"efi/check.efi" is also used by the Makefile for additional checks
(mkreloc).


So, if I let the duplicated check for $(XEN_BUILD_EFI) is that it felt
wrong to produce "efi/check.o" in "arch/x86/arch.mk" and then later use
it in "arch/x86/Makefile". I could maybe move the command that create
efi/check.o in the $(XEN_BUILD_PE) check, or I could try to move most of
the checks done for EFI into x86/arch.mk. Or maybe just creating the
"efi/check.o" file in x86/arch.mk and use it in x86/Makefile, with a
comment.

What do you think?

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 25/31] build: remove unneeded deps of x86_emulate.o
  2021-08-06 16:06   ` Jan Beulich
@ 2021-08-09 16:02     ` Anthony PERARD
  0 siblings, 0 replies; 82+ messages in thread
From: Anthony PERARD @ 2021-08-09 16:02 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Cooper, Roger Pau Monné, Wei Liu, xen-devel

On Fri, Aug 06, 2021 at 06:06:37PM +0200, Jan Beulich wrote:
> On 01.07.2021 16:10, Anthony PERARD wrote:
> > Those two dependencies already exist so make doesn't need to know
> > about them. The dependency will be generated by $(CC).
> > 
> > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Unless I'm mistaken this was actually an omission by 68b1230ae393
> ("Auto-build dependency files in hypervisor build tree"), which
> would again suggest this can go in independently of all of the
> earlier patches? In any event

That sound right. Yes.

> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Thanks,

-- 
Anthony PERARD


^ permalink raw reply	[flat|nested] 82+ messages in thread

* Re: [XEN PATCH v6 21/31] build: set XEN_BUILD_EFI earlier
  2021-08-09 15:59     ` Anthony PERARD
@ 2021-08-10  7:44       ` Jan Beulich
  0 siblings, 0 replies; 82+ messages in thread
From: Jan Beulich @ 2021-08-10  7:44 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Andrew Cooper, Roger Pau Monné,
	Wei Liu, George Dunlap, Ian Jackson, Julien Grall,
	Stefano Stabellini, xen-devel

On 09.08.2021 17:59, Anthony PERARD wrote:
> On Thu, Aug 05, 2021 at 09:27:18AM +0200, Jan Beulich wrote:
>> On 01.07.2021 16:10, Anthony PERARD wrote:
>>> We are going to need the variable XEN_BUILD_EFI earlier.
>>>
>>> This early check is using "try-run" to allow to have a temporary
>>> output file in case it is needed for $(CC) to build the *.c file.
>>>
>>> The "efi/check.o" file is still needed in "arch/x86/Makefile" so the
>>> check is currently duplicated.
>>
>> Why is this? Can't you ...
>>
>>> --- a/xen/arch/x86/Makefile
>>> +++ b/xen/arch/x86/Makefile
>>> @@ -126,7 +126,7 @@ $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
>>>  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)
>>> +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
>>
>> ... use here what you ...
>>
>>> --- a/xen/arch/x86/arch.mk
>>> +++ b/xen/arch/x86/arch.mk
>>> @@ -60,5 +60,10 @@ ifeq ($(CONFIG_UBSAN),y)
>>>  $(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment)
>>>  endif
>>>  
>>> +ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
>>> +# Check if the compiler supports the MS ABI.
>>> +export XEN_BUILD_EFI := $(call try-run,$(CC) $(CFLAGS) -c arch/x86/efi/check.c -o "$$TMPO",y)
>>> +endif
>>
>> ... export here?
> 
> The problem with the check for EFI support is that there several step,
> with a step depending on the binary produced by the previous one.
> 
> XEN_BUILD_EFI
>     In addition to check "__ms_abi__" attribute is supported by $CC, the
>     file "efi/check.o" is produced.
> XEN_BUILD_PE
>     It is using "efi/check.o" to check for PE support and produce
>     "efi/check.efi".
> "efi/check.efi" is also used by the Makefile for additional checks
> (mkreloc).
> 
> 
> So, if I let the duplicated check for $(XEN_BUILD_EFI) is that it felt
> wrong to produce "efi/check.o" in "arch/x86/arch.mk" and then later use
> it in "arch/x86/Makefile". I could maybe move the command that create
> efi/check.o in the $(XEN_BUILD_PE) check, or I could try to move most of
> the checks done for EFI into x86/arch.mk. Or maybe just creating the
> "efi/check.o" file in x86/arch.mk and use it in x86/Makefile, with a
> comment.
> 
> What do you think?

The last option looks to promise the least code churn while still
eliminating the duplication. So that's one option I'd be fine with, the
other being to do all of this together in a single place.

Jan



^ permalink raw reply	[flat|nested] 82+ messages in thread

end of thread, other threads:[~2021-08-10  7:44 UTC | newest]

Thread overview: 82+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 14:09 [XEN PATCH v6 00/31] xen: Build system improvements Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 01/31] build: fix %.s: %.S rule Anthony PERARD
2021-07-05 14:40   ` Jan Beulich
2021-07-01 14:09 ` [XEN PATCH v6 02/31] build: introduce cpp_flags macro Anthony PERARD
2021-07-07 14:18   ` Jan Beulich
2021-07-12 10:53     ` Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 03/31] build: use if_changed on built_in.o Anthony PERARD
2021-07-08 12:03   ` Andrew Cooper
2021-07-12 11:08     ` Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 04/31] build: use if_changed_rules with %.o:%.c targets Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 05/31] build: factorise generation of the linker scripts Anthony PERARD
2021-07-07 14:25   ` Jan Beulich
2021-07-12 11:02     ` Anthony PERARD
2021-07-13  7:28       ` Jan Beulich
2021-07-01 14:09 ` [XEN PATCH v6 06/31] x86/mm: avoid building multiple .o from a single .c file Anthony PERARD
2021-07-07 14:45   ` Jan Beulich
2021-07-12 12:49     ` Anthony PERARD
2021-07-13  7:32       ` Jan Beulich
2021-07-01 14:09 ` [XEN PATCH v6 07/31] build,include: rework compat-build-source.py Anthony PERARD
2021-07-07 14:58   ` Jan Beulich
2021-07-12 14:35     ` Anthony PERARD
2021-07-13  7:37       ` Jan Beulich
2021-07-01 14:09 ` [XEN PATCH v6 08/31] build,include: rework compat-build-header.py Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 09/31] build: clean "lib.a" Anthony PERARD
2021-07-07 15:03   ` Jan Beulich
2021-07-12 14:42     ` Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 10/31] build: use $(kconfig) shortcut in clean rule Anthony PERARD
2021-07-07 15:05   ` Jan Beulich
2021-07-01 14:09 ` [XEN PATCH v6 11/31] build: fix clean targets when subdir-y is used Anthony PERARD
2021-07-07 15:15   ` Jan Beulich
2021-07-12 14:54     ` Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 12/31] build: use subdir-y in test/Makefile Anthony PERARD
2021-07-07 15:26   ` Jan Beulich
2021-07-12 15:22     ` Anthony PERARD
2021-07-13  7:41       ` Jan Beulich
2021-07-13 14:35         ` Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 13/31] build,tools: have default rules depends on symbols Anthony PERARD
2021-07-07 15:28   ` Jan Beulich
2021-07-01 14:09 ` [XEN PATCH v6 14/31] build,arm: move LDFLAGS change to arch.mk Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 15/31] build: move make option changes check earlier Anthony PERARD
2021-07-07 15:40   ` Jan Beulich
2021-07-12 16:21     ` Anthony PERARD
2021-07-13  7:42       ` Jan Beulich
2021-07-01 14:09 ` [XEN PATCH v6 16/31] build: avoid building arm/arm/*/head.o twice Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 17/31] build: convert binfile use to if_changed Anthony PERARD
2021-07-07 15:48   ` Jan Beulich
2021-07-12 16:32     ` Anthony PERARD
2021-07-13  7:51       ` Jan Beulich
2021-07-13 14:58         ` Anthony PERARD
2021-07-13 15:33           ` Jan Beulich
2021-07-01 14:09 ` [XEN PATCH v6 18/31] xen: move include/asm-* to include/arch-*/asm Anthony PERARD
2021-07-01 17:24   ` Paul Durrant
2021-07-01 17:26   ` Bob Eshleman
2021-08-05  7:04   ` Jan Beulich
2021-08-09 13:20     ` Anthony PERARD
2021-07-01 14:09 ` [XEN PATCH v6 19/31] build: rework .banner generation Anthony PERARD
2021-08-05  7:09   ` Jan Beulich
2021-08-09 13:31     ` Anthony PERARD
2021-07-01 14:10 ` [XEN PATCH v6 20/31] build: generate "include/xen/compile.h" with filechk Anthony PERARD
2021-08-05  7:20   ` Jan Beulich
2021-08-09 14:27     ` Anthony PERARD
2021-07-01 14:10 ` [XEN PATCH v6 21/31] build: set XEN_BUILD_EFI earlier Anthony PERARD
2021-08-05  7:27   ` Jan Beulich
2021-08-09 15:59     ` Anthony PERARD
2021-08-10  7:44       ` Jan Beulich
2021-07-01 14:10 ` [XEN PATCH v6 22/31] build: fix $(TARGET).efi creation in arch/arm Anthony PERARD
2021-07-01 14:10 ` [XEN PATCH v6 23/31] build: fix arch/x86/node.o rule Anthony PERARD
2021-07-07 16:04   ` Jan Beulich
2021-07-01 14:10 ` [XEN PATCH v6 24/31] build: set ALL_OBJS to main Makefile; move prelink.o to main Makefile Anthony PERARD
2021-07-01 14:10 ` [XEN PATCH v6 25/31] build: remove unneeded deps of x86_emulate.o Anthony PERARD
2021-08-06 16:06   ` Jan Beulich
2021-08-09 16:02     ` Anthony PERARD
2021-07-01 14:10 ` [XEN PATCH v6 26/31] build: clean common temporary files from root makefile Anthony PERARD
2021-07-01 14:10 ` [XEN PATCH v6 27/31] build: prepare to always invoke $(MAKE) from xen/, use $(obj) Anthony PERARD
2021-07-01 14:10 ` [XEN PATCH v6 28/31] build: rework test/livepatch/Makefile Anthony PERARD
2021-07-01 14:10 ` [XEN PATCH v6 29/31] build: build everything from the root dir, use obj=$subdir Anthony PERARD
2021-07-01 17:49   ` Bob Eshleman
2021-07-01 14:10 ` [XEN PATCH v6 30/31] build: introduce if_changed_deps Anthony PERARD
2021-07-01 14:10 ` [XEN PATCH v6 31/31] build,riscv: tell the build system about riscv64/head.S Anthony PERARD
2021-07-01 17:52   ` Bob Eshleman
2021-07-02  4:45   ` Alistair Francis
2021-07-10  0:50   ` Connor Davis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.