Re: [PATCH 2/2] iommu/amd: Force identity mode for selected GPUs only
Vasant Hegde <[email protected]>
| Newsgroups | dev.linux.lists.iommu,org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
Mario,
On 7/23/2026 10:02 PM, Mario Limonciello wrote:
>
>
> On 7/23/26 11:23, Vasant Hegde wrote:
>> Mario,
>>
>>
>> On 7/23/2026 9:41 PM, Mario Limonciello wrote:
>>>
>>>
>>> On 7/23/26 10:59, Bjorn Helgaas wrote:
>>>> On Thu, Jul 23, 2026 at 06:15:48AM +0000, Vasant Hegde wrote:
>>>>> Certain AMD GPU's must always be in identity mode. Currently its enforced
>>>>> using PASID check. It worked fine as most GPU's has PASID feature. But
>>>>> this means, identity mode enforcement is done for all PASID capable devices.
>>>>
>>>> I think it would be useful to know something about *why* these devices
>>>> require identity mode. And what happens without identity mode, i.e., is
>>>> there a user-visible symptom that happens when the wrong mode is used?
>>>>
>>>> Since the code doesn't test any feature bits, I assume it's because these
>>>> devices have some hardware defect?
>>>>
>>>> s/GPU's/GPUs/ (twice)
.../...
>>
>> +static bool quirks_force_identity_mapping(struct pci_dev *pdev)
>> +{
>> + struct pci_dev *root_port;
>> + int class = pdev->class >> 8;
>> +
>> + /* AMD GPU vendor ID */
>> + if (pdev->vendor != PCI_VENDOR_ID_ATI)
>> + return false;
>> +
>> + /* GPU class */
>> + if (class != PCI_CLASS_DISPLAY_VGA &&
>> + class != PCI_CLASS_DISPLAY_OTHER)
>> + return false;
>> +
>> + if (pci_upstream_bridge(pdev) &&
>
> I don't think you need to check for pci_upstream_bridge() to be non-NULL. You
> already checked that it's an endpoint by looking at the class. So an endpoint
> will be connected to a bridge of some sort (either a switch internal to the dGPU
> or to a root port).
Ok will fix it .
>
>> + pci_upstream_bridge(pdev)->vendor == PCI_VENDOR_ID_ATI)
>> + return false;
>> +
>
> Make sure you leave a comment here about what true means (/* it is the GPU in an
> APU */) so that if we need to add more cases later it's obvious without having
> to dig up this thread again.
Sure.
-Vasant