public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Hollis Blanchard <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Rusty Russell <rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
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
Subject: Re: [PATCH] [v2] linux: virtio: Standardize virtio's concept of "page size"
Date: Thu, 13 Nov 2008 15:49:03 -0600	[thread overview]
Message-ID: <1226612943.5339.44.camel@localhost.localdomain> (raw)
In-Reply-To: <200811130844.57749.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.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 <hollisb-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
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

      parent reply	other threads:[~2008-11-13 21:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa3de103a4e7d70354e0.1226360229@localhost.localdomain>
     [not found] ` <200811112347.27844.rusty@rustcorp.com.au>
2008-11-11 17:18   ` [PATCH] [v2] linux: virtio: Standardize virtio's concept of "page size" Hollis Blanchard
2008-11-11 17:21     ` Avi Kivity
2008-11-12 12:21 ` Rusty Russell
     [not found]   ` <200811122251.14159.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2008-11-12 16:16     ` Hollis Blanchard
2008-11-12 22:14       ` Rusty Russell
2008-11-13 21:48         ` Hollis Blanchard
     [not found]           ` <1226612913.5339.42.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-11-14  1:27             ` Rusty Russell
     [not found]         ` <200811130844.57749.rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org>
2008-11-13 21:49           ` Hollis Blanchard [this message]

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=1226612943.5339.44.camel@localhost.localdomain \
    --to=hollisb-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=aliguori-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=markmc-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=rusty-8n+1lVoiYb80n/F98K4Iww@public.gmane.org \
    --cc=xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox