Skip to contentSkip to conversation

Intel AHCI ICH9R not detecting devices

PATCH Applied xerces8 3 participants 13 messages Aug 22, 2008 – Sep 27, 2008 libata

lore
Share & tools
lore

xerces8

author
#0 lore raw

(this time with proper subject)

Hi!

I noticed that recent kernels do not detect my SATA devices (two SATA hard drives and one DVD unit).

HW: Asus P5K-E WiFi mainboard, BIOS version 1013 (latest as of now) BIOS setup: SATA adapter mode : AHCI
CPU: Intel Core2 Q6600 (not overclocked)
RAM: 4x2GB DDR2-800

Kernel: 2.6.26.3 (vanilla unpatched)
arch: i386

kernel config : http://pastebin.com/f7640ead2
dmesg output : http://pastebin.com/f3b3fac14
lspci: http://pastebin.com/f2a3edebf
lspci -v -n : http://pastebin.com/f724cf3
/proc/cpuinfo: http://pastebin.com/f11930c44

uname -a :
Linux RIPLinuX 2.6.26.3 #1 Fri Aug 22 16:24:23 CEST 2008 i686 GNU/Linux

/proc/version:
Linux version 2.6.26.3 (stein@udba) (gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) #1 Fri Aug 22 16:24:23 CEST 2008

Funny thing, in 64 bit mode it all works fine (tested and first discovered with RIPLinux 6.3; the above config should match the 32 bit config from riplinux)

Please advise.

Regards,
David Balažic

#1 lore raw

Hello,

Quoted 8 lines · xerces8 wrote:

I noticed that recent kernels do not detect my SATA devices (two SATA hard drives and one DVD unit).

HW: Asus P5K-E WiFi mainboard, BIOS version 1013 (latest as of now) BIOS setup: SATA adapter mode : AHCI
CPU: Intel Core2 Q6600 (not overclocked)
RAM: 4x2GB DDR2-800

Quoted 8 lines

Kernel: 2.6.26.3 (vanilla unpatched)
arch: i386

kernel config : http://pastebin.com/f7640ead2
dmesg output : http://pastebin.com/f3b3fac14
lspci: http://pastebin.com/f2a3edebf
lspci -v -n : http://pastebin.com/f724cf3
/proc/cpuinfo: http://pastebin.com/f11930c44

It's usually best to include relevant excerpts inline and then attach the whole stuff as attachments. Posting links to some URL or non-OSDL bugzilla entries is likely to significantly increase your chance of just being skipped over. You know, we're cranky nerds who hate the web and stick to 80-column terminals. ;-)

ahci 0000:00:1f.2: AHCI 0001.0200 32 slots 6 ports 3 Gbps 0x3f impl SATA mode ahci 0000:00:1f.2: flags: 64bit ncq sntf stag pm led clo pmp pio slum part
PCI: Setting latency timer of device 0000:00:1f.2 to 64
ACPI: PCI interrupt for device 0000:00:1f.2 disabled
ahci: probe of 0000:00:1f.2 failed with error -16

This looks like resource conflict to me, which could have resulted from ahci trying to grab all resources. Can you please post the result of "cat /proc/ioports" and "cat /proc/iomem"?

Quoted 3 lines

Funny thing, in 64 bit mode it all works fine (tested and first discovered with RIPLinux 6.3; the above config should match the 32 bit config from riplinux)

Yeah, different arch codes can do strange things to PCI IRQ routing or resource allocations.

Signature · 1 line
tejun
author
#2 lore raw
Quoted 30 lines · Tejun Heo
Quoted 8 lines · xerces8 wrote:

I noticed that recent kernels do not detect my SATA devices (two SATA hard drives and one DVD unit).

HW: Asus P5K-E WiFi mainboard, BIOS version 1013 (latest as of now) BIOS setup: SATA adapter mode : AHCI
CPU: Intel Core2 Q6600 (not overclocked)
RAM: 4x2GB DDR2-800

Quoted 8 lines

Kernel: 2.6.26.3 (vanilla unpatched)
arch: i386

