Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Shuai Xue <xueshuai@linux.alibaba.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, kbusch@kernel.org,
	sathyanarayanan.kuppuswamy@linux.intel.com, mahesh@linux.ibm.com,
	oohall@gmail.com, Jonathan.Cameron@huawei.com,
	terry.bowman@amd.com, tianruidong@linux.alibaba.com
Subject: Re: [PATCH v6 4/5] PCI/ERR: Use pcie_aer_is_native() to check for native AER control
Date: Fri, 24 Oct 2025 11:38:10 +0800	[thread overview]
Message-ID: <91cf33b4-7f67-4f3a-b095-e8f04d8c18e9@linux.alibaba.com> (raw)
In-Reply-To: <aPrvEZ3X4_tiD2Fh@wunner.de>



在 2025/10/24 11:14, Lukas Wunner 写道:
> On Fri, Oct 24, 2025 at 11:09:25AM +0800, Shuai Xue wrote:
>> 2025/10/23 18:29, Lukas Wunner:
>>> On Mon, Oct 20, 2025 at 10:45:31PM +0800, Shuai Xue wrote:
>>>>  From PCIe spec, BIT 0-2 are logged for functions supporting Advanced
>>>> Error Handling.
>>>>
>>>> I am not sure if we should clear BIT 3, and also BIT 6 (Emergency Powerjj
>>>> Reduction Detected) and in case a AER error.
>>>
>>> AFAIUI, bits 0 to 3 are what the PCIe r7.0 sec 6.2.1 calls
>>> "baseline capability" error reporting.  They're supported
>>> even if AER is not supported.
>>>
>>> Bit 6 has nothing to do with this AFAICS.
>>
>> Per PCIe r7.0 section 7.5.3.5:
>>
>>    **For Functions supporting Advanced Error Handling**, errors are logged
>>    in this register regardless of the settings of the Uncorrectable Error
>>    Mask register. Default value of this bit is 0b.
>>
>>  From this, it's clear that bits 0 to 2 are not logged unless AER is supported.
> 
> No.  It just means that if AER is supported, the Uncorrectable Error Mask
> register has no bearing on whether the bits in the Device Status register
> are set.  It does not mean that the bits are only set if AER is supported.
> 

Thank you for pointing that out. I now understand that my interpretation
was incorrect.

As such, I will drop this patch that introduced the dev->aer_cap check.

The remaining question is whether it would make more sense to rename
pcie_clear_device_status() to pci_clear_device_error_status() and refine
its behavior by adding a mask specifically for bits 0 to 3. Here’s an
example of the proposed change:

-void pcie_clear_device_status(struct pci_dev *dev)
+void pci_clear_device_error_status(struct pci_dev *dev)
  {
         u16 sta;

         pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &sta);
-       pcie_capability_write_word(dev, PCI_EXP_DEVSTA, sta);
+       /* clear error-related bits: 0-3   */
+       pcie_capability_write_word(dev, PCI_EXP_DEVSTA, sta & 0xF);
  }

Renaming the function to pci_clear_device_error_status() better
reflects its current focus on clearing error-related bits, and
introducing the mask ensures that only those relevant bits (0-3) are
cleared, rather than modifying the entire register. What do you think
about these changes?

Thanks.
Shuai

  reply	other threads:[~2025-10-24  3:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15  2:41 [PATCH v6 0/5] PCI/AER: Report fatal errors of RCiEP and EP if link recoverd Shuai Xue
2025-10-15  2:41 ` [PATCH v6 1/5] PCI/DPC: Clarify naming for error port in DPC Handling Shuai Xue
2025-10-15  2:41 ` [PATCH v6 2/5] PCI/DPC: Run recovery on device that detected the error Shuai Xue
2025-10-15  2:41 ` [PATCH v6 3/5] PCI/AER: Report fatal errors of RCiEP and EP if link recoverd Shuai Xue
2025-10-20 10:10   ` Lukas Wunner
2025-10-20 12:58     ` Shuai Xue
2025-10-20 13:54       ` Lukas Wunner
2025-10-20 14:17         ` Shuai Xue
2025-10-20 14:24           ` Lukas Wunner
2025-10-20 15:20             ` Shuai Xue
2025-10-23 10:48               ` Lukas Wunner
2025-10-24  6:43                 ` Shuai Xue
2025-12-16  8:07                   ` Shuai Xue
2025-10-20 18:38   ` Kuppuswamy Sathyanarayanan
2025-10-21  1:51     ` Shuai Xue
2025-10-15  2:41 ` [PATCH v6 4/5] PCI/ERR: Use pcie_aer_is_native() to check for native AER control Shuai Xue
2025-10-20 10:17   ` Lukas Wunner
2025-10-20 13:09     ` Shuai Xue
2025-10-20 13:58       ` Lukas Wunner
2025-10-20 14:45         ` Shuai Xue
2025-10-23 10:29           ` Lukas Wunner
2025-10-24  3:09             ` Shuai Xue
2025-10-24  3:14               ` Lukas Wunner
2025-10-24  3:38                 ` Shuai Xue [this message]
2025-10-24  4:03                   ` Lukas Wunner
2025-10-24  5:37                     ` Shuai Xue
2025-10-20 18:43   ` Kuppuswamy Sathyanarayanan
2025-10-15  2:41 ` [PATCH v6 5/5] PCI/AER: Clear both AER fatal and non-fatal status Shuai Xue
2025-10-20 18:44   ` Kuppuswamy Sathyanarayanan
2025-10-21  1:33     ` Shuai Xue

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=91cf33b4-7f67-4f3a-b095-e8f04d8c18e9@linux.alibaba.com \
    --to=xueshuai@linux.alibaba.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lukas@wunner.de \
    --cc=mahesh@linux.ibm.com \
    --cc=oohall@gmail.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=terry.bowman@amd.com \
    --cc=tianruidong@linux.alibaba.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