Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a generic way to reset a PCI device in Linux from the command line? That is, cause the PCI bus to issue a reset command.

share|improve this question

migrated from serverfault.com Jan 23 '12 at 10:30

This question came from our site for system and network administrators.

3 Answers 3

Since a generic PCI device is not hotpluggable there won't be a way to reset it and have the kernel re-enumerate it.

Whatever kind of problems you are trying to solve, there surely is a better way than to just reset it.

share|improve this answer
    
I'm simulating a PCI device in QEMU and need to reset it's state as I develop. I wanted to do it from within the guest. –  Jonathan Jan 24 '12 at 5:20

The closest thing the PCI bus has to a device level reset is changing the power state to D3 and back to D0. After unloading the driver ( it would be bad to reset the hardware out from under the driver ), you can use setpci to write to the control registers to change the power state, but I believe this happens automatically when you unload the driver.

share|improve this answer

according to http://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci you can reset individual functions of the device if that's supported:

What:       /sys/bus/pci/devices/.../reset
Description:
            Some devices allow an individual function to be reset
            without affecting other functions in the same device.
            For devices that have this support, a file named reset
            will be present in sysfs.  Writing 1 to this file
            will perform reset.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.