ARM: KVM: use kvm_kernel_vfp_t as an abstract type for VFP containers
In order to keep the VFP allocation code common, use an abstract type for the VFP containers. Maps onto struct vfp_hard_struct on ARM. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
This commit is contained in:
parent
e7858c58d5
commit
9c7a6432fb
2 changed files with 7 additions and 5 deletions
|
@ -87,6 +87,8 @@ struct kvm_vcpu_fault_info {
|
||||||
u32 hyp_pc; /* PC when exception was taken from Hyp mode */
|
u32 hyp_pc; /* PC when exception was taken from Hyp mode */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct vfp_hard_struct kvm_kernel_vfp_t;
|
||||||
|
|
||||||
struct kvm_vcpu_arch {
|
struct kvm_vcpu_arch {
|
||||||
struct kvm_regs regs;
|
struct kvm_regs regs;
|
||||||
|
|
||||||
|
@ -103,8 +105,8 @@ struct kvm_vcpu_arch {
|
||||||
struct kvm_vcpu_fault_info fault;
|
struct kvm_vcpu_fault_info fault;
|
||||||
|
|
||||||
/* Floating point registers (VFP and Advanced SIMD/NEON) */
|
/* Floating point registers (VFP and Advanced SIMD/NEON) */
|
||||||
struct vfp_hard_struct vfp_guest;
|
kvm_kernel_vfp_t vfp_guest;
|
||||||
struct vfp_hard_struct *vfp_host;
|
kvm_kernel_vfp_t *vfp_host;
|
||||||
|
|
||||||
/* VGIC state */
|
/* VGIC state */
|
||||||
struct vgic_cpu vgic_cpu;
|
struct vgic_cpu vgic_cpu;
|
||||||
|
|
|
@ -49,7 +49,7 @@ __asm__(".arch_extension virt");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page);
|
static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page);
|
||||||
static struct vfp_hard_struct __percpu *kvm_host_vfp_state;
|
static kvm_kernel_vfp_t __percpu *kvm_host_vfp_state;
|
||||||
static unsigned long hyp_default_vectors;
|
static unsigned long hyp_default_vectors;
|
||||||
|
|
||||||
/* Per-CPU variable containing the currently running vcpu. */
|
/* Per-CPU variable containing the currently running vcpu. */
|
||||||
|
@ -908,7 +908,7 @@ static int init_hyp_mode(void)
|
||||||
/*
|
/*
|
||||||
* Map the host VFP structures
|
* Map the host VFP structures
|
||||||
*/
|
*/
|
||||||
kvm_host_vfp_state = alloc_percpu(struct vfp_hard_struct);
|
kvm_host_vfp_state = alloc_percpu(kvm_kernel_vfp_t);
|
||||||
if (!kvm_host_vfp_state) {
|
if (!kvm_host_vfp_state) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
kvm_err("Cannot allocate host VFP state\n");
|
kvm_err("Cannot allocate host VFP state\n");
|
||||||
|
@ -916,7 +916,7 @@ static int init_hyp_mode(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
for_each_possible_cpu(cpu) {
|
for_each_possible_cpu(cpu) {
|
||||||
struct vfp_hard_struct *vfp;
|
kvm_kernel_vfp_t *vfp;
|
||||||
|
|
||||||
vfp = per_cpu_ptr(kvm_host_vfp_state, cpu);
|
vfp = per_cpu_ptr(kvm_host_vfp_state, cpu);
|
||||||
err = create_hyp_mappings(vfp, vfp + 1);
|
err = create_hyp_mappings(vfp, vfp + 1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue