public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Olaf Dabrunz <od@suse.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	Jon Masters <jonathan@jonmasters.org>,
	linux-kernel@vger.kernel.org, Olaf Dabrunz <od@suse.de>,
	Stefan Assmann <sassmann@suse.de>
Subject: [PATCH 7/7] bootirqquirk= parameter to enable bootirq quirks for additional chips
Date: Mon,  2 Jun 2008 14:45:07 +0200	[thread overview]
Message-ID: <1212410707427-git-send-email-od@suse.de> (raw)
In-Reply-To: <12124107071847-git-send-email-od@suse.de>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5399 bytes --]

From: Olaf Dabrunz <od@suse.de>

The existing bootirq quirks and the reroute workaround may work for other chips
where we could not test them. This parameter allows users to apply these to
other chips without the need to re-build the kernel.

This patch was conceived simultaneously by Stefan Assmann, Daniel Gollub and
Olaf Dabrunz. The implementation is the author's.

    bootirqquirk=0x<vendor>,0x<device>,<quirk_type>

    - quirk type  1 - 32 selects an IRQ reroute algorithm for devices
      connected to that PCI bridge (currently only algorithm "1" is
      implemented),

    - quirk type 33 -  x applies one of the known quirks to the PCI
      device, currently these:

        33 -> quirk_disable_intel_boot_interrupt
        34 -> quirk_disable_broadcom_boot_interrupt
        35 -> quirk_disable_amd_8111_boot_interrupt
        36 -> quirk_disable_amd_813x_boot_interrupt
        37 -> quirk_disable_amd_sb700s_boot_interrupt

