mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jeff Garzik <jeff@garzik.org>
Cc: David Miller <davem@davemloft.net>,
	torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda-intel - Disable MSI support by default
Date: Wed, 15 Nov 2006 19:58:13 +0100	[thread overview]
Message-ID: <s5hslgktu4a.wl%tiwai@suse.de> (raw)
In-Reply-To: <455B5D22.10408@garzik.org>

At Wed, 15 Nov 2006 13:32:02 -0500,
Jeff Garzik wrote:
> 
> Takashi Iwai wrote:
> > The snd-hda-intel driver has a test of MSI, but it seems not working
> > on every machine.  It caused non-cared interrupts and the kernel
> > disabled that irq.
> 
> Possibly the test was broken.  Did you have IRQF_DISABLED and 
> IRQF_SHARED flags set?

I think IRQF_* is irrelevant there.
It looks like that the hardware issues INTX regardless whether MSI is
enabled or not.  Thus it ends up with unexpected irqs which are never
caught by the driver (the driver expects a different irq from MSI),
and eventually the kernel kills this irq.

Possibly calling pci_intx() as you suggested might help to avoid this
situation.  Can anyone test the patch below?


Takashi

---
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index e35cfd3..bdb92b3 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -544,6 +544,7 @@ static unsigned int azx_rirb_get_respons
 		free_irq(chip->irq, chip);
 		chip->irq = -1;
 		pci_disable_msi(chip->pci);
+		pci_intx(chip->pci, 1);
 		chip->msi = 0;
 		if (azx_acquire_irq(chip, 1) < 0)
 			return -1;
@@ -830,14 +831,15 @@ static irqreturn_t azx_interrupt(int irq
 {
 	struct azx *chip = dev_id;
 	struct azx_dev *azx_dev;
+	unsigned long flags;
 	u32 status;
 	int i;
 
-	spin_lock(&chip->reg_lock);
+	spin_lock_irqsave(&chip->reg_lock, flags);
 
 	status = azx_readl(chip, INTSTS);
 	if (status == 0) {
-		spin_unlock(&chip->reg_lock);
+		spin_unlock_irqrestore(&chip->reg_lock, flags);
 		return IRQ_NONE;
 	}
 	
@@ -867,7 +869,7 @@ static irqreturn_t azx_interrupt(int irq
 	if (azx_readb(chip, STATESTS) & 0x04)
 		azx_writeb(chip, STATESTS, 0x04);
 #endif
-	spin_unlock(&chip->reg_lock);
+	spin_unlock_irqrestore(&chip->reg_lock, flags);
 	
 	return IRQ_HANDLED;
 }
@@ -1380,7 +1382,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,9 +1438,12 @@ static int azx_resume(struct pci_dev *pc
 		return -EIO;
 	}
 	pci_set_master(pci);
-	if (chip->msi)
+	if (chip->msi) {
 		if (pci_enable_msi(pci) < 0)
 			chip->msi = 0;
+		else
+			pci_intx(pci, 0);
+	}
 	if (azx_acquire_irq(chip, 1) < 0)
 		return -EIO;
 	azx_init_chip(chip);
@@ -1561,9 +1567,12 @@ static int __devinit azx_create(struct s
 		goto errout;
 	}
 
-	if (chip->msi)
+	if (chip->msi) {
 		if (pci_enable_msi(pci) < 0)
 			chip->msi = 0;
+		else
+			pci_intx(pci, 0);
+	}
 
 	if (azx_acquire_irq(chip, 0) < 0) {
 		err = -EBUSY;

  parent reply	other threads:[~2006-11-15 18:58 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200611150059.kAF0xBTl009796@hera.kernel.org>
2006-11-15  1:34 ` 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 [this message]
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
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

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=s5hslgktu4a.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=davem@davemloft.net \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®