public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Suthikulpanit, Suravee" <suravee.suthikulpanit@amd.com>
To: Shuah Khan <skhan@linuxfoundation.org>,
	linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org
Cc: joro@8bytes.org, will@kernel.org, jsnitsel@redhat.com,
	pmenzel@molgen.mpg.de, Jon.Grimm@amd.com,
	Tj <ml.linux@elloe.vision>,
	Alexander Monakov <amonakov@ispras.ru>,
	David Coe <david.coe@live.co.uk>
Subject: Re: [PATCH 1/2] Revert "iommu/amd: Fix performance counter initialization"
Date: Tue, 13 Apr 2021 20:36:11 +0700	[thread overview]
Message-ID: <c48c9579-e123-7dfb-47ca-a93856731f6f@amd.com> (raw)
In-Reply-To: <f156768c-37fd-a4e8-3959-a5bc5dae918c@linuxfoundation.org>

Shuah,

On 4/10/2021 12:06 AM, Shuah Khan wrote:
>> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
>> index 321f5906e6ed..648cdfd03074 100644
>> --- a/drivers/iommu/amd/init.c
>> +++ b/drivers/iommu/amd/init.c
>> ....
>> @@ -1729,39 +1728,17 @@ static void __init init_iommu_perf_ctr(struct amd_iommu *iommu)
>>       amd_iommu_pc_present = true;
>>       /* save the value to restore, if writable */
>> -    if (iommu_pc_get_set_reg(iommu, 0, 0, 0, &save_reg, false) ||
>> -        iommu_pc_get_set_reg(iommu, 0, 0, 8, &save_src, false))
>> -        goto pc_false;
>> -
>> -    /*
>> -     * Disable power gating by programing the performance counter
>> -     * source to 20 (i.e. counts the reads and writes from/to IOMMU
>> -     * Reserved Register [MMIO Offset 1FF8h] that are ignored.),
>> -     * which never get incremented during this init phase.
>> -     * (Note: The event is also deprecated.)
>> -     */
>> -    val = 20;
>> -    if (iommu_pc_get_set_reg(iommu, 0, 0, 8, &val, true))
>> +    if (iommu_pc_get_set_reg(iommu, 0, 0, 0, &save_reg, false))
>>           goto pc_false;
>>       /* Check if the performance counters can be written to */
>> -    val = 0xabcd;
>> -    for (retry = 5; retry; retry--) {
>> -        if (iommu_pc_get_set_reg(iommu, 0, 0, 0, &val, true) ||
>> -            iommu_pc_get_set_reg(iommu, 0, 0, 0, &val2, false) ||
>> -            val2)
>> -            break;
>> -
>> -        /* Wait about 20 msec for power gating to disable and retry. */
>> -        msleep(20);
>> -    }
>> -
>> -    /* restore */
>> -    if (iommu_pc_get_set_reg(iommu, 0, 0, 0, &save_reg, true) ||
>> -        iommu_pc_get_set_reg(iommu, 0, 0, 8, &save_src, true))
>> +    if ((iommu_pc_get_set_reg(iommu, 0, 0, 0, &val, true)) ||
>> +        (iommu_pc_get_set_reg(iommu, 0, 0, 0, &val2, false)) ||
>> +        (val != val2))
> 
> Probably don't need parentheses around 'val != val2'

This is the result from git revert. Also, the logic is removed in patch 2/2.

Suravee

  reply	other threads:[~2021-04-13 13:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09  8:58 [PATCH 0/2] iommu/amd: Revert and remove failing PMC test Suravee Suthikulpanit
2021-04-09  8:58 ` [PATCH 1/2] Revert "iommu/amd: Fix performance counter initialization" Suravee Suthikulpanit
2021-04-09 17:06   ` Shuah Khan
2021-04-13 13:36     ` Suthikulpanit, Suravee [this message]
2021-04-09  8:58 ` [PATCH 2/2] iommu/amd: Remove performance counter pre-initialization test Suravee Suthikulpanit
2021-04-09 16:37   ` Shuah Khan
2021-04-09 17:10     ` Shuah Khan
2021-04-09 20:00   ` Shuah Khan
2021-04-09 20:19     ` Shuah Khan
2021-04-09 20:11   ` David Coe
2021-04-10  8:17   ` David Coe
2021-04-10 10:03   ` David Coe
2021-04-13 13:51     ` Suthikulpanit, Suravee
2021-04-14 15:33       ` David Coe
2021-04-15  9:28         ` Suthikulpanit, Suravee
2021-04-15 14:39           ` David Coe
2021-04-15 16:20           ` David Coe
2021-04-18 19:16           ` David Coe
2021-04-14 22:18       ` David Coe
2021-04-20  8:38     ` Suthikulpanit, Suravee
2021-04-20 10:33       ` Alexander Monakov
2021-04-13  9:38   ` David Coe
2021-04-15 13:41 ` [PATCH 0/2] iommu/amd: Revert and remove failing PMC test 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=c48c9579-e123-7dfb-47ca-a93856731f6f@amd.com \
    --to=suravee.suthikulpanit@amd.com \
    --cc=Jon.Grimm@amd.com \
    --cc=amonakov@ispras.ru \
    --cc=david.coe@live.co.uk \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=jsnitsel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ml.linux@elloe.vision \
    --cc=pmenzel@molgen.mpg.de \
    --cc=skhan@linuxfoundation.org \
    --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