Re: [PATCH 2/2] iommu/amd: Force identity mode for selected GPUs only
Mario Limonciello <[email protected]> Mon, 27 Jul 2026 09:45:36 -0500
| Newsgroups | dev.linux.lists.iommu,org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
On 7/26/26 23:19, Vasant Hegde wrote:
>
>
> On 7/24/2026 8:45 PM, Jason Gunthorpe wrote:
>> On Thu, Jul 23, 2026 at 06:15:48AM +0000, Vasant Hegde wrote:
>>> @@ -3120,20 +3146,28 @@ static int amd_iommu_def_domain_type(struct device *dev)
>>> if (!dev_data)
>>> return 0;
>>>
>>> + if (!dev_is_pci(dev))
>>> + return 0;
>>> +
>>> /* Always use DMA domain for untrusted device */
>>> - if (dev_is_pci(dev) && to_pci_dev(dev)->untrusted)
>>> + if (to_pci_dev(dev)->untrusted)
>>> return IOMMU_DOMAIN_DMA;
>>
>> The core code does this, it shouldn't be in a driver?
>
> Right. I didn't realized core has this check. I will drop this check in next
> version.
>
>>
>>> - /*
>>> - * Do not identity map IOMMUv2 capable devices when:
>>> - * - memory encryption is active, because some of those devices
>>> - * (AMD GPUs) don't have the encryption bit in their DMA-mask
>>> - * and require remapping.
>>> - * - SNP is enabled, because it prohibits DTE[Mode]=0.
>>> - */
>>> - if (pdev_pasid_supported(dev_data) &&
>>> - !cc_platform_has(CC_ATTR_MEM_ENCRYPT) &&
>>> - !amd_iommu_snp_en) {
>>> + /* Apply device specific quirks */
>>> + if (quirks_force_identity_mapping(to_pci_dev(dev))) {
>>> +
>>> + /*
>>> + * When memory encryption is active, some of these devices
>>> + * don't have the encryption bit in their DMA-mask and
>>> + * require remapping.
>>> + */
>>> + if (cc_platform_has(CC_ATTR_MEM_ENCRYPT))
>>> + return 0;
>>
>> I think this can probably be dropped now? There is no intersection of
>> this old broken embedded GPU and a CPU that supports CC right?
>
>
> I did consider dropping these two checks, but I was not entirely sure. So I kept
> as is for now. Once these series settles and I can go with next step of dropping
> these two checks.
>
> @Alex, @Mario, Any suggestions ?
>
The background comes from this series:
https://lore.kernel.org/all/[email protected]/
> -Vasant
>
>>
>>> +
>>> + /* DTE[Mode]=0 is prohibited when SNP is enabled */
>>> + if (amd_iommu_snp_en)
>>> + return 0;
>>
>> Ditto?
>>
>> Jason
>