linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH] ALSA: hda-intel - Disable MSI support by default
@ 2006-11-16  0:17 Lu, Yinghai
  0 siblings, 0 replies; 101+ messages in thread
From: Lu, Yinghai @ 2006-11-16  0:17 UTC (permalink / raw)
  To: Olivier Nicolas, Linus Torvalds
  Cc: Mws, Jeff Garzik, Krzysztof Halasa, David Miller, linux-kernel,
	tiwai

I just tried latest git and one MCP55+IO55 and had_intel, ALC883 codec
MB.

It works well with routeirq or not.

The BIOS disable the MSI cap.

YH



^ permalink raw reply	[flat|nested] 101+ messages in thread
* RE: [PATCH] ALSA: hda-intel - Disable MSI support by default
@ 2006-11-16  3:50 Lu, Yinghai
  2006-11-16 23:36 ` Olivier Nicolas
  0 siblings, 1 reply; 101+ messages in thread
From: Lu, Yinghai @ 2006-11-16  3:50 UTC (permalink / raw)
  To: Lu, Yinghai, Olivier Nicolas, Linus Torvalds
  Cc: Mws, Jeff Garzik, Krzysztof Halasa, David Miller, linux-kernel,
	tiwai

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

Add pci_intx to diable intx could make MSI work with pci.

Olivier, Please test it attached patch with latest git ... I hardcode to
make enable_msi=1.

YH


[-- Attachment #2: hda_intel_pci_intx.diff --]
[-- Type: application/octet-stream, Size: 1452 bytes --]

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index e35cfd3..e8c4bf5 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -547,6 +547,7 @@ static unsigned int azx_rirb_get_respons
 		chip->msi = 0;
 		if (azx_acquire_irq(chip, 1) < 0)
 			return -1;
+		pci_intx(chip->pci, 1);
 		goto again;
 	}
 
@@ -1435,11 +1436,17 @@ static int azx_resume(struct pci_dev *pc
 		return -EIO;
 	}
 	pci_set_master(pci);
-	if (chip->msi)
-		if (pci_enable_msi(pci) < 0)
+	if (chip->msi) {
+		pci_intx(pci, 0);
+		if (pci_enable_msi(pci) < 0) {
 			chip->msi = 0;
+		}
+	}
 	if (azx_acquire_irq(chip, 1) < 0)
 		return -EIO;
+
+	if (!chip->msi) 
+		pci_intx(pci, 1);
 	azx_init_chip(chip);
 	snd_hda_resume(chip->bus);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
@@ -1531,7 +1538,8 @@ static int __devinit azx_create(struct s
 	chip->pci = pci;
 	chip->irq = -1;
 	chip->driver_type = driver_type;
-	chip->msi = enable_msi;
+//	chip->msi = enable_msi;
+	chip->msi = 1;
 
 	chip->position_fix = position_fix;
 	chip->single_cmd = single_cmd;
@@ -1561,14 +1569,20 @@ #endif
 		goto errout;
 	}
 
-	if (chip->msi)
-		if (pci_enable_msi(pci) < 0)
+	if (chip->msi) {
+		pci_intx(pci, 0);
+		if (pci_enable_msi(pci) < 0) {
 			chip->msi = 0;
+		}
+	}
 
 	if (azx_acquire_irq(chip, 0) < 0) {
 		err = -EBUSY;
 		goto errout;
 	}
+	
+	if(!chip->msi)
+		pci_intx(pci, 1);
 
 	pci_set_master(pci);
 	synchronize_irq(chip->irq);

^ permalink raw reply related	[flat|nested] 101+ messages in thread
* Re: [PATCH] ALSA: hda-intel - Disable MSI support by default
@ 2006-11-16  4:24 linux
  2006-11-16 10:53 ` Alan
  2006-11-16 16:05 ` Linus Torvalds
  0 siblings, 2 replies; 101+ messages in thread
From: linux @ 2006-11-16  4:24 UTC (permalink / raw)
  To: linux-kernel, torvalds; +Cc: linux

> It all boils down to the same thing: either we have to know that MSI works 
> (where "know" is obviously relative - it's not like you can avoid _all_ 
> bugs, but dammit, even a single report of "not working" means that there 
> are probably a ton of machines like that, and we did something wrong), or 
> we shouldn't use it. There is no middle ground. You can't really safely 
> "test" for it, and while you _can_ say "just do both", it doesn't really 
> help anything (and potentially exposes you to just more bugs: if enablign 
> MSI actually _does_ disable INTx, but then doesn't work, at a minimum you 
> end up with a device that doesn't work, even if the rest of the kernel 
> might be ok).

Er... why can't you test it?

The fundamental problem in IRQ routing is that if you have it wrong,
you have a screaming interrupt that you can't shut up.

Well, before giving up entirely, assume that *some* device owns that
interrupt, it's just mis-routed.

So start calling the IRQ handlers for *every* PCI device until the
damn interrupt goes away, or you've really proved that it can't
be shut up.

If you have interrupts coming in fast, you might have to retry a few
times to be sure there's nothing to be done, but that's nothing new.

Now, if you get really nasty with the locking, you can disable all
other interrupt handlers on all processors until you've dealt with
the screaming interrupt, and when it goes away, you can point the
finger conclusively at the device which has the misrouted interrupt.
And you've also found where its interrupt *is* routed.

If you don't have such nasty locking, then you only have a strong
suspiscion about what did it, but a few repetitions can firm that up.
Any time a device handles an interrupt that arrived from the expected
place, its index of suspiscion goes down.  You can even use this
to select an order to call the various PCI drivers.

All of this can be rather time-consuming and mess up real-time response,
but it's only once per boot, and being able to point the finger accurately
at buggy hardware rather than not working at all for mysterious reasons is
quite nice.  And an increasing number of BIOS vendors and OEMs are testing
with Linux, even if only cursorily, so there is some (slow) feedback.

Whether you actually learn to cope with misrouted interrupts is
a separate issue that I won't raise.

^ permalink raw reply	[flat|nested] 101+ messages in thread
* RE: [PATCH] ALSA: hda-intel - Disable MSI support by default
@ 2006-11-16  4:25 Lu, Yinghai
  2006-11-16 18:00 ` D. Hazelton
  0 siblings, 1 reply; 101+ messages in thread
