Commit 1a61ae7a authored by Marc Zyngier's avatar Marc Zyngier

ARM: KVM: Move the HYP code to its own section

In order to be able to spread the HYP code into multiple compilation
units, adopt a layout similar to that of arm64:
- the HYP text is emited in its own section (.hyp.text)
- two linker generated symbols are use to identify the boundaries
  of that section

No functionnal change.
Acked-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
parent 35a2491a
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#ifndef __ARM_KVM_ASM_H__ #ifndef __ARM_KVM_ASM_H__
#define __ARM_KVM_ASM_H__ #define __ARM_KVM_ASM_H__
#include <asm/virt.h>
/* 0 is reserved as an invalid value. */ /* 0 is reserved as an invalid value. */
#define c0_MPIDR 1 /* MultiProcessor ID Register */ #define c0_MPIDR 1 /* MultiProcessor ID Register */
#define c0_CSSELR 2 /* Cache Size Selection Register */ #define c0_CSSELR 2 /* Cache Size Selection Register */
...@@ -91,8 +93,8 @@ extern char __kvm_hyp_exit_end[]; ...@@ -91,8 +93,8 @@ extern char __kvm_hyp_exit_end[];
extern char __kvm_hyp_vector[]; extern char __kvm_hyp_vector[];
extern char __kvm_hyp_code_start[]; #define __kvm_hyp_code_start __hyp_text_start
extern char __kvm_hyp_code_end[]; #define __kvm_hyp_code_end __hyp_text_end
extern void __kvm_flush_vm_context(void); extern void __kvm_flush_vm_context(void);
extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa);
......
...@@ -74,6 +74,10 @@ static inline bool is_hyp_mode_mismatched(void) ...@@ -74,6 +74,10 @@ static inline bool is_hyp_mode_mismatched(void)
{ {
return !!(__boot_cpu_mode & BOOT_CPU_MODE_MISMATCH); return !!(__boot_cpu_mode & BOOT_CPU_MODE_MISMATCH);
} }
/* The section containing the hypervisor text */
extern char __hyp_text_start[];
extern char __hyp_text_end[];
#endif #endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
......
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
*(.proc.info.init) \ *(.proc.info.init) \
VMLINUX_SYMBOL(__proc_info_end) = .; VMLINUX_SYMBOL(__proc_info_end) = .;
#define HYPERVISOR_TEXT \
VMLINUX_SYMBOL(__hyp_text_start) = .; \
*(.hyp.text) \
VMLINUX_SYMBOL(__hyp_text_end) = .;
#define IDMAP_TEXT \ #define IDMAP_TEXT \
ALIGN_FUNCTION(); \ ALIGN_FUNCTION(); \
VMLINUX_SYMBOL(__idmap_text_start) = .; \ VMLINUX_SYMBOL(__idmap_text_start) = .; \
...@@ -108,6 +113,7 @@ SECTIONS ...@@ -108,6 +113,7 @@ SECTIONS
TEXT_TEXT TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
HYPERVISOR_TEXT
KPROBES_TEXT KPROBES_TEXT
*(.gnu.warning) *(.gnu.warning)
*(.glue_7) *(.glue_7)
......
...@@ -28,9 +28,7 @@ ...@@ -28,9 +28,7 @@
#include "interrupts_head.S" #include "interrupts_head.S"
.text .text
.pushsection .hyp.text, "ax"
__kvm_hyp_code_start:
.globl __kvm_hyp_code_start
/******************************************************************** /********************************************************************
* Flush per-VMID TLBs * Flush per-VMID TLBs
...@@ -314,8 +312,6 @@ THUMB( orr r2, r2, #PSR_T_BIT ) ...@@ -314,8 +312,6 @@ THUMB( orr r2, r2, #PSR_T_BIT )
eret eret
.endm .endm
.text
.align 5 .align 5
__kvm_hyp_vector: __kvm_hyp_vector:
.globl __kvm_hyp_vector .globl __kvm_hyp_vector
...@@ -511,10 +507,9 @@ hyp_fiq: ...@@ -511,10 +507,9 @@ hyp_fiq:
.ltorg .ltorg
__kvm_hyp_code_end: .popsection
.globl __kvm_hyp_code_end
.section ".rodata" .pushsection ".rodata"
und_die_str: und_die_str:
.ascii "unexpected undefined exception in Hyp mode at: %#08x\n" .ascii "unexpected undefined exception in Hyp mode at: %#08x\n"
...@@ -524,3 +519,5 @@ dabt_die_str: ...@@ -524,3 +519,5 @@ dabt_die_str:
.ascii "unexpected data abort in Hyp mode at: %#08x\n" .ascii "unexpected data abort in Hyp mode at: %#08x\n"
svc_die_str: svc_die_str:
.ascii "unexpected HVC/SVC trap in Hyp mode at: %#08x\n" .ascii "unexpected HVC/SVC trap in Hyp mode at: %#08x\n"
.popsection
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment