lkml.org 
[lkml]   [2020]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v3 1/1] PCI/ERR: Fix reset logic in pcie_do_recovery() call
    From
    Date
    On 9/27/2020 10:43 PM, Kuppuswamy, Sathyanarayanan wrote:
    > FATAL + no-hotplug - In this case, link will still be reseted. But
    > currently driver state is not properly restored. So I attempted
    > to restore it using pci_reset_bus().
    >
    >          status = reset_link(dev);
    > -        if (status != PCI_ERS_RESULT_RECOVERED) {
    > +        if (status == PCI_ERS_RESULT_RECOVERED) {
    > +            status = PCI_ERS_RESULT_NEED_RESET;
    >
    > ...
    >
    >      if (status == PCI_ERS_RESULT_NEED_RESET) {
    >          /*
    > -         * TODO: Should call platform-specific
    > -         * functions to reset slot before calling
    > -         * drivers' slot_reset callbacks?
    > +         * TODO: Optimize the call to pci_reset_bus()
    > +         *
    > +         * There are two components to pci_reset_bus().
    > +         *
    > +         * 1. Do platform specific slot/bus reset.
    > +         * 2. Save/Restore all devices in the bus.
    > +         *
    > +         * For hotplug capable devices and fatal errors,
    > +         * device is already in reset state due to link
    > +         * reset. So repeating platform specific slot/bus
    > +         * reset via pci_reset_bus() call is redundant. So
    > +         * can optimize this logic and conditionally call
    > +         * pci_reset_bus().
    >           */
    > +        pci_reset_bus(dev);

    I think we have to go to remove/rescan for this case as you also
    mentioned above. There is no state to save. All BAR assignments
    are gone. Entire device programming is also lost.

    I don't think pci_reset_bus() can recover from this situation safely.
    It will make things worse by saving/restoring the hardware default
    state.

    This should remove/rescan logic should be inside DPC's slot_reset()
    function BTW. Not here.

    \
     
     \ /
      Last update: 2020-09-28 13:18    [W:3.433 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site