TGL-H system freeze for >30 seconds after exiting s2idle
I opened a bug on https://bugzilla.kernel.org/show_bug.cgi?id=212951 which I used to take it as a BIOS bug. The NVIDIA GPU will fall off the bus after exiting s2idle in TGL-H systems if the docking station (or USB-C dongle with HDMI/DP ports) with external display connected is unplugged when the system is still in s2idle. The system will be hold by the infinite loop in ACPI method IPCS and then the PCIe root port of NVIDIA gpu fails the power transition from D3cold to D0. Then display managed by the NVDIA GPU shows nothing until system reboot. It only happens when NVIDIA GPU in either Performance mode or On-Demand mode.
Since the bug is triggered by the unplug action when the system in s2idle, I assume that it's due to the unplug action is not handled properly during resume, So I tried to handle HPD event earlier in i915 driver before the _SB.PC00.PEG1.PG01._ON for PEG1 and it seems to make difference. Please refer to https://bugzilla.kernel.org/show_bug.cgi?id=212951#c13 and the attachments.
Please help suggest what we can do in i915 driver. Let me know if there's any information missing.