rtcpu: camera-diagnostics: Use device_iommu_mapped() to check IOMMU status

Replace the explicit IOMMU domain check using iommu_get_domain_for_dev()
with the more direct device_iommu_mapped() function. This ensures, iommu
domain is mapped and ready.

Bug 5225858

Change-Id: If54b77ed2468b2967a28abf98c5ff3e8517a7405
Signed-off-by: Mohit Ingale <mohiti@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3343722
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Jagadeesh Kinni <jkinni@nvidia.com>
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-by: Bhushan Rayrikar <brayrikar@nvidia.com>
Reviewed-by: Shiva Dubey <sdubey@nvidia.com>
This commit is contained in:
Mohit Ingale
2025-04-18 01:23:52 +00:00
committed by Jon Hunter
parent 2cdcd7f6a2
commit 63597e114a

View File

@@ -391,7 +391,7 @@ static void camera_diag_notify(struct tegra_ivc_channel *chan)
* @retval -EINVAL Invalid parameters * @retval -EINVAL Invalid parameters
* @retval -ENOMEM Failed to allocate memory * @retval -ENOMEM Failed to allocate memory
* @retval -ENODEV Failed to find ISP device node * @retval -ENODEV Failed to find ISP device node
* @retval -EPROBE_DEFER ISP or IOMMU domain not ready yet * @retval -EPROBE_DEFER ISP or IOMMU not yet mapped
*/ */
static int camera_diag_channel_init(struct camera_diag_channel *ch) static int camera_diag_channel_init(struct camera_diag_channel *ch)
{ {
@@ -400,7 +400,6 @@ static int camera_diag_channel_init(struct camera_diag_channel *ch)
struct platform_device *isp_pdev; struct platform_device *isp_pdev;
struct device *isp_dev = NULL; struct device *isp_dev = NULL;
int ret, i; int ret, i;
struct iommu_domain *domain;
struct sg_table sgt; struct sg_table sgt;
int chip_id = __tegra_get_chip_id(); int chip_id = __tegra_get_chip_id();
int max_allowed_instances; int max_allowed_instances;
@@ -492,10 +491,9 @@ static int camera_diag_channel_init(struct camera_diag_channel *ch)
isp_dev = &isp_pdev->dev; isp_dev = &isp_pdev->dev;
/* Check if ISP device has an IOMMU domain attached */ /* Check if ISP device has an IOMMU mapped */
domain = iommu_get_domain_for_dev(isp_dev); if (!device_iommu_mapped(isp_dev)) {
if (!domain) { dev_dbg(&ch->dev, "ISP%d IOMMU not mapped yet, deferring probe\n", i);
dev_dbg(&ch->dev, "ISP%d IOMMU domain not ready yet, deferring probe\n", i);
put_device(&isp_pdev->dev); put_device(&isp_pdev->dev);
of_node_put(isp_node); of_node_put(isp_node);
if (i == 0) { if (i == 0) {