@@ -62,17 +62,13 @@ static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
62
62
{
63
63
uint64_t nworld_pml4e = 0UL ;
64
64
uint64_t sworld_pml4e = 0UL ;
65
- struct mem_map_params map_params ;
66
65
uint64_t gpa = 0UL ;
67
66
uint64_t hpa = gpa2hpa (vm , gpa_orig );
68
- uint64_t table_present = (IA32E_EPT_R_BIT |
69
- IA32E_EPT_W_BIT |
70
- IA32E_EPT_X_BIT );
67
+ uint64_t table_present = EPT_RWX ;
71
68
uint64_t pdpte = 0 , * dest_pdpte_p = NULL , * src_pdpte_p = NULL ;
72
69
void * sub_table_addr = NULL , * pml4_base = NULL ;
73
70
struct vm * vm0 = get_vm_from_vmid (0U );
74
71
uint16_t i ;
75
- struct vcpu * vcpu ;
76
72
77
73
if (vm0 == NULL ) {
78
74
pr_err ("Parse vm0 context failed." );
@@ -112,7 +108,6 @@ static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
112
108
sworld_pml4e = HVA2HPA (sub_table_addr ) | table_present ;
113
109
mem_write64 (pml4_base , sworld_pml4e );
114
110
115
-
116
111
nworld_pml4e = mem_read64 (vm -> arch_vm .nworld_eptp );
117
112
118
113
/*
@@ -131,18 +126,11 @@ static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
131
126
dest_pdpte_p ++ ;
132
127
}
133
128
134
- /* Map gpa_rebased~ gpa_rebased+ size to secure ept mapping
129
+ /* Map [ gpa_rebased, gpa_rebased + size) to secure ept mapping
135
130
* TODO: not create inverted page tables for trusty memory
136
131
*/
137
- map_params .page_table_type = PTT_EPT ;
138
- map_params .pml4_inverted = vm -> arch_vm .m2p ;
139
- map_params .pml4_base = pml4_base ;
140
- map_mem (& map_params , (void * )hpa ,
141
- (void * )gpa_rebased , size ,
142
- (IA32E_EPT_R_BIT |
143
- IA32E_EPT_W_BIT |
144
- IA32E_EPT_X_BIT |
145
- IA32E_EPT_WB ));
132
+ ept_mr_add (vm , (uint64_t * )vm -> arch_vm .sworld_eptp ,
133
+ hpa , gpa_rebased , size , EPT_RWX | EPT_WB );
146
134
147
135
/* Get the gpa address in SOS */
148
136
gpa = hpa2gpa (vm0 , hpa );
@@ -156,10 +144,6 @@ static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
156
144
vm -> sworld_control .sworld_memory .base_gpa_in_uos = gpa_orig ;
157
145
vm -> sworld_control .sworld_memory .base_hpa = hpa ;
158
146
vm -> sworld_control .sworld_memory .length = size ;
159
-
160
- foreach_vcpu (i , vm , vcpu ) {
161
- vcpu_make_request (vcpu , ACRN_REQUEST_EPT_FLUSH );
162
- }
163
147
}
164
148
165
149
void destroy_secure_world (struct vm * vm , bool need_clr_mem )
0 commit comments