]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Generate hyp relocation data
authorDavid Brazdil <dbrazdil@google.com>
Tue, 5 Jan 2021 18:05:37 +0000 (18:05 +0000)
committerMarc Zyngier <maz@kernel.org>
Sat, 23 Jan 2021 14:01:00 +0000 (14:01 +0000)
commitdb2599665947ec598e15330c292a655cb127741a
tree4701a348938accf04d577b0e5b680d30d6818cd7
parentdfad694e3b4fb763c4a25bd42fe32818576db687
KVM: arm64: Generate hyp relocation data

Add a post-processing step to compilation of KVM nVHE hyp code which
calls a custom host tool (gen-hyprel) on the partially linked object
file (hyp sections' names prefixed).

The tool lists all R_AARCH64_ABS64 data relocations targeting hyp
sections and generates an assembly file that will form a new section
.hyp.reloc in the kernel binary. The new section contains an array of
32-bit offsets to the positions targeted by these relocations.

Since these addresses of those positions will not be determined until
linking of `vmlinux`, each 32-bit entry carries a R_AARCH64_PREL32
relocation with addend <section_base_sym> + <r_offset>. The linker of
`vmlinux` will therefore fill the slot accordingly.

This relocation data will be used at runtime to convert the kernel VAs
at those positions to hyp VAs.

Signed-off-by: David Brazdil <dbrazdil@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210105180541.65031-5-dbrazdil@google.com
arch/arm64/kernel/vmlinux.lds.S
arch/arm64/kvm/hyp/nvhe/.gitignore
arch/arm64/kvm/hyp/nvhe/Makefile
arch/arm64/kvm/hyp/nvhe/gen-hyprel.c [new file with mode: 0644]