1
\$\begingroup\$

As far as I understand, hot-plugging a PCIe connection requires both hardware and software support.

Software-wise, it makes sense, since the OS has to re-scan the bus, and by default it doesn't do this after the initial scan.

Hardware-wise, I do imagine it would require special circuitry in order to send an interrupt to the CPU, so that the OS is informed about a new device being connected to the bus.

However, what I do not understand, is why there is a risk of burning/damaging components if I just plug-in a PCIe device while the computer is running.

  • How does electrical current flow differently from when the PC is turned on after the insertion?
\$\endgroup\$
2
  • \$\begingroup\$ So, ask about PCI OR PCIe. These are so fundamentally different that you shouldn't ask about both in one question, because answers would just need to get too long. Since you've tagged your question pcie, I'm removing all PCI references from the question. \$\endgroup\$ Jan 12 '17 at 14:39
  • \$\begingroup\$ If the user always do it right, it could be easy. But how many user safely disables the device before unplugging it? USB devices for example? \$\endgroup\$ Jan 12 '17 at 20:03
2
\$\begingroup\$

There are chips that require power up to occur in particular sequences most chips require power to be present before that data lines are driven. You must consider what happens when ground makes contact late, for example a high speed LVDS pair (common mode voltage ~1V and abs max maybe 2.5V) connects before the ground makes contact and after the 3.3V (or worse the 12V) rail has connected.... If not thought about the answer is often smoke.

Hot plug is a pain to get right even if you are designing for it from scratch, and often involves extra logic and power switching hardware which no commodity box designer wants to include.

Then there is the ringing and bounce as contacts make and break during insertion, this is a pain in all ways, and there is a reason things like the industrial versions of PCI have connectors with three or four different length pins to ensure correct sequencing.

\$\endgroup\$
4
  • \$\begingroup\$ If I somehow ensure that GND pins make contact first, can I be certain there will be no permanent damage? (Apart from the chance that the connection might not be successfully established) \$\endgroup\$ Jan 12 '17 at 16:28
  • \$\begingroup\$ Also, if I know the connection type (i.e. PCIe-PCI or PCIe-PCIe), how can I figure out in what order should the pins make contact? Is it specified in some official document like the PCIe standard? Can it be deduced in some other way? \$\endgroup\$ Jan 12 '17 at 16:39
  • \$\begingroup\$ Nope, power sequence also matters, as does transient protection to reduce the risks of overshoot and ringing. \$\endgroup\$
    – Dan Mills
    Jan 12 '17 at 16:51
  • \$\begingroup\$ Generally ground then power then data and clocks, then finally a pin that is much shorter then the others that signals the mainboard to power up the device. The hotplug spec for whichever PCI spec you are working on will specify this stuff as well as the requirements of the other side of the interface. \$\endgroup\$
    – Dan Mills
    Jan 12 '17 at 16:54
4
\$\begingroup\$

Software-wise, it makes sense, since the OS has to re-scan the bus, and by default it doesn't do this after the initial scan.

Nah. PCIe is a point-to-point network much more than a bus that needs to be scanned. But you're right, something in the OS needs to be able to handle the info coming from the PCIe bus master that topology has changed.

Also, your OS needs to be able to deal with new memory regions being mapped to new hardware and so on.

Hardware-wise, I do imagine it would require special circuitry in order to send an interrupt to the CPU, so that the OS is informed about a new device being connected to the bus.

Hardware support not only means that (that functionality is pretty certainly there in every PCIe bus master implementation through the PCIe standard), but also simply routines in the PCIe hardware's firmware to initialize the new link etc.

How does electrical current flow differently from when the PC is turned on after the insertion?

That's kind of like asking why you can't insert a RAM bar when your system is already running: Electrical connections are sensitive things, and plugging in something "takes forever" and does all kind of weird stuff (ringing etc) on the freshly connecting signal and power lines. So, your hardware and connector need to be designed in a way that makes sure not to e.g. power up ESD-sensitive pins while the connector is still mechanically handled (because sudden disconnections, like they always happen when you make a mechanical contact) will lead to voltage spikes, and obviously, while you're still "scratching" metal against metal, the link will be so unreliable that all signal carried across this will be broken.

Hence, your design must make sure to only power and initialize the device after the necessary connections have been securely made.

On hot-un-plugging, things are even more dangerous: you need to make sure not to damage host and PCIe device by letting the host know things are going to disappear from the bus in a couple milliseconds, by making sure you sever the connections in a sensible order, and by making the link electrically safe to disconnection.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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