Commit f54a0fb7 authored by Jerry Snitselaar's avatar Jerry Snitselaar Committed by Xiaochen Shen
Browse files

dmaengine: idxd: Check for driver name match before sva user feature

mainline inclusion
from mainline-v6.10-rc1
commit c863062cf8250d8330859fc1d730b2aed3313bcd
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I9TA1S
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c863062cf8250d8330859fc1d730b2aed3313bcd



--------------------------------

Currently if the user driver is probed on a workqueue configured for
another driver with SVA not enabled on the system, it will print
out a number of probe failing messages like the following:

    [   264.831140] user: probe of wq13.0 failed with error -95

On some systems, such as GNR, the number of messages can
reach over 100.

Move the SVA feature check to be after the driver name match
check.

Intel-SIG: commit c863062cf825 dmaengine: idxd: Check for driver name match before sva user feature.
Incremental backporting patches for DSA/IAA on Intel Xeon platform.

Cc: Vinod Koul <vkoul@kernel.org>
Cc: dmaengine@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: default avatarFenghua Yu <fenghua.yu@intel.com>
Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
Link: https://lore.kernel.org/r/20240405213941.3629709-1-jsnitsel@redhat.com


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarXiaochen Shen <xiaochen.shen@intel.com>
parent a1adce22
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -593,6 +593,14 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev)
	if (idxd->state != IDXD_DEV_ENABLED)
		return -ENXIO;

	mutex_lock(&wq->wq_lock);

	if (!idxd_wq_driver_name_match(wq, dev)) {
		idxd->cmd_status = IDXD_SCMD_WQ_NO_DRV_NAME;
		rc = -ENODEV;
		goto wq_err;
	}

	/*
	 * User type WQ is enabled only when SVA is enabled for two reasons:
	 *   - If no IOMMU or IOMMU Passthrough without SVA, userspace
@@ -608,14 +616,7 @@ static int idxd_user_drv_probe(struct idxd_dev *idxd_dev)
		dev_dbg(&idxd->pdev->dev,
			"User type WQ cannot be enabled without SVA.\n");

		return -EOPNOTSUPP;
	}

	mutex_lock(&wq->wq_lock);

	if (!idxd_wq_driver_name_match(wq, dev)) {
		idxd->cmd_status = IDXD_SCMD_WQ_NO_DRV_NAME;
		rc = -ENODEV;
		rc = -EOPNOTSUPP;
		goto wq_err;
	}