Skip to content

Commit 0b31b77

Browse files
Merge patch series "PCI/AER: Remove redundant Device Control Error Reporting Enable"
Bjorn Helgaas <helgaas@kernel.org> says: Since f26e58b ("PCI/AER: Enable error reporting when AER is native"), which appeared in v6.0, the PCI core has enabled PCIe error reporting for all devices during enumeration. Remove driver code to do this and remove unnecessary includes of <linux/aer.h> from several other drivers. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents 99e0cd4 + d7ba106 commit 0b31b77

File tree

18 files changed

+27
-168
lines changed

18 files changed

+27
-168
lines changed

drivers/scsi/aacraid/linit.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include <linux/module.h>
2727
#include <linux/moduleparam.h>
2828
#include <linux/pci.h>
29-
#include <linux/aer.h>
3029
#include <linux/slab.h>
3130
#include <linux/mutex.h>
3231
#include <linux/spinlock.h>
@@ -1783,7 +1782,6 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
17831782

17841783
aac_scan_host(aac);
17851784

1786-
pci_enable_pcie_error_reporting(pdev);
17871785
pci_save_state(pdev);
17881786

17891787
return 0;
@@ -1949,7 +1947,6 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
19491947
scsi_host_complete_all_commands(shost, DID_NO_CONNECT);
19501948
aac_release_resources(aac);
19511949

1952-
pci_disable_pcie_error_reporting(pdev);
19531950
aac_adapter_ioremap(aac, 0);
19541951

19551952
return PCI_ERS_RESULT_NEED_RESET;

drivers/scsi/arcmsr/arcmsr_hba.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
#include <linux/timer.h>
5858
#include <linux/slab.h>
5959
#include <linux/pci.h>
60-
#include <linux/aer.h>
6160
#include <linux/circ_buf.h>
6261
#include <asm/dma.h>
6362
#include <asm/io.h>

drivers/scsi/be2iscsi/be_main.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5545,13 +5545,6 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
55455545
goto disable_pci;
55465546
}
55475547

5548-
/* Enable EEH reporting */
5549-
ret = pci_enable_pcie_error_reporting(pcidev);
5550-
if (ret)
5551-
beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT,
5552-
"BM_%d : PCIe Error Reporting "
5553-
"Enabling Failed\n");
5554-
55555548
pci_save_state(pcidev);
55565549

55575550
/* Initialize Driver configuration Paramters */
@@ -5736,7 +5729,6 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
57365729
pci_disable_msix(phba->pcidev);
57375730
pci_dev_put(phba->pcidev);
57385731
iscsi_host_free(phba->shost);
5739-
pci_disable_pcie_error_reporting(pcidev);
57405732
pci_set_drvdata(pcidev, NULL);
57415733
disable_pci:
57425734
pci_release_regions(pcidev);
@@ -5779,7 +5771,6 @@ static void beiscsi_remove(struct pci_dev *pcidev)
57795771

57805772
pci_dev_put(phba->pcidev);
57815773
iscsi_host_free(phba->shost);
5782-
pci_disable_pcie_error_reporting(pcidev);
57835774
pci_set_drvdata(pcidev, NULL);
57845775
pci_release_regions(pcidev);
57855776
pci_disable_device(pcidev);

drivers/scsi/be2iscsi/be_main.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/in.h>
1717
#include <linux/ctype.h>
1818
#include <linux/module.h>
19-
#include <linux/aer.h>
2019
#include <scsi/scsi.h>
2120
#include <scsi/scsi_cmnd.h>
2221
#include <scsi/scsi_device.h>

drivers/scsi/bfa/bfad.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -738,9 +738,6 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
738738
goto out_release_region;
739739
}
740740

741-
/* Enable PCIE Advanced Error Recovery (AER) if kernel supports */
742-
pci_enable_pcie_error_reporting(pdev);
743-
744741
bfad->pci_bar0_kva = pci_iomap(pdev, 0, pci_resource_len(pdev, 0));
745742
bfad->pci_bar2_kva = pci_iomap(pdev, 2, pci_resource_len(pdev, 2));
746743

@@ -801,8 +798,6 @@ bfad_pci_uninit(struct pci_dev *pdev, struct bfad_s *bfad)
801798
pci_iounmap(pdev, bfad->pci_bar0_kva);
802799
pci_iounmap(pdev, bfad->pci_bar2_kva);
803800
pci_release_regions(pdev);
804-
/* Disable PCIE Advanced Error Recovery (AER) */
805-
pci_disable_pcie_error_reporting(pdev);
806801
pci_disable_device(pdev);
807802
}
808803

@@ -1562,7 +1557,6 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
15621557
if (restart_bfa(bfad) == -1)
15631558
goto out_disable_device;
15641559

1565-
pci_enable_pcie_error_reporting(pdev);
15661560
dev_printk(KERN_WARNING, &pdev->dev,
15671561
"slot_reset completed flags: 0x%x!\n", bfad->bfad_flags);
15681562

