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 07/13] xen: implement IO APIC support in Xen mptable parser
Date: Tue, 24 Dec 2013 12:20:56 +0100	[thread overview]
Message-ID: <1387884062-41154-8-git-send-email-roger.pau__8654.52678776837$1387884294$gmane$org@citrix.com> (raw)
In-Reply-To: <1387884062-41154-1-git-send-email-roger.pau@citrix.com>

Use madt_setup_io (from madt.c) on Xen apic_enumerator, in order to
parse the interrupt sources from the IO APIC.

I would like to get opinions, but I think we should rename and move
madt_setup_io to io_apic.c.
---
 sys/amd64/include/apicvar.h |    1 +
 sys/i386/include/apicvar.h  |    1 +
 sys/x86/acpica/madt.c       |    5 ++---
 sys/x86/xen/mptable.c       |   24 +++++++++++++++++++++++-
 4 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/sys/amd64/include/apicvar.h b/sys/amd64/include/apicvar.h
index a48a76b..3974067 100644
--- a/sys/amd64/include/apicvar.h
+++ b/sys/amd64/include/apicvar.h
@@ -233,6 +233,7 @@ int	lapic_set_lvt_triggermode(u_int apic_id, u_int lvt,
 void	lapic_set_tpr(u_int vector);
 void	lapic_setup(int boot);
 void	xen_intr_handle_upcall(struct trapframe *frame);
+int	madt_setup_io(void);
 
 #endif /* !LOCORE */
 #endif /* _MACHINE_APICVAR_H_ */
diff --git a/sys/i386/include/apicvar.h b/sys/i386/include/apicvar.h
index c8ee9bc..05ec013 100644
--- a/sys/i386/include/apicvar.h
+++ b/sys/i386/include/apicvar.h
@@ -232,6 +232,7 @@ int	lapic_set_lvt_triggermode(u_int apic_id, u_int lvt,
 void	lapic_set_tpr(u_int vector);
 void	lapic_setup(int boot);
 void	xen_intr_handle_upcall(struct trapframe *frame);
+int	madt_setup_io(void);
 
 #endif /* !LOCORE */
 #endif /* _MACHINE_APICVAR_H_ */
diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c
index 5929fde..6f3b591 100644
--- a/sys/x86/acpica/madt.c
+++ b/sys/x86/acpica/madt.c
@@ -61,7 +61,7 @@ static struct lapic_info {
 } lapics[MAX_APIC_ID + 1];
 
 static int madt_found_sci_override;
-static ACPI_TABLE_MADT *madt;
+ACPI_TABLE_MADT *madt;
 static vm_paddr_t madt_physaddr;
 static vm_offset_t madt_length;
 
@@ -84,7 +84,6 @@ static void	madt_probe_cpus_handler(ACPI_SUBTABLE_HEADER *entry,
 		    void *arg __unused);
 static void	madt_register(void *dummy);
 static int	madt_setup_local(void);
-static int	madt_setup_io(void);
 static void	madt_walk_table(acpi_subtable_handler *handler, void *arg);
 
 static struct apic_enumerator madt_enumerator = {
@@ -147,7 +146,7 @@ madt_setup_local(void)
 /*
  * Enumerate I/O APICs and setup interrupt sources.
  */
-static int
+int
 madt_setup_io(void)
 {
 	void *ioapic;
diff --git a/sys/x86/xen/mptable.c b/sys/x86/xen/mptable.c
index 0384886..46b03f3 100644
--- a/sys/x86/xen/mptable.c
+++ b/sys/x86/xen/mptable.c
@@ -43,6 +43,9 @@ __FBSDID("$FreeBSD$");
 #include <machine/intr_machdep.h>
 #include <machine/apicvar.h>
 
+#include <contrib/dev/acpica/include/acpi.h>
+#include <contrib/dev/acpica/include/actables.h>
+
 #include <machine/cpu.h>
 #include <machine/smp.h>
 
@@ -51,6 +54,9 @@ __FBSDID("$FreeBSD$");
 
 #include <xen/interface/vcpu.h>
 
+/* From madt.c */
+extern ACPI_TABLE_MADT *madt;
+
 static int xenpv_probe(void);
 static int xenpv_probe_cpus(void);
 static int xenpv_setup_local(void);
@@ -107,7 +113,23 @@ xenpv_setup_local(void)
 static int
 xenpv_setup_io(void)
 {
-	return (0);
+	vm_paddr_t madt_physaddr;
+	vm_offset_t madt_length;
+
+	if (!xen_initial_domain())
+		return (0);
+
+	madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
+	if (madt_physaddr == 0)
+		panic("could not find MADT table");
+	madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT);
+	if (madt == NULL)
+		panic("unable to map MADT");
+	madt_length = madt->Header.Length;
+	acpi_unmap_table(madt);
+	madt = pmap_mapbios(madt_physaddr, madt_length);
+
+	return (madt_setup_io());
 }
 
 static void
-- 
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 ` [PATCH RFC 05/13] xen: implement Xen IO APIC ops Roger Pau Monne
2013-12-24 11:20 ` [PATCH RFC 06/13] xen: Dom0 console fixes Roger Pau Monne
2013-12-24 11:20 ` Roger Pau Monne [this message]
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-8-git-send-email-roger.pau__8654.52678776837$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.