From: Lu, Yinghai @ 2006-11-16  4:25 UTC (permalink / raw)
  To: Lu, Yinghai, Olivier Nicolas, Linus Torvalds
  Cc: Mws, Jeff Garzik, Krzysztof Halasa, David Miller, linux-kernel,
	tiwai

I think the root cause in hda_intel driver's self.

It gets io-apic irq initialized at first, and it will use
azx_acquire_irq to install handler after check if MSI can be enabled.
And when it try to enable the MSI, that will start the int in the chip.
Even handler for MSI is not installed.

YH





^ permalink raw reply	[flat|nested] 101+ messages in thread
* RE: [PATCH] ALSA: hda-intel - Disable MSI support by default
@ 2006-11-16 23:54 Lu, Yinghai
  2006-11-17  0:49 ` Olivier Nicolas
  0 siblings, 1 reply; 101+ messages in thread
From: Lu, Yinghai @ 2006-11-16 23:54 UTC (permalink / raw)
  To: Olivier Nicolas
  Cc: Linus Torvalds, Mws, Jeff Garzik, Krzysztof Halasa, David Miller,
	linux-kernel, tiwai

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

-----Original Message-----
From: Olivier Nicolas [mailto:olivn@trollprod.org] 


>IRQ 22 is disabled but snd_hda_intel seems to get a MSI interrupt! (It 
>cannot be reproduced)

>313:          0          1   PCI-MSI-edge      HDA Intel

Please try attached one, also build hda_intel into kernel directly if it
is not.

YH


[-- Attachment #2: hda_intel_pci_intx_11162006.diff --]
[-- Type: application/octet-stream, Size: 2585 bytes --]

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index e35cfd3..98d25d8 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -55,7 +55,7 @@ static char *model;
 static int position_fix;
 static int probe_mask = -1;
 static int single_cmd;
-static int enable_msi;
+static int disable_msi;
 
 module_param(index, int, 0444);
 MODULE_PARM_DESC(index, "Index value for Intel HD audio interface.");
@@ -69,8 +69,8 @@ module_param(probe_mask, int, 0444);
 MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1).");
 module_param(single_cmd, bool, 0444);
 MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs (for debugging only).");
-module_param(enable_msi, int, 0);
-MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)");
+module_param(disable_msi, int, 0);
+MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)");
 
 
 /* just for backward compatibility */
@@ -547,6 +547,7 @@ static unsigned int azx_rirb_get_respons
 		chip->msi = 0;
 		if (azx_acquire_irq(chip, 1) < 0)
 			return -1;
+		pci_intx(chip->pci, 1);
 		goto again;
 	}
 
@@ -1380,7 +1381,8 @@ static int __devinit azx_init_stream(str
 
 static int azx_acquire_irq(struct azx *chip, int do_disconnect)
 {
-	if (request_irq(chip->pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED,
+	if (request_irq(chip->pci->irq, azx_interrupt,
+			chip->msi ? 0 : IRQF_SHARED,
 			"HDA Intel", chip)) {
 		printk(KERN_ERR "hda-intel: unable to grab IRQ %d, "
 		       "disabling device\n", chip->pci->irq);
@@ -1435,11 +1437,16 @@ static int azx_resume(struct pci_dev *pc
 		return -EIO;
 	}
 	pci_set_master(pci);
-	if (chip->msi)
+	if (chip->msi) {
+		pci_intx(pci, 0);
 		if (pci_enable_msi(pci) < 0)
 			chip->msi = 0;
+	}
 	if (azx_acquire_irq(chip, 1) < 0)
 		return -EIO;
+
+	if (!chip->msi) 
+		pci_intx(pci, 1);
 	azx_init_chip(chip);
 	snd_hda_resume(chip->bus);
 	snd_power_change_state(card, SNDRV_CTL_POWER_D0);
@@ -1531,7 +1538,7 @@ static int __devinit azx_create(struct s
 	chip->pci = pci;
 	chip->irq = -1;
 	chip->driver_type = driver_type;
-	chip->msi = enable_msi;
+	chip->msi = !disable_msi;
 
 	chip->position_fix = position_fix;
 	chip->single_cmd = single_cmd;
@@ -1561,14 +1568,19 @@ #endif
 		goto errout;
 	}
 
-	if (chip->msi)
+	if (chip->msi) {
+		pci_intx(pci, 0);
 		if (pci_enable_msi(pci) < 0)
 			chip->msi = 0;
+	}
 
 	if (azx_acquire_irq(chip, 0) < 0) {
 		err = -EBUSY;
 		goto errout;
 	}
+	
+	if(!chip->msi)
+		pci_intx(pci, 1);
 
 	pci_set_master(pci);
 	synchronize_irq(chip->irq);

^ permalink raw reply related	[flat|nested] 101+ messages in thread
* RE: [PATCH] ALSA: hda-intel - Disable MSI support by default
@ 2006-11-17 17:42 Lu, Yinghai
  0 siblings, 0 replies; 101+ messages in thread
From: Lu, Yinghai @ 2006-11-17 17:42 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Takashi Iwai, Olivier Nicolas, Jeff Garzik, David Miller,
	linux-kernel

-----Original Message-----
From: Linus Torvalds [mailto:torvalds@osdl.org] 

>Eventually, MSI will hopefully be the more robust of the two methods. 
>Maybe it will take a year. And maybe we'll end up not using MSI on a
lot 
>of the _current_ crop of motherboards. We don't want to carry the "fall

>back from MSI to INTx" code around. We just want a flag saying "use
MSI" 
>or "use INTx".

Good, that will be simple and clear.

YH



^ permalink raw reply	[flat|nested] 101+ messages in thread

end of thread, other threads:[~2006-11-17 17:52 UTC | newest]

Thread overview: 101+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200611150059.kAF0xBTl009796@hera.kernel.org>
2006-11-15  1:34 ` [PATCH] ALSA: hda-intel - Disable MSI support by default Jeff Garzik
2006-11-15  1:55   ` Linus Torvalds
2006-11-15  2:40     ` Jeff Garzik
2006-11-15  2:49       ` Linus Torvalds
2006-11-15  3:00         ` David Miller
2006-11-15  3:10           ` Linus Torvalds
2006-11-15  3:21             ` David Miller
2006-11-15  3:54               ` Linus Torvalds
2006-11-15  4:11                 ` Jeff Garzik
2006-11-15  4:15                   ` David Miller
2006-11-15  4:24                     ` Jeff Garzik
2006-11-15  4:28                       ` David Miller
2006-11-16  2:25                         ` Benjamin Herrenschmidt
2006-11-16  2:28                           ` Benjamin Herrenschmidt
2006-11-16  3:25                           ` Jeff Garzik
2006-11-16  4:12                             ` Benjamin Herrenschmidt
2006-11-16  6:13                               ` Jeff Garzik
2006-11-16 14:41                                 ` Krzysztof Halasa
2006-11-16 15:27                                   ` Jeff Garzik
2006-11-16 17:24                                     ` Roland Dreier
2006-11-15 19:09                       ` Stephen Hemminger
2006-11-15 19:23                         ` Jeff Garzik
2006-11-15 19:49                           ` Stephen Hemminger
2006-11-15 22:31                             ` Roland Dreier
2006-11-16  2:24                     ` Benjamin Herrenschmidt
2006-11-15  4:30                   ` Roland Dreier
2006-11-15  4:56                     ` Jeff Garzik
2006-11-15 15:53                     ` Linus Torvalds
2006-11-15 18:30                       ` Jeff Garzik
2006-11-15 18:45                       ` Roland Dreier
2006-11-16  2:29                     ` Benjamin Herrenschmidt
2006-11-15 13:34                   ` Krzysztof Halasa
2006-11-15 18:42                     ` Jeff Garzik
2006-11-15 19:04                       ` Linus Torvalds
2006-11-15 19:20                         ` Jeff Garzik
2006-11-15 19:35                           ` Linus Torvalds
2006-11-15 19:59                             ` Mws
2006-11-15 20:14                               ` Linus Torvalds
2006-11-15 20:53                                 ` Olivier Nicolas
2006-11-16  6:08                                   ` Yinghai Lu
2006-11-16 23:25                                     ` Olivier Nicolas
2006-11-15 21:10                                 ` Mws
2006-11-16 11:10                                   ` Mws
2006-11-15  4:14                 ` Roland Dreier
2006-11-15  4:49                 ` Andi Kleen
2006-11-15  4:57                   ` Roland Dreier
2006-11-15  5:11                     ` Andi Kleen
2006-11-15 22:43                       ` Roland Dreier
2006-11-15 18:35                   ` [PATCH] ACPI: use MSI_NOT_SUPPORTED bit Randy Dunlap
2006-11-15 18:44                     ` Andi Kleen
2006-11-15 19:41                       ` [PATCH v2] " Randy Dunlap
2006-11-15 19:58                         ` [PATCH v3] " Randy Dunlap
2006-11-15 20:19                     ` [PATCH] " Len Brown
2006-11-16  2:22                 ` [PATCH] ALSA: hda-intel - Disable MSI support by default Benjamin Herrenschmidt
2006-11-15 10:31               ` Takashi Iwai
2006-11-15 16:19                 ` Linus Torvalds
2006-11-15 16:24                   ` Arjan van de Ven
2006-11-15 16:36                     ` Linus Torvalds
2006-11-15 18:40                       ` Jeff Garzik
2006-11-15 18:51                         ` Linus Torvalds
2006-11-15 19:01                           ` Arjan van de Ven
2006-11-15 19:34                       ` Stephen Clark
2006-11-15 19:48                         ` Jeff Garzik
2006-11-15 20:01                           ` Stephen Clark
2006-11-15 18:32                 ` Jeff Garzik
2006-11-15 18:32                   ` Jeff Garzik
2006-11-15 18:58                   ` Takashi Iwai
2006-11-15 19:15                     ` Jeff Garzik
2006-11-16 10:44                       ` Takashi Iwai
2006-11-16 23:01                         ` Olivier Nicolas
2006-11-17 10:55                           ` Takashi Iwai
2006-11-17 16:17                             ` Yinghai Lu
2006-11-17 16:35                               ` Linus Torvalds
2006-11-15 19:20                 ` Stephen Hemminger
2006-11-15 22:35                   ` Roland Dreier
2006-11-15  4:01           ` Benjamin Herrenschmidt
2006-11-15  4:07             ` David Miller
2006-11-15  7:23               ` Benjamin Herrenschmidt
2006-11-15 10:06                 ` Segher Boessenkool
2006-11-15  4:23             ` Roland Dreier
2006-11-15  7:24               ` Benjamin Herrenschmidt
2006-11-15  4:04         ` Benjamin Herrenschmidt
2006-11-15  4:14           ` Jeff Garzik
2006-11-15  4:24           ` Roland Dreier
2006-11-15  2:58       ` Randy Dunlap
2006-11-15  3:10       ` D. Hazelton
2006-11-15  3:30         ` Jeff Garzik
2006-11-15  3:53           ` D. Hazelton
2006-11-15 11:40             ` Alan
2006-11-16  4:06               ` D. Hazelton
2006-11-16  0:17 Lu, Yinghai
  -- strict thread matches above, loose matches on Subject: below --
2006-11-16  3:50 Lu, Yinghai
2006-11-16 23:36 ` Olivier Nicolas
2006-11-16  4:24 linux
2006-11-16 10:53 ` Alan
2006-11-16 16:05 ` Linus Torvalds
2006-11-16  4:25 Lu, Yinghai
2006-11-16 18:00 ` D. Hazelton
2006-11-16 23:54 Lu, Yinghai
2006-11-17  0:49 ` Olivier Nicolas
2006-11-17 17:42 Lu, Yinghai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).