drivers/scsi/bfa/bfad_drv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <linux/vmalloc.h>
3131
#include <linux/workqueue.h>
3232
#include <linux/bitops.h>
33-
#include <linux/aer.h>
3433
#include <scsi/scsi.h>
3534
#include <scsi/scsi_host.h>
3635
#include <scsi/scsi_tcq.h>

drivers/scsi/csiostor/csio_init.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <linux/module.h>
3939
#include <linux/init.h>
4040
#include <linux/pci.h>
41-
#include <linux/aer.h>
4241
#include <linux/mm.h>
4342
#include <linux/notifier.h>
4443
#include <linux/kdebug.h>

drivers/scsi/hpsa.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9108,7 +9108,6 @@ static void hpsa_remove_one(struct pci_dev *pdev)
91089108

91099109
free_percpu(h->lockup_detected); /* init_one 2 */
91109110
h->lockup_detected = NULL; /* init_one 2 */
9111-
/* (void) pci_disable_pcie_error_reporting(pdev); */ /* init_one 1 */
91129111

91139112
hpda_free_ctlr_info(h); /* init_one 1 */
91149113
}

drivers/scsi/lpfc/lpfc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,6 @@ struct lpfc_hba {
10361036
#define FCF_TS_INPROG 0x200 /* FCF table scan in progress */
10371037
#define FCF_RR_INPROG 0x400 /* FCF roundrobin flogi in progress */
10381038
#define HBA_FIP_SUPPORT 0x800 /* FIP support in HBA */
1039-
#define HBA_AER_ENABLED 0x1000 /* AER enabled with HBA */
10401039
#define HBA_DEVLOSS_TMO 0x2000 /* HBA in devloss timeout */
10411040
#define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */
10421041
#define HBA_IOQ_FLUSH 0x8000 /* FCP/NVME I/O queues being flushed */
@@ -1190,7 +1189,6 @@ struct lpfc_hba {
11901189
#define LPFC_MAX_ENBL_FC4_TYPE LPFC_ENABLE_FCP
11911190
#define LPFC_DEF_ENBL_FC4_TYPE LPFC_ENABLE_FCP
11921191
#endif
1193-
uint32_t cfg_aer_support;
11941192
uint32_t cfg_sriov_nr_virtfn;
11951193
uint32_t cfg_request_firmware_upgrade;
11961194
uint32_t cfg_suppress_link_up;

drivers/scsi/lpfc/lpfc_attr.c

Lines changed: 27 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4371,13 +4371,22 @@ static DEVICE_ATTR_RW(lpfc_link_speed);
43714371

43724372
/*
43734373
# lpfc_aer_support: Support PCIe device Advanced Error Reporting (AER)
4374-
# 0 = aer disabled or not supported
43754374
# 1 = aer supported and enabled (default)
4376-
# Value range is [0,1]. Default value is 1.
4375+
# PCIe error reporting is always enabled by the PCI core, so this always
4376+
# shows 1.
4377+
#
4378+
# N.B. Parts of LPFC_ATTR open-coded since some of the underlying
4379+
# infrastructure (phba->cfg_aer_support) is gone.
43774380
*/
4378-
LPFC_ATTR(aer_support, 1, 0, 1,
4379-
"Enable PCIe device AER support");
4380-
lpfc_param_show(aer_support)
4381+
static uint lpfc_aer_support = 1;
4382+
module_param(lpfc_aer_support, uint, S_IRUGO);
4383+
MODULE_PARM_DESC(lpfc_aer_support, "Enable PCIe device AER support");
4384+
static ssize_t
4385+
lpfc_aer_support_show(struct device *dev, struct device_attribute *attr,
4386+
char *buf)
4387+
{
4388+
return scnprintf(buf, PAGE_SIZE, "%d\n", lpfc_aer_support);
4389+
}
43814390

43824391
/**
43834392
* lpfc_aer_support_store - Set the adapter for aer support
@@ -4388,76 +4397,27 @@ lpfc_param_show(aer_support)
43884397
* @count: unused variable.
43894398
*
43904399
* Description:
4391-
* If the val is 1 and currently the device's AER capability was not
4392-
* enabled, invoke the kernel's enable AER helper routine, trying to
4393-
* enable the device's AER capability. If the helper routine enabling
4394-
* AER returns success, update the device's cfg_aer_support flag to
4395-
* indicate AER is supported by the device; otherwise, if the device
4396-
* AER capability is already enabled to support AER, then do nothing.
4397-
*
4398-
* If the val is 0 and currently the device's AER support was enabled,
4399-
* invoke the kernel's disable AER helper routine. After that, update
4400-
* the device's cfg_aer_support flag to indicate AER is not supported
4401-
* by the device; otherwise, if the device AER capability is already
4402-
* disabled from supporting AER, then do nothing.
4400+
* PCIe error reporting is enabled by the PCI core, so drivers don't need
4401+
* to do anything. Retain this interface for backwards compatibility,
4402+
* but do nothing.
44034403
*
44044404
* Returns:
4405-
* length of the buf on success if val is in range the intended mode
4406-
* is supported.
4407-
* -EINVAL if val out of range or intended mode is not supported.
4405+
* length of the buf on success
4406+
* -EINVAL if val out of range
44084407
**/
44094408
static ssize_t
44104409
lpfc_aer_support_store(struct device *dev, struct device_attribute *attr,
44114410
const char *buf, size_t count)
44124411
{
4413-
struct Scsi_Host *shost = class_to_shost(dev);
4414-
struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
4415-
struct lpfc_hba *phba = vport->phba;
4416-
int val = 0, rc = -EINVAL;
4412+
int val = 0;
44174413

44184414
if (!isdigit(buf[0]))
44194415
return -EINVAL;
44204416
if (sscanf(buf, "%i", &val) != 1)
44214417
return -EINVAL;
44224418

4423-
switch (val) {
4424-
case 0:
4425-
if (phba->hba_flag & HBA_AER_ENABLED) {
4426-
rc = pci_disable_pcie_error_reporting(phba->pcidev);
4427-
if (!rc) {
4428-
spin_lock_irq(&phba->hbalock);
4429-
phba->hba_flag &= ~HBA_AER_ENABLED;
4430-
spin_unlock_irq(&phba->hbalock);
4431-
phba->cfg_aer_support = 0;
4432-
rc = strlen(buf);
4433-
} else
4434-
rc = -EPERM;
4435-
} else {
4436-
phba->cfg_aer_support = 0;
4437-
rc = strlen(buf);
4438-
}
4439-
break;
4440-
case 1:
4441-
if (!(phba->hba_flag & HBA_AER_ENABLED)) {
4442-
rc = pci_enable_pcie_error_reporting(phba->pcidev);
4443-
if (!rc) {
4444-
spin_lock_irq(&phba->hbalock);
4445-
phba->hba_flag |= HBA_AER_ENABLED;
4446-
spin_unlock_irq(&phba->hbalock);
4447-
phba->cfg_aer_support = 1;
4448-
rc = strlen(buf);
4449-
} else
4450-
rc = -EPERM;
4451-
} else {
4452-
phba->cfg_aer_support = 1;
4453-
rc = strlen(buf);
4454-
}
4455-
break;
4456-
default:
4457-
rc = -EINVAL;
4458-
break;
4459-
}
4460-
return rc;
4419+
dev_info_once(dev, "PCIe error reporting automatically enabled by the PCI core; sysfs write ignored\n");
4420+
return strlen(buf);
44614421
}
44624422

44634423
static DEVICE_ATTR_RW(lpfc_aer_support);
@@ -4470,16 +4430,16 @@ static DEVICE_ATTR_RW(lpfc_aer_support);
44704430
* @count: unused variable.
44714431
*
44724432
* Description:
4473-
* If the @buf contains 1 and the device currently has the AER support
4474-
* enabled, then invokes the kernel AER helper routine
4433+
* If the @buf contains 1, invokes the kernel AER helper routine
44754434
* pci_aer_clear_nonfatal_status() to clean up the uncorrectable
44764435
* error status register.
44774436
*
44784437
* Notes:
44794438
*
44804439
* Returns:
4481-
* -EINVAL if the buf does not contain the 1 or the device is not currently
4482-
* enabled with the AER support.
4440+
* -EINVAL if the buf does not contain 1
4441+
* -EPERM if the OS cannot clear AER error status, i.e., when platform
4442+
* firmware owns the AER Capability
44834443
**/
44844444
static ssize_t
44854445
lpfc_aer_cleanup_state(struct device *dev, struct device_attribute *attr,
@@ -4497,8 +4457,7 @@ lpfc_aer_cleanup_state(struct device *dev, struct device_attribute *attr,
44974457
if (val != 1)
44984458
return -EINVAL;
44994459

4500-
if (phba->hba_flag & HBA_AER_ENABLED)
4501-
rc = pci_aer_clear_nonfatal_status(phba->pcidev);
4460+
rc = pci_aer_clear_nonfatal_status(phba->pcidev);
45024461

45034462
if (rc == 0)
45044463
return strlen(buf);
@@ -7283,7 +7242,6 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
72837242

72847243
lpfc_sg_seg_cnt_init(phba, lpfc_sg_seg_cnt);
72857244
lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth);
7286-
lpfc_aer_support_init(phba, lpfc_aer_support);
72877245
lpfc_sriov_nr_virtfn_init(phba, lpfc_sriov_nr_virtfn);
72887246
lpfc_request_firmware_upgrade_init(phba, lpfc_req_fw_upgrade);
72897247
lpfc_suppress_link_up_init(phba, lpfc_suppress_link_up);

0 commit comments

Comments
 (0)