Skip to content

Commit 0f766ca

Browse files
shiqinggwenlingz
authored andcommitted
hv: replace CPU_PAGE_SHIFT with PAGE_SHIFT
- replace CPU_PAGE_SHIFT with PAGE_SHIFT These two MACROs are duplicated and PAGE_SHIFT is a more reasonable name. - remove unused MACROs related to page shift in cpu.h Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 2f15d35 commit 0f766ca

File tree

5 files changed

+8
-13
lines changed

5 files changed

+8
-13
lines changed

hypervisor/arch/x86/assign.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void ptirq_build_physical_msi(struct acrn_vm *vm, struct ptirq_msi_info *
9191
bool phys;
9292

9393
/* get physical destination cpu mask */
94-
dest = (uint32_t)(info->vmsi_addr >> CPU_PAGE_SHIFT) & 0xffU;
94+
dest = (uint32_t)(info->vmsi_addr >> PAGE_SHIFT) & 0xffU;
9595
phys = ((info->vmsi_addr & MSI_ADDR_LOG) != MSI_ADDR_LOG);
9696

9797
calcvdest(vm, &vdmask, dest, phys);
@@ -112,7 +112,7 @@ static void ptirq_build_physical_msi(struct acrn_vm *vm, struct ptirq_msi_info *
112112
/* update physical dest mode & dest field */
113113
info->pmsi_addr = info->vmsi_addr;
114114
info->pmsi_addr &= ~0xFF00CU;
115-
info->pmsi_addr |= (dest_mask << CPU_PAGE_SHIFT) | MSI_ADDR_RH | MSI_ADDR_LOG;
115+
info->pmsi_addr |= (dest_mask << PAGE_SHIFT) | MSI_ADDR_RH | MSI_ADDR_LOG;
116116

117117
dev_dbg(ACRN_DBG_IRQ, "MSI addr:data = 0x%llx:%x(V) -> 0x%llx:%x(P)",
118118
info->vmsi_addr, info->vmsi_data,

hypervisor/arch/x86/guest/guest.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,8 +664,7 @@ uint64_t e820_alloc_low_memory(uint32_t size_arg)
664664
struct e820_entry *entry, *new_entry;
665665

666666
/* We want memory in page boundary and integral multiple of pages */
667-
size = (((size + PAGE_SIZE) - 1U) >> CPU_PAGE_SHIFT)
668-
<< CPU_PAGE_SHIFT;
667+
size = (((size + PAGE_SIZE) - 1U) >> PAGE_SHIFT) << PAGE_SHIFT;
669668

670669
for (i = 0U; i < e820_entries; i++) {
671670
entry = &e820[i];

hypervisor/arch/x86/vtd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment, uint8
871871
/* create context table for the bus if not present */
872872
context_table_addr = hva2hpa(get_ctx_table(dmar_unit->index, bus));
873873

874-
context_table_addr = context_table_addr >> CPU_PAGE_SHIFT;
874+
context_table_addr = context_table_addr >> PAGE_SHIFT;
875875

876876
lower = dmar_set_bitslice(lower,
877877
ROOT_ENTRY_LOWER_CTP_MASK, ROOT_ENTRY_LOWER_CTP_POS, context_table_addr);
@@ -886,7 +886,7 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment, uint8
886886
ROOT_ENTRY_LOWER_CTP_MASK, ROOT_ENTRY_LOWER_CTP_POS);
887887
}
888888

889-
context_table_addr = context_table_addr << CPU_PAGE_SHIFT;
889+
context_table_addr = context_table_addr << PAGE_SHIFT;
890890

891891
context_table = (struct dmar_context_entry *)hpa2hva(context_table_addr);
892892
context_entry = context_table + devfun;
@@ -927,7 +927,7 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment, uint8
927927
upper = dmar_set_bitslice(upper,
928928
CTX_ENTRY_UPPER_DID_MASK, CTX_ENTRY_UPPER_DID_POS, (uint64_t)vmid_to_domainid(domain->vm_id));
929929
lower = dmar_set_bitslice(lower,
930-
CTX_ENTRY_LOWER_SLPTPTR_MASK, CTX_ENTRY_LOWER_SLPTPTR_POS, domain->trans_table_ptr >> CPU_PAGE_SHIFT);
930+
CTX_ENTRY_LOWER_SLPTPTR_MASK, CTX_ENTRY_LOWER_SLPTPTR_POS, domain->trans_table_ptr >> PAGE_SHIFT);
931931
lower = dmar_set_bitslice(lower, CTX_ENTRY_LOWER_P_MASK, CTX_ENTRY_LOWER_P_POS, 1UL);
932932

933933
context_entry->upper = upper;
@@ -957,7 +957,7 @@ static int remove_iommu_device(const struct iommu_domain *domain, uint16_t segme
957957
root_entry = root_table + bus;
958958

959959
context_table_addr = dmar_get_bitslice(root_entry->lower, ROOT_ENTRY_LOWER_CTP_MASK, ROOT_ENTRY_LOWER_CTP_POS);
960-
context_table_addr = context_table_addr << CPU_PAGE_SHIFT;
960+
context_table_addr = context_table_addr << PAGE_SHIFT;
961961
context_table = (struct dmar_context_entry *)hpa2hva(context_table_addr);
962962

963963
context_entry = context_table + devfun;

hypervisor/debug/shell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ static void get_entry_info(const struct ptirq_remapping_info *entry, char *type,
909909
if (is_entry_active(entry)) {
910910
if (entry->intr_type == PTDEV_INTR_MSI) {
911911
(void)strcpy_s(type, 16U, "MSI");
912-
*dest = (entry->msi.pmsi_addr & 0xFF000U) >> CPU_PAGE_SHIFT;
912+
*dest = (entry->msi.pmsi_addr & 0xFF000U) >> PAGE_SHIFT;
913913
if ((entry->msi.pmsi_data & APIC_TRIGMOD_LEVEL) != 0U) {
914914
*lvl_tm = true;
915915
} else {

hypervisor/include/arch/x86/cpu.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@
3939
#define CPU_H
4040

4141
/* Define page size */
42-
#define CPU_PAGE_SHIFT 12U
4342
#define CPU_PAGE_MASK 0xFFFFFFFFFFFFF000UL
4443

45-
#define MMU_PTE_PAGE_SHIFT CPU_PAGE_SHIFT
46-
#define MMU_PDE_PAGE_SHIFT 21U
47-
4844
/* Define CPU stack alignment */
4945
#define CPU_STACK_ALIGN 16UL
5046

0 commit comments

Comments
 (0)