GPU hotplug with pciehp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello all,

I'm trying to provide hot-swap support for GPU devices, specifically headless GPUs. The native PCIe hotplug drivers prevent this explicitly with the following (referencing pciehp but the same can be found in shpchp):

int pciehp_unconfigure_device(struct slot *p_slot)
{
...
   for (j = 0; j < 8; j++) {
        ...
        if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
                ctrl_err(ctrl, "Cannot remove display device %s\n",
                         pci_name(temp));
                pci_dev_put(temp);
                continue;
        }
        if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) {
                pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl);
                if (bctl & PCI_BRIDGE_CTL_VGA) {
                        ctrl_err(ctrl,
                                 "Cannot remove display device %s\n",
                                 pci_name(temp));
                        pci_dev_put(temp);
                        continue;
                }
        }
...
}

A similar check is made in pciehp_configure_device() to prevent hot-adding a display device.

Why is this check needed? Is it to prevent a user from hot-removing a graphics card that is driving their display? If so, this seems like a heavy hammer to protect against a user-requested (albeit probably naive) action. I've tested hotplug of GPU's with a patch to remove this check and it appears to work without negative side effects. Is there something I'm missing about this check?

Also, if these checks are indeed necessary I believe there may be a bug in pciehp_unconfigure_device(). By not setting an rc value if the display adapter condition is met, the function will return successfully without properly unconfiguring the device. Then remove_board() would end up powering the slot off anyway. There is a similar but less severe issue with pciehp_configure_device() in the hot-add scenario.
Thanks for the help.

Cheers,
Praveen

--
Praveen Kalamegham
praveen@xxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux