public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Drake <dsd@gentoo.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Jeff Garzik <jeff@garzik.org>,
	greg@kroah.com, cw@f00f.org, harmon@ksu.edu,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Add SATA device to VIA IRQ quirk fixup list
Date: Sun, 16 Jul 2006 15:09:36 +0100	[thread overview]
Message-ID: <44BA48A0.2060008@gentoo.org> (raw)
In-Reply-To: <20060714074305.1248b98e.akpm@osdl.org>

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

Andrew,

Andrew Morton wrote:
> Guys, this is a really serious failure but afaict nobody is working on it
> and generally nothing at all is happening.
> 
> How do we fix all this?  (Who owns it?)

I'd like to push the attached patch for inclusion. I have tested it on 
my VIA Apollo system, and I hope it is an acceptable compromise while 
nobody has a complete understanding of the issues around this quirk.

I think this belongs to Greg as its a PCI thing, but we should probably 
look for a yay or nay from Jeff as well.

Daniel

[-- Attachment #2: via-irq-fixup-sata.patch --]
[-- Type: text/x-patch, Size: 3308 bytes --]

[PATCH] PCI quirk_via_irq behaviour change

The most recent VIA IRQ quirk changes have broken various VIA devices for
some users. We are not able to add these devices to the blacklist as they
are also available in PCI-card form, and running the quirk on these devices
brings us back to square one (running the VIA quirk on non-VIA boards where
the quirk is not needed).

This patch, based on suggestions from Sergey Vlasov, implements a scheme
similar to but more restrictive than the scheme we had in 2.6.16 and earlier.
It runs the quirk on all VIA hardware, but only if a VIA southbridge was
detected on the system.

There is still a downside to this patch: if the user inserts a VIA PCI card
into a VIA-based motherboard, the quirk will also run on the VIA PCI card.
This corner case is hard to avoid.

However, I think this patch should be applied because:
 - The quirk won't run on Chris's non-VIA system, which was the cause of
   change in the first place.
 - Affected sata_via users will be able to boot again
 - Nobody really has a full understanding of the problem and the issues,
   so I think this "compromise solution" should be acceptable for now.

Signed-off-by: Daniel Drake <dsd@gentoo.org>

Index: linux/drivers/pci/quirks.c
===================================================================
--- linux.orig/drivers/pci/quirks.c
+++ linux/drivers/pci/quirks.c
@@ -648,10 +648,37 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_V
  * Some of the on-chip devices are actually '586 devices' so they are
  * listed here.
  */
+
+static int via_irq_fixup_needed = -1;
+
+/*
+ * As some VIA hardware is available in PCI-card form, we need to restrict
+ * this quirk to VIA PCI hardware built onto VIA-based motherboards only.
+ * We try to locate a VIA southbridge before deciding whether the quirk
+ * should be applied.
+ */
+static const struct pci_device_id via_irq_fixup_tbl[] = {
+	{
+		.vendor 	= PCI_VENDOR_ID_VIA,
+		.device		= PCI_ANY_ID,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.class		= PCI_CLASS_BRIDGE_ISA << 8,
+		.class_mask	= 0xffff00,
+	},
+	{ 0, },
+};
+
 static void quirk_via_irq(struct pci_dev *dev)
 {
 	u8 irq, new_irq;
 
+	if (via_irq_fixup_needed == -1)
+		via_irq_fixup_needed = pci_dev_present(via_irq_fixup_tbl);
+
+	if (!via_irq_fixup_needed)
+		return;
+
 	new_irq = dev->irq & 0xf;
 	pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &irq);
 	if (new_irq != irq) {
@@ -661,13 +688,7 @@ static void quirk_via_irq(struct pci_dev
 		pci_write_config_byte(dev, PCI_INTERRUPT_LINE, new_irq);
 	}
 }
-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_0, quirk_via_irq);
-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, quirk_via_irq);
-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_2, quirk_via_irq);
-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_via_irq);
-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686, quirk_via_irq);
-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_via_irq);
-DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_5, quirk_via_irq);
+DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_via_irq);
 
 /*
  * VIA VT82C598 has its device ID settable and many BIOSes

  parent reply	other threads:[~2006-07-16 14:03 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-14  9:52 [PATCH] Add SATA device to VIA IRQ quirk fixup list Daniel Drake
2006-07-14 11:08 ` Jeff Garzik
2006-07-14 11:40   ` Daniel Drake
2006-07-14 11:51     ` Jeff Garzik
2006-07-14 12:15       ` Daniel Drake
2006-07-14 12:51         ` Sergey Vlasov
2006-07-14 13:20           ` Daniel Drake
2006-07-14 14:43       ` Andrew Morton
2006-07-14 15:42         ` Chris Wedgwood
2006-07-14 16:01           ` Scott J. Harmon
2006-07-14 16:17           ` Daniel Drake
2006-07-14 16:16             ` Chris Wedgwood
2006-07-14 16:24             ` Daniel Drake
2006-07-14 16:33               ` Chris Wedgwood
2006-07-14 16:51                 ` Daniel Drake
2006-07-14 16:48               ` Sergio Monteiro Basto
2006-07-14 17:06                 ` Daniel Drake
2006-07-14 17:21                   ` Sergey Vlasov
2006-07-14 15:46         ` Sergio Monteiro Basto
2006-07-14 16:13           ` Chris Wedgwood
2006-07-15  0:10             ` Sergio Monteiro Basto
2006-07-16 14:09         ` Daniel Drake [this message]
2006-07-16 18:31           ` Greg KH
2006-07-17  0:34             ` Chris Wedgwood
2006-07-25  4:40               ` Andrew Morton
2006-07-26  0:42                 ` Alan Cox
2006-07-26 12:45                   ` Sergio Monteiro Basto
2006-07-26 13:59                     ` Daniel Drake
2006-07-26 14:06                       ` Sergio Monteiro Basto
2006-07-26 14:31                         ` Daniel Drake
2006-07-26 15:11                           ` Sergio Monteiro Basto
2006-07-26 22:14                           ` Sergio Monteiro Basto
2006-07-14 23:58   ` Chris Wedgwood
  -- strict thread matches above, loose matches on Subject: below --
2006-07-14 19:26 Brown, Len

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=44BA48A0.2060008@gentoo.org \
    --to=dsd@gentoo.org \
    --cc=akpm@osdl.org \
    --cc=cw@f00f.org \
    --cc=greg@kroah.com \
    --cc=harmon@ksu.edu \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox