From: Jason Gunthorpe <jgg@nvidia.com>
To: Baolu Lu <baolu.lu@linux.intel.com>
Cc: iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
Christoph Hellwig <hch@infradead.org>,
Kevin Tian <kevin.tian@intel.com>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/6] ARM/dma-mapping: Remove iommu_detach_device()
Date: Sat, 18 Feb 2023 11:58:53 -0400 [thread overview]
Message-ID: <Y/D1vVlqnLAlu2Ck@nvidia.com> (raw)
In-Reply-To: <6be2aa16-817a-fb85-5371-08e656a29217@linux.intel.com>
On Sat, Feb 18, 2023 at 02:59:16PM +0800, Baolu Lu wrote:
> > arm_iommu doesn't work that way, it allocates and assigns domains so
> > when the platform DMA ops are in control the group->domain is not NULL
>
> This is what the iommu core assumes, right? Any iommu group should
> always has a domain attached, default domain, blocking domain or driver-
> owned unmanaged domain. The iommu core just switches between different
> domains.
That would be nice, but we still have NULL domains in some cases right
now.
> > - which is the opposite of S390's design. Further when arm_iommu asks
> > for a NULL domain it doesn't mean "put it back to platform DMA ops" it
> > really means "park the IOMMU it is not being used anymore"
>
> This is what identity domain and blocking domains were designed to do,
> right?
>
> If my understanding is right, ARM presumably could implement the
> identity default domain and blocking domain. With that implemented,
> iommu_attach/detac_device() could be removed from drivers and everything
> then could go through the iommu core.
Yes, ideally, but I have no idea what the few reamining drivers do
with their code to properly classify it. So what I showed in the
little sketch was to just mark it DOMAIN_PRIVATE and if someone knows
the right answer they can change it to blocking/identity someday.
In the mean time we can get rid of the NULL domain situation. The core
code would immediately attach either the default or 'idle' domain on
probe and a device will always have a domain attached until release.
I still don't entirely understand how exynox works. In ARM64 mode it
should have default domains, but since it doesn't supply a
def_domain_type() op it only gets the default set of default domains
eg PCI devices.
So on ARM64 some devices don't get default domains, and on ARM32 those
devices use arm_iommu but crashed because of a lack of default domain?
It is confusing. It is harmelss to create a DMA default domain on
ARM32, at worst it wastes a bit of memory. So maybe the fact it
crashes on ARM32 indicates a bug on ARM64 where some devices are not
properly using default domains??
Jason
next prev parent reply other threads:[~2023-02-18 15:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 9:47 [PATCH v2 0/6] iommu: Extend changing default domain to normal group Lu Baolu
2023-02-17 9:47 ` [PATCH v2 1/6] ARM/dma-mapping: Remove iommu_detach_device() Lu Baolu
2023-02-17 15:39 ` Jason Gunthorpe
2023-02-18 6:59 ` Baolu Lu
2023-02-18 15:58 ` Jason Gunthorpe [this message]
2023-02-20 14:21 ` Robin Murphy
2023-02-17 9:47 ` [PATCH v2 2/6] iommu: Split iommu_group_remove_device() into helpers Lu Baolu
2023-02-17 9:47 ` [PATCH v2 3/6] iommu: Same critical region for device release and removal Lu Baolu
2023-02-17 15:40 ` Jason Gunthorpe
2023-02-18 7:29 ` Baolu Lu
2023-02-21 1:13 ` Jason Gunthorpe
2023-02-17 9:47 ` [PATCH v2 4/6] iommu: Move lock from iommu_change_dev_def_domain() to its caller Lu Baolu
2023-02-17 9:47 ` [PATCH v2 5/6] iommu: Replace device_lock() with group->mutex Lu Baolu
2023-02-17 9:47 ` [PATCH v2 6/6] iommu: Cleanup iommu_change_dev_def_domain() Lu Baolu
2023-02-17 15:47 ` [PATCH v2 0/6] iommu: Extend changing default domain to normal group Jason Gunthorpe
2023-02-18 7:31 ` Baolu Lu
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=Y/D1vVlqnLAlu2Ck@nvidia.com \
--to=jgg@nvidia.com \
--cc=baolu.lu@linux.intel.com \
--cc=hch@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/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