Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e286bcfc authored by Scott Bauer's avatar Scott Bauer Committed by Jens Axboe
Browse files

nvme/pci: re-check security protocol support after reset



A device may change capabilities after each reset, e.g. due to a firmware
upgrade.  We should thus check for Security Send/Receive and OPAL support
after each reset.

Based on patches from Christoph and Keith.

Signed-off-by: default avatarScott Bauer <scott.bauer@intel.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 7d6d1578
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -1736,7 +1736,7 @@ static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl)
	if (dev->ctrl.admin_q)
		blk_put_queue(dev->ctrl.admin_q);
	kfree(dev->queues);
	kfree(dev->ctrl.opal_dev);
	free_opal_dev(dev->ctrl.opal_dev);
	kfree(dev);
}

@@ -1786,13 +1786,16 @@ static void nvme_reset_work(struct work_struct *work)
	if (result)
		goto out;

	if ((dev->ctrl.oacs & NVME_CTRL_OACS_SEC_SUPP) && !dev->ctrl.opal_dev) {
	if (dev->ctrl.oacs & NVME_CTRL_OACS_SEC_SUPP) {
		if (!dev->ctrl.opal_dev)
			dev->ctrl.opal_dev =
				init_opal_dev(&dev->ctrl, &nvme_sec_submit);
	}

	if (was_suspend)
		else if (was_suspend)
			opal_unlock_from_suspend(dev->ctrl.opal_dev);
	} else {
		free_opal_dev(dev->ctrl.opal_dev);
		dev->ctrl.opal_dev = NULL;
	}

	result = nvme_setup_io_queues(dev);
	if (result)