Commit 3351e4f0 authored by Uma Krishnan's avatar Uma Krishnan Committed by Martin K. Petersen

scsi: cxlflash: Support AFU state toggling

The AFU should be enabled following a successful configuration and disabled
near the end of the cleanup path.
Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
Acked-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 012f394c
...@@ -342,12 +342,18 @@ static void ocxlflash_unconfig_afu(struct ocxl_hw_afu *afu) ...@@ -342,12 +342,18 @@ static void ocxlflash_unconfig_afu(struct ocxl_hw_afu *afu)
static void ocxlflash_destroy_afu(void *afu_cookie) static void ocxlflash_destroy_afu(void *afu_cookie)
{ {
struct ocxl_hw_afu *afu = afu_cookie; struct ocxl_hw_afu *afu = afu_cookie;
int pos;
if (!afu) if (!afu)
return; return;
ocxlflash_release_context(afu->ocxl_ctx); ocxlflash_release_context(afu->ocxl_ctx);
idr_destroy(&afu->idr); idr_destroy(&afu->idr);
/* Disable the AFU */
pos = afu->acfg.dvsec_afu_control_pos;
ocxl_config_set_afu_state(afu->pdev, pos, 0);
ocxlflash_unconfig_afu(afu); ocxlflash_unconfig_afu(afu);
kfree(afu); kfree(afu);
} }
...@@ -499,6 +505,9 @@ static int ocxlflash_config_afu(struct pci_dev *pdev, struct ocxl_hw_afu *afu) ...@@ -499,6 +505,9 @@ static int ocxlflash_config_afu(struct pci_dev *pdev, struct ocxl_hw_afu *afu)
__func__, rc); __func__, rc);
goto out; goto out;
} }
/* Enable the AFU */
ocxl_config_set_afu_state(pdev, acfg->dvsec_afu_control_pos, 1);
out: out:
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment