]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: SAUCE: cxlflash: Read host AFU configuration
authorUma Krishnan <ukrishn@linux.vnet.ibm.com>
Tue, 7 Nov 2017 18:01:19 +0000 (12:01 -0600)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 27 Mar 2018 19:10:07 +0000 (14:10 -0500)
BugLink: http://bugs.launchpad.net/bugs/1752672
The host AFU configuration is read on the initialization path to identify
the features and configuration of the AFU. This data is cached for use in
later configuration steps.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/scsi/cxlflash/ocxl_hw.c
drivers/scsi/cxlflash/ocxl_hw.h

index 39cccb78e542fc345aa129c282b8e803d0820feb..232503002056f4d59a967431b0f90193425fa09a 100644 (file)
@@ -75,6 +75,33 @@ out:
        return rc;
 }
 
+/**
+ * ocxlflash_config_afu() - configure the host AFU
+ * @pdev:      PCI device associated with the host.
+ * @afu:       AFU associated with the host.
+ *
+ * Must be called _after_ host function configuration.
+ *
+ * Return: 0 on success, -errno on failure
+ */
+static int ocxlflash_config_afu(struct pci_dev *pdev, struct ocxl_hw_afu *afu)
+{
+       struct ocxl_afu_config *acfg = &afu->acfg;
+       struct ocxl_fn_config *fcfg = &afu->fcfg;
+       struct device *dev = &pdev->dev;
+       int rc = 0;
+
+       /* Read AFU config at index 0 */
+       rc = ocxl_config_read_afu(pdev, fcfg, acfg, 0);
+       if (unlikely(rc)) {
+               dev_err(dev, "%s: ocxl_config_read_afu failed rc=%d\n",
+                       __func__, rc);
+               goto out;
+       }
+out:
+       return rc;
+}
+
 /**
  * ocxlflash_create_afu() - create the AFU for OCXL
  * @pdev:      PCI device associated with the host.
@@ -102,6 +129,13 @@ static void *ocxlflash_create_afu(struct pci_dev *pdev)
                        __func__, rc);
                goto err1;
        }
+
+       rc = ocxlflash_config_afu(pdev, afu);
+       if (unlikely(rc)) {
+               dev_err(dev, "%s: AFU configuration failed rc=%d\n",
+                       __func__, rc);
+               goto err1;
+       }
 out:
        return afu;
 err1:
index 190d71a3ac2eeddf30dcb8e2e8f76ffe8e77ec5c..f6af247b390bce6d6a57146e8f8635498a00e4e4 100644 (file)
@@ -18,6 +18,7 @@ struct ocxl_hw_afu {
        struct device *dev;             /* Generic device */
 
        struct ocxl_fn_config fcfg;     /* DVSEC config of the function */
+       struct ocxl_afu_config acfg;    /* AFU configuration data */
 
        int fn_actag_base;              /* Function acTag base */
        int fn_actag_enabled;           /* Function acTag number enabled */