Skip to content

Commit 9257ecf

Browse files
lifeixlijinxia
authored andcommitted
hv: mmu: cleanup mmu.h
Remove unused Macro defininion. Tracked-On: #1124 Signed-off-by: Li, Fei1 <fei1.li@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent 06ab2b8 commit 9257ecf

File tree

8 files changed

+40
-193
lines changed

8 files changed

+40
-193
lines changed

hypervisor/arch/x86/cpu_primary.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,14 @@ cpu_primary32_gdt_ptr:
225225
.align 0x1000
226226
.global cpu_boot32_page_tables_start
227227
cpu_boot32_page_tables_start:
228-
/* 0x3 = (IA32E_COMM_P_BIT | IA32E_COMM_RW_BIT) */
228+
/* 0x3 = (PAGE_PRESENT | PAGE_RW) */
229229
.quad cpu_primary32_pdpt_addr + 0x3
230230
/*0x1000 = CPU_PAGE_SIZE*/
231231
.align 0x1000
232232
cpu_primary32_pdpt_addr:
233233
address = 0
234234
.rept 4
235-
/* 0x3 = (IA32E_COMM_P_BIT | IA32E_COMM_RW_BIT) */
235+
/* 0x3 = (PAGE_PRESENT | PAGE_RW) */
236236
.quad cpu_primary32_pdt_addr + address + 0x3
237237
/*0x1000 = CPU_PAGE_SIZE*/
238238
address = address + 0x1000
@@ -242,7 +242,7 @@ cpu_primary32_pdpt_addr:
242242
cpu_primary32_pdt_addr:
243243
address = 0
244244
.rept 2048
245-
/* 0x83 = (IA32E_PDPTE_PS_BIT | IA32E_COMM_P_BIT | IA32E_COMM_RW_BIT) */
245+
/* 0x83 = (PAGE_PSE | PAGE_PRESENT | PAGE_RW) */
246246
.quad address + 0x83
247247
address = address + 0x200000
248248
.endr

hypervisor/arch/x86/ept.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static uint64_t find_next_table(uint32_t table_offset, const void *table_base)
2727
}
2828

2929
/* Set table present bits to any of the read/write/execute bits */
30-
table_present = (IA32E_EPT_R_BIT | IA32E_EPT_W_BIT | IA32E_EPT_X_BIT);
30+
table_present = EPT_RWX;
3131