kernel config : http://pastebin.com/f7640ead2
dmesg output : http://pastebin.com/f3b3fac14
lspci: http://pastebin.com/f2a3edebf
lspci -v -n : http://pastebin.com/f724cf3
/proc/cpuinfo: http://pastebin.com/f11930c44

It's usually best to include relevant excerpts inline and then attach the whole stuff as attachments. Posting links to some URL or non-OSDL bugzilla entries is likely to significantly increase your chance of just being skipped over. You know, we're cranky nerds who hate the web and stick to 80-column terminals. ;-)

ahci 0000:00:1f.2: AHCI 0001.0200 32 slots 6 ports 3 Gbps 0x3f impl SATA mode ahci 0000:00:1f.2: flags: 64bit ncq sntf stag pm led clo pmp pio slum part
PCI: Setting latency timer of device 0000:00:1f.2 to 64
ACPI: PCI interrupt for device 0000:00:1f.2 disabled
ahci: probe of 0000:00:1f.2 failed with error -16

Quoted 3 lines

This looks like resource conflict to me, which could have resulted from ahci trying to grab all resources. Can you please post the result of "cat /proc/ioports" and "cat /proc/iomem"?

I noticed that in IDE mode the same happens (32bit kernel has problems, 64bit kernel has not), so here is dmesg, iomem and ioports for all 4 combinations.

Regards,
David

#3 lore raw
Quoted 7 lines · xerces8 wrote:
Quoted 3 lines

This looks like resource conflict to me, which could have resulted from ahci trying to grab all resources. Can you please post the result of "cat /proc/ioports" and "cat /proc/iomem"?

I noticed that in IDE mode the same happens (32bit kernel has problems, 64bit kernel has not), so here is dmesg, iomem and ioports for all 4 combinations.

Can you please try the attached debug patch and report boot log. All resources look fine.

Thanks.

Signature · 1 line
tejun
---
 drivers/ata/ahci.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/ata/ahci.c +16 -5
Index: tree0/drivers/ata/ahci.c
===================================================================
@@ -2240,8 +2240,10 @@ static int ahci_init_one(struct pci_dev
 
 	/* acquire resources */
 	rc = pcim_enable_device(pdev);
-	if (rc)
+	if (rc) {
+		dev_printk(KERN_WARNING, &pdev->dev, "pcim_enable_device failed %d\n", rc);
 		return rc;
+	}
 
 	/* AHCI controllers often implement SFF compatible interface.
 	 * Grab all PCI BARs just in case.
@@ -2249,8 +2251,10 @@ static int ahci_init_one(struct pci_dev
 	rc = pcim_iomap_regions_request_all(pdev, 1 << AHCI_PCI_BAR, DRV_NAME);
 	if (rc == -EBUSY)
 		pcim_pin_device(pdev);
-	if (rc)
+	if (rc) {
+		dev_printk(KERN_WARNING, &pdev->dev, "pcim_iomap_regions_request_all() failed %d\n", rc);
 		return rc;
+	}
 
 	if (pdev->vendor == PCI_VENDOR_ID_INTEL &&
 	    (pdev->device == 0x2652 || pdev->device == 0x2653)) {
@@ -2324,19 +2328,26 @@ static int ahci_init_one(struct pci_dev
 
 	/* initialize adapter */
 	rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64);
-	if (rc)
+	if (rc) {
+		dev_printk(KERN_WARNING, &pdev->dev, "ahci_configure_dma_masks() failed %d\n", rc);
 		return rc;
+	}
 
 	rc = ahci_reset_controller(host);
-	if (rc)
+	if (rc) {
+		dev_printk(KERN_WARNING, &pdev->dev, "ahci_reset_controller() failed %d\n", rc);
 		return rc;
+	}
 
 	ahci_init_controller(host);
 	ahci_print_info(host);
 
 	pci_set_master(pdev);
-	return ata_host_activate(host, pdev->irq, ahci_interrupt, IRQF_SHARED,
+	rc = ata_host_activate(host, pdev->irq, ahci_interrupt, IRQF_SHARED,
 				 &ahci_sht);
+	if (rc)
+		dev_printk(KERN_WARNING, &pdev->dev, "ahci_host_activate() failed %d\n", rc);
+	return rc;
 }
 
 static int __init ahci_init(void)
