[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/27] hvf: Avoid mapping regions < PAGE_SIZE as ram
From: |
Paolo Bonzini |
Subject: |
[PULL 12/27] hvf: Avoid mapping regions < PAGE_SIZE as ram |
Date: |
Wed, 3 Nov 2021 16:04:27 +0100 |
From: Alexander Graf <agraf@csgraf.de>
HVF has generic memory listener code that adds all RAM regions as HVF RAM
regions. However, HVF can only handle page aligned, page granule regions.
So let's ignore regions that are not page aligned and sized. They will be
trapped as MMIO instead.
Signed-off-by: Alexander Graf <agraf@csgraf.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20211025132147.28308-1-agraf@csgraf.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
accel/hvf/hvf-accel-ops.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index 2b2c411076..54457c76c2 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -122,6 +122,7 @@ static void hvf_set_phys_mem(MemoryRegionSection *section,
bool add)
MemoryRegion *area = section->mr;
bool writeable = !area->readonly && !area->rom_device;
hv_memory_flags_t flags;
+ uint64_t page_size = qemu_real_host_page_size;
if (!memory_region_is_ram(area)) {
if (writeable) {
@@ -135,6 +136,12 @@ static void hvf_set_phys_mem(MemoryRegionSection *section,
bool add)
}
}
+ if (!QEMU_IS_ALIGNED(int128_get64(section->size), page_size) ||
+ !QEMU_IS_ALIGNED(section->offset_within_address_space, page_size)) {
+ /* Not page aligned, so we can not map as RAM */
+ add = false;
+ }
+
mem = hvf_find_overlap_slot(
section->offset_within_address_space,
int128_get64(section->size));
--
2.31.1
- [PULL 05/27] util: Make some iova_tree parameters const, (continued)
- [PULL 05/27] util: Make some iova_tree parameters const, Paolo Bonzini, 2021/11/03
- [PULL 03/27] Partially revert "build: -no-pie is no functional linker flag", Paolo Bonzini, 2021/11/03
- [PULL 08/27] optionrom: add a DMA-enabled multiboot ROM, Paolo Bonzini, 2021/11/03
- [PULL 06/27] MAINTAINERS: update location of microvm docs, Paolo Bonzini, 2021/11/03
- [PULL 09/27] target/i386: use DMA-enabled multiboot ROM for new-enough QEMU machine types, Paolo Bonzini, 2021/11/03
- [PULL 10/27] configure: remove useless NPTL probe, Paolo Bonzini, 2021/11/03
- [PULL 11/27] configure: do not duplicate CPU_CFLAGS into QEMU_LDFLAGS, Paolo Bonzini, 2021/11/03
- [PULL 01/27] Makefile: Fix gtags generation, Paolo Bonzini, 2021/11/03
- [PULL 04/27] configure/optionrom: Fix MSYS2 multiboot.bin issue, Paolo Bonzini, 2021/11/03
- [PULL 07/27] target/i386: move linuxboot_dma_enabled to X86MachineState, Paolo Bonzini, 2021/11/03
- [PULL 12/27] hvf: Avoid mapping regions < PAGE_SIZE as ram,
Paolo Bonzini <=
- [PULL 15/27] vl: deprecate -watchdog, Paolo Bonzini, 2021/11/03
- [PULL 17/27] hw/i386: fix vmmouse registration, Paolo Bonzini, 2021/11/03
- [PULL 26/27] configure: Remove the check for the __thread keyword, Paolo Bonzini, 2021/11/03
- [PULL 27/27] configure: fix --audio-drv-list help message, Paolo Bonzini, 2021/11/03
- [PULL 14/27] watchdog: add information from -watchdog help to -device help, Paolo Bonzini, 2021/11/03
- [PULL 22/27] meson.build: Allow to disable OSS again, Paolo Bonzini, 2021/11/03
- [PULL 23/27] meson: remove pointless warnings, Paolo Bonzini, 2021/11/03
- [PULL 24/27] meson: remove unnecessary coreaudio test program, Paolo Bonzini, 2021/11/03
- [PULL 19/27] esp: ensure in-flight SCSI requests are always cancelled, Paolo Bonzini, 2021/11/03
- [PULL 20/27] qtest/am53c974-test: add test for cancelling in-flight requests, Paolo Bonzini, 2021/11/03