Re: [PATCH] PCI: Set device power state to PCI_D0 for device withoutnative PM support

From: Stefano Stabellini
Date: Thu Oct 06 2011 - 06:41:11 EST

On Wed, 5 Oct 2011, Ajaykumar Hotchandani wrote:
> During test of one IB card with guest VM, found that, msi is not initialized properly.
> It turns out __write_msi_msg will do nothing if device current_state is not PCI_D0.
> And, that pci device does not have pm_cap in guest VM.
> There is an error in setting of power state to PCI_D0 in pci_enable_device(), but error is not returned for this.
> Following is code flow:
> pci_enable_device() --> __pci_enable_device_flags() --> do_pci_enable_device() --> pci_set_power_state() --> __pci_start_power_transition()
> We have following condition inside __pci_start_power_transition():
> if (platform_pci_power_manageable(dev)) {
> error = platform_pci_set_power_state(dev, state);
> if (!error)
> pci_update_current_state(dev, state);
> } else {
> error = -ENODEV;
> /* Fall back to PCI_D0 if native PM is not supported */
> if (!dev->pm_cap)
> dev->current_state = PCI_D0;
> }
> Here, from platform_pci_set_power_state(), acpi_pci_set_power_state() is getting called and that is failing with ENODEV because of following condition:
> if (!handle || ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0",&tmp)))
> return -ENODEV;
> Because of that, pci_update_current_state() is not getting called.
> With this patch, if device power state can not be set via platform_pci_set_power_state and that device does not have native pm support, then PCI device power state will be set to PCI_D0.
> Signed-off-by: Ajaykumar Hotchandani<ajaykumar.hotchandani@xxxxxxxxxx>
> Signed-off-by: Yinghai Lu<>

I had the same issue and sent a patch a while ago to fix it, adding

current_state = PCI_D0 in acpiphp_glue.c:register_slot

it is strange that this does not work for you:
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at