From: Mario Limonciello <superm1@kernel.org>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Alex Deucher <alexander.deucher@amd.com>,
Joerg Roedel <joro@8bytes.org>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Vasant Hegde <vasant.hegde@amd.com>,
"open list:RADEON and AMDGPU DRM DRIVERS"
<amd-gfx@lists.freedesktop.org>,
open list <linux-kernel@vger.kernel.org>,
"open list:AMD IOMMU (AMD-VI)" <iommu@lists.linux.dev>
Subject: Re: [PATCH] iommu/amd: Make PerfOpt compulsory for APUs in identity
Date: Mon, 28 Sep 2026 13:01:20 -0500 [thread overview]
Message-ID: <7a503739-9458-4d2a-a84f-276ebeb7b713@kernel.org> (raw)
In-Reply-To: <20260928172741.GJ163130@ziepe.ca>
On 9/28/26 12:27, Jason Gunthorpe wrote:
> On Sun, Sep 27, 2026 at 11:50:50PM -0500, Mario Limonciello (AMD) wrote:
>> PerfOpt is only a feature usable by integrated GPUs and only in identity
>> mode. Instead of leaving a policy knob in amdgpu, just turn it on when
>> an integrated GPU in an APU is in identity. Re-use the heuristic in
>> amd_iommu_def_domain_type() to make this decision.
>>
>> This drops quite a bit of compatibility glue. There was a refcounting
>> system, exported symbols, and device attach/detach logic. By just setting
>> it immediately it's a lot more straightforward.
>>
>> Suggested-by: Jason Gunthorpe <jgg@ziepe.ca>
>> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 -
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 50 -----
>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 --
>> drivers/iommu/amd/amd_iommu.h | 2 +-
>> drivers/iommu/amd/amd_iommu_types.h | 3 -
>> drivers/iommu/amd/init.c | 3 +-
>> drivers/iommu/amd/iommu.c | 234 ++++-----------------
>> include/linux/amd-iommu.h | 11 -
>> 8 files changed, 48 insertions(+), 268 deletions(-)
>
> Diffing across the originals to net them out it is much smaller:
>
> 5 files changed, 122 insertions(+), 1 deletion(-)
>
> And I think this is much better , but I have a few questions
>
> Why is this setting and clearing perf_opt in dev_data?
>
> I expect probe to make a determination if this device has the special
> path and if so then there should be a permanent flag in the dev_data.
>
> Based on that flag amd_iommu_def_domain_type() can return identity to
> override things
>
> When the driver does an identity attachment it would enable the
> perfopt and write out the right DTE for it.
I believe you're right. This was an artifact from the tracking I had to
do when it was a two driver solution. I'll rework it.
>
> Whenever the driver removes that identity it would disable the
> perf_opt. These points are all marked out in the attach function flow
> you don't need another variable to keep track, or the funny logic to
> block things. All you want is an attached identity domain that is
> "optimized".
>
> Release goes to blocked which should already disable it, so no need to
> disable it again in amd_iommu_release_device()
>
> The repeated pattern is a bit much:
> + if (dev_data->perfopt) {
> + if (WARN_ON(amd_iommu_perfopt_clear(iommu)))
> + dev_err(dev, "IOMMU%d: failed to clear PerfOpt on release\n",
> + iommu->index);
>
> Clear should probably just do the warn on and not return any error
> code. It is never OK to allow this to fail..
OK.
>
> I'm also scratching my head a bit why the global register needs to be
> set/unset like this? Does that global bit completely bypass the iommu
> for a single special device? With no way to discover from FW which BDF
> is the special device? If this is the right guess please document this
> in a comment around __perfopt_write (and again that's awful, ACPI
> should have a pointer to the special device so the OS can understand
> this)
>
Yeah; it's only for the privileged integrated GPU to access system memory.
I'll leave a comment around it in a v2.
prev parent reply other threads:[~2026-09-28 18:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 4:50 Mario Limonciello (AMD)
2026-09-28 17:27 ` Jason Gunthorpe
2026-09-28 18:01 ` Mario Limonciello [this message]
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=7a503739-9458-4d2a-a84f-276ebeb7b713@kernel.org \
--to=superm1@kernel.org \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@amd.com \
/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
all inboxes | Powered by JetHome®