• Bjorn Helgaas's avatar
    PCI: pciehp: Compute timeout from hotplug command start time · 40b96083
    Bjorn Helgaas authored
    If we issue a hotplug command, go do something else, then come back and
    wait for the command to complete, we don't have to wait the whole timeout
    period, because some of it elapsed while we were doing something else.
    
    Keep track of the time we issued the command, and wait only until the
    timeout period from that point has elapsed.
    
    For controllers with errata like Intel CF118, we previously timed out
    before issuing the second hotplug command:
    
      At time T1 (during boot):
        - Write DLLSCE, ABPE, PDCE, etc. to Slot Control
      At time T2 (hotplug event):
        - Wait for command completion (CC) in Slot Status
        - Timeout at T2 + 1 second because CC is never set in Slot Status
        - Write PCC, PIC, etc. to Slot Control
    
    With this change, we wait until T1 + 1 second instead of T2 + 1 second.
    If the hotplug event is more than 1 second after the boot-time
    initialization, we won't wait for the timeout at all.
    
    We still emit a "Timeout on hotplug command" message if it timed out; we
    should see this on the first hotplug event on every controller with this
    erratum, as well as on real errors on controllers without the erratum.
    
    Link: http://www.intel.com/content/www/us/en/processors/xeon/xeon-e7-v2-spec-update.html
    Tested-by: Rajat Jain <rajatxjain@gmail.com>	(IDT 807a controller)
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    Acked-by: default avatarYinghai Lu <yinghai@kernel.org>
    40b96083
pciehp_hpc.c 23 KB