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

TOMOYO Linux Cross Reference
Linux/arch/x86/virt/vmx/tdx/tdx.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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 */
  2 #ifndef _X86_VIRT_TDX_H
  3 #define _X86_VIRT_TDX_H
  4 
  5 #include <linux/bits.h>
  6 
  7 /*
  8  * This file contains both macros and data structures defined by the TDX
  9  * architecture and Linux defined software data structures and functions.
 10  * The two should not be mixed together for better readability.  The
 11  * architectural definitions come first.
 12  */
 13 
 14 /*
 15  * TDX module SEAMCALL leaf functions
 16  */
 17 #define TDH_PHYMEM_PAGE_RDMD    24
 18 #define TDH_SYS_KEY_CONFIG      31
 19 #define TDH_SYS_INIT            33
 20 #define TDH_SYS_RD              34
 21 #define TDH_SYS_LP_INIT         35
 22 #define TDH_SYS_TDMR_INIT       36
 23 #define TDH_SYS_CONFIG          45
 24 
 25 /* TDX page types */
 26 #define PT_NDA          0x0
 27 #define PT_RSVD         0x1
 28 
 29 /*
 30  * Global scope metadata field ID.
 31  *
 32  * See Table "Global Scope Metadata", TDX module 1.5 ABI spec.
 33  */
 34 #define MD_FIELD_ID_MAX_TDMRS                   0x9100000100000008ULL
 35 #define MD_FIELD_ID_MAX_RESERVED_PER_TDMR       0x9100000100000009ULL
 36 #define MD_FIELD_ID_PAMT_4K_ENTRY_SIZE          0x9100000100000010ULL
 37 #define MD_FIELD_ID_PAMT_2M_ENTRY_SIZE          0x9100000100000011ULL
 38 #define MD_FIELD_ID_PAMT_1G_ENTRY_SIZE          0x9100000100000012ULL
 39 
 40 /*
 41  * Sub-field definition of metadata field ID.
 42  *
 43  * See Table "MD_FIELD_ID (Metadata Field Identifier / Sequence Header)
 44  * Definition", TDX module 1.5 ABI spec.
 45  *
 46  *  - Bit 33:32: ELEMENT_SIZE_CODE -- size of a single element of metadata
 47  *
 48  *      0: 8 bits
 49  *      1: 16 bits
 50  *      2: 32 bits
 51  *      3: 64 bits
 52  */
 53 #define MD_FIELD_ID_ELE_SIZE_CODE(_field_id)    \
 54                 (((_field_id) & GENMASK_ULL(33, 32)) >> 32)
 55 
 56 #define MD_FIELD_ID_ELE_SIZE_16BIT      1
 57 
 58 struct tdmr_reserved_area {
 59         u64 offset;
 60         u64 size;
 61 } __packed;
 62 
 63 #define TDMR_INFO_ALIGNMENT     512
 64 #define TDMR_INFO_PA_ARRAY_ALIGNMENT    512
 65 
 66 struct tdmr_info {
 67         u64 base;
 68         u64 size;
 69         u64 pamt_1g_base;
 70         u64 pamt_1g_size;
 71         u64 pamt_2m_base;
 72         u64 pamt_2m_size;
 73         u64 pamt_4k_base;
 74         u64 pamt_4k_size;
 75         /*
 76          * The actual number of reserved areas depends on the value of
 77          * field MD_FIELD_ID_MAX_RESERVED_PER_TDMR in the TDX module
 78          * global metadata.
 79          */
 80         DECLARE_FLEX_ARRAY(struct tdmr_reserved_area, reserved_areas);
 81 } __packed __aligned(TDMR_INFO_ALIGNMENT);
 82 
 83 /*
 84  * Do not put any hardware-defined TDX structure representations below
 85  * this comment!
 86  */
 87 
 88 /* Kernel defined TDX module status during module initialization. */
 89 enum tdx_module_status_t {
 90         TDX_MODULE_UNINITIALIZED,
 91         TDX_MODULE_INITIALIZED,
 92         TDX_MODULE_ERROR
 93 };
 94 
 95 struct tdx_memblock {
 96         struct list_head list;
 97         unsigned long start_pfn;
 98         unsigned long end_pfn;
 99         int nid;
100 };
101 
102 /* "TDMR info" part of "Global Scope Metadata" for constructing TDMRs */
103 struct tdx_tdmr_sysinfo {
104         u16 max_tdmrs;
105         u16 max_reserved_per_tdmr;
106         u16 pamt_entry_size[TDX_PS_NR];
107 };
108 
109 /* Warn if kernel has less than TDMR_NR_WARN TDMRs after allocation */
110 #define TDMR_NR_WARN 4
111 
112 struct tdmr_info_list {
113         void *tdmrs;    /* Flexible array to hold 'tdmr_info's */
114         int nr_consumed_tdmrs;  /* How many 'tdmr_info's are in use */
115 
116         /* Metadata for finding target 'tdmr_info' and freeing @tdmrs */
117         int tdmr_sz;    /* Size of one 'tdmr_info' */
118         int max_tdmrs;  /* How many 'tdmr_info's are allocated */
119 };
120 
121 #endif
122 

~ [ 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