Re: [PATCH v2] PCI/PM: Restore BARs after powering up during enumeration
From: Rafael J. Wysocki (Intel)
Date: Tue Oct 13 2026 - 12:39:33 EST
On Tue, Oct 13, 2026 at 8:10 AM Keng-Yu Lin <keng-yu.lin@xxxxxxx> wrote:
>
> Hi Rafael, Mario,
>
> The initial read is not needed to fix the reported D3hot-to-D0
> failure. I added it to avoid extra BAR writes on devices already
> in D0.
>
> pci_power_up() does update current_state, but need_restore is
> calculated before that update. The check includes:
>
> dev->current_state >= PCI_D3hot
>
> For an initially unknown device with PMCSR reporting D0 and
> No_Soft_Reset clear, this still requests a BAR restore. Reading
> the state first avoids that request, although the final
> current_state is D0 either way.
Fair enough, but if the device is in D0 already, it need not be
powered up, so if you make a point to update the power state upfront,
you may as well skip the power up if the outcome is D0.