Skip to contentSkip to conversation

Hack in dirty logging for VGA

PATCH In review Alexander Graf 1 participant 1 message Jul 16, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 23/23 Hack in dirty logging for VGA

I haven't implemented dirty logging yet, but without things are just way too slow. So for the time being I hacked in a dummy function that always tells userspace we're dirty in VGA regions.

Please don't apply this. This patch is for reference only.

---
 arch/powerpc/kvm/powerpc.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
arch/powerpc/kvm/powerpc.c +20 -1
index 2a4551f..fba06ff 100644
@@ -411,7 +411,26 @@ out:
 
 int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
 {
-	return -ENOTSUPP;
+	/* XXX clear (and fill?) dirty log */
+	struct kvm_memory_slot *memslot;
+	int i, n;
+
+        if (log->slot >= KVM_MEMORY_SLOTS)
+                return -EINVAL;
+
+        memslot = &kvm->memslots[log->slot];
+
+	/* XXX This is a hack to get VGA updating working for now */
+	if (memslot->base_gfn != 0x8000)
+		return -ENOENT;
+
+	n = ALIGN(memslot->npages, BITS_PER_LONG) / 8;
+	for (i = 0; i < n; i++)
+		memslot->dirty_bitmap[i] = 0;
+
+	memslot->dirty_bitmap[0] = ( 1 << 30 ) - 1;
+
+	return 0;
 }
 
 long kvm_arch_vm_ioctl(struct file *filp,
Signature · 1 line
1.6.0.2