From e14cafe412cdea3fd1992bb4380783832423d9a7 Mon Sep 17 00:00:00 2001 From: Sainath Grandhi Date: Thu, 9 Apr 2020 23:11:30 -0700 Subject: [PATCH] acrn-config: round HI_MMIO_START/HI_MMIO_END to the closest 1G Rounding HI_MMIO_START, HI_MMIO_END to the closest 1G. This avoids round up logic in the hypervisor. Tracked-On: #4586 Signed-off-by: Sainath Grandhi --- misc/acrn-config/board_config/misc_cfg_h.py | 4 ++-- misc/acrn-config/library/common.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/misc/acrn-config/board_config/misc_cfg_h.py b/misc/acrn-config/board_config/misc_cfg_h.py index c80ec90a0..8edf63ef6 100644 --- a/misc/acrn-config/board_config/misc_cfg_h.py +++ b/misc/acrn-config/board_config/misc_cfg_h.py @@ -106,8 +106,8 @@ def find_hi_mmio_window(config): print("", file=config) if is_hi_mmio: - print("#define HI_MMIO_START\t\t0x%xUL" % mmio_min, file=config) - print("#define HI_MMIO_END\t\t0x%xUL" % mmio_max, file=config) + print("#define HI_MMIO_START\t\t0x%xUL" % common.round_down(mmio_min, common.SIZE_G), file=config) + print("#define HI_MMIO_END\t\t0x%xUL" % common.round_up(mmio_max, common.SIZE_G), file=config) else: print("#define HI_MMIO_START\t\t~0UL", file=config) print("#define HI_MMIO_END\t\t0UL", file=config) diff --git a/misc/acrn-config/library/common.py b/misc/acrn-config/library/common.py index 765e7c3ee..316bceaa3 100644 --- a/misc/acrn-config/library/common.py +++ b/misc/acrn-config/library/common.py @@ -466,6 +466,9 @@ def undline_name(name): return name_str +def round_down(addr, mem_align): + """Keep memory align""" + return (addr & (~(mem_align - 1))) def round_up(addr, mem_align): """Keep memory align"""