From: Yinghai Lu <yhlu.kernel@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>,
Daniel Exner <dex@dragonslave.de>, Len Brown <lenb@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86: update mptable fix with no ioapic v2
Date: Wed, 18 Jun 2008 17:29:31 -0700 [thread overview]
Message-ID: <200806181729.31464.yhlu.kernel@gmail.com> (raw)
In-Reply-To: <200806181432.57204.yhlu.kernel@gmail.com>
if the system doesn't have ioapic, we don't need to store entries for mptable
update
also let mp_config_acpi_gsi not call func in mpparse
so later could decouple mpparse with acpi more easily
Reported-by: Daniel Exner <dex@dragonslave.de>
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/acpi/boot.c | 87 ++++++++++++++++++++++++++++----------------
arch/x86/kernel/mpparse.c | 19 ++++-----
include/asm-x86/mpspec.h | 2 -
3 files changed, 65 insertions(+), 43 deletions(-)
Index: linux-2.6/arch/x86/kernel/acpi/boot.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/acpi/boot.c
+++ linux-2.6/arch/x86/kernel/acpi/boot.c
@@ -958,10 +958,37 @@ void __init mp_register_ioapic(int id, u
nr_ioapics++;
}
+static void assign_to_mp_irq(struct mp_config_intsrc *m,
+ struct mp_config_intsrc *mp_irq)
+{
+ memcpy(mp_irq, m, sizeof(struct mp_config_intsrc));
+}
+
+static int mp_irq_cmp(struct mp_config_intsrc *mp_irq,
+ struct mp_config_intsrc *m)
+{
+ return memcmp(mp_irq, m, sizeof(struct mp_config_intsrc));
+}
+
+static void save_mp_irq(struct mp_config_intsrc *m)
+{
+ int i;
+
+ for (i = 0; i < mp_irq_entries; i++) {
+ if (!mp_irq_cmp(&mp_irqs[i], m))
+ return;
+ }
+
+ assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]);
+ if (++mp_irq_entries == MAX_IRQ_SOURCES)
+ panic("Max # of irq sources exceeded!!\n");
+}
+
void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi)
{
int ioapic;
int pin;
+ struct mp_config_intsrc mp_irq;
/*
* Convert 'gsi' to 'ioapic.pin'.
@@ -979,18 +1006,15 @@ void __init mp_override_legacy_irq(u8 bu
if ((bus_irq == 0) && (trigger == 3))
trigger = 1;
- mp_irqs[mp_irq_entries].mp_type = MP_INTSRC;
- mp_irqs[mp_irq_entries].mp_irqtype = mp_INT;
- mp_irqs[mp_irq_entries].mp_irqflag = (trigger << 2) | polarity;
- mp_irqs[mp_irq_entries].mp_srcbus = MP_ISA_BUS;
- mp_irqs[mp_irq_entries].mp_srcbusirq = bus_irq; /* IRQ */
- mp_irqs[mp_irq_entries].mp_dstapic =
- mp_ioapics[ioapic].mp_apicid; /* APIC ID */
- mp_irqs[mp_irq_entries].mp_dstirq = pin; /* INTIN# */
-
- if (++mp_irq_entries == MAX_IRQ_SOURCES)
- panic("Max # of irq sources exceeded!!\n");
+ mp_irq.mp_type = MP_INTSRC;
+ mp_irq.mp_irqtype = mp_INT;
+ mp_irq.mp_irqflag = (trigger << 2) | polarity;
+ mp_irq.mp_srcbus = MP_ISA_BUS;
+ mp_irq.mp_srcbusirq = bus_irq; /* IRQ */
+ mp_irq.mp_dstapic = mp_ioapics[ioapic].mp_apicid; /* APIC ID */
+ mp_irq.mp_dstirq = pin; /* INTIN# */
+ save_mp_irq(&mp_irq);
}
void __init mp_config_acpi_legacy_irqs(void)
@@ -998,6 +1022,7 @@ void __init mp_config_acpi_legacy_irqs(v
int i;
int ioapic;
unsigned int dstapic;
+ struct mp_config_intsrc mp_irq;
#if defined (CONFIG_MCA) || defined (CONFIG_EISA)
/*
@@ -1050,16 +1075,15 @@ void __init mp_config_acpi_legacy_irqs(v
continue; /* IRQ already used */
}
- mp_irqs[mp_irq_entries].mp_type = MP_INTSRC;
- mp_irqs[mp_irq_entries].mp_irqflag = 0; /* Conforming */
- mp_irqs[mp_irq_entries].mp_srcbus = MP_ISA_BUS;
- mp_irqs[mp_irq_entries].mp_dstapic = dstapic;
- mp_irqs[mp_irq_entries].mp_irqtype = mp_INT;
- mp_irqs[mp_irq_entries].mp_srcbusirq = i; /* Identity mapped */
- mp_irqs[mp_irq_entries].mp_dstirq = i;
+ mp_irq.mp_type = MP_INTSRC;
+ mp_irq.mp_irqflag = 0; /* Conforming */
+ mp_irq.mp_srcbus = MP_ISA_BUS;
+ mp_irq.mp_dstapic = dstapic;
+ mp_irq.mp_irqtype = mp_INT;
+ mp_irq.mp_srcbusirq = i; /* Identity mapped */
+ mp_irq.mp_dstirq = i;
- if (++mp_irq_entries == MAX_IRQ_SOURCES)
- panic("Max # of irq sources exceeded!!\n");
+ save_mp_irq(&mp_irq);
}
}
@@ -1167,25 +1191,26 @@ int mp_register_gsi(u32 gsi, int trigger
int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
u32 gsi, int triggering, int polarity)
{
- struct mpc_config_intsrc intsrc;
+#ifdef CONFIG_X86_MPPARSE
+ struct mp_config_intsrc mp_irq;
int ioapic;
- if (!enable_update_mptable)
+ if (!acpi_ioapic)
return 0;
/* print the entry should happen on mptable identically */
- intsrc.mpc_type = MP_INTSRC;
- intsrc.mpc_irqtype = mp_INT;
- intsrc.mpc_irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) |
+ mp_irq.mp_type = MP_INTSRC;
+ mp_irq.mp_irqtype = mp_INT;
+ mp_irq.mp_irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) |
(polarity == ACPI_ACTIVE_HIGH ? 1 : 3);
- intsrc.mpc_srcbus = number;
- intsrc.mpc_srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
+ mp_irq.mp_srcbus = number;
+ mp_irq.mp_srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3);
ioapic = mp_find_ioapic(gsi);
- intsrc.mpc_dstapic = mp_ioapic_routing[ioapic].apic_id;
- intsrc.mpc_dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base;
-
- MP_intsrc_info(&intsrc);
+ mp_irq.mp_dstapic = mp_ioapic_routing[ioapic].apic_id;
+ mp_irq.mp_dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base;
+ save_mp_irq(&mp_irq);
+#endif
return 0;
}
Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -34,8 +34,6 @@
#include <mach_mpparse.h>
#endif
-int enable_update_mptable;
-
/*
* Checksum an MP configuration block.
*/
@@ -246,7 +244,7 @@ static void __init print_mp_irq_info(str
mp_irq->mp_srcbusirq, mp_irq->mp_dstapic, mp_irq->mp_dstirq);
}
-static void assign_to_mp_irq(struct mpc_config_intsrc *m,
+static void __init assign_to_mp_irq(struct mpc_config_intsrc *m,
struct mp_config_intsrc *mp_irq)
{
mp_irq->mp_dstapic = m->mpc_dstapic;
@@ -270,7 +268,7 @@ static void __init assign_to_mpc_intsrc(
m->mpc_dstirq = mp_irq->mp_dstirq;
}
-static int mp_irq_mpc_intsrc_cmp(struct mp_config_intsrc *mp_irq,
+static int __init mp_irq_mpc_intsrc_cmp(struct mp_config_intsrc *mp_irq,
struct mpc_config_intsrc *m)
{
if (mp_irq->mp_dstapic != m->mpc_dstapic)
@@ -291,17 +289,16 @@ static int mp_irq_mpc_intsrc_cmp(struct
return 0;
}
-void MP_intsrc_info(struct mpc_config_intsrc *m)
+static void __init MP_intsrc_info(struct mpc_config_intsrc *m)
{
int i;
print_MP_intsrc_info(m);
- if (enable_update_mptable)
- for (i = 0; i < mp_irq_entries; i++) {
- if (!mp_irq_mpc_intsrc_cmp(&mp_irqs[i], m))
- return;
- }
+ for (i = 0; i < mp_irq_entries; i++) {
+ if (!mp_irq_mpc_intsrc_cmp(&mp_irqs[i], m))
+ return;
+ }
assign_to_mp_irq(m, &mp_irqs[mp_irq_entries]);
if (++mp_irq_entries == MAX_IRQ_SOURCES)
@@ -1113,6 +1110,8 @@ out:
return 0;
}
+static int __initdata enable_update_mptable;
+
static int __init update_mptable_setup(char *str)
{
enable_update_mptable = 1;
Index: linux-2.6/include/asm-x86/mpspec.h
===================================================================
--- linux-2.6.orig/include/asm-x86/mpspec.h
+++ linux-2.6/include/asm-x86/mpspec.h
@@ -59,9 +59,7 @@ extern void mp_override_legacy_irq(u8 bu
u32 gsi);
extern void mp_config_acpi_legacy_irqs(void);
extern int mp_register_gsi(u32 gsi, int edge_level, int active_high_low);
-extern void MP_intsrc_info(struct mpc_config_intsrc *m);
#ifdef CONFIG_X86_IO_APIC
-extern int enable_update_mptable;
extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
u32 gsi, int triggering, int polarity);
#else
next prev parent reply other threads:[~2008-06-19 0:28 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200805041823.57198.yhlu.kernel@gmail.com>
2008-05-06 17:38 ` [PATCH] x86: update mptable Yinghai Lu
2008-05-06 17:41 ` [PATCH] x86: fixed mtrr change WP to WB Yinghai Lu
2008-05-06 17:48 ` H. Peter Anvin
2008-05-06 18:24 ` Yinghai Lu
2008-05-06 18:31 ` H. Peter Anvin
2008-05-06 18:34 ` Yinghai Lu
2008-05-06 18:43 ` H. Peter Anvin
2008-05-06 19:05 ` Yinghai Lu
2008-05-06 19:08 ` H. Peter Anvin
2008-05-06 19:15 ` Yinghai Lu
2008-05-07 7:48 ` [PATCH] x86: update mptable v2 Yinghai Lu
2008-05-17 2:32 ` [PATCH] x86: update mptable v3 Yinghai Lu
2008-05-19 15:46 ` Ingo Molnar
2008-05-19 19:35 ` [PATCH] x86: update mptable v4 Yinghai Lu
2008-05-19 19:52 ` [PATCH] x86: update mptable v5 Yinghai Lu
2008-05-25 23:00 ` [PATCH] x86: update mptable v6 Yinghai Lu
2008-06-01 20:17 ` [PATCH] x86: update mptable v7 Yinghai Lu
2008-06-09 2:53 ` [PATCH] x86: update mptable v7 - fix Yinghai Lu
2008-06-09 10:13 ` Ingo Molnar
2008-06-09 17:51 ` Yinghai Lu
2008-06-09 18:11 ` Maciej W. Rozycki
2008-06-09 19:09 ` Ingo Molnar
2008-06-09 19:38 ` Yinghai Lu
2008-06-09 19:46 ` H. Peter Anvin
2008-06-09 19:49 ` Maciej W. Rozycki
2008-06-18 21:32 ` [PATCH] x86: update mptable fix with no ioapic Yinghai Lu
2008-06-19 0:29 ` Yinghai Lu [this message]
2008-06-19 7:18 ` [PATCH] x86: let MPS support selectable Yinghai Lu
2008-06-19 12:13 ` Ingo Molnar
2008-06-19 12:49 ` Ingo Molnar
2008-06-19 15:10 ` Maciej W. Rozycki
2008-06-19 17:39 ` Yinghai Lu
2008-06-19 18:03 ` Len Brown
2008-06-19 18:48 ` Maciej W. Rozycki
2008-06-26 9:31 ` Ingo Molnar
[not found] ` <200806191213.10312.yhlu.kernel@gmail.com>
2008-06-19 19:15 ` [PATCH] x86: fix compiling when CONFIG_X86_MPPARSE is not set Yinghai Lu
2008-06-20 14:42 ` [PATCH] x86: check command line " Yinghai Lu
2008-06-20 15:01 ` Ingo Molnar
2008-06-20 15:04 ` Yinghai Lu
2008-06-20 15:36 ` Maciej W. Rozycki
2008-06-20 23:11 ` [PATCH] x86: check command line when CONFIG_X86_MPPARSE is not set v2 Yinghai Lu
2008-06-21 8:14 ` [PATCH] x86: clean up init_amd() Yinghai Lu
2008-06-24 12:12 ` [PATCH] x86: check command line when CONFIG_X86_MPPARSE is not set Pavel Machek
2008-06-26 8:23 ` Yinghai Lu
[not found] ` <200806200733.31477.yhlu.kernel@gmail.com>
2008-06-20 15:03 ` [PATCH] x86: simplify x86_mpparse dependency check Ingo Molnar
2008-06-20 15:31 ` Maciej W. Rozycki
2008-06-19 12:13 ` [PATCH] x86: update mptable fix with no ioapic v2 Ingo Molnar
2008-06-18 22:18 ` [PATCH] x86: update mptable v7 Len Brown
2008-06-18 22:32 ` Yinghai Lu
2008-06-19 0:33 ` Len Brown
2008-06-19 0:49 ` Yinghai Lu
2008-06-19 4:32 ` Eric W. Biederman
2008-06-19 5:09 ` H. Peter Anvin
2008-06-19 5:11 ` Yinghai Lu
2008-06-19 5:27 ` Len Brown
2008-06-19 6:37 ` Eric W. Biederman
2008-06-19 7:31 ` Yinghai Lu
2008-06-19 18:16 ` Len Brown
2008-06-20 6:47 ` Ingo Molnar
2008-06-20 7:20 ` Yinghai Lu
2008-06-20 9:12 ` Andi Kleen
2008-06-19 5:20 ` Len Brown
2008-06-19 6:26 ` Yinghai Lu
2008-06-19 6:28 ` H. Peter Anvin
2008-06-19 6:35 ` Yinghai Lu
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=200806181729.31464.yhlu.kernel@gmail.com \
--to=yhlu.kernel@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dex@dragonslave.de \
--cc=hpa@zytor.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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.