xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	keir@xen.org, Ian.Campbell@citrix.com, JBeulich@suse.com,
	konrad.wilk@oracle.com
Subject: [PATCH v2 2/2] linux/xen: support pirq_eoi_map
Date: Thu, 26 Jan 2012 18:00:39 +0000	[thread overview]
Message-ID: <1327600839-23469-2-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1201261736580.3196@kaball-desktop>

The pirq_eoi_map is a bitmap offered by Xen to check which pirqs need to
be EOI'd without having to issue an hypercall every time.
We use PHYSDEVOP_pirq_eoi_gmfn (v2) to map the bitmap, then, if we
succeed, we use pirq_eoi_map to check whether pirqs need eoi.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 drivers/xen/events.c            |   17 ++++++++++++++++-
 include/xen/interface/physdev.h |   12 ++++++++++++
 2 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 6e075cd..7fdc738 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -37,6 +37,7 @@
 #include <asm/idle.h>
 #include <asm/io_apic.h>
 #include <asm/sync_bitops.h>
+#include <asm/xen/page.h>
 #include <asm/xen/pci.h>
 #include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>
@@ -108,6 +109,7 @@ struct irq_info {
 #define PIRQ_SHAREABLE	(1 << 1)
 
 static int *evtchn_to_irq;
+static unsigned long *pirq_eoi_map;
 
 static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG],
 		      cpu_evtchn_mask);
@@ -274,6 +276,9 @@ static bool pirq_needs_eoi(unsigned irq)
 
 	BUG_ON(info->type != IRQT_PIRQ);
 
+	if (pirq_eoi_map != NULL)
+		return test_bit(irq, pirq_eoi_map);
+
 	return info->u.pirq.flags & PIRQ_NEEDS_EOI;
 }
 
@@ -1693,7 +1698,7 @@ void xen_callback_vector(void) {}
 
 void __init xen_init_IRQ(void)
 {
-	int i;
+	int i, rc;
 
 	evtchn_to_irq = kcalloc(NR_EVENT_CHANNELS, sizeof(*evtchn_to_irq),
 				    GFP_KERNEL);
@@ -1714,8 +1719,18 @@ void __init xen_init_IRQ(void)
 		 * __acpi_register_gsi can point at the right function */
 		pci_xen_hvm_init();
 	} else {
+		struct physdev_pirq_eoi_gmfn eoi_gmfn;
+
 		irq_ctx_init(smp_processor_id());
 		if (xen_initial_domain())
 			pci_xen_initial_domain();
+
+		pirq_eoi_map = (void *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
+		eoi_gmfn.gmfn = virt_to_mfn(pirq_eoi_map);
+		rc = HYPERVISOR_physdev_op(PHYSDEVOP_pirq_eoi_gmfn, &eoi_gmfn);
+		if (rc != 0) {
+			free_page((unsigned long) pirq_eoi_map);
+			pirq_eoi_map = NULL;
+		}
 	}
 }
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index c1080d9..132c61f 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -39,6 +39,18 @@ struct physdev_eoi {
 };
 
 /*
+ * Register a shared page for the hypervisor to indicate whether the
+ * guest must issue PHYSDEVOP_eoi. The page registered is used as a bit
+ * array indexed by Xen's PIRQ value.
+ */
+#define PHYSDEVOP_pirq_eoi_gmfn      28
+struct physdev_pirq_eoi_gmfn {
+    /* IN */
+    unsigned long gmfn;
+};
+
+
+/*
  * Query the status of an IRQ line.
  * @arg == pointer to physdev_irq_status_query structure.
  */
-- 
1.7.2.5

  parent reply	other threads:[~2012-01-26 18:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-26 15:49 [PATCH 0/2] use pirq_eoi_map in modern Linux kernels Stefano Stabellini
2012-01-26 15:49 ` [PATCH 1/2] xen: Introduce PHYSDEVOP_pirq_eoi_gmfn_new Stefano Stabellini
2012-01-26 16:09   ` Jan Beulich
2012-01-26 16:14     ` Stefano Stabellini
2012-01-26 16:11   ` Keir Fraser
2012-01-26 16:26     ` Keir Fraser
2012-01-26 16:29     ` Stefano Stabellini
2012-01-26 16:42       ` Ian Campbell
2012-01-26 16:45         ` Stefano Stabellini
2012-01-26 17:13           ` Keir Fraser
2012-01-26 17:37             ` Stefano Stabellini
2012-01-26 18:00               ` [PATCH v2 1/2] xen: introduce PHYSDEVOP_pirq_eoi_gmfn_v2 Stefano Stabellini
2012-01-26 18:00               ` Stefano Stabellini [this message]
2012-01-26 18:51                 ` [PATCH v2 2/2] linux/xen: support pirq_eoi_map Konrad Rzeszutek Wilk
2012-01-27 11:03                   ` Stefano Stabellini
2012-01-27 13:51                     ` Konrad Rzeszutek Wilk
2012-01-27 14:10                       ` Stefano Stabellini
2012-01-26 17:14       ` [PATCH 1/2] xen: Introduce PHYSDEVOP_pirq_eoi_gmfn_new Keir Fraser
2012-01-26 15:49 ` [PATCH 2/2] linux/xen: support pirq_eoi_map Stefano Stabellini

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=1327600839-23469-2-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=konrad.wilk@oracle.com \
    --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).