Signed-off-by: Olaf Dabrunz <od@suse.de>
Signed-off-by: Stefan Assmann <sassmann@suse.de>
---
 drivers/pci/quirks.c |  118 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 118 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 090ce38..bb7fa65 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1576,6 +1576,113 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_PXH_1,	quirk_re
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_PXHV,	quirk_reroute_to_boot_interrupts_intel);
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_80332_0,	quirk_reroute_to_boot_interrupts_intel);
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_80332_1,	quirk_reroute_to_boot_interrupts_intel);
+
+/*
+ * For additional boot irq quirks save boot time settings or call the quirks
+ * directly.
+ */
+
+#define MAX_BOOTTIME_CONFIG_PCI_FIXUPS_EARLY			32
+struct pci_fixup __start_bc_pci_fixups_early[MAX_BOOTTIME_CONFIG_PCI_FIXUPS_EARLY];
+struct pci_fixup *__end_bc_pci_fixups_early = __start_bc_pci_fixups_early +
+					MAX_BOOTTIME_CONFIG_PCI_FIXUPS_EARLY;
+
+static void (*bootirq_quirk_func[])(struct pci_dev *dev) = {
+	&quirk_disable_intel_boot_interrupt,
+	&quirk_disable_broadcom_boot_interrupt,
+	&quirk_disable_amd_8111_boot_interrupt,
+	&quirk_disable_amd_813x_boot_interrupt,
+	&quirk_disable_amd_sb700s_boot_interrupt,
+};
+
+int __init bootirqquirk_setup(char *str)
+{
+	int ints[4];
+	struct quirk_bootirq_reroute_dev tmp;
+	int i;
+
+	str = get_options(str, ARRAY_SIZE(ints), ints);
+	if (!str)
+		return 0;
+
+	if (nobootirqquirk)
+		return 1;
+
+	/* all parameters are required */
+	if (ints[0] != 3)
+		return 0;
+
+	/* save settings */
+	tmp.vendor = ints[1];
+	tmp.device = ints[2];
+	tmp.quirk_variant = ints[3];
+
+	/*
+	 * quirk variants > MAX_QUIRK_BOOTIRQ_REROUTE_VARIANTS select quirk
+	 * functions
+	 */
+	if (tmp.quirk_variant > MAX_QUIRK_BOOTIRQ_REROUTE_VARIANTS) {
+		for (i = 0; i < MAX_BOOTTIME_CONFIG_PCI_FIXUPS_EARLY; i++) {
+			if (__start_bc_pci_fixups_early[i].vendor == 0)
+				break;
+
+			if (__start_bc_pci_fixups_early[i].vendor == tmp.vendor &&
+			    __start_bc_pci_fixups_early[i].device == tmp.device)
+				return 1;	/* already in array */
+		}
+
+		if (i >= MAX_BOOTTIME_CONFIG_PCI_FIXUPS_EARLY) {
+			printk(KERN_INFO "PCI quirk: too many boottime "
+					"configurable early quirk entries when "
+					"trying to add 0x%04x:0x%04x\n",
+					tmp.vendor, tmp.device);
+			return 0;
+		}
+
+		if (tmp.quirk_variant > ARRAY_SIZE(bootirq_quirk_func) +
+				MAX_QUIRK_BOOTIRQ_REROUTE_VARIANTS) {
+			printk(KERN_INFO "PCI quirk: no such quirk function: "
+					"%d\n", tmp.quirk_variant);
+			return 0;
+		}
+
+		__start_bc_pci_fixups_early[i].vendor = tmp.vendor;
+		__start_bc_pci_fixups_early[i].device = tmp.device;
+		__start_bc_pci_fixups_early[i].hook =
+				bootirq_quirk_func[tmp.quirk_variant -
+				(MAX_QUIRK_BOOTIRQ_REROUTE_VARIANTS + 1)];
+	} else {
+		for (i = 0; i < MAX_QUIRK_BOOTIRQ_REROUTE_DEVS; i++) {
+			if (quirk_bootirq_reroute_devs[i].vendor == 0)
+				break;
+
+			if (quirk_bootirq_reroute_devs[i].vendor == tmp.vendor &&
+			    quirk_bootirq_reroute_devs[i].device == tmp.device)
+				return 1;	/* already in array */
+		}
+
+		if (i >= MAX_QUIRK_BOOTIRQ_REROUTE_DEVS) {
+			printk(KERN_INFO "PCI quirk: too many reroute entries when "
+					"trying to add 0x%04x:0x%04x\n",
+					tmp.vendor, tmp.device);
+			return 0;
+		}
+
+		quirk_bootirq_reroute_devs[i].vendor = tmp.vendor;
+		quirk_bootirq_reroute_devs[i].device = tmp.device;
+		quirk_bootirq_reroute_devs[i].quirk_variant = tmp.quirk_variant;
+
+		reroute_to_boot_interrupts = 1;
+	}
+
+	printk(KERN_INFO "PCI quirk: reroute interrupts for 0x%04x:0x%04x\n",
+			tmp.vendor, tmp.device);
+	return 1;
+}
+
+/* bootirqquirk=0x<vendor>,0x<device>,<quirk_type> */
+__setup("bootirqquirk=", bootirqquirk_setup);
+
 #endif /* CONFIG_X86_IO_APIC */
 
 /*
@@ -1773,6 +1880,17 @@ void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev)
 		return;
 	}
 	pci_do_fixups(dev, start, end);
+
+	switch(pass) {
+	case pci_fixup_early:
+		start = __start_bc_pci_fixups_early;
+		end = __end_bc_pci_fixups_early;
+		break;
+
+	default:
+		return;
+	}
+	pci_do_fixups(dev, start, end);
 }
 EXPORT_SYMBOL(pci_fixup_device);
 
-- 
1.5.2.4

-- 
Olaf Dabrunz (od/odabrunz), SUSE Linux Products GmbH, Nürnberg


  parent reply	other threads:[~2008-06-02 13:53 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-02 12:45 [PATCH 0/7] Boot IRQ quirks and rerouting Olaf Dabrunz
2008-06-02 12:45 ` [PATCH 1/7] add kernel cmdline option to disable pci-irq quirks Olaf Dabrunz
2008-06-03 10:13   ` Thomas Gleixner
2008-06-03 17:00     ` Stefan Assmann
2008-06-02 12:45 ` [PATCH 2/7] reroute PCI interrupt to legacy boot interrupt equivalent Olaf Dabrunz
2008-06-03 10:37   ` Thomas Gleixner
2008-06-03 22:59     ` Randy Dunlap
2008-06-12 14:14     ` Olaf Dabrunz
2008-06-02 12:45 ` [PATCH 3/7] disable legacy boot interrupt generation Olaf Dabrunz
2008-06-03 10:40   ` Thomas Gleixner
2008-06-02 12:45 ` [PATCH 4/7] disable broadcomm " Olaf Dabrunz
2008-06-03 10:46   ` Thomas Gleixner
2008-06-03 15:46   ` Jon Masters
2008-06-03 15:59     ` Olaf Dabrunz
2008-06-03 16:05       ` Jon Masters
2008-06-03 17:27         ` Olaf Dabrunz
2008-06-02 12:45 ` [PATCH 5/7] disable AMD/ATI " Olaf Dabrunz
2008-06-03 10:54   ` Thomas Gleixner
2008-06-12 14:14     ` Olaf Dabrunz
2008-06-02 12:45 ` [PATCH 6/7] disable pci legacy boot irq quirks on noapic boot Olaf Dabrunz
2008-06-03 10:55   ` Thomas Gleixner
2008-06-02 12:45 ` Olaf Dabrunz [this message]
2008-06-03 10:56   ` [PATCH 7/7] bootirqquirk= parameter to enable bootirq quirks for additional chips Thomas Gleixner
2008-06-04 10:06     ` Olaf Dabrunz
2008-06-02 16:43 ` [PATCH 0/7] Boot IRQ quirks and rerouting Olaf Dabrunz
2008-06-03 10:11 ` Thomas Gleixner
2008-06-03 17:08   ` Olaf Dabrunz
2008-06-03 10:21 ` Olaf Dabrunz
2008-06-03 15:52 ` Jon Masters
2008-06-03 16:17   ` Stefan Assmann
2008-06-03 16:56   ` Olaf Dabrunz
2008-06-04  2:35 ` Eric W. Biederman
2008-06-04  9:49   ` Stefan Assmann
2008-06-04 10:45     ` Eric W. Biederman
2008-06-04 11:33       ` Stefan Assmann
2008-06-04 15:52         ` Maciej W. Rozycki
2008-06-04 16:08           ` Thomas Gleixner
2008-06-04 17:18             ` Maciej W. Rozycki
2008-06-04 17:33               ` Thomas Gleixner
2008-06-04 17:53                 ` Maciej W. Rozycki
2008-06-04 18:35                   ` Thomas Gleixner
2008-06-04 18:51                     ` Maciej W. Rozycki
2010-02-16  0:30           ` Yuhong Bao
2008-06-04 18:57         ` Jon Masters
2008-06-04 19:19           ` Maciej W. Rozycki
2008-06-04 19:59             ` Jon Masters
2008-06-04 22:07               ` Maciej W. Rozycki
2008-06-04 22:27                 ` Jon Masters
2008-06-04 23:08                   ` Maciej W. Rozycki
2008-06-04 11:37       ` Olaf Dabrunz
2008-06-04 18:44     ` Jon Masters

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=1212410707427-git-send-email-od@suse.de \
    --to=od@suse.de \
    --cc=hpa@zytor.com \
    --cc=jonathan@jonmasters.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sassmann@suse.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox