On Thu, 2008-11-13 at 08:44 +1030, Rusty Russell wrote:
>
> Note that I still don't have a balloon patch: want to send me one?
qemu: virtio-balloon: don't use TARGET_PAGE_BITS in balloon interface
Make the balloon interface always use 4K pages.
Signed-off-by: Hollis Blanchard <[EMAIL PROTECTED]>
---
Only build-tested.
diff --git a/qemu/hw/virtio-balloon.c b/qemu/hw/virtio-balloon.c
--- a/qemu/hw/virtio-balloon.c
+++ b/qemu/hw/virtio-balloon.c
@@ -87,7 +87,7 @@ static void virtio_balloon_handle_output
ram_addr_t pa;
ram_addr_t addr;
- pa = (ram_addr_t)ldl_p(&pfn) << TARGET_PAGE_BITS;
+ pa = (ram_addr_t)ldl_p(&pfn) << VIRTIO_BALLOON_PFN_SHIFT;
offset += 4;
addr = cpu_get_physical_page_desc(pa);
@@ -135,11 +135,11 @@ static ram_addr_t virtio_balloon_to_targ
target = ram_size;
if (target) {
- dev->num_pages = (ram_size - target) >> TARGET_PAGE_BITS;
+ dev->num_pages = (ram_size - target) >> VIRTIO_BALLOON_PFN_SHIFT;
virtio_notify_config(&dev->vdev);
}
- return ram_size - (dev->actual << TARGET_PAGE_BITS);
+ return ram_size - (dev->actual << VIRTIO_BALLOON_PFN_SHIFT);
}
static void virtio_balloon_save(QEMUFile *f, void *opaque)
diff --git a/qemu/hw/virtio-balloon.h b/qemu/hw/virtio-balloon.h
--- a/qemu/hw/virtio-balloon.h
+++ b/qemu/hw/virtio-balloon.h
@@ -23,6 +23,9 @@
/* The feature bitmap for virtio balloon */
#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming
pages */
+/* Size of a PFN in the balloon interface. */
+#define VIRTIO_BALLOON_PFN_SHIFT 12
+
struct virtio_balloon_config
{
/* Number of pages host wants Guest to give up. */
--
Hollis Blanchard
IBM Linux Technology Center
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html