* [PATCH] Bug fix for PME interrupt handler, add Root Status check
@ 2017-09-28 3:54 Qiang
2017-09-28 23:13 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Qiang @ 2017-09-28 3:54 UTC (permalink / raw)
To: helgaas; +Cc: linux-pci, linux-pm, gabriele.paoloni, linuxarm
PCIe PME and hot plug share same interrupt number. In some special case,
Link down event cause hot plug interrupt, devices is not disconnected,
But read config will return 0xff.
In that case, PME work function will run and not return Because
Root Status PME bit always 1 and can not be cleared.
This patch add Root Status check in PME interrupt handler,
Just do same as pciehp isr Slot status check.
Signed-off-by: Qiang Zheng <zhengqiang10@huawei.com>
---
drivers/pci/pcie/pme.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
index fafdb16..67144f5 100644
--- a/drivers/pci/pcie/pme.c
+++ b/drivers/pci/pcie/pme.c
@@ -273,7 +273,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context)
spin_lock_irqsave(&data->lock, flags);
pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
- if (!(rtsta & PCI_EXP_RTSTA_PME)) {
+ if (rtsta == (u32)(~0) || !(rtsta & PCI_EXP_RTSTA_PME)) {
spin_unlock_irqrestore(&data->lock, flags);
return IRQ_NONE;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Bug fix for PME interrupt handler, add Root Status check
2017-09-28 3:54 [PATCH] Bug fix for PME interrupt handler, add Root Status check Qiang
@ 2017-09-28 23:13 ` Rafael J. Wysocki
2017-09-29 6:10 ` Zhengqiang
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-09-28 23:13 UTC (permalink / raw)
To: Qiang; +Cc: Bjorn Helgaas, Linux PCI, Linux PM, Gabriele Paoloni, Linuxarm
On Thu, Sep 28, 2017 at 5:54 AM, Qiang <zhengqiang10@huawei.com> wrote:
> PCIe PME and hot plug share same interrupt number. In some special case,
> Link down event cause hot plug interrupt, devices is not disconnected,
> But read config will return 0xff.
>
> In that case, PME work function will run and not return Because
> Root Status PME bit always 1 and can not be cleared.
>
> This patch add Root Status check in PME interrupt handler,
> Just do same as pciehp isr Slot status check.
>
> Signed-off-by: Qiang Zheng <zhengqiang10@huawei.com>
> ---
> drivers/pci/pcie/pme.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
> index fafdb16..67144f5 100644
> --- a/drivers/pci/pcie/pme.c
> +++ b/drivers/pci/pcie/pme.c
> @@ -273,7 +273,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context)
> spin_lock_irqsave(&data->lock, flags);
> pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
>
> - if (!(rtsta & PCI_EXP_RTSTA_PME)) {
> + if (rtsta == (u32)(~0) || !(rtsta & PCI_EXP_RTSTA_PME)) {
> spin_unlock_irqrestore(&data->lock, flags);
> return IRQ_NONE;
> }
OK, but isn't there a symbol for all ones in u32? And if there isn't,
what about adding it?
Thanks,
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bug fix for PME interrupt handler, add Root Status check
2017-09-28 23:13 ` Rafael J. Wysocki
@ 2017-09-29 6:10 ` Zhengqiang
2017-09-29 13:12 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Zhengqiang @ 2017-09-29 6:10 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Bjorn Helgaas, Linux PCI, Linux PM, Gabriele Paoloni, Linuxarm
Hi,Rafael, thanks for you reply.
please see my comment.
On 2017/9/29 7:13, Rafael J. Wysocki wrote:
> On Thu, Sep 28, 2017 at 5:54 AM, Qiang <zhengqiang10@huawei.com> wrote:
>> PCIe PME and hot plug share same interrupt number. In some special case,
>> Link down event cause hot plug interrupt, devices is not disconnected,
>> But read config will return 0xff.
>>
>> In that case, PME work function will run and not return Because
>> Root Status PME bit always 1 and can not be cleared.
>>
>> This patch add Root Status check in PME interrupt handler,
>> Just do same as pciehp isr Slot status check.
>>
>> Signed-off-by: Qiang Zheng <zhengqiang10@huawei.com>
>> ---
>> drivers/pci/pcie/pme.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
>> index fafdb16..67144f5 100644
>> --- a/drivers/pci/pcie/pme.c
>> +++ b/drivers/pci/pcie/pme.c
>> @@ -273,7 +273,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context)
>> spin_lock_irqsave(&data->lock, flags);
>> pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
>>
>> - if (!(rtsta & PCI_EXP_RTSTA_PME)) {
>> + if (rtsta == (u32)(~0) || !(rtsta & PCI_EXP_RTSTA_PME)) {
>> spin_unlock_irqrestore(&data->lock, flags);
>> return IRQ_NONE;
>> }
>
> OK, but isn't there a symbol for all ones in u32? And if there isn't,
> what about adding it?
>
Here is Root Status register definitions.
Bit Location Register Description Attributes
15:0 PME Requester ID – RO
This field indicates the PCI Requester ID of the
last PME Requester. This field is only valid
when the PME Status bit is Set.
16 PME Status – This bit RW1C RW1C
indicates that PME was asserted by the PME Requester
indicated in the PME Requester ID field. Subsequent PMEs
are kept pending until the status register is cleared by
software by writing a 1b.
Default value of this bit is 0b.
17 PME Pending – RO
This bit indicates that another PME is pending
when the PME Status bit is Set. When the PME Status bit is
cleared by software; the PME is delivered by hardware by
setting the PME Status bit again and updating the PME
Requester ID field appropriately. The PME Pending bit is
cleared by hardware if no more PMEs are pending.
31:18 RsvdZ
Bit[31:18] is RsvdZ, read only and must return zero when read.
So, i guess there is no a symbol for all ones in u32.
If read Root Status return 0xff, perhaps RC is disconnected or accessed timeout.
> Thanks,
> Rafael
>
> .
>
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bug fix for PME interrupt handler, add Root Status check
2017-09-29 6:10 ` Zhengqiang
@ 2017-09-29 13:12 ` Rafael J. Wysocki
2017-09-30 1:46 ` Zhengqiang
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-09-29 13:12 UTC (permalink / raw)
To: Zhengqiang
Cc: Rafael J. Wysocki, Bjorn Helgaas, Linux PCI, Linux PM,
Gabriele Paoloni, Linuxarm
On Fri, Sep 29, 2017 at 8:10 AM, Zhengqiang <zhengqiang10@huawei.com> wrote:
> Hi,Rafael, thanks for you reply.
> please see my comment.
>
> On 2017/9/29 7:13, Rafael J. Wysocki wrote:
>> On Thu, Sep 28, 2017 at 5:54 AM, Qiang <zhengqiang10@huawei.com> wrote:
>>> PCIe PME and hot plug share same interrupt number. In some special case,
>>> Link down event cause hot plug interrupt, devices is not disconnected,
>>> But read config will return 0xff.
>>>
>>> In that case, PME work function will run and not return Because
>>> Root Status PME bit always 1 and can not be cleared.
>>>
>>> This patch add Root Status check in PME interrupt handler,
>>> Just do same as pciehp isr Slot status check.
>>>
>>> Signed-off-by: Qiang Zheng <zhengqiang10@huawei.com>
>>> ---
>>> drivers/pci/pcie/pme.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
>>> index fafdb16..67144f5 100644
>>> --- a/drivers/pci/pcie/pme.c
>>> +++ b/drivers/pci/pcie/pme.c
>>> @@ -273,7 +273,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context)
>>> spin_lock_irqsave(&data->lock, flags);
>>> pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
>>>
>>> - if (!(rtsta & PCI_EXP_RTSTA_PME)) {
>>> + if (rtsta == (u32)(~0) || !(rtsta & PCI_EXP_RTSTA_PME)) {
>>> spin_unlock_irqrestore(&data->lock, flags);
>>> return IRQ_NONE;
>>> }
>>
>> OK, but isn't there a symbol for all ones in u32? And if there isn't,
>> what about adding it?
>>
> Here is Root Status register definitions.
Well, that's not what I meant.
You have "rtsta == (u32)(~0)" in the patch above, but you could do
"rtsta == U32_MAX" instead.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Bug fix for PME interrupt handler, add Root Status check
2017-09-29 13:12 ` Rafael J. Wysocki
@ 2017-09-30 1:46 ` Zhengqiang
0 siblings, 0 replies; 5+ messages in thread
From: Zhengqiang @ 2017-09-30 1:46 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Bjorn Helgaas, Linux PCI, Linux PM, Gabriele Paoloni, Linuxarm
On 2017/9/29 21:12, Rafael J. Wysocki wrote:
> On Fri, Sep 29, 2017 at 8:10 AM, Zhengqiang <zhengqiang10@huawei.com> wrote:
>> Hi,Rafael, thanks for you reply.
>> please see my comment.
>>
>> On 2017/9/29 7:13, Rafael J. Wysocki wrote:
>>> On Thu, Sep 28, 2017 at 5:54 AM, Qiang <zhengqiang10@huawei.com> wrote:
>>>> PCIe PME and hot plug share same interrupt number. In some special case,
>>>> Link down event cause hot plug interrupt, devices is not disconnected,
>>>> But read config will return 0xff.
>>>>
>>>> In that case, PME work function will run and not return Because
>>>> Root Status PME bit always 1 and can not be cleared.
>>>>
>>>> This patch add Root Status check in PME interrupt handler,
>>>> Just do same as pciehp isr Slot status check.
>>>>
>>>> Signed-off-by: Qiang Zheng <zhengqiang10@huawei.com>
>>>> ---
>>>> drivers/pci/pcie/pme.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c
>>>> index fafdb16..67144f5 100644
>>>> --- a/drivers/pci/pcie/pme.c
>>>> +++ b/drivers/pci/pcie/pme.c
>>>> @@ -273,7 +273,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context)
>>>> spin_lock_irqsave(&data->lock, flags);
>>>> pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta);
>>>>
>>>> - if (!(rtsta & PCI_EXP_RTSTA_PME)) {
>>>> + if (rtsta == (u32)(~0) || !(rtsta & PCI_EXP_RTSTA_PME)) {
>>>> spin_unlock_irqrestore(&data->lock, flags);
>>>> return IRQ_NONE;
>>>> }
>>>
>>> OK, but isn't there a symbol for all ones in u32? And if there isn't,
>>> what about adding it?
>>>
>> Here is Root Status register definitions.
>
> Well, that's not what I meant.
>
> You have "rtsta == (u32)(~0)" in the patch above, but you could do
> "rtsta == U32_MAX" instead.
>
Sure, I will change it next patch .Thanks.
> Thanks,
> Rafael
>
> .
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-30 1:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-28 3:54 [PATCH] Bug fix for PME interrupt handler, add Root Status check Qiang
2017-09-28 23:13 ` Rafael J. Wysocki
2017-09-29 6:10 ` Zhengqiang
2017-09-29 13:12 ` Rafael J. Wysocki
2017-09-30 1:46 ` Zhengqiang
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).