Skip to content

Commit

Permalink
kvm: arm/arm64: Allow arch specific configurations for VM
Browse files Browse the repository at this point in the history
Allow the arch backends to perform VM specific initialisation.
This will be later used to handle IPA size configuration and per-VM
VTCR configuration on arm64.

Cc: Marc Zyngier <[email protected]>
Cc: Christoffer Dall <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Signed-off-by: Suzuki K Poulose <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
  • Loading branch information
Suzuki K Poulose authored and Marc Zyngier committed Oct 1, 2018
1 parent b2df44f commit 5b6c674
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions arch/arm/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,11 @@ static inline void kvm_vcpu_put_sysregs(struct kvm_vcpu *vcpu) {}
struct kvm *kvm_arch_alloc_vm(void);
void kvm_arch_free_vm(struct kvm *kvm);

static inline int kvm_arm_config_vm(struct kvm *kvm, unsigned long type)
{
if (type)
return -EINVAL;
return 0;
}

#endif /* __ARM_KVM_HOST_H__ */
2 changes: 2 additions & 0 deletions arch/arm64/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,4 +513,6 @@ void kvm_vcpu_put_sysregs(struct kvm_vcpu *vcpu);
struct kvm *kvm_arch_alloc_vm(void);
void kvm_arch_free_vm(struct kvm *kvm);

int kvm_arm_config_vm(struct kvm *kvm, unsigned long type);

#endif /* __ARM64_KVM_HOST_H__ */
7 changes: 7 additions & 0 deletions arch/arm64/kvm/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,10 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
/* Reset timer */
return kvm_timer_vcpu_reset(vcpu);
}

int kvm_arm_config_vm(struct kvm *kvm, unsigned long type)
{
if (type)
return -EINVAL;
return 0;
}
5 changes: 3 additions & 2 deletions virt/kvm/arm/arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
{
int ret, cpu;

if (type)
return -EINVAL;
ret = kvm_arm_config_vm(kvm, type);
if (ret)
return ret;

kvm->arch.last_vcpu_ran = alloc_percpu(typeof(*kvm->arch.last_vcpu_ran));
if (!kvm->arch.last_vcpu_ran)
Expand Down

0 comments on commit 5b6c674

Please sign in to comment.