Skip to content

Commit 184bee3

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Require DMA domain if hardware not support passthrough
The iommu core defines the def_domain_type callback to query the iommu driver about hardware capability and quirks. The iommu driver should declare IOMMU_DOMAIN_DMA requirement for hardware lacking pass-through capability. Earlier VT-d hardware implementations did not support pass-through translation mode. The iommu driver relied on a paging domain with all physical system memory addresses identically mapped to the same IOVA to simulate pass-through translation before the def_domain_type was introduced and it has been kept until now. It's time to adjust it now to make the Intel iommu driver follow the def_domain_type semantics. Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 7c626ce commit 184bee3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,6 +2149,16 @@ static bool device_rmrr_is_relaxable(struct device *dev)
21492149

21502150
static int device_def_domain_type(struct device *dev)
21512151
{
2152+
struct device_domain_info *info = dev_iommu_priv_get(dev);
2153+
struct intel_iommu *iommu = info->iommu;
2154+
2155+
/*
2156+
* Hardware does not support the passthrough translation mode.
2157+
* Always use a dynamaic mapping domain.
2158+
*/
2159+
if (!ecap_pass_through(iommu->ecap))
2160+
return IOMMU_DOMAIN_DMA;
2161+
21522162
if (dev_is_pci(dev)) {
21532163
struct pci_dev *pdev = to_pci_dev(dev);
21542164

0 commit comments

Comments
 (0)