mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-12 00:38:55 +00:00
KVM: PPC: Book3S HV: Add function kvmhv_vcpu_is_radix()
There exists a function kvm_is_radix() which is used to determine if a kvm instance is using the radix mmu. However this only applies to the first level (L1) guest. Add a function kvmhv_vcpu_is_radix() which can be used to determine if the current execution context of the vcpu is radix, accounting for if the vcpu is running a nested guest. Currently all nested guests must be radix but this may change in the future. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
This commit is contained in:
parent
693ac10a88
commit
d232afebf9
@ -55,6 +55,7 @@ struct kvm_nested_guest {
|
|||||||
cpumask_t need_tlb_flush;
|
cpumask_t need_tlb_flush;
|
||||||
cpumask_t cpu_in_guest;
|
cpumask_t cpu_in_guest;
|
||||||
short prev_cpu[NR_CPUS];
|
short prev_cpu[NR_CPUS];
|
||||||
|
u8 radix; /* is this nested guest radix */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -150,6 +151,18 @@ static inline bool kvm_is_radix(struct kvm *kvm)
|
|||||||
return kvm->arch.radix;
|
return kvm->arch.radix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool kvmhv_vcpu_is_radix(struct kvm_vcpu *vcpu)
|
||||||
|
{
|
||||||
|
bool radix;
|
||||||
|
|
||||||
|
if (vcpu->arch.nested)
|
||||||
|
radix = vcpu->arch.nested->radix;
|
||||||
|
else
|
||||||
|
radix = kvm_is_radix(vcpu->kvm);
|
||||||
|
|
||||||
|
return radix;
|
||||||
|
}
|
||||||
|
|
||||||
#define KVM_DEFAULT_HPT_ORDER 24 /* 16MB HPT by default */
|
#define KVM_DEFAULT_HPT_ORDER 24 /* 16MB HPT by default */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -480,6 +480,7 @@ struct kvm_nested_guest *kvmhv_alloc_nested(struct kvm *kvm, unsigned int lpid)
|
|||||||
if (shadow_lpid < 0)
|
if (shadow_lpid < 0)
|
||||||
goto out_free2;
|
goto out_free2;
|
||||||
gp->shadow_lpid = shadow_lpid;
|
gp->shadow_lpid = shadow_lpid;
|
||||||
|
gp->radix = 1;
|
||||||
|
|
||||||
memset(gp->prev_cpu, -1, sizeof(gp->prev_cpu));
|
memset(gp->prev_cpu, -1, sizeof(gp->prev_cpu));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user