From: Anthony Liguori <aliguori@us.ibm.com>
To: Gregory Haskins <ghaskins@novell.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
avi@redhat.com, glommer@redhat.com
Subject: Re: [KVM PATCH] KVM: introduce "xinterface" API for external interaction with guests
Date: Thu, 16 Jul 2009 10:37:41 -0500 [thread overview]
Message-ID: <4A5F4945.3080202@us.ibm.com> (raw)
In-Reply-To: <20090716151945.29318.10882.stgit@dev.haskins.net>
Gregory Haskins wrote:
> +/*
> + * ------------
> + * XINTERFACE (External Interface)
> + * -------------
> + */
> +
> +static struct kvm *
> +intf_to_kvm(struct kvm_xinterface *intf)
> +{
> + return container_of(intf, struct kvm, xinterface);
> +}
> +
> +static unsigned long
> +xinterface_gpa_to_hva(struct kvm_xinterface *intf, unsigned long gpa)
> +{
> + struct kvm *kvm = intf_to_kvm(intf);
> + unsigned long addr;
> +
> + addr = gfn_to_hva(kvm, gpa >> PAGE_SHIFT);
> + if (kvm_is_error_hva(addr))
> + return 0;
> +
> + return addr + offset_in_page(gpa);
> +}
> +
> +static struct page *
> +xinterface_gpa_to_page(struct kvm_xinterface *intf, unsigned long gpa)
> +{
> + struct kvm *kvm = intf_to_kvm(intf);
> + struct page *page;
> +
> + page = gfn_to_page(kvm, gpa >> PAGE_SHIFT);
> + if (page == bad_page)
> + return ERR_PTR(-EINVAL);
> +
> + return page;
> +}
> +
> +static void
> +xinterface_release(struct kvm_xinterface *intf)
> +{
> + struct kvm *kvm = intf_to_kvm(intf);
> +
> + kvm_put_kvm(kvm);
> +}
> +
> +struct kvm_xinterface_ops _kvm_xinterface_ops = {
> + .gpa_to_hva = xinterface_gpa_to_hva,
> + .gpa_to_page = xinterface_gpa_to_page,
> + .release = xinterface_release,
> +};
>
How do you deal with locking?
The mappings (gpa_to_page) are not fixed. They can and do change very
often. The interface doesn't seem to attempt to cope with this.
Regards,
Anthony Liguori
next prev parent reply other threads:[~2009-07-16 15:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-16 15:19 [KVM PATCH] xinterface Gregory Haskins
2009-07-16 15:19 ` [KVM PATCH] KVM: introduce "xinterface" API for external interaction with guests Gregory Haskins
2009-07-16 15:30 ` Sam Ravnborg
2009-07-16 15:31 ` Gregory Haskins
2009-07-16 15:37 ` Anthony Liguori [this message]
2009-07-16 15:47 ` Gregory Haskins
2009-07-16 16:09 ` Anthony Liguori
2009-07-16 16:52 ` Arnd Bergmann
2009-07-16 18:22 ` Gregory Haskins
2009-07-16 18:53 ` Gregory Haskins
2009-07-16 19:38 ` Zan Lynx
2009-07-16 19:48 ` Gregory Haskins
2009-07-16 19:46 ` Arnd Bergmann
2009-07-17 0:25 ` Gregory Haskins
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=4A5F4945.3080202@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=ghaskins@novell.com \
--cc=glommer@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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