All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: freebsd-xen@freebsd.org, freebsd-current@freebsd.org,
	xen-devel@lists.xenproject.org, gibbs@freebsd.org,
	jhb@freebsd.org, kib@freebsd.org, julien.grall@citrix.com
Cc: Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH RFC 05/13] xen: implement Xen IO APIC ops
Date: Tue, 24 Dec 2013 12:20:54 +0100	[thread overview]
Message-ID: <1387884062-41154-6-git-send-email-roger.pau__30240.6917013743$1387884294$gmane$org@citrix.com> (raw)
In-Reply-To: <1387884062-41154-1-git-send-email-roger.pau@citrix.com>

Implement a different set of hooks for IO APIC to use when running
under Xen Dom0.
---
 sys/x86/xen/pv.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c
index ab4afba..e5ad200 100644
--- a/sys/x86/xen/pv.c
+++ b/sys/x86/xen/pv.c
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include <vm/vm_pager.h>
 #include <vm/vm_param.h>
 
+#include <x86/apicreg.h>
 #include <machine/sysarch.h>
 #include <machine/clock.h>
 #include <machine/pc/bios.h>
@@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include <xen/xen-os.h>
 #include <xen/hypervisor.h>
 #include <xen/pv.h>
+#include <xen/xen_intr.h>
 
 #include <xen/interface/vcpu.h>
 
@@ -73,6 +75,11 @@ static caddr_t xen_pv_parse_preload_data(u_int64_t);
 static void xen_pv_parse_memmap(caddr_t, vm_paddr_t *, int *);
 
 static void xen_pv_set_init_ops(void);
+
+static u_int xen_pv_ioapic_read(volatile ioapic_t *, int);
+static void xen_pv_ioapic_write(volatile ioapic_t *, int, u_int);
+static void xen_pv_ioapic_register_intr(struct ioapic_intsrc *);
+
 /*---------------------------- Extern Declarations ---------------------------*/
 /* Variables used by amd64 mp_machdep to start APs */
 extern struct mtx ap_boot_mtx;
@@ -92,6 +99,13 @@ struct init_ops xen_init_ops = {
 	.parse_memmap =		xen_pv_parse_memmap,
 };
 
+/* Xen ioapic_ops implementation */
+struct ioapic_ops xen_ioapic_ops = {
+	.read =			xen_pv_ioapic_read,
+	.write =		xen_pv_ioapic_write,
+	.register_intr =	xen_pv_ioapic_register_intr,
+};
+
 static struct
 {
 	const char	*ev;
@@ -342,6 +356,34 @@ xen_pv_parse_memmap(caddr_t kmdp, vm_paddr_t *physmap, int *physmap_idx)
 	bios_add_smap_entries(xen_smap, size, physmap, physmap_idx);
 }
 
+static u_int
+xen_pv_ioapic_read(volatile ioapic_t *apic, int reg)
+{
+	struct physdev_apic apic_op;
+	int rc;
+
+	mtx_assert(&icu_lock, MA_OWNED);
+
+	apic_op.apic_physbase = pmap_kextract((vm_offset_t) apic);
+	apic_op.reg = reg;
+	rc = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op);
+	if (rc)
+		panic("apic_read operation failed");
+
+	return (apic_op.value);
+}
+
+static void
+xen_pv_ioapic_write(volatile ioapic_t *apic, int reg, u_int val)
+{
+}
+
+static void
+xen_pv_ioapic_register_intr(struct ioapic_intsrc *pin)
+{
+	xen_register_pirq(pin->io_irq, pin->io_activehi, pin->io_edgetrigger);
+}
+
 static void
 xen_pv_set_init_ops(void)
 {
@@ -349,4 +391,6 @@ xen_pv_set_init_ops(void)
 	init_ops = xen_init_ops;
 	/* Disable lapic */
 	lapic_disabled = true;
+	/* IOAPIC ops for Xen PV */
+	ioapic_ops = xen_ioapic_ops;
 }
