mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
ANDROID: KVM: arm64: Introduce predicates to check for protected state
In order to determine whether or not a VM or (hyp) vCPU are protected, introduce a helper function to query this state. For now, these will always return 'false' as the underlying field is never configured. Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Will Deacon <willdeacon@google.com> Bug: 233587962 Change-Id: Ib39d510d56b5d96d97526d725c7768d4fe5cf752
This commit is contained in:
committed by
Will Deacon
parent
d1a0be6f60
commit
e36af628ae
@@ -183,6 +183,7 @@ struct kvm_protected_vm {
|
||||
pkvm_handle_t handle;
|
||||
struct kvm_hyp_memcache teardown_mc;
|
||||
struct list_head pinned_pages;
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
struct kvm_arch {
|
||||
@@ -1037,10 +1038,7 @@ int kvm_set_ipa_limit(void);
|
||||
struct kvm *kvm_arch_alloc_vm(void);
|
||||
void kvm_arch_free_vm(struct kvm *kvm);
|
||||
|
||||
static inline bool kvm_vm_is_protected(struct kvm *kvm)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#define kvm_vm_is_protected(kvm) ((kvm)->arch.pkvm.enabled)
|
||||
|
||||
void kvm_init_protected_traps(struct kvm_vcpu *vcpu);
|
||||
|
||||
|
||||
@@ -53,6 +53,19 @@ pkvm_hyp_vcpu_to_hyp_vm(struct pkvm_hyp_vcpu *hyp_vcpu)
|
||||
return container_of(hyp_vcpu->vcpu.kvm, struct pkvm_hyp_vm, kvm);
|
||||
}
|
||||
|
||||
static inline bool vcpu_is_protected(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
if (!is_protected_kvm_enabled())
|
||||
return false;
|
||||
|
||||
return vcpu->kvm->arch.pkvm.enabled;
|
||||
}
|
||||
|
||||
static inline bool pkvm_hyp_vcpu_is_protected(struct pkvm_hyp_vcpu *hyp_vcpu)
|
||||
{
|
||||
return vcpu_is_protected(&hyp_vcpu->vcpu);
|
||||
}
|
||||
|
||||
void pkvm_hyp_vm_table_init(void *tbl);
|
||||
|
||||
int __pkvm_init_vm(struct kvm *host_kvm, unsigned long vm_hva,
|
||||
|
||||
Reference in New Issue
Block a user