3232
/* Determine if a valid entry exists */
3333
if ((table_entry & table_present) == 0UL) {
@@ -274,8 +274,8 @@ int ept_mr_add(const struct vm *vm, uint64_t *pml4_page,
274274
* to force snooping of PCIe devices if the page
275275
* is cachable
276276
*/
277-
if ((prot & IA32E_EPT_MT_MASK) != IA32E_EPT_UNCACHED) {
278-
prot |= IA32E_EPT_SNOOP_CTRL;
277+
if ((prot & EPT_MT_MASK) != EPT_UNCACHED) {
278+
prot |= EPT_SNOOP_CTRL;
279279
}
280280

281281
ret = mmu_add(pml4_page, hpa, gpa, size, prot, PTT_EPT);

hypervisor/arch/x86/guest/guest.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ static int local_gva2gpa_common(struct vcpu *vcpu, struct page_walk_info *pw_inf
126126
}
127127

128128
/* check if the entry present */
129-
if ((entry & MMU_32BIT_PDE_P) == 0U) {
129+
if ((entry & PAGE_PRESENT) == 0U) {
130130
ret = -EFAULT;
131131
goto out;
132132
}
133133
/* check for R/W */
134-
if (pw_info->is_write_access && ((entry & MMU_32BIT_PDE_RW) == 0U)) {
134+
if (pw_info->is_write_access && ((entry & PAGE_RW) == 0U)) {
135135
/* Case1: Supermode and wp is 1
136136
* Case2: Usermode */
137137
if (pw_info->is_user_mode || pw_info->wp) {
@@ -141,16 +141,16 @@ static int local_gva2gpa_common(struct vcpu *vcpu, struct page_walk_info *pw_inf
141141
/* check for nx, since for 32-bit paing, the XD bit is
142142
* reserved(0), use the same logic as PAE/4-level paging */
143143
if (pw_info->is_inst_fetch && pw_info->nxe &&
144-
((entry & MMU_MEM_ATTR_BIT_EXECUTE_DISABLE) != 0U)) {
144+
((entry & PAGE_NX) != 0U)) {
145145
fault = 1;
146146
}
147147

148148
/* check for U/S */
149-
if (((entry & MMU_32BIT_PDE_US) == 0U) && pw_info->is_user_mode) {
149+
if (((entry & PAGE_USER) == 0U) && pw_info->is_user_mode) {
150150
fault = 1;
151151
}
152152

153-
if (pw_info->pse && ((i > 0U) && ((entry & MMU_32BIT_PDE_PS) != 0U))) {
153+
if (pw_info->pse && ((i > 0U) && ((entry & PAGE_PSE) != 0U))) {
154154
break;
155155
}
156156
addr = entry;
@@ -189,7 +189,7 @@ static int local_gva2gpa_pae(struct vcpu *vcpu, struct page_walk_info *pw_info,
189189
index = (gva >> 30) & 0x3UL;
190190
entry = base[index];
191191

192-
if ((entry & MMU_32BIT_PDE_P) == 0U) {
192+
if ((entry & PAGE_PRESENT) == 0U) {
193193
ret = -EFAULT;
194194
goto out;
195195
}

hypervisor/arch/x86/mtrr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,24 +129,24 @@ static uint32_t update_ept(struct vm *vm, uint64_t start,
129129

130130
switch ((uint64_t)type) {
131131
case MTRR_MEM_TYPE_WC:
132-
attr = IA32E_EPT_WC;
132+
attr = EPT_WC;
133133
break;
134134
case MTRR_MEM_TYPE_WT:
135-
attr = IA32E_EPT_WT;
135+
attr = EPT_WT;
136136
break;
137137
case MTRR_MEM_TYPE_WP:
138-
attr = IA32E_EPT_WP;
138+
attr = EPT_WP;
139139
break;
140140
case MTRR_MEM_TYPE_WB:
141-
attr = IA32E_EPT_WB;
141+
attr = EPT_WB;
142142
break;
143143
case MTRR_MEM_TYPE_UC:
144144
default:
145-
attr = IA32E_EPT_UNCACHED;
145+
attr = EPT_UNCACHED;
146146
}
147147

148148
ept_mr_modify(vm, (uint64_t *)vm->arch_vm.nworld_eptp,
149-
start, size, attr, IA32E_EPT_MT_MASK);
149+
start, size, attr, EPT_MT_MASK);
150150
return attr;
151151
}
152152

hypervisor/arch/x86/trampoline.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,15 @@ CPU_Boot_Page_Tables_ptr:
203203
.align 0x1000
204204
.global CPU_Boot_Page_Tables_Start
205205
CPU_Boot_Page_Tables_Start:
206-
/* 0x3 = (IA32E_COMM_P_BIT | IA32E_COMM_RW_BIT) */
206+
/* 0x3 = (PAGE_PRESENT | PAGE_RW) */
207207
.quad trampoline_pdpt_addr + 0x3
208208
/*0x1000 = CPU_PAGE_SIZE*/
209209
.align 0x1000
210210
.global trampoline_pdpt_addr
211211
trampoline_pdpt_addr:
212212
address = 0
213213
.rept 4
214-
/* 0x3 = (IA32E_COMM_P_BIT | IA32E_COMM_RW_BIT) */
214+
/* 0x3 = (PAGE_PRESENT | PAGE_RW) */
215215
.quad trampoline_pdt_addr + address + 0x3
216216
/*0x1000 = CPU_PAGE_SIZE*/
217217
address = address + 0x1000
@@ -221,7 +221,7 @@ trampoline_pdpt_addr:
221221
trampoline_pdt_addr:
222222
address = 0
223223
.rept 2048
224-
/* 0x83 = (IA32E_PDPTE_PS_BIT | IA32E_COMM_P_BIT | IA32E_COMM_RW_BIT) */
224+
/* 0x83 = (PAGE_PSE | PAGE_PRESENT | PAGE_RW) */
225225
.quad address + 0x83
226226
address = address + 0x200000
227227
.endr

hypervisor/arch/x86/trusty.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
119119
for (i = 0U; i < IA32E_NUM_ENTRIES - 1; i++) {
120120
pdpte = mem_read64(src_pdpte_p);
121121
if ((pdpte & table_present) != 0UL) {
122-
pdpte &= ~IA32E_EPT_X_BIT;
122+
pdpte &= ~EPT_EXE;
123123
mem_write64(dest_pdpte_p, pdpte);
124124
}
125125
src_pdpte_p++;

0 commit comments

Comments
 (0)