Re: [PATCH v2] PCI/PM: Restore BARs after powering up during enumeration

From: Keng-Yu Lin

Date: Tue Oct 13 2026 - 02:13:20 EST


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.

Before submitting v1, I tested a restore-only version without
the initial read on Venice. It fixed kdump, but also rewrote
seven unchanged BARs during crash-kernel enumeration. With the
initial read, only the two cleared xHCI BARs were restored.

Thanks,
Keng-Yu