• Lukas Wunner's avatar
    PCI: pciehp: Always enable occupied slot on probe · cdf6b736
    Lukas Wunner authored
    Per PCIe r4.0, sec 6.7.3.4, a "port may optionally send an MSI when
    there are hot-plug events that occur while interrupt generation is
    disabled, and interrupt generation is subsequently enabled."
    
    On probe, we currently clear all event bits in the Slot Status register
    with the notable exception of the Presence Detect Changed bit.  Thereby
    we seek to receive an interrupt for an already occupied slot once event
    notification is enabled.
    
    But because the interrupt is optional, users may have to specify the
    pciehp_force parameter on the command line, which is inconvenient.
    
    Moreover, now that pciehp's event handling has become resilient to
    missed events, a Presence Detect Changed interrupt for a slot which is
    powered on is interpreted as removal of the card.  If the slot has
    already been brought up by the BIOS, receiving such an interrupt on
    probe causes the slot to be powered off and immediately back on, which
    is likewise undesirable.
    
    Avoid both issues by making the behavior of pciehp_force the default and
    clearing the Presence Detect Changed bit on probe.
    
    Note that the stated purpose of pciehp_force per the MODULE_PARM_DESC
    ("Force pciehp, even if OSHP is missing") seems nonsensical because the
    OSHP control method is only relevant for SHCP slots according to the
    PCI Firmware specification r3.0, sec 4.8.
    Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
    cdf6b736
pciehp_hpc.c 23.5 KB