@rgag pointed you in the right direction.
The Linux PCIe device driver should implement the following handlers:
reset_prepare() and reset_done()
Look for an implementation in intel ice driver as an example:
static const struct pci_error_handlers ice_pci_err_handler = {
.error_detected = ice_pci_err_detected,
.slot_reset = ice_pci_err_slot_reset,
.reset_prepare = ice_pci_err_reset_prepare,
.reset_done = ice_pci_err_reset_done,
.resume = ice_pci_err_resume
};