idxd: disable the idxd device on shutdown

Required by spec.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ib13ca2d7ab7045a87ddc483dc1f70e649b3b9294
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10982
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
This commit is contained in:
paul luse 2022-01-05 14:38:52 -07:00 committed by Jim Harris
parent c501d2b37c
commit af6d280247

View File

@ -180,6 +180,18 @@ idxd_map_pci_bars(struct spdk_idxd_device *idxd)
return 0;
}
static void
idxd_disable_dev(struct spdk_idxd_device *idxd)
{
int rc;
_idxd_write_4(idxd, IDXD_CMD_OFFSET, IDXD_DISABLE_DEV << IDXD_CMD_SHIFT);
rc = idxd_wait_cmd(idxd, IDXD_REGISTER_TIMEOUT_US);
if (rc < 0) {
SPDK_ERRLOG("Error disabling device %u\n", rc);
}
}
static int
idxd_reset_dev(struct spdk_idxd_device *idxd)
{
@ -427,6 +439,8 @@ user_idxd_device_destruct(struct spdk_idxd_device *idxd)
{
struct spdk_user_idxd_device *user_idxd = __user_idxd(idxd);
idxd_disable_dev(idxd);
idxd_unmap_pci_bar(idxd, IDXD_MMIO_BAR);
idxd_unmap_pci_bar(idxd, IDXD_WQ_BAR);
free(idxd->groups);