From: Fenghua Yu fenghua.yu@intel.com Sent: Saturday, October 15, 2022 6:26 AM
/*
* User type WQ is enabled only when SVA is enabled for two
reasons:
* - If no IOMMU or IOMMU Passthrough without SVA, userspace
This statement is kind of misleading. Even if IOMMU is in DMA mode user type WQ still doesn't work w/o SVA.
* can directly access physical address through the WQ.
* - The IDXD cdev driver does not provide any ways to pin
* user pages and translate the address from user VA to IOVA or
* PA without IOMMU SVA. Therefore the application has no way
* to instruct the device to perform DMA function. This makes
* the cdev not usable for normal application usage.
*/
It could be simply stated as "SVA is the only secure/reliable way for the device to access user space memory"
if (!device_user_pasid_enabled(idxd)) {
idxd->cmd_status = IDXD_SCMD_WQ_USER_NO_IOMMU;
be specific i.e. IDXD_SCMD_WQ_USER_NO_SVA
dev_dbg(&idxd->pdev->dev,
"User type WQ cannot be enabled without SVA.\n");
return -EOPNOTSUPP;
}
with above change the check on pasid_enabled should be removed from idxd_cdev_open() and idxd_cdev_release(). They should always work with SVA enabled.