qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hvf: Avoid mapping regions < PAGE_SIZE as ram


From: Alexander Graf
Subject: Re: [PATCH] hvf: Avoid mapping regions < PAGE_SIZE as ram
Date: Mon, 25 Oct 2021 21:10:26 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.1


On 25.10.21 19:11, Paolo Bonzini wrote:
On 25/10/21 10:25, Alexander Graf wrote:
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>
---
  accel/hvf/hvf-accel-ops.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c
index 6bf319d34c..090155853a 100644
--- a/accel/hvf/hvf-accel-ops.c
+++ b/accel/hvf/hvf-accel-ops.c
@@ -135,6 +135,12 @@ static void hvf_set_phys_mem(MemoryRegionSection *section, bool add)
          }
      }
  +    if (int128_get64(section->size) & (qemu_real_host_page_size - 1) || +        section->offset_within_address_space & (qemu_real_host_page_size - 1)) {
+        /* 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));


Queued, thanks.


You probably want v2 instead :)

Alex





reply via email to

[Prev in Thread] Current Thread [Next in Thread]