author
#4 lore raw
Quoted 11 lines · Tejun Heo
Quoted 7 lines · xerces8 wrote:
Quoted 3 lines

This looks like resource conflict to me, which could have resulted from ahci trying to grab all resources. Can you please post the result of "cat /proc/ioports" and "cat /proc/iomem"?

I noticed that in IDE mode the same happens (32bit kernel has problems, 64bit kernel has not), so here is dmesg, iomem and ioports for all 4 combinations.

Can you please try the attached debug patch and report boot log. All resources look fine.

(removing [email protected] from CC, that is my other email address)

Hi!

I am away from home and will try the patch probably on Friday.

Until then thanks for your support!

David

author
#5 lore raw
In reply to Tejun Heo
Quoted 11 lines · Tejun Heo
Quoted 7 lines · xerces8 wrote:
Quoted 3 lines

This looks like resource conflict to me, which could have resulted from ahci trying to grab all resources. Can you please post the result of "cat /proc/ioports" and "cat /proc/iomem"?

I noticed that in IDE mode the same happens (32bit kernel has problems, 64bit kernel has not), so here is dmesg, iomem and ioports for all 4 combinations.

Can you please try the attached debug patch and report boot log. All resources look fine.

Hi!

(I was away during the week)

I run the patch and the result is attached.

Regards,
David

author
#6 lore raw
Quoted 11 lines · xerces8 wrote:
Quoted 9 lines · Tejun Heo
Quoted 7 lines · xerces8 wrote:
Quoted 3 lines

This looks like resource conflict to me, which could have resulted from ahci trying to grab all resources. Can you please post the result of "cat /proc/ioports" and "cat /proc/iomem"?

I noticed that in IDE mode the same happens (32bit kernel has problems, 64bit kernel has not), so here is dmesg, iomem and ioports for all 4 combinations.

Quoted 8 lines
Quoted 2 lines

Can you please try the attached debug patch and report boot log. All resources look fine.

Hi!

(I was away during the week)

I run the patch and the result is attached.

I put more debug in the function that failed and tracked the problem down to setup_irq(). I also enabled CONFIG_DEBUG_SHIRQ. The kernel messages are attached.

Regards,
David

PS: I will leave on Sunday evening, so if you have questions, ask the soon ;-)

#7 lore raw
Quoted 2 lines · xerces8 wrote:

I put more debug in the function that failed and tracked the problem down to setup_irq(). I also enabled CONFIG_DEBUG_SHIRQ. The kernel messages are attached.

Aieee... please disable ide-generic.

Signature · 1 line
tejun
author
#8 lore raw
Quoted 5 lines · Tejun Heo
Quoted 2 lines · xerces8 wrote:

I put more debug in the function that failed and tracked the problem down to setup_irq(). I also enabled CONFIG_DEBUG_SHIRQ. The kernel messages are attached.

Aieee... please disable ide-generic.

(you mean CONFIG_IDE_GENERIC, right ?)

Can you elaborate ?
Is this some bug ?

I can't just a tell distro owner to change a kernel build option because someone told me to :-)
(remember, this is a problem with the kernel of RIPLinux, a small recovery live CD)

Regards,
David

#9 lore raw
Quoted 7 lines · xerces8 wrote:
Quoted 4 lines · Tejun Heo
Quoted 2 lines · xerces8 wrote:

I put more debug in the function that failed and tracked the problem down to setup_irq(). I also enabled CONFIG_DEBUG_SHIRQ. The kernel messages are attached.

Aieee... please disable ide-generic.

Quoted 8 lines

(you mean CONFIG_IDE_GENERIC, right ?)

Can you elaborate ?
Is this some bug ?

I can't just a tell distro owner to change a kernel build option because someone told me to :-) (remember, this is a problem with the kernel of RIPLinux, a small recovery live CD)

Enabling generic by default is a bad bad bad bad bad bad bad idea. It just grabs legacy IO ports and interrupts and doesn't wanna share them. Under some configurations, it used to cause two drivers to be attached to the same device triggering weird problems, which shouldn't happen anymore, but it still can prevent proper drivers from acquiring the resources. In your case, USB host controller was also assigned to the same IRQ and failed to initialize IRQ. It just can't play nice with modern devices and drivers.

