From dd43f3ba0a658068aa09c73f73ba4c88dbb10063 Mon Sep 17 00:00:00 2001 From: Shiqing Gao Date: Mon, 3 Dec 2018 09:41:18 +0800 Subject: [PATCH] hv: replace CPU_PAGE_MASK with PAGE_MASK replace CPU_PAGE_MASK with PAGE_MASK These two MACROs are duplicated and PAGE_MASK is a more reasonable name. Tracked-On: #861 Signed-off-by: Shiqing Gao Acked-by: Eddie Dong --- hypervisor/arch/x86/cpu.c | 2 +- hypervisor/include/arch/x86/cpu.h | 3 --- hypervisor/include/arch/x86/mmu.h | 4 ++-- hypervisor/include/arch/x86/page.h | 1 + 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index bf4337e13..b77a376c4 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -95,7 +95,7 @@ static inline bool get_monitor_cap(void) static uint64_t get_address_mask(uint8_t limit) { - return ((1UL << limit) - 1UL) & CPU_PAGE_MASK; + return ((1UL << limit) - 1UL) & PAGE_MASK; } static void get_cpu_capabilities(void) diff --git a/hypervisor/include/arch/x86/cpu.h b/hypervisor/include/arch/x86/cpu.h index 4e6b9d055..ffcdce466 100644 --- a/hypervisor/include/arch/x86/cpu.h +++ b/hypervisor/include/arch/x86/cpu.h @@ -38,9 +38,6 @@ #ifndef CPU_H #define CPU_H -/* Define page size */ -#define CPU_PAGE_MASK 0xFFFFFFFFFFFFF000UL - /* Define CPU stack alignment */ #define CPU_STACK_ALIGN 16UL diff --git a/hypervisor/include/arch/x86/mmu.h b/hypervisor/include/arch/x86/mmu.h index d4fe52d08..338a50647 100644 --- a/hypervisor/include/arch/x86/mmu.h +++ b/hypervisor/include/arch/x86/mmu.h @@ -55,12 +55,12 @@ static inline uint64_t round_page_up(uint64_t addr) { - return (((addr + (uint64_t)PAGE_SIZE) - 1UL) & CPU_PAGE_MASK); + return (((addr + (uint64_t)PAGE_SIZE) - 1UL) & PAGE_MASK); } static inline uint64_t round_page_down(uint64_t addr) { - return (addr & CPU_PAGE_MASK); + return (addr & PAGE_MASK); } /** diff --git a/hypervisor/include/arch/x86/page.h b/hypervisor/include/arch/x86/page.h index 897d5eb2f..e7ce39f97 100644 --- a/hypervisor/include/arch/x86/page.h +++ b/hypervisor/include/arch/x86/page.h @@ -9,6 +9,7 @@ #define PAGE_SHIFT 12U #define PAGE_SIZE (1U << PAGE_SHIFT) +#define PAGE_MASK 0xFFFFFFFFFFFFF000UL /* size of the low MMIO address space: 2GB */ #define PLATFORM_LO_MMIO_SIZE 0x80000000UL