0001
0002
0003
0004
0005
0006
0007 #include <asm/kvm_asm.h>
0008 #include <asm/kvm_hyp.h>
0009 #include <asm/kvm_mmu.h>
0010
0011
0012
0013
0014
0015
0016
0017 u64 __ro_after_init hyp_cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
0018
0019 u64 cpu_logical_map(unsigned int cpu)
0020 {
0021 BUG_ON(cpu >= ARRAY_SIZE(hyp_cpu_logical_map));
0022
0023 return hyp_cpu_logical_map[cpu];
0024 }
0025
0026 unsigned long __hyp_per_cpu_offset(unsigned int cpu)
0027 {
0028 unsigned long *cpu_base_array;
0029 unsigned long this_cpu_base;
0030 unsigned long elf_base;
0031
0032 BUG_ON(cpu >= ARRAY_SIZE(kvm_arm_hyp_percpu_base));
0033
0034 cpu_base_array = (unsigned long *)&kvm_arm_hyp_percpu_base;
0035 this_cpu_base = kern_hyp_va(cpu_base_array[cpu]);
0036 elf_base = (unsigned long)&__per_cpu_start;
0037 return this_cpu_base - elf_base;
0038 }