From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: aquini@redhat.com, mst@redhat.com, anton.vorontsov@linaro.org,
agl@us.ibm.com, amit.shah@redhat.com
Subject: [Qemu-devel] [RFC 1/3] virtio-balloon: add guest_get_actual_ram()
Date: Tue, 18 Dec 2012 18:16:53 -0200 [thread overview]
Message-ID: <1355861815-2607-2-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1355861815-2607-1-git-send-email-lcapitulino@redhat.com>
A future commit will also want to use this.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
hw/virtio-balloon.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index dd1a650..03248df 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -161,6 +161,11 @@ static uint32_t virtio_balloon_get_features(VirtIODevice *vdev, uint32_t f)
return f;
}
+static ram_addr_t guest_get_actual_ram(const VirtIOBalloon *s)
+{
+ return ram_size - ((uint64_t) s->actual << VIRTIO_BALLOON_PFN_SHIFT);
+}
+
static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
{
VirtIOBalloon *dev = opaque;
@@ -186,8 +191,7 @@ static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
*/
reset_stats(dev);
- info->actual = ram_size - ((uint64_t) dev->actual <<
- VIRTIO_BALLOON_PFN_SHIFT);
+ info->actual = guest_get_actual_ram(dev);
}
static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
--
1.8.0
next prev parent reply other threads:[~2012-12-18 20:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 20:16 [Qemu-devel] [RFC 0/3] auto-ballooning prototype (host part) Luiz Capitulino
2012-12-18 20:16 ` Luiz Capitulino [this message]
2012-12-18 20:16 ` [Qemu-devel] [RFC 2/3] virtio-balloon: add virtio_balloon_conf skeleton Luiz Capitulino
2012-12-18 20:16 ` [Qemu-devel] [RFC 3/3] virtio-balloon: add auto-ballooning support Luiz Capitulino
2012-12-18 22:53 ` Anton Vorontsov
2012-12-19 11:30 ` Luiz Capitulino
2012-12-20 5:24 ` Dietmar Maurer
2012-12-22 21:45 ` Luiz Capitulino
2013-01-11 20:32 ` Amit Shah
2013-01-14 11:58 ` Luiz Capitulino
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=1355861815-2607-2-git-send-email-lcapitulino@redhat.com \
--to=lcapitulino@redhat.com \
--cc=agl@us.ibm.com \
--cc=amit.shah@redhat.com \
--cc=anton.vorontsov@linaro.org \
--cc=aquini@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).