mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vasant Hegde <vasant.hegde@amd.com>
To: Mario Limonciello <superm1@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Joerg Roedel <joro@8bytes.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@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 v2] iommu/amd: Make PerfOpt compulsory
Date: Wed, 30 Sep 2026 19:20:47 +0530	[thread overview]
Message-ID: <9891d6d8-cfbc-4453-97b9-ceca7fb3ea56@amd.com> (raw)
In-Reply-To: <edae0bd0-e580-45f2-953e-dd117791c488@kernel.org>



On 9/30/2026 7:09 PM, Mario Limonciello wrote:
> On 9/30/26 04:38, Vasant Hegde wrote:
>> Mario,
>>

.../...

>>> +    u32 old, val, readback;
>>> +
>>> +    if (!check_feature(FEATURE_PERF_OPT))
>>> +        return enable ? -ENODEV : 0;
>>> +
>>> +    old = readl(iommu->mmio_base + MMIO_PERF_OPT_OFFSET);
>>> +    if (old == U32_MAX)
>>> +        return -EIO;
>>> +
>>> +    val = enable ? old | PERF_OPT_EN : old & ~PERF_OPT_EN;
>>> +    if (val != old)
>>> +        writel(val, iommu->mmio_base + MMIO_PERF_OPT_OFFSET);
>>> +    readback = readl(iommu->mmio_base + MMIO_PERF_OPT_OFFSET);
>>> +    if (readback == U32_MAX ||
>>> +        (readback & PERF_OPT_EN) != (val & PERF_OPT_EN)) {
>>> +        dev_err(iommu->iommu.dev, "Failed to set PerfOpt to %d\n", enable);
>>> +        return -EIO;
>>> +    }
>>> +
>>
>> May be check return value before enabling dev_data->perfopt?
> 
> I thought about this.
> 
> Let me know what you think of the approach of clearing the bit in amd_iommu_efr
> on failures within amd_iommu_perfopt_set().

Yeah. It makes sense.

-Vasant


      reply	other threads:[~2026-09-30 13:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  1:34 Mario Limonciello (AMD)
2026-09-30  9:38 ` Vasant Hegde
2026-09-30 13:39   ` Mario Limonciello
2026-09-30 13:50     ` Vasant Hegde [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=9891d6d8-cfbc-4453-97b9-ceca7fb3ea56@amd.com \
    --to=vasant.hegde@amd.com \
    --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=superm1@kernel.org \
    --cc=suravee.suthikulpanit@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®