diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2016-01-02 08:57:18 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2016-02-29 13:34:12 -0500 |
commit | 1a61ae7af4d65ee311a737d550da6cf92a3aea4c (patch) | |
tree | 7376af842c29835f2c7d7e2bdc87fa5f405f06b2 | |
parent | 35a2491a624af1fa7ab6990639f5246cd5f12592 (diff) |
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: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | arch/arm/include/asm/kvm_asm.h | 6 | ||||
-rw-r--r-- | arch/arm/include/asm/virt.h | 4 | ||||
-rw-r--r-- | arch/arm/kernel/vmlinux.lds.S | 6 | ||||
-rw-r--r-- | arch/arm/kvm/interrupts.S | 13 |
4 files changed, 19 insertions, 10 deletions
diff --git a/arch/arm/include/asm/kvm_asm.h b/arch/arm/include/asm/kvm_asm.h index 194c91b610ff..fa2fd253974f 100644 --- a/arch/arm/include/asm/kvm_asm.h +++ b/arch/arm/include/asm/kvm_asm.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #ifndef __ARM_KVM_ASM_H__ | 19 | #ifndef __ARM_KVM_ASM_H__ |
20 | #define __ARM_KVM_ASM_H__ | 20 | #define __ARM_KVM_ASM_H__ |
21 | 21 | ||
22 | #include <asm/virt.h> | ||
23 | |||
22 | /* 0 is reserved as an invalid value. */ | 24 | /* 0 is reserved as an invalid value. */ |
23 | #define c0_MPIDR 1 /* MultiProcessor ID Register */ | 25 | #define c0_MPIDR 1 /* MultiProcessor ID Register */ |
24 | #define c0_CSSELR 2 /* Cache Size Selection Register */ | 26 | #define c0_CSSELR 2 /* Cache Size Selection Register */ |
@@ -91,8 +93,8 @@ extern char __kvm_hyp_exit_end[]; | |||
91 | 93 | ||
92 | extern char __kvm_hyp_vector[]; | 94 | extern char __kvm_hyp_vector[]; |
93 | 95 | ||
94 | extern char __kvm_hyp_code_start[]; | 96 | #define __kvm_hyp_code_start __hyp_text_start |
95 | extern char __kvm_hyp_code_end[]; | 97 | #define __kvm_hyp_code_end __hyp_text_end |
96 | 98 | ||
97 | extern void __kvm_flush_vm_context(void); | 99 | extern void __kvm_flush_vm_context(void); |
98 | extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); | 100 | extern void __kvm_tlb_flush_vmid_ipa(struct kvm *kvm, phys_addr_t ipa); |
diff --git a/arch/arm/include/asm/virt.h b/arch/arm/include/asm/virt.h index 4371f45c5784..5fdbfea6defb 100644 --- a/arch/arm/include/asm/virt.h +++ b/arch/arm/include/asm/virt.h | |||
@@ -74,6 +74,10 @@ static inline bool is_hyp_mode_mismatched(void) | |||
74 | { | 74 | { |
75 | return !!(__boot_cpu_mode & BOOT_CPU_MODE_MISMATCH); | 75 | return !!(__boot_cpu_mode & BOOT_CPU_MODE_MISMATCH); |
76 | } | 76 | } |
77 | |||
78 | /* The section containing the hypervisor text */ | ||
79 | extern char __hyp_text_start[]; | ||
80 | extern char __hyp_text_end[]; | ||
77 | #endif | 81 | #endif |
78 | 82 | ||
79 | #endif /* __ASSEMBLY__ */ | 83 | #endif /* __ASSEMBLY__ */ |
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 8b60fde5ce48..b4139cbbbdd9 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S | |||
@@ -18,6 +18,11 @@ | |||
18 | *(.proc.info.init) \ | 18 | *(.proc.info.init) \ |
19 | VMLINUX_SYMBOL(__proc_info_end) = .; | 19 | VMLINUX_SYMBOL(__proc_info_end) = .; |
20 | 20 | ||
21 | #define HYPERVISOR_TEXT \ | ||
22 | VMLINUX_SYMBOL(__hyp_text_start) = .; \ | ||
23 | *(.hyp.text) \ | ||
24 | VMLINUX_SYMBOL(__hyp_text_end) = .; | ||
25 | |||
21 | #define IDMAP_TEXT \ | 26 | #define IDMAP_TEXT \ |
22 | ALIGN_FUNCTION(); \ | 27 | ALIGN_FUNCTION(); \ |
23 | VMLINUX_SYMBOL(__idmap_text_start) = .; \ | 28 | VMLINUX_SYMBOL(__idmap_text_start) = .; \ |
@@ -108,6 +113,7 @@ SECTIONS | |||
108 | TEXT_TEXT | 113 | TEXT_TEXT |
109 | SCHED_TEXT | 114 | SCHED_TEXT |
110 | LOCK_TEXT | 115 | LOCK_TEXT |
116 | HYPERVISOR_TEXT | ||
111 | KPROBES_TEXT | 117 | KPROBES_TEXT |
112 | *(.gnu.warning) | 118 | *(.gnu.warning) |
113 | *(.glue_7) | 119 | *(.glue_7) |
diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S index 900ef6dd8f72..9d9cb71df449 100644 --- a/arch/arm/kvm/interrupts.S +++ b/arch/arm/kvm/interrupts.S | |||
@@ -28,9 +28,7 @@ | |||
28 | #include "interrupts_head.S" | 28 | #include "interrupts_head.S" |
29 | 29 | ||
30 | .text | 30 | .text |
31 | 31 | .pushsection .hyp.text, "ax" | |
32 | __kvm_hyp_code_start: | ||
33 | .globl __kvm_hyp_code_start | ||
34 | 32 | ||
35 | /******************************************************************** | 33 | /******************************************************************** |
36 | * Flush per-VMID TLBs | 34 | * Flush per-VMID TLBs |
@@ -314,8 +312,6 @@ THUMB( orr r2, r2, #PSR_T_BIT ) | |||
314 | eret | 312 | eret |
315 | .endm | 313 | .endm |
316 | 314 | ||
317 | .text | ||
318 | |||
319 | .align 5 | 315 | .align 5 |
320 | __kvm_hyp_vector: | 316 | __kvm_hyp_vector: |
321 | .globl __kvm_hyp_vector | 317 | .globl __kvm_hyp_vector |
@@ -511,10 +507,9 @@ hyp_fiq: | |||
511 | 507 | ||
512 | .ltorg | 508 | .ltorg |
513 | 509 | ||
514 | __kvm_hyp_code_end: | 510 | .popsection |
515 | .globl __kvm_hyp_code_end | ||
516 | 511 | ||
517 | .section ".rodata" | 512 | .pushsection ".rodata" |
518 | 513 | ||
519 | und_die_str: | 514 | und_die_str: |
520 | .ascii "unexpected undefined exception in Hyp mode at: %#08x\n" | 515 | .ascii "unexpected undefined exception in Hyp mode at: %#08x\n" |
@@ -524,3 +519,5 @@ dabt_die_str: | |||
524 | .ascii "unexpected data abort in Hyp mode at: %#08x\n" | 519 | .ascii "unexpected data abort in Hyp mode at: %#08x\n" |
525 | svc_die_str: | 520 | svc_die_str: |
526 | .ascii "unexpected HVC/SVC trap in Hyp mode at: %#08x\n" | 521 | .ascii "unexpected HVC/SVC trap in Hyp mode at: %#08x\n" |
522 | |||
523 | .popsection | ||