~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm64/kvm/hyp/include/nvhe/pkvm.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2021 Google LLC
  4  * Author: Fuad Tabba <tabba@google.com>
  5  */
  6 
  7 #ifndef __ARM64_KVM_NVHE_PKVM_H__
  8 #define __ARM64_KVM_NVHE_PKVM_H__
  9 
 10 #include <asm/kvm_pkvm.h>
 11 
 12 #include <nvhe/gfp.h>
 13 #include <nvhe/spinlock.h>
 14 
 15 /*
 16  * Holds the relevant data for maintaining the vcpu state completely at hyp.
 17  */
 18 struct pkvm_hyp_vcpu {
 19         struct kvm_vcpu vcpu;
 20 
 21         /* Backpointer to the host's (untrusted) vCPU instance. */
 22         struct kvm_vcpu *host_vcpu;
 23 };
 24 
 25 /*
 26  * Holds the relevant data for running a protected vm.
 27  */
 28 struct pkvm_hyp_vm {
 29         struct kvm kvm;
 30 
 31         /* Backpointer to the host's (untrusted) KVM instance. */
 32         struct kvm *host_kvm;
 33 
 34         /* The guest's stage-2 page-table managed by the hypervisor. */
 35         struct kvm_pgtable pgt;
 36         struct kvm_pgtable_mm_ops mm_ops;
 37         struct hyp_pool pool;
 38         hyp_spinlock_t lock;
 39 
 40         /*
 41          * The number of vcpus initialized and ready to run.
 42          * Modifying this is protected by 'vm_table_lock'.
 43          */
 44         unsigned int nr_vcpus;
 45 
 46         /* Array of the hyp vCPU structures for this VM. */
 47         struct pkvm_hyp_vcpu *vcpus[];
 48 };
 49 
 50 static inline struct pkvm_hyp_vm *
 51 pkvm_hyp_vcpu_to_hyp_vm(struct pkvm_hyp_vcpu *hyp_vcpu)
 52 {
 53         return container_of(hyp_vcpu->vcpu.kvm, struct pkvm_hyp_vm, kvm);
 54 }
 55 
 56 static inline bool pkvm_hyp_vcpu_is_protected(struct pkvm_hyp_vcpu *hyp_vcpu)
 57 {
 58         return vcpu_is_protected(&hyp_vcpu->vcpu);
 59 }
 60 
 61 void pkvm_hyp_vm_table_init(void *tbl);
 62 
 63 int __pkvm_init_vm(struct kvm *host_kvm, unsigned long vm_hva,
 64                    unsigned long pgd_hva);
 65 int __pkvm_init_vcpu(pkvm_handle_t handle, struct kvm_vcpu *host_vcpu,
 66                      unsigned long vcpu_hva);
 67 int __pkvm_teardown_vm(pkvm_handle_t handle);
 68 
 69 struct pkvm_hyp_vcpu *pkvm_load_hyp_vcpu(pkvm_handle_t handle,
 70                                          unsigned int vcpu_idx);
 71 void pkvm_put_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu);
 72 
 73 #endif /* __ARM64_KVM_NVHE_PKVM_H__ */
 74 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php