From: <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
keir@xen.org, Stefano.Stabellini@eu.citrix.com
Subject: [PATCH v2] xen: introduce HVM_PARAM_BUFIOREQ_EVTCHN
Date: Wed, 16 Nov 2011 11:46:33 +0000 [thread overview]
Message-ID: <1321443993-8724-1-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Introduce an event channel for buffered io event notifications,
advertise the port number using an hvm param.
This way the device model is not forced to check the buffered io page
for data several times a second for the entire life of the VM (buffered
io is mostly used for stdvga emulation in Xen that is switched off after
the guest goes into graphical mode).
Changes in v2:
- return -EINVAL to callers that try to set HVM_PARAM_BUFIOREQ_EVTCHN
from outside the hypervisor.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
xen/arch/x86/hvm/hvm.c | 13 +++++++++++++
xen/arch/x86/hvm/io.c | 2 ++
xen/include/public/hvm/params.h | 3 ++-
3 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index ab7763b..86627f6 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -972,6 +972,16 @@ int hvm_vcpu_initialise(struct vcpu *v)
/* Register ioreq event channel. */
v->arch.hvm_vcpu.xen_port = rc;
+
+ if ( v->vcpu_id == 0 )
+ {
+ /* Create bufioreq event channel. */
+ rc = alloc_unbound_xen_event_channel(v, 0);
+ if ( rc < 0 )
+ goto fail2;
+ v->domain->arch.hvm_domain.params[HVM_PARAM_BUFIOREQ_EVTCHN] = rc;
+ }
+
spin_lock(&v->domain->arch.hvm_domain.ioreq.lock);
if ( v->domain->arch.hvm_domain.ioreq.va != NULL )
get_ioreq(v)->vp_eport = v->arch.hvm_vcpu.xen_port;
@@ -3543,6 +3553,9 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE(void) arg)
if ( rc == 0 )
rc = nestedhvm_vcpu_initialise(v);
break;
+ case HVM_PARAM_BUFIOREQ_EVTCHN:
+ rc = -EINVAL;
+ break;
}
if ( rc == 0 )
diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index 7ebefc7..41a2ede 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -118,6 +118,8 @@ int hvm_buffered_io_send(ioreq_t *p)
wmb();
pg->write_pointer += qw ? 2 : 1;
+ notify_via_xen_event_channel(v->domain,
+ v->domain->arch.hvm_domain.params[HVM_PARAM_BUFIOREQ_EVTCHN]);
spin_unlock(&iorp->lock);
return 1;
diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h
index 1c5a1a9..6699788 100644
--- a/xen/include/public/hvm/params.h
+++ b/xen/include/public/hvm/params.h
@@ -52,6 +52,7 @@
#define HVM_PARAM_IOREQ_PFN 5
#define HVM_PARAM_BUFIOREQ_PFN 6
+#define HVM_PARAM_BUFIOREQ_EVTCHN 26
#ifdef __ia64__
@@ -141,6 +142,6 @@
/* Boolean: Enable nestedhvm (hvm only) */
#define HVM_PARAM_NESTEDHVM 24
-#define HVM_NR_PARAMS 26
+#define HVM_NR_PARAMS 27
#endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
--
1.7.2.3
reply other threads:[~2011-11-16 11:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1321443993-8724-1-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xensource.com \
/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).