Merge branch 'for-6.2/cxl-aer' into for-6.2/cxl
authorDan Williams <dan.j.williams@intel.com>
Mon, 5 Dec 2022 20:31:30 +0000 (12:31 -0800)
committerDan Williams <dan.j.williams@intel.com>
Mon, 5 Dec 2022 20:31:30 +0000 (12:31 -0800)
Pick up CXL AER handling and correctable error extensions. Resolve
conflicts with cxl_pmem_wq reworks and RCH support.

1  2 
drivers/cxl/core/pci.c
drivers/cxl/core/port.c
drivers/cxl/core/regs.c
drivers/cxl/cxl.h
drivers/cxl/cxlmem.h
drivers/cxl/pci.c
include/linux/pci.h

Simple merge
Simple merge
Simple merge
Simple merge
index 710c7694bf9fffdc709d2ccd02bfdb23e32d6de4,b3117fd67f42099a6b5835b1c210305b1ac81487..785c6c12515db499bbd396565b13080b49f6ffff
@@@ -199,9 -186,9 +199,10 @@@ struct cxl_endpoint_dvsec_info 
   * Currently only memory devices are represented.
   *
   * @dev: The device associated with this CXL state
+  * @cxlmd: The device representing the CXL.mem capabilities of @dev
   * @regs: Parsed register blocks
   * @cxl_dvsec: Offset to the PCIe device DVSEC
 + * @rcd: operating in RCD mode (CXL 3.0 9.11.8 CXL Devices Attached to an RCH)
   * @payload_size: Size of space for payload
   *                (CXL 2.0 8.2.8.4.3 Mailbox Capabilities Register)
   * @lsa_size: Size of Label Storage Area
index 73ff6c33a0c0f0e2308d7697509ed35b0d718c6e,36db681f3705ff393d9bb135dafa783f6e847290..6cec9fa9326c1d77b7683290a16eae57cf2d7bdd
@@@ -433,15 -400,11 +405,20 @@@ static void devm_cxl_pci_create_doe(str
        }
  }
  
 +/*
 + * Assume that any RCIEP that emits the CXL memory expander class code
 + * is an RCD
 + */
 +static bool is_cxl_restricted(struct pci_dev *pdev)
 +{
 +      return pci_pcie_type(pdev) == PCI_EXP_TYPE_RC_END;
 +}
 +
+ static void disable_aer(void *pdev)
+ {
+       pci_disable_pcie_error_reporting(pdev);
+ }
  static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
  {
        struct cxl_register_map map;
        cxlds = cxl_dev_state_create(&pdev->dev);
        if (IS_ERR(cxlds))
                return PTR_ERR(cxlds);
+       pci_set_drvdata(pdev, cxlds);
  
 +      cxlds->rcd = is_cxl_restricted(pdev);
        cxlds->serial = pci_get_dsn(pdev);
        cxlds->cxl_dvsec = pci_find_dvsec_capability(
                pdev, PCI_DVSEC_VENDOR_ID_CXL, CXL_DVSEC_PCIE_DEVICE);
        if (IS_ERR(cxlmd))
                return PTR_ERR(cxlmd);
  
 -      if (resource_size(&cxlds->pmem_res) && IS_ENABLED(CONFIG_CXL_PMEM))
 -              rc = devm_cxl_add_nvdimm(&pdev->dev, cxlmd);
 -
+       if (cxlds->regs.ras) {
+               pci_enable_pcie_error_reporting(pdev);
+               rc = devm_add_action_or_reset(&pdev->dev, disable_aer, pdev);
+               if (rc)
+                       return rc;
+       }
+       pci_save_state(pdev);
        return rc;
  }
  
Simple merge