Signature · 1 line
tejun
author
#10 lore raw
Quoted 17 lines · Tejun Heo
Quoted 7 lines · xerces8 wrote:
Quoted 4 lines · Tejun Heo
Quoted 2 lines · xerces8 wrote:

I put more debug in the function that failed and tracked the problem down to setup_irq(). I also enabled CONFIG_DEBUG_SHIRQ. The kernel messages are attached.

Aieee... please disable ide-generic.

Quoted 8 lines

(you mean CONFIG_IDE_GENERIC, right ?)

Can you elaborate ?
Is this some bug ?

I can't just a tell distro owner to change a kernel build option because someone told me to :-) (remember, this is a problem with the kernel of RIPLinux, a small recovery live CD)

Quoted 8 lines

Enabling generic by default is a bad bad bad bad bad bad bad idea. It just grabs legacy IO ports and interrupts and doesn't wanna share them. Under some configurations, it used to cause two drivers to be attached to the same device triggering weird problems, which shouldn't happen anymore, but it still can prevent proper drivers from acquiring the resources. In your case, USB host controller was also assigned to the same IRQ and failed to initialize IRQ. It just can't play nice with modern devices and drivers.

Maybe a summary of this should be added as a help for the CONFIG_IDE_GENERIC option ?

Regards,
David

#11 lore raw

PATCH 1/1 ide: note that IDE generic may prevent other drivers from attaching

Enabling IDE generic may prevent ATA controllers located on legacy ports from being attached to more proper driver or can prevent other controllers which share the IRQ from working. Note it in the help message.

---
 drivers/ide/Kconfig |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/ide/Kconfig +14 -0
index fc735ab..5e5b2d3 100644
@@ -292,6 +292,20 @@ config IDE_GENERIC
 	tristate "generic/default IDE chipset support"
 	depends on ALPHA || X86 || IA64 || M32R || MIPS
 	help
+	  This is the generic IDE driver.  This driver attaches to the
+	  fixed legacy ports (e.g. on PCs 0x1f0/0x170, 0x1e8/0x168 and
+	  so on).  Please note that if this driver is built into the
+	  kernel or loaded before other ATA (IDE or libata) drivers
+	  and the controller is located at legacy ports, this driver
+	  will grab those ports and thus can prevent the controller
+	  specific driver from attaching.
+
+	  Also, currently, IDE generic doesn't allow IRQ sharing
+	  meaning that the IRQs it grabs won't be available to other
+	  controllers sharing those IRQs which usually makes drivers
+	  for those controllers fail.  Generally, it's not a good idea
+	  to load IDE generic driver on modern systems.
+
 	  If unsure, say N.
 
 config BLK_DEV_PLATFORM
#12 lore raw

Re: [PATCH] ide: note that IDE generic may prevent other drivers from attaching

Quoted 6 lines · Tejun Heo

Enabling IDE generic may prevent ATA controllers located on legacy ports from being attached to more proper driver or can prevent other controllers which share the IRQ from working. Note it in the help message.

applied

Quoted 9 lines
---
 drivers/ide/Kconfig |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/ide/Kconfig +0 -0
index fc735ab..5e5b2d3 100644

drivers/ide/Kconfig config IDE_GENERIC · line 301

Quoted 10 lines
drivers/ide/Kconfig +7 -0
@@ -292,6 +292,20 @@ config IDE_GENERIC
 	tristate "generic/default IDE chipset support"
 	depends on ALPHA || X86 || IA64 || M32R || MIPS
 	help
+	  This is the generic IDE driver.  This driver attaches to the
+	  fixed legacy ports (e.g. on PCs 0x1f0/0x170, 0x1e8/0x168 and
+	  so on).  Please note that if this driver is built into the
+	  kernel or loaded before other ATA (IDE or libata) drivers
+	  and the controller is located at legacy ports, this driver
+	  will grab those ports and thus can prevent the controller
+	  specific driver from attaching.

s/will grab/may grab/ since Borislav has fixed PCI-case for .28