-- 
1.7.7.5 (Apple Git-26)

  parent reply	other threads:[~2013-12-24 11:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1387884062-41154-1-git-send-email-roger.pau@citrix.com>
2013-12-24 11:20 ` [PATCH RFC 01/13] xen: use the hardware e820 map on Dom0 Roger Pau Monne
2013-12-24 11:20 ` [PATCH RFC 02/13] ioapic: introduce hooks for some ioapic ops Roger Pau Monne
2013-12-24 11:20 ` [PATCH RFC 03/13] xen: mask event channels while changing affinity Roger Pau Monne
2013-12-24 11:20 ` [PATCH RFC 04/13] xen: implement basic PIRQ support for Dom0 Roger Pau Monne
2014-01-21 18:52   ` John Baldwin
2013-12-24 11:20 ` Roger Pau Monne [this message]
2013-12-24 11:20 ` [PATCH RFC 06/13] xen: Dom0 console fixes Roger Pau Monne
2013-12-24 11:20 ` [PATCH RFC 07/13] xen: implement IO APIC support in Xen mptable parser Roger Pau Monne
2013-12-24 11:20 ` [PATCH RFC 08/13] xen: change order of Xen intr init and IO APIC registration Roger Pau Monne
2013-12-24 11:20 ` [PATCH RFC 09/13] xen: change quality of the MADT ACPI enumerator Roger Pau Monne
2014-02-08 21:42   ` John Baldwin
     [not found]   ` <1980951.95r2q2cca3@ralph.baldwin.cx>
2014-02-14  1:49     ` Andrew Cooper
     [not found]     ` <52FD7624.90202@citrix.com>
2014-02-14 17:51       ` John Baldwin
     [not found]       ` <201402141251.10278.jhb@freebsd.org>
2014-02-17 16:01         ` Roger Pau Monné
2013-12-24 11:20 ` [PATCH RFC 10/13] xen: add ACPI bus to xen_nexus when running as Dom0 Roger Pau Monne
2013-12-24 11:21 ` [PATCH RFC 11/13] pci: introduce a new event on PCI device detection Roger Pau Monne
2013-12-24 11:21 ` [PATCH RFC 12/13] mca: disable cmc enable on Xen PV Roger Pau Monne
2013-12-24 11:21 ` [PATCH RFC 13/13] xenstore: changes needed to boot in Dom0 mode Roger Pau Monne
     [not found] ` <1387884062-41154-4-git-send-email-roger.pau@citrix.com>
2014-01-03 20:45   ` [PATCH RFC 03/13] xen: mask event channels while changing affinity Konrad Rzeszutek Wilk
     [not found] ` <1387884062-41154-2-git-send-email-roger.pau@citrix.com>
2014-01-21 18:25   ` [PATCH RFC 01/13] xen: use the hardware e820 map on Dom0 John Baldwin
     [not found] ` <1387884062-41154-3-git-send-email-roger.pau@citrix.com>
2014-01-21 18:27   ` [PATCH RFC 02/13] ioapic: introduce hooks for some ioapic ops John Baldwin
     [not found] ` <1387884062-41154-6-git-send-email-roger.pau@citrix.com>
2014-01-21 18:55   ` [PATCH RFC 05/13] xen: implement Xen IO APIC ops John Baldwin
     [not found] ` <1387884062-41154-7-git-send-email-roger.pau@citrix.com>
2014-01-21 19:02   ` [PATCH RFC 06/13] xen: Dom0 console fixes John Baldwin
     [not found] ` <1387884062-41154-8-git-send-email-roger.pau@citrix.com>
2014-02-08 21:36   ` [PATCH RFC 07/13] xen: implement IO APIC support in Xen mptable parser John Baldwin
     [not found] ` <1387884062-41154-9-git-send-email-roger.pau@citrix.com>
2014-02-08 21:37   ` [PATCH RFC 08/13] xen: change order of Xen intr init and IO APIC registration John Baldwin
     [not found] ` <1387884062-41154-11-git-send-email-roger.pau@citrix.com>
2014-02-08 21:50   ` [PATCH RFC 10/13] xen: add ACPI bus to xen_nexus when running as Dom0 John Baldwin
     [not found]   ` <2410827.IqfpSAhe3T@ralph.baldwin.cx>
2014-02-14 10:38     ` Roger Pau Monné
     [not found]     ` <52FDF217.3040005@citrix.com>
2014-02-14 17:50       ` John Baldwin
     [not found] ` <1387884062-41154-12-git-send-email-roger.pau@citrix.com>
2014-02-08 21:57   ` [PATCH RFC 11/13] pci: introduce a new event on PCI device detection John Baldwin
     [not found] ` <1387884062-41154-13-git-send-email-roger.pau@citrix.com>
2014-02-08 22:02   ` [PATCH RFC 12/13] mca: disable cmc enable on Xen PV John Baldwin

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='1387884062-41154-6-git-send-email-roger.pau__30240.6917013743$1387884294$gmane$org@citrix.com' \
    --to=roger.pau@citrix.com \
    --cc=freebsd-current@freebsd.org \
    --cc=freebsd-xen@freebsd.org \
    --cc=gibbs@freebsd.org \
    --cc=jhb@freebsd.org \
    --cc=julien.grall@citrix.com \
    --cc=kib@freebsd.org \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.