@@ -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 **/
44094408static ssize_t
44104409lpfc_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
44634423static 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 **/
44844444static ssize_t
44854445lpfc_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