From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Magnus Kulke <magnuskulke@linux.microsoft.com>, qemu-devel@nongnu.org
Cc: "Cameron Esfahani" <dirty@apple.com>,
"Phil Dennis-Jordan" <phil@philjordan.eu>,
"Roman Bolshakov" <rbolshakov@ddn.com>,
"Thomas Huth" <thuth@redhat.com>,
"Zhao Liu" <zhao1.liu@intel.com>, "Wei Liu" <wei.liu@kernel.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Wei Liu" <liuwe@microsoft.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Magnus Kulke" <magnuskulke@microsoft.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH v2 26/27] accel/mshv: Workaround for overlappig mem mappings
Date: Tue, 1 Jul 2025 20:22:09 +0200 [thread overview]
Message-ID: <8e1e8f28-28cb-4529-ad2d-9cd277f7ccd1@linaro.org> (raw)
In-Reply-To: <20250701172834.44849-27-magnuskulke@linux.microsoft.com>
Hi Magnus,
On 1/7/25 19:28, Magnus Kulke wrote:
> QEMU maps certain regions into the guest multiple times, as seen in the
> trace below. Currently the MSHV kernel driver will reject those
> mappings. To workaround this, a record is kept (a static global list of
> "slots", inspired by what the HVF accelerator has implemented). An
> overlapping region is not registered at the hypervisor, and marked as
> mapped=false. If there is an UNMAPPED_GPA exit, we can look for a slot
> that is unmapped and would cover the GPA. In this case we map out the
> conflicting slot and map in the requested region.
>
> mshv_set_phys_mem add=1 name=pc.bios
> mshv_map_memory => u_a=7ffff4e00000 gpa=00fffc0000 size=00040000
> mshv_set_phys_mem add=1 name=ioapic
> mshv_set_phys_mem add=1 name=hpet
> mshv_set_phys_mem add=0 name=pc.ram
> mshv_unmap_memory u_a=7fff67e00000 gpa=0000000000 size=80000000
> mshv_set_phys_mem add=1 name=pc.ram
> mshv_map_memory u_a=7fff67e00000 gpa=0000000000 size=000c0000
> mshv_set_phys_mem add=1 name=pc.rom
> mshv_map_memory u_a=7ffff4c00000 gpa=00000c0000 size=00020000
> mshv_set_phys_mem add=1 name=pc.bios
> mshv_remap_attempt => u_a=7ffff4e20000 gpa=00000e0000 size=00020000
>
> Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
> ---
> accel/mshv/mem.c | 264 ++++++++++++++++++++++++++++++++----
> accel/mshv/trace-events | 7 +-
> include/system/mshv.h | 16 ++-
> target/i386/mshv/mshv-cpu.c | 43 ++++++
> 4 files changed, 295 insertions(+), 35 deletions(-)
>
> diff --git a/accel/mshv/mem.c b/accel/mshv/mem.c
> index 6d7a726898..0ffe379601 100644
> --- a/accel/mshv/mem.c
> +++ b/accel/mshv/mem.c
> @@ -20,44 +20,167 @@
> #include <sys/ioctl.h>
> #include "trace.h"
>
> +MshvMemorySlot mem_slots[MSHV_MAX_MEM_SLOTS];
Ideally this should be in MshvState. Just a comment, not asking for
changes... yet ;).
next prev parent reply other threads:[~2025-07-01 18:23 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 17:28 [PATCH v2 00/27] Implementing a MSHV (Microsoft Hypervisor) accelerator Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 01/27] accel: Add Meson and config support for MSHV accelerator Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 02/27] target/i386/emulate: Allow instruction decoding from stream Magnus Kulke
2025-07-02 4:41 ` Wei Liu
2025-07-01 17:28 ` [PATCH v2 03/27] target/i386/mshv: Add x86 decoder/emu implementation Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 04/27] hw/intc: Generalize APIC helper names from kvm_* to accel_* Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 05/27] include/hw/hyperv: Add MSHV ABI header definitions Magnus Kulke
2025-07-02 9:11 ` Cornelia Huck
2025-07-02 10:11 ` Magnus Kulke
2025-07-02 10:32 ` Cornelia Huck
2025-07-02 13:48 ` Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 06/27] accel/mshv: Add accelerator skeleton Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 07/27] accel/mshv: Register memory region listeners Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 08/27] accel/mshv: Initialize VM partition Magnus Kulke
2025-07-02 4:45 ` Wei Liu
2025-07-01 17:28 ` [PATCH v2 09/27] accel/mshv: Register guest memory regions with hypervisor Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 10/27] accel/mshv: Add ioeventfd support Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 11/27] accel/mshv: Add basic interrupt injection support Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 12/27] accel/mshv: Add vCPU creation and execution loop Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 13/27] accel/mshv: Add vCPU signal handling Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 14/27] target/i386/mshv: Add CPU create and remove logic Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 15/27] target/i386/mshv: Implement mshv_store_regs() Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 16/27] target/i386/mshv: Implement mshv_get_standard_regs() Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 17/27] target/i386/mshv: Implement mshv_get_special_regs() Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 18/27] target/i386/mshv: Implement mshv_arch_put_registers() Magnus Kulke
2025-07-02 4:46 ` Wei Liu
2025-07-01 17:28 ` [PATCH v2 19/27] target/i386/mshv: Set local interrupt controller state Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 20/27] target/i386/mshv: Register CPUID entries with MSHV Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 21/27] target/i386/mshv: Register MSRs " Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 22/27] target/i386/mshv: Integrate x86 instruction decoder/emulator Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 23/27] target/i386/mshv: Write MSRs to the hypervisor Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 24/27] target/i386/mshv: Implement mshv_vcpu_run() Magnus Kulke
2025-07-02 5:30 ` Wei Liu
2025-07-01 17:28 ` [PATCH v2 25/27] target/i386/mshv: Handle HVMSG_X64_HALT vm exit Magnus Kulke
2025-07-01 17:39 ` Magnus Kulke
2025-07-01 17:28 ` [PATCH v2 26/27] accel/mshv: Workaround for overlappig mem mappings Magnus Kulke
2025-07-01 18:22 ` Philippe Mathieu-Daudé [this message]
2025-07-01 17:28 ` [PATCH v2 27/27] docs: Add mshv to documentation Magnus Kulke
2025-07-02 5:35 ` [PATCH v2 00/27] Implementing a MSHV (Microsoft Hypervisor) accelerator Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8e1e8f28-28cb-4529-ad2d-9cd277f7ccd1@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=cohuck@redhat.com \
--cc=dirty@apple.com \
--cc=liuwe@microsoft.com \
--cc=magnuskulke@linux.microsoft.com \
--cc=magnuskulke@microsoft.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=phil@philjordan.eu \
--cc=qemu-devel@nongnu.org \
--cc=rbolshakov@ddn.com \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=wei.liu@kernel.org \
--cc=zhao1.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).