linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Sanjay R Mehta <sanmehta@amd.com>
Cc: Lukas Wunner <lukas@wunner.de>,
	Sanjay R Mehta <Sanju.Mehta@amd.com>,
	bhelgaas@google.com, stuart.w.hayes@gmail.com,
	mr.nuke.me@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: pciehp: Add check for DL_ACTIVE bit in pciehp_check_link_status()
Date: Thu, 8 Oct 2020 14:29:04 +0300	[thread overview]
Message-ID: <20201008112904.GH4077@smile.fi.intel.com> (raw)
In-Reply-To: <7309c7f3-a895-e4aa-578e-444c5d5734d6@amd.com>

On Thu, Oct 08, 2020 at 12:43:17PM +0530, Sanjay R Mehta wrote:
> On 10/7/2020 1:08 AM, Lukas Wunner wrote:
> > On Tue, Oct 06, 2020 at 01:24:28PM -0500, Sanjay R Mehta wrote:
> >> if DL_ACTIVE bit is set it means that there is no need to check
> >> PCI_EXP_LNKSTA_LT bit, as DL_ACTIVE would have set only if the link
> >> is already trained. Hence adding a check which takes care of this
> >> scenario.
> > 
> > Sorry for being dense but I don't understand this at all:
> > 
> > The PCI_EXP_DPC_CAP_DL_ACTIVE bit which you check here indicates
> > that the port is capable of sending an ERR_COR interrupt whenever
> > the link transitions from inactive to active.
> > 
> > What is the connection to the PCI_EXP_LNKSTA_LT bit (which indicates
> > that the link is still being trained)?
> > 
> > Also, the negation of a bitwise AND is always either 0 or 1
> > (!(lnk_status & PCI_EXP_DPC_CAP_DL_ACTIVE)), so bit 0 is set or not set.
> > However PCI_EXP_LNKSTA_LT is bit 11.  A bitwise AND of bit 11 and 0 is
> > always 0, so the expression can never be 1.
> > 
> > Am I missing something?
> > 
> Please accept my sincere apologies for sending the wrong patch.
> 
> I am supposed to use PCI_EXP_LNKSTA_DLLLA bit in my patch but have used PCI_EXP_DPC_CAP_DL_ACTIVE.
> 
> The correct code should be as below,
> 
> -     if ((lnk_status & PCI_EXP_LNKSTA_LT) ||
> +     if (((lnk_status & PCI_EXP_LNKSTA_LT) &
> +          !(lnk_status & PCI_EXP_LNKSTA_DLLLA )) ||
> 
> Is it right? please share your feedback, if I am wrong. Will send out V2 patch, once you confirm on this.

At least you are ignoring LKP valid warning...

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2020-10-08 11:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 18:24 [PATCH] PCI: pciehp: Add check for DL_ACTIVE bit in pciehp_check_link_status() Sanjay R Mehta
2020-10-06 19:38 ` Lukas Wunner
2020-10-08  7:13   ` Sanjay R Mehta
2020-10-08 11:29     ` Andy Shevchenko [this message]
2020-10-09 10:34     ` Lukas Wunner
2020-10-07  9:30 ` [kbuild] " Dan Carpenter

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=20201008112904.GH4077@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Sanju.Mehta@amd.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=mr.nuke.me@gmail.com \
    --cc=sanmehta@amd.com \
    --cc=stuart.w.hayes@gmail.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;
as well as URLs for NNTP newsgroup(s).