Forward-port reset-related changes from 5.4 tree.