scsi: cxlflash: Setup function acTag range
authorUma Krishnan <ukrishn@linux.vnet.ibm.com>
Mon, 26 Mar 2018 16:31:21 +0000 (11:31 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 18 Apr 2018 23:32:48 +0000 (19:32 -0400)
The OCXL specification supports distributing acTags amongst different AFUs and
functions on the link. The platform-specific acTag range for the link is
obtained using the OCXL provider services and then assigned to the host
function based on implementation.

Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/cxlflash/ocxl_hw.c
drivers/scsi/cxlflash/ocxl_hw.h

index 85c0f84..7783842 100644 (file)
@@ -42,6 +42,7 @@ static int ocxlflash_config_fn(struct pci_dev *pdev, struct ocxl_hw_afu *afu)
 {
        struct ocxl_fn_config *fcfg = &afu->fcfg;
        struct device *dev = &pdev->dev;
+       u16 base, enabled, supported;
        int rc = 0;
 
        /* Read DVSEC config of the function */
@@ -59,6 +60,20 @@ static int ocxlflash_config_fn(struct pci_dev *pdev, struct ocxl_hw_afu *afu)
                        dev_warn(dev, "%s: Unexpected AFU index value %d\n",
                                 __func__, fcfg->max_afu_index);
        }
+
+       rc = ocxl_config_get_actag_info(pdev, &base, &enabled, &supported);
+       if (unlikely(rc)) {
+               dev_err(dev, "%s: ocxl_config_get_actag_info failed rc=%d\n",
+                       __func__, rc);
+               goto out;
+       }
+
+       afu->fn_actag_base = base;
+       afu->fn_actag_enabled = enabled;
+
+       ocxl_config_set_actag(pdev, fcfg->dvsec_function_pos, base, enabled);
+       dev_dbg(dev, "%s: Function acTag range base=%u enabled=%u\n",
+               __func__, base, enabled);
 out:
        return rc;
 }
index 356a6a3..55e833c 100644 (file)
@@ -19,5 +19,8 @@ struct ocxl_hw_afu {
 
        struct ocxl_fn_config fcfg;     /* DVSEC config of the function */
 
+       int fn_actag_base;              /* Function acTag base */
+       int fn_actag_enabled;           /* Function acTag number enabled */
+
        bool is_present;                /* Function has AFUs defined */
 };