Hi Kyle, On Wed, Apr 26, 2017 at 5:56 PM, Kyle Gale <kylewgale@xxxxxxxxx> wrote: > Hi, > > > > Can someone help me understand why I need to remove my stale PCI > device files from the tree if I want to properly get my device > re-initialized after unplugging and reinserting? > > > > For example, I turn on my system with my PCI device plugged in. All is > fine. I unplug it, plug it back in, and rescan (echo 1 > > /sys/bus/pci/devices/rescan) and end up in this state where my BAR0 is > not set, and other things are not entirely correct. Ideally, the PCI hotplug code would automatically remove the PCI device files when you remove the physical device, and it would also automatically scan the device when you plug it back in. You shouldn't need to do either the remove or the rescan manually via sysfs. Apparently your system does actually support hotplug. Do you have it enabled in the kernel? The "lspci -vv" output, dmesg output, and your .config would help answer these questions. Bjorn