From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hollis Blanchard Subject: Re: [PATCH] [v2] linux: virtio: Standardize virtio's concept of "page size" Date: Thu, 13 Nov 2008 15:49:03 -0600 Message-ID: <1226612943.5339.44.camel@localhost.localdomain> References: <200811122251.14159.rusty@rustcorp.com.au> <1226506591.19156.10.camel@localhost.localdomain> <200811130844.57749.rusty@rustcorp.com.au> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org, markmc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Rusty Russell Return-path: In-Reply-To: <200811130844.57749.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org> Sender: kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: kvm.vger.kernel.org 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 --- 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-ppc" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html