mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 12:13:51 -04:00
misc: pci_endpoint_test: Add AER error handlers
The Endpoint test driver doesn't need to do anything fancy in its error handlers; just restore the config space that was saved during probe and report the correct result. This helps in making sure that the AER recovery succeeds. Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/20260729-pci-port-reset-v9-5-53570b92064d@oss.qualcomm.com
This commit is contained in:
committed by
Bjorn Helgaas
parent
b376b3ff9c
commit
29e179cb7f
@@ -1325,6 +1325,8 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
|
||||
misc_device->parent = &pdev->dev;
|
||||
misc_device->fops = &pci_endpoint_test_fops;
|
||||
|
||||
pci_save_state(pdev);
|
||||
|
||||
ret = misc_register(misc_device);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to register device\n");
|
||||
@@ -1452,12 +1454,33 @@ static const struct pci_device_id pci_endpoint_test_tbl[] = {
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, pci_endpoint_test_tbl);
|
||||
|
||||
static pci_ers_result_t pci_endpoint_test_error_detected(struct pci_dev *pdev,
|
||||
pci_channel_state_t state)
|
||||
{
|
||||
if (state == pci_channel_io_perm_failure)
|
||||
return PCI_ERS_RESULT_DISCONNECT;
|
||||
|
||||
return PCI_ERS_RESULT_NEED_RESET;
|
||||
}
|
||||
|
||||
static pci_ers_result_t pci_endpoint_test_slot_reset(struct pci_dev *pdev)
|
||||
{
|
||||
pci_restore_state(pdev);
|
||||
return PCI_ERS_RESULT_RECOVERED;
|
||||
}
|
||||
|
||||
static const struct pci_error_handlers pci_endpoint_test_err_handler = {
|
||||
.error_detected = pci_endpoint_test_error_detected,
|
||||
.slot_reset = pci_endpoint_test_slot_reset,
|
||||
};
|
||||
|
||||
static struct pci_driver pci_endpoint_test_driver = {
|
||||
.name = DRV_MODULE_NAME,
|
||||
.id_table = pci_endpoint_test_tbl,
|
||||
.probe = pci_endpoint_test_probe,
|
||||
.remove = pci_endpoint_test_remove,
|
||||
.sriov_configure = pci_sriov_configure_simple,
|
||||
.err_handler = &pci_endpoint_test_err_handler,
|
||||
};
|
||||
module_pci_driver(pci_endpoint_test_driver);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user