~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm64/kvm/hyp/nvhe/Makefile

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 # SPDX-License-Identifier: GPL-2.0
  2 #
  3 # Makefile for Kernel-based Virtual Machine module, HYP/nVHE part
  4 #
  5 
  6 asflags-y := -D__KVM_NVHE_HYPERVISOR__ -D__DISABLE_EXPORTS
  7 
  8 # Tracepoint and MMIO logging symbols should not be visible at nVHE KVM as
  9 # there is no way to execute them and any such MMIO access from nVHE KVM
 10 # will explode instantly (Words of Marc Zyngier). So introduce a generic flag
 11 # __DISABLE_TRACE_MMIO__ to disable MMIO tracing for nVHE KVM.
 12 ccflags-y := -D__KVM_NVHE_HYPERVISOR__ -D__DISABLE_EXPORTS -D__DISABLE_TRACE_MMIO__
 13 ccflags-y += -fno-stack-protector       \
 14              -DDISABLE_BRANCH_PROFILING \
 15              $(DISABLE_STACKLEAK_PLUGIN)
 16 
 17 hostprogs := gen-hyprel
 18 HOST_EXTRACFLAGS += -I$(objtree)/include
 19 
 20 lib-objs := clear_page.o copy_page.o memcpy.o memset.o
 21 lib-objs := $(addprefix ../../../lib/, $(lib-objs))
 22 
 23 CFLAGS_switch.nvhe.o += -Wno-override-init
 24 
 25 hyp-obj-y := timer-sr.o sysreg-sr.o debug-sr.o switch.o tlb.o hyp-init.o host.o \
 26          hyp-main.o hyp-smp.o psci-relay.o early_alloc.o page_alloc.o \
 27          cache.o setup.o mm.o mem_protect.o sys_regs.o pkvm.o stacktrace.o ffa.o
 28 hyp-obj-y += ../vgic-v3-sr.o ../aarch32.o ../vgic-v2-cpuif-proxy.o ../entry.o \
 29          ../fpsimd.o ../hyp-entry.o ../exception.o ../pgtable.o
 30 hyp-obj-$(CONFIG_LIST_HARDENED) += list_debug.o
 31 hyp-obj-y += $(lib-objs)
 32 
 33 ##
 34 ## Build rules for compiling nVHE hyp code
 35 ## Output of this folder is `kvm_nvhe.o`, a partially linked object
 36 ## file containing all nVHE hyp code and data.
 37 ##
 38 
 39 hyp-obj := $(patsubst %.o,%.nvhe.o,$(hyp-obj-y))
 40 obj-y := kvm_nvhe.o
 41 targets += $(hyp-obj) kvm_nvhe.tmp.o kvm_nvhe.rel.o hyp.lds hyp-reloc.S hyp-reloc.o
 42 
 43 # 1) Compile all source files to `.nvhe.o` object files. The file extension
 44 #    avoids file name clashes for files shared with VHE.
 45 $(obj)/%.nvhe.o: $(src)/%.c FORCE
 46         $(call if_changed_rule,cc_o_c)
 47 $(obj)/%.nvhe.o: $(src)/%.S FORCE
 48         $(call if_changed_rule,as_o_S)
 49 
 50 # 2) Compile linker script.
 51 $(obj)/hyp.lds: $(src)/hyp.lds.S FORCE
 52         $(call if_changed_dep,cpp_lds_S)
 53 
 54 # 3) Partially link all '.nvhe.o' files and apply the linker script.
 55 #    Prefixes names of ELF sections with '.hyp', eg. '.hyp.text'.
 56 #    Note: The following rule assumes that the 'ld' rule puts LDFLAGS before
 57 #          the list of dependencies to form '-T $(obj)/hyp.lds'. This is to
 58 #          keep the dependency on the target while avoiding an error from
 59 #          GNU ld if the linker script is passed to it twice.
 60 LDFLAGS_kvm_nvhe.tmp.o := -r -T
 61 $(obj)/kvm_nvhe.tmp.o: $(obj)/hyp.lds $(addprefix $(obj)/,$(hyp-obj)) FORCE
 62         $(call if_changed,ld)
 63 
 64 # 4) Generate list of hyp code/data positions that need to be relocated at
 65 #    runtime. Because the hypervisor is part of the kernel binary, relocations
 66 #    produce a kernel VA. We enumerate relocations targeting hyp at build time
 67 #    and convert the kernel VAs at those positions to hyp VAs.
 68 $(obj)/hyp-reloc.S: $(obj)/kvm_nvhe.tmp.o $(obj)/gen-hyprel FORCE
 69         $(call if_changed,hyprel)
 70 
 71 # 5) Compile hyp-reloc.S and link it into the existing partially linked object.
 72 #    The object file now contains a section with pointers to hyp positions that
 73 #    will contain kernel VAs at runtime. These pointers have relocations on them
 74 #    so that they get updated as the hyp object is linked into `vmlinux`.
 75 LDFLAGS_kvm_nvhe.rel.o := -r
 76 $(obj)/kvm_nvhe.rel.o: $(obj)/kvm_nvhe.tmp.o $(obj)/hyp-reloc.o FORCE
 77         $(call if_changed,ld)
 78 
 79 # 6) Produce the final 'kvm_nvhe.o', ready to be linked into 'vmlinux'.
 80 #    Prefixes names of ELF symbols with '__kvm_nvhe_'.
 81 $(obj)/kvm_nvhe.o: $(obj)/kvm_nvhe.rel.o FORCE
 82         $(call if_changed,hypcopy)
 83 
 84 # The HYPREL command calls `gen-hyprel` to generate an assembly file with
 85 # a list of relocations targeting hyp code/data.
 86 quiet_cmd_hyprel = HYPREL  $@
 87       cmd_hyprel = $(obj)/gen-hyprel $< > $@
 88 
 89 # The HYPCOPY command uses `objcopy` to prefix all ELF symbol names
 90 # to avoid clashes with VHE code/data.
 91 quiet_cmd_hypcopy = HYPCOPY $@
 92       cmd_hypcopy = $(OBJCOPY) --prefix-symbols=__kvm_nvhe_ $< $@
 93 
 94 # Remove ftrace and Shadow Call Stack CFLAGS.
 95 # This is equivalent to the 'notrace' and '__noscs' annotations.
 96 KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_FTRACE) $(CC_FLAGS_SCS), $(KBUILD_CFLAGS))
 97 # Starting from 13.0.0 llvm emits SHT_REL section '.llvm.call-graph-profile'
 98 # when profile optimization is applied. gen-hyprel does not support SHT_REL and
 99 # causes a build failure. Remove profile optimization flags.
100 KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%, $(KBUILD_CFLAGS))
101 KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php