AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, Mario Limonciello <superm1@gmail.com>
Cc: Joerg Roedel <joro@8bytes.org>,
	Alex Deucher <alexander.deucher@amd.com>,
	 amd-gfx@lists.freedesktop.org,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Vasant Hegde <vasant.hegde@amd.com>,
	Will Deacon <will@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	"open list:AMD IOMMU (AMD-VI)" <iommu@lists.linux.dev>,
	Jatin Kataria <jkataria@netflix.com>,
	Boqun Feng <boqunf@netflix.com>,
	"Derek J . Clark" <derekjohn.clark@gmail.com>
Subject: Re: [PATCH v2 1/2] iommu/amd: Add PerfOpt IOMMU performance optimization support
Date: Mon, 28 Sep 2026 10:32:41 -0500	[thread overview]
Message-ID: <34bcdf7a-82b1-43cb-8409-735ebef3fa97@amd.com> (raw)
In-Reply-To: <20260928120831.GF163130@ziepe.ca>



On 9/28/26 07:08, Jason Gunthorpe wrote:
> On Fri, Sep 25, 2026 at 07:33:08PM -0500, Mario Limonciello wrote:
>>
>>
>> On 9/25/26 5:39 PM, Jason Gunthorpe wrote:
>>> On Fri, Sep 25, 2026 at 08:11:41AM -0500, Mario Limonciello wrote:
>>>>
>>>>
>>>> On 9/25/26 07:28, Jason Gunthorpe wrote:
>>>>> On Fri, Sep 25, 2026 at 09:20:02AM +0200, Joerg Roedel wrote:
>>>>>> On Thu, Sep 24, 2026 at 07:50:18PM -0300, Jason Gunthorpe wrote:
>>>>>>> Why does the GPU driver have to request this? Why can't the iommu
>>>>>>> driver know that this is a special device that can use this magic fast
>>>>>>> path and then auto set it when identity is asked for?
>>>>>>
>>>>>> This is a layering violation either way. Either the IOMMU driver needs to poke
>>>>>> into device details and their relations or the device driver needs to poke into
>>>>>> IOMMU details.
>>>>>
>>>>> There are no device details, this is just a module option in the gpu
>>>>> driver.
>>>>
>>>> Well the GPU driver has knowledge whether it's a GPU inside of an APU to
>>>> decide if it's valid.  That information is part of the discovery table
>>>> setup.
>>>
>>> Where was that in patch 2?
>>
>> amdgpu_device_use_perfopt()
> 
> Ah, sneaky, that looks like it just decodes from a a giant list of PCI IDs

Actually; no.  amdgpu has migrated away from PCI IDs and probes based on 
the "ATI vendor" + "display class" instead.  As part of the probe 
sequence there is something called an IP discovery table pull from the 
platform that identifies all IP blocks in the hardware.

This IP discovery table will indicate graphics IP and that is mapped to 
relevant driver code.  So for example GC 11.5.1 is what you find in a 
Strix Halo APU.  If a future APU had exactly the same graphics IP but a 
different display IP it would still be GC 11.5.1.

This design was implemented about 4 years ago, and all SoCs (APU, dGPU 
and accelerator) since then use it.
>   
>>> The right way for this to work is to quirk it through the iommu driver
>>> so it can choose the fast mode, and not involve the GPU driver at
>>> all. Like we've done for every other GPU weirdness. And AMD should be
>>> making this work better by providing ACPI support so the iommu driver
>>> can understand how it should work without inspecting PCI IDs.
>>
>> There is a heuristic that Vasant added recently that we detect APU from the
>> IOMMU driver.  We might be able to use that for now.
>>
>> I'll take a look at what an incremental patch looks like on top of
>> iommu/next that I think reworks all these paths the way you want.  I should
>> be able to post something next week.
> 
> ACPI is the right answer to these kinds of problems.
> 
> Jason

I'll discuss this with architects for the future programs.

For now as promissed I've worked out a patch [1] that keeps it all in 
iommu/amd per your suggestions.  It is using the existing APU heuristic.

https://lore.kernel.org/linux-iommu/20260928045050.955165-1-superm1@kernel.org/ 
[1]

  reply	other threads:[~2026-09-28 15:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08  4:12 [PATCH v2 0/2] IOMMU Performance Optimization support Mario Limonciello
2026-09-08  4:12 ` [PATCH v2 1/2] iommu/amd: Add PerfOpt IOMMU performance optimization support Mario Limonciello
2026-09-24 22:50   ` Jason Gunthorpe
2026-09-25  0:03     ` Mario Limonciello
2026-09-25  0:17       ` Jason Gunthorpe
2026-09-25  0:21         ` Mario Limonciello
2026-09-25  7:20     ` Joerg Roedel
2026-09-25 12:28       ` Jason Gunthorpe
2026-09-25 13:11         ` Mario Limonciello
2026-09-25 22:39           ` Jason Gunthorpe
2026-09-26  0:33             ` Mario Limonciello
2026-09-28 12:08               ` Jason Gunthorpe
2026-09-28 15:32                 ` Mario Limonciello [this message]
2026-09-28 17:11                   ` Jason Gunthorpe
2026-09-28 17:15                     ` Mario Limonciello
2026-09-29  2:53                       ` Deucher, Alexander
2026-09-28  5:17     ` Christoph Hellwig
2026-09-25  7:30   ` Joerg Roedel
2026-09-08  4:12 ` [PATCH v2 2/2] drm/amdgpu: Enable PerfOpt IOMMU perf optimization when GPU in identity domain Mario Limonciello
2026-09-20 14:10 ` [PATCH v2 0/2] IOMMU Performance Optimization support Mario Limonciello
2026-09-20 16:27 ` Boqun Feng
2026-09-24 11:42 ` Joerg Roedel
2026-09-24 13:01   ` Deucher, Alexander
2026-09-24 13:50     ` Joerg Roedel

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=34bcdf7a-82b1-43cb-8409-735ebef3fa97@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=boqunf@netflix.com \
    --cc=derekjohn.clark@gmail.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=jkataria@netflix.com \
    --cc=joro@8bytes.org \
    --cc=robin.murphy@arm.com \
    --cc=superm1@gmail.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=vasant.hegde@amd.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