this is a port of current kvm vga memory optimization to our new
infrastructure proposed by anthony. It's goal is to use as few
kvm specific hooks as possible. In fact, the only one I'm relying
on is enabling/disabling of logging. The rest, is pretty much general.
We map the linear frame buffer area as RAM, and then use dirty tracking
to decide whether or not to update it. To be consistent with qemu,
this version, differently from upstream kvm, tracks memory based on its
physical address, represented by vram_offset, instead of vram_ptr, or
any other construct.
Let me know what you think
+int cpu_physical_memory_get_dirty(ram_addr_t addr,
+ int dirty_flags)
+{
+ int is_dirty = 0;
+ is_dirty = phys_ram_dirty[addr >> TARGET_PAGE_BITS] & dirty_flags;
+ if (is_dirty)
+ goto out;
+#ifdef CONFIG_KVM
+ if (kvm_enabled())
+ is_dirty = kvm_physical_memory_get_dirty(addr);
+ /* to make it usable below */
+ is_dirty = !!is_dirty * 0xff;
+#endif
+out:
+ return is_dirty;
+}
+