Skip to content

Commit aeff27c

Browse files
oohalmpe
authored andcommitted
powerpc/eeh: Set attention indicator while recovering
I am the RAS team. Hear me roar. Roar. On a more serious note, being able to locate failed devices can be helpful. Set the attention indicator if the slot supports it once we've determined the device is present and only clear it if the device is fully recovered. Signed-off-by: Oliver O'Halloran <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 018c49e commit aeff27c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

arch/powerpc/kernel/eeh_driver.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,13 +803,39 @@ static bool eeh_slot_presence_check(struct pci_dev *pdev)
803803
if (!ops || !ops->get_adapter_status)
804804
return true;
805805

806+
/* set the attention indicator while we've got the slot ops */
807+
if (ops->set_attention_status)
808+
ops->set_attention_status(slot->hotplug, 1);
809+
806810
rc = ops->get_adapter_status(slot->hotplug, &state);
807811
if (rc)
808812
return true;
809813

810814
return !!state;
811815
}
812816

817+
static void eeh_clear_slot_attention(struct pci_dev *pdev)
818+
{
819+
const struct hotplug_slot_ops *ops;
820+
struct pci_slot *slot;
821+
822+
if (!pdev)
823+
return;
824+
825+
if (pdev->error_state == pci_channel_io_perm_failure)
826+
return;
827+
828+
slot = pdev->slot;
829+
if (!slot || !slot->hotplug)
830+
return;
831+
832+
ops = slot->hotplug->ops;
833+
if (!ops || !ops->set_attention_status)
834+
return;
835+
836+
ops->set_attention_status(slot->hotplug, 0);
837+
}
838+
813839
/**
814840
* eeh_handle_normal_event - Handle EEH events on a specific PE
815841
* @pe: EEH PE - which should not be used after we return, as it may
@@ -1098,6 +1124,12 @@ void eeh_handle_normal_event(struct eeh_pe *pe)
10981124
* we don't want to modify the PE tree structure so we do it here.
10991125
*/
11001126
eeh_pe_cleanup(pe);
1127+
1128+
/* clear the slot attention LED for all recovered devices */
1129+
eeh_for_each_pe(pe, tmp_pe)
1130+
eeh_pe_for_each_dev(tmp_pe, edev, tmp)
1131+
eeh_clear_slot_attention(edev->pdev);
1132+
11011133
eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true);
11021134
}
11031135

0 commit comments

Comments
 (0)