aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2021-03-23 14:57:31 +0100
committerArd Biesheuvel <ardb@kernel.org>2021-03-23 14:57:31 +0100
commit133ead68041bbb2bef5dba91fdc8c330d1ab50e5 (patch)
tree1f75edbaf3b703cadea8a434e916d482997d02df
parent8fce732cf9283249dc1c9f5094f327caa7c478da (diff)
downloadlinux-133ead68041bbb2bef5dba91fdc8c330d1ab50e5.tar.gz
arm64: kvm: build cloned NVHE objects in the nvhe/ build tree
The Makefile for the standalone NVHE executable incorporates some source and assembly files from other places in the arch/arm64 tree, and produces NVHE specific object files from them that are linked into the NVHE executable. Currently, these .nvhe.o objects are emitted along with their ordinary .o counterparts, i.e., not under arch/arm64/kvm/hyp/nvhe, but wherever the source file in question happens to reside. This does not play well with Kbuild features such as building with M= to define a subtree, or setting per-object CFLAGS using the CFLAGS_<name-of-object-file>.o=... syntax. So instead, let's move these objects into the nvhe/ subdirectory, by creating special make rules for each set of objects residing in a specific arch/arm64 subdirectory other than nvhe/ Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-rw-r--r--arch/arm64/kvm/hyp/nvhe/Makefile16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile
index f55201a7ff33a..f87a8d33add84 100644
--- a/arch/arm64/kvm/hyp/nvhe/Makefile
+++ b/arch/arm64/kvm/hyp/nvhe/Makefile
@@ -10,14 +10,16 @@ hostprogs := gen-hyprel
HOST_EXTRACFLAGS += -I$(objtree)/include
lib-objs := clear_page.o copy_page.o memcpy.o memset.o
-lib-objs := $(addprefix ../../../lib/, $(lib-objs))
+lib-objs := $(addprefix lib-, $(lib-objs))
+
+kvm-objs := vgic-v3-sr.o aarch32.o vgic-v2-cpuif-proxy.o entry.o fpsimd.o \
+ hyp-entry.o exception.o pgtable.o
+kvm-objs := $(addprefix kvm-, $(kvm-objs))
obj-y := timer-sr.o sysreg-sr.o debug-sr.o switch.o tlb.o hyp-init.o host.o \
hyp-main.o hyp-smp.o psci-relay.o early_alloc.o stub.o page_alloc.o \
cache.o setup.o mm.o mem_protect.o
-obj-y += ../vgic-v3-sr.o ../aarch32.o ../vgic-v2-cpuif-proxy.o ../entry.o \
- ../fpsimd.o ../hyp-entry.o ../exception.o ../pgtable.o
-obj-y += $(lib-objs)
+obj-y += $(lib-objs) $(kvm-objs)
##
## Build rules for compiling nVHE hyp code
@@ -35,6 +37,12 @@ $(obj)/%.nvhe.o: $(src)/%.c FORCE
$(call if_changed_rule,cc_o_c)
$(obj)/%.nvhe.o: $(src)/%.S FORCE
$(call if_changed_rule,as_o_S)
+$(obj)/lib-%.nvhe.o: $(srctree)/arch/arm64/lib/%.S FORCE
+ $(call if_changed_rule,as_o_S)
+$(obj)/kvm-%.nvhe.o: $(srctree)/arch/arm64/kvm/hyp/%.c FORCE
+ $(call if_changed_rule,cc_o_c)
+$(obj)/kvm-%.nvhe.o: $(srctree)/arch/arm64/kvm/hyp/%.S FORCE
+ $(call if_changed_rule,as_o_S)
# 2) Compile linker script.
$(obj)/hyp.lds: $(src)/hyp.lds.S FORCE