![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 /* 0003 * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 0004 */ 0005 0006 #ifndef _NE_MISC_DEV_H_ 0007 #define _NE_MISC_DEV_H_ 0008 0009 #include <linux/cpumask.h> 0010 #include <linux/list.h> 0011 #include <linux/miscdevice.h> 0012 #include <linux/mm.h> 0013 #include <linux/mutex.h> 0014 #include <linux/pci.h> 0015 #include <linux/wait.h> 0016 0017 #include "ne_pci_dev.h" 0018 0019 /** 0020 * struct ne_mem_region - Entry in the enclave user space memory regions list. 0021 * @mem_region_list_entry: Entry in the list of enclave memory regions. 0022 * @memory_size: Size of the user space memory region. 0023 * @nr_pages: Number of pages that make up the memory region. 0024 * @pages: Pages that make up the user space memory region. 0025 * @userspace_addr: User space address of the memory region. 0026 */ 0027 struct ne_mem_region { 0028 struct list_head mem_region_list_entry; 0029 u64 memory_size; 0030 unsigned long nr_pages; 0031 struct page **pages; 0032 u64 userspace_addr; 0033 }; 0034 0035 /** 0036 * struct ne_enclave - Per-enclave data used for enclave lifetime management. 0037 * @enclave_info_mutex : Mutex for accessing this internal state. 0038 * @enclave_list_entry : Entry in the list of created enclaves. 0039 * @eventq: Wait queue used for out-of-band event notifications 0040 * triggered from the PCI device event handler to 0041 * the enclave process via the poll function. 0042 * @has_event: Variable used to determine if the out-of-band event 0043 * was triggered. 0044 * @max_mem_regions: The maximum number of memory regions that can be 0045 * handled by the hypervisor. 0046 * @mem_regions_list: Enclave user space memory regions list. 0047 * @mem_size: Enclave memory size. 0048 * @mm : Enclave process abstraction mm data struct. 0049 * @nr_mem_regions: Number of memory regions associated with the enclave. 0050 * @nr_parent_vm_cores : The size of the threads per core array. The 0051 * total number of CPU cores available on the 0052 * parent / primary VM. 0053 * @nr_threads_per_core: The number of threads that a full CPU core has. 0054 * @nr_vcpus: Number of vcpus associated with the enclave. 0055 * @numa_node: NUMA node of the enclave memory and CPUs. 0056 * @slot_uid: Slot unique id mapped to the enclave. 0057 * @state: Enclave state, updated during enclave lifetime. 0058 * @threads_per_core: Enclave full CPU cores array, indexed by core id, 0059 * consisting of cpumasks with all their threads. 0060 * Full CPU cores are taken from the NE CPU pool 0061 * and are available to the enclave. 0062 * @vcpu_ids: Cpumask of the vCPUs that are set for the enclave. 0063 */ 0064 struct ne_enclave { 0065 struct mutex enclave_info_mutex; 0066 struct list_head enclave_list_entry; 0067 wait_queue_head_t eventq; 0068 bool has_event; 0069 u64 max_mem_regions; 0070 struct list_head mem_regions_list; 0071 u64 mem_size; 0072 struct mm_struct *mm; 0073 unsigned int nr_mem_regions; 0074 unsigned int nr_parent_vm_cores; 0075 unsigned int nr_threads_per_core; 0076 unsigned int nr_vcpus; 0077 int numa_node; 0078 u64 slot_uid; 0079 u16 state; 0080 cpumask_var_t *threads_per_core; 0081 cpumask_var_t vcpu_ids; 0082 }; 0083 0084 /** 0085 * enum ne_state - States available for an enclave. 0086 * @NE_STATE_INIT: The enclave has not been started yet. 0087 * @NE_STATE_RUNNING: The enclave was started and is running as expected. 0088 * @NE_STATE_STOPPED: The enclave exited without userspace interaction. 0089 */ 0090 enum ne_state { 0091 NE_STATE_INIT = 0, 0092 NE_STATE_RUNNING = 2, 0093 NE_STATE_STOPPED = U16_MAX, 0094 }; 0095 0096 /** 0097 * struct ne_devs - Data structure to keep refs to the NE misc and PCI devices. 0098 * @ne_misc_dev: Nitro Enclaves misc device. 0099 * @ne_pci_dev : Nitro Enclaves PCI device. 0100 */ 0101 struct ne_devs { 0102 struct miscdevice *ne_misc_dev; 0103 struct ne_pci_dev *ne_pci_dev; 0104 }; 0105 0106 /* Nitro Enclaves (NE) data structure for keeping refs to the NE misc and PCI devices. */ 0107 extern struct ne_devs ne_devs; 0108 0109 #endif /* _NE_MISC_DEV_H_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |