Skip to content

Commit a1ff8fe

Browse files
zhang-ruigregkh
authored andcommitted
PCI: Disable async suspend/resume for JMicron multi-function SATA/AHCI
commit 91f15fb upstream. On multi-function JMicron SATA/PATA/AHCI devices, the PATA controller at function 1 doesn't work if it is powered on before the SATA controller at function 0. The result is that PATA doesn't work after resume, and we print messages like this: pata_jmicron 0000:02:00.1: Refused to change power state, currently in D3 irq 17: nobody cared (try booting with the "irqpoll" option) Async resume was introduced in v3.15 by 76569fa ("PM / sleep: Asynchronous threads for resume_noirq"). Prior to that, we powered on the functions in order, so this problem shouldn't happen. e6b7e41 ("ata: Disabling the async PM for JMicron chip 363/361") solved the problem for JMicron 361 and 363 devices. With async suspend disabled, we always power on function 0 before function 1. Barto then reported the same problem with a JMicron 368 (see comment #57 in the bugzilla). Rather than extending the blacklist piecemeal, disable async suspend for all JMicron multi-function SATA/PATA/AHCI devices. This quirk could stay in the ahci and pata_jmicron drivers, but it's likely the problem will occur even if pata_jmicron isn't loaded until after the suspend/resume. Making it a PCI quirk ensures that we'll preserve the power-on order even if the drivers aren't loaded. [bhelgaas: changelog, limit to multi-function, limit to IDE/ATA] Link: https://bugzilla.kernel.org/show_bug.cgi?id=81551 Reported-and-tested-by: Barto <[email protected]> Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 884372a commit a1ff8fe

File tree

3 files changed

+13
-24
lines changed

3 files changed

+13
-24
lines changed

drivers/ata/ahci.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
349349
/* JMicron 362B and 362C have an AHCI function with IDE class code */
350350
{ PCI_VDEVICE(JMICRON, 0x2362), board_ahci_ign_iferr },
351351
{ PCI_VDEVICE(JMICRON, 0x236f), board_ahci_ign_iferr },
352+
/* May need to update quirk_jmicron_async_suspend() for additions */
352353

353354
/* ATI */
354355
{ PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */
@@ -1377,18 +1378,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
13771378
else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000)
13781379
ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS;
13791380

1380-
/*
1381-
* The JMicron chip 361/363 contains one SATA controller and one
1382-
* PATA controller,for powering on these both controllers, we must
1383-
* follow the sequence one by one, otherwise one of them can not be
1384-
* powered on successfully, so here we disable the async suspend
1385-
* method for these chips.
1386-
*/
1387-
if (pdev->vendor == PCI_VENDOR_ID_JMICRON &&
1388-
(pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 ||
1389-
pdev->device == PCI_DEVICE_ID_JMICRON_JMB361))
1390-
device_disable_async_suspend(&pdev->dev);
1391-
13921381
/* acquire resources */
13931382
rc = pcim_enable_device(pdev);
13941383
if (rc)

drivers/ata/pata_jmicron.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,6 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i
143143
};
144144
const struct ata_port_info *ppi[] = { &info, NULL };
145145

146-
/*
147-
* The JMicron chip 361/363 contains one SATA controller and one
148-
* PATA controller,for powering on these both controllers, we must
149-
* follow the sequence one by one, otherwise one of them can not be
150-
* powered on successfully, so here we disable the async suspend
151-
* method for these chips.
152-
*/
153-
if (pdev->vendor == PCI_VENDOR_ID_JMICRON &&
154-
(pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 ||
155-
pdev->device == PCI_DEVICE_ID_JMICRON_JMB361))
156-
device_disable_async_suspend(&pdev->dev);
157-
158146
return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0);
159147
}
160148

drivers/pci/quirks.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,18 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB3
15761576

15771577
#endif
15781578

1579+
static void quirk_jmicron_async_suspend(struct pci_dev *dev)
1580+
{
1581+
if (dev->multifunction) {
1582+
device_disable_async_suspend(&dev->dev);
1583+
dev_info(&dev->dev, "async suspend disabled to avoid multi-function power-on ordering issue\n");
1584+
}
1585+
}
1586+
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE, 8, quirk_jmicron_async_suspend);
1587+
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_CLASS_STORAGE_SATA_AHCI, 0, quirk_jmicron_async_suspend);
1588+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_JMICRON, 0x2362, quirk_jmicron_async_suspend);
1589+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_JMICRON, 0x236f, quirk_jmicron_async_suspend);
1590+
15791591
#ifdef CONFIG_X86_IO_APIC
15801592
static void quirk_alder_ioapic(struct pci_dev *pdev)
15811593
{

0 commit comments

Comments
 (0)