All of lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Kulke <magnuskulke@linux.microsoft.com>
To: qemu-devel@nongnu.org
Cc: "Doru Blânzeanu" <dblanzeanu@linux.microsoft.com>,
	"Doru Blânzeanu" <doru.blanzeanu@microsoft.com>,
	"Wei Liu" <wei.liu@kernel.org>, "Wei Liu" <liuwe@microsoft.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Magnus Kulke" <magnuskulke@linux.microsoft.com>
Subject: [PATCH] accel/mshv: mark VGA mem as dirty in mshv_log_sync
Date: Wed, 25 Nov 2026 14:11:14 +0100	[thread overview]
Message-ID: <20261125131114.49490-1-magnuskulke@linux.microsoft.com> (raw)

The accelerator needs to report changed video memory for the VGA display
update (e.g. for a VNC backend). We currently report the full section as
dirty. MSHV enables hypervisor dirty tracking only during migration, so
a VGA-only refresh is not able to query that bitmap.

During migrations we will use the migration dirty-log.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
---
 accel/mshv/mem.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/accel/mshv/mem.c b/accel/mshv/mem.c
index 00d69fca8d..98db7bf117 100644
--- a/accel/mshv/mem.c
+++ b/accel/mshv/mem.c
@@ -428,11 +428,24 @@ void mshv_log_sync(MemoryListener *listener, MemoryRegionSection *section)
     ram_addr_t ram_addr;
     int ret;
     MemoryRegion *mr = section->mr;
+    bool vga_logging, migration_logging;
 
     if (!memory_region_is_ram(mr) || memory_region_is_rom(mr)) {
         return;
     }
 
+    /* mark VGA always dirty, but keep bitmap tracking during migration */
+    vga_logging = memory_region_get_dirty_log_mask(mr) & BIT(DIRTY_MEMORY_VGA);
+    migration_logging = memory_region_get_dirty_log_mask(mr) &
+                        BIT(DIRTY_MEMORY_MIGRATION);
+    if (vga_logging && !migration_logging) {
+        mr_offset = section->offset_within_region;
+        size = int128_get64(section->size);
+
+        memory_region_set_dirty(mr, mr_offset, size);
+        return;
+    }
+
     size = align_section(section, &start_addr);
     if (!size) {
         return;
-- 
2.34.1



             reply	other threads:[~2026-11-25 13:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 13:11 Magnus Kulke [this message]
2026-11-25 14:29 ` [PATCH] accel/mshv: mark VGA mem as dirty in mshv_log_sync Mohamed Mediouni
2026-11-25 19:48   ` Magnus Kulke

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=20261125131114.49490-1-magnuskulke@linux.microsoft.com \
    --to=magnuskulke@linux.microsoft.com \
    --cc=dblanzeanu@linux.microsoft.com \
    --cc=doru.blanzeanu@microsoft.com \
    --cc=liuwe@microsoft.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wei.liu@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.