From: Xu Yilun <yilun.xu@linux.intel.com>
To: adrianhoyin.ng@altera.com
Cc: dinguyen@kernel.org, mdf@kernel.org, yilun.xu@intel.com,
trix@redhat.com, linux-fpga@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] firmware: stratix10-svc: Add SMMU support for Agilex5
Date: Fri, 19 Dec 2025 22:44:29 +0800 [thread overview]
Message-ID: <aUVkzV447+NDmLg1@yilunxu-OptiPlex-7050> (raw)
In-Reply-To: <20251217055632.1776206-2-adrianhoyin.ng@altera.com>
> @@ -1907,8 +1988,52 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
> controller->genpool = genpool;
> controller->task = NULL;
> controller->invoke_fn = invoke_fn;
> + controller->is_smmu_enabled = false;
> + controller->sdm_dma_addr_offset = 0x0;
> init_completion(&controller->complete_status);
>
> + if (of_device_is_compatible(node, "intel,agilex5-svc")) {
> + if (device_iommu_mapped(&pdev->dev)) {
> + controller->is_smmu_enabled = true;
> + controller->sdm_dma_addr_offset = AGILEX5_SDM_DMA_ADDR_OFFSET;
> + pr_debug("Intel Service Layer Driver: IOMMU Present\n");
> + controller->domain = iommu_get_dma_domain(dev);
> +
> + if (!controller->domain) {
> + pr_warn("Intel Service Layer Driver: Error IOMMU domain\n");
> + ret = -ENODEV;
> + goto err_destroy_pool;
> + } else {
> + ret = iova_cache_get();
> + if (ret < 0) {
> + pr_warn("Intel Service Layer Driver: IOVA cache failed\n");
> + iommu_domain_free(controller->domain);
> + ret = -ENODEV;
> + goto err_destroy_pool;
> + }
> + ret = iommu_attach_device(controller->domain, dev);
I don't understand why you retrieved device's default domain and set it
back to the same device. Seems nothing changed?
> + if (ret) {
> + pr_warn("Intel Service Layer Driver: Error IOMMU attach failed\n");
> + iova_cache_put();
> + iommu_domain_free(controller->domain);
> + ret = -ENODEV;
> + goto err_destroy_pool;
> + }
> + }
> +
> + order = __ffs(controller->domain->pgsize_bitmap);
> + init_iova_domain(&controller->carveout.domain, 1UL << order,
> + IOMMU_STARTING_ADDR);
And why you have to carveout an iova space? The requirement is just the
device can only accept 24bit iova address, that's normal requrement for
many devices, can we just do:
dma_set_mask(dev, DMA_BIT_MASK(24));
dma_set_coherent_mask(dev, DMA_BIT_MASK(24));
dma_map_single(...)
instead of manipulating iova && iommu mapping by your own?
Another thing is why we should bifurcate direct dma & iommu mapped dma
in the driver, DMA APIs take care of these 2 cases.
Thanks,
Yilun
next prev parent reply other threads:[~2025-12-19 15:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 5:56 [PATCH 0/2] Add Agilex5 SMMU support for service layer and FPGA manager adrianhoyin.ng
2025-12-17 5:56 ` [PATCH 1/2] firmware: stratix10-svc: Add SMMU support for Agilex5 adrianhoyin.ng
2025-12-19 14:44 ` Xu Yilun [this message]
2025-12-17 5:56 ` [PATCH 2/2] fpga: stratix10-soc: Add persistent SMMU-aware DMA handling " adrianhoyin.ng
2025-12-19 15:09 ` Xu Yilun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aUVkzV447+NDmLg1@yilunxu-OptiPlex-7050 \
--to=yilun.xu@linux.intel.com \
--cc=adrianhoyin.ng@altera.com \
--cc=dinguyen@kernel.org \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=trix@redhat.com \
--cc=yilun.xu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®