From: Lu Baolu <baolu.lu@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Kevin Tian <kevin.tian@intel.com>
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
Lu Baolu <baolu.lu@linux.intel.com>
Subject: [PATCH v3 0/7] iommu/vt-d: Convert to use static identity domain
Date: Tue, 6 Aug 2024 10:39:34 +0800 [thread overview]
Message-ID: <20240806023941.93454-1-baolu.lu@linux.intel.com> (raw)
Intel's IOMMU driver used a special domain called 1:1 mapping domain to
support the domain of type IOMMU_DOMAIN_IDENTITY, which enables device
drivers to directly utilize physical addresses for DMA access despite
the presence of IOMMU units.
The implementation of the 1:1 mapping domain is influenced by hardware
differences. While modern Intel VT-d implementations support hardware
passthrough translation mode, earlier versions lacked this feature,
which requires a more complex implementation approach.
The 1:1 mapping domain for earlier hardware was implemented by associating
a DMA domain with an IOVA (IO Virtual Address) equivalent to the
physical address. While, for most hardware supporting passthrough mode,
simply setting the hardware's passthrough mode is sufficient. These two
modes were merged together in si_domain, which is a special DMA domain
sharing the domain ops of an ordinary DMA domain.
As the iommu core has evolved, it has introduced global static identity
domain with "never fail" attach semantics. This means that the domain is
always available and cannot fail to attach. The iommu driver now assigns
this domain directly at iommu_ops->identity_domain instead of allocating
it through the domain allocation interface.
This converts the Intel IOMMU driver to embrace the global static
identity domain. For early legacy hardwares that don't support
passthrough translation mode, ask the iommu core to use a DMA type of
default domain. For modern hardwares that support passthrough
translation mode, implement a static global identity domain.
The whole series is also available at
https://github.com/LuBaolu/intel-iommu/commits/vtd-static-identity-domain-v3
Change log:
v3:
- Kevin worried that some graphic devices might still require identity
domain. Forcing DMA domain for those drivers might break the existing
functionality.
https://lore.kernel.org/linux-iommu/BN9PR11MB52761FF9AB496B422596DDDF8C8AA@BN9PR11MB5276.namprd11.prod.outlook.com/
After confirmed with the graphic community, we decouple "igfx_off"
kernel command from graphic identity mapping with the following commits:
ba00196ca41c ("iommu/vt-d: Decouple igfx_off from graphic identity mapping")
4b8d18c0c986 ("iommu/vt-d: Remove INTEL_IOMMU_BROKEN_GFX_WA").
v2: https://lore.kernel.org/linux-iommu/20231205012203.244584-1-baolu.lu@linux.intel.com/
- Re-orgnize the patches by removing 1:1 mappings before implementing
global static domain.
v1: https://lore.kernel.org/linux-iommu/20231120112944.142741-1-baolu.lu@linux.intel.com/
Lu Baolu (7):
iommu/vt-d: Require DMA domain if hardware not support passthrough
iommu/vt-d: Remove identity mappings from si_domain
iommu/vt-d: Always reserve a domain ID for identity setup
iommu/vt-d: Prepare for global static identity domain
iommu/vt-d: Factor out helpers from domain_context_mapping_one()
iommu/vt-d: Add support for static identity domain
iommu/vt-d: Cleanup si_domain
drivers/iommu/intel/iommu.c | 434 +++++++++++++++++-------------------
1 file changed, 201 insertions(+), 233 deletions(-)
--
2.34.1
next reply other threads:[~2024-08-06 2:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-06 2:39 Lu Baolu [this message]
2024-08-06 2:39 ` [PATCH v3 1/7] iommu/vt-d: Require DMA domain if hardware not support passthrough Lu Baolu
2024-08-06 16:54 ` Jason Gunthorpe
2024-08-14 16:13 ` Jerry Snitselaar
2024-08-06 2:39 ` [PATCH v3 2/7] iommu/vt-d: Remove identity mappings from si_domain Lu Baolu
2024-08-06 17:05 ` Jason Gunthorpe
2024-08-07 6:14 ` Baolu Lu
2024-08-06 2:39 ` [PATCH v3 3/7] iommu/vt-d: Always reserve a domain ID for identity setup Lu Baolu
2024-08-06 17:06 ` Jason Gunthorpe
2024-08-07 6:19 ` Baolu Lu
2024-08-07 12:09 ` Jason Gunthorpe
2024-08-07 13:38 ` Baolu Lu
2024-08-14 16:31 ` Jerry Snitselaar
2024-08-06 2:39 ` [PATCH v3 4/7] iommu/vt-d: Prepare for global static identity domain Lu Baolu
2024-08-06 17:12 ` Jason Gunthorpe
2024-08-07 6:41 ` Baolu Lu
2024-08-07 12:17 ` Jason Gunthorpe
2024-08-07 13:44 ` Baolu Lu
2024-08-06 2:39 ` [PATCH v3 5/7] iommu/vt-d: Factor out helpers from domain_context_mapping_one() Lu Baolu
2024-08-06 17:13 ` Jason Gunthorpe
2024-08-14 16:19 ` Jerry Snitselaar
2024-08-06 2:39 ` [PATCH v3 6/7] iommu/vt-d: Add support for static identity domain Lu Baolu
2024-08-06 17:18 ` Jason Gunthorpe
2024-08-06 2:39 ` [PATCH v3 7/7] iommu/vt-d: Cleanup si_domain Lu Baolu
2024-08-06 17:19 ` Jason Gunthorpe
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=20240806023941.93454-1-baolu.lu@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--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