linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pciehp: Acknowledge the spurious "cmd completed" event.
@ 2013-11-05 22:33 Rajat Jain
  2013-11-06  0:25 ` Bjorn Helgaas
  0 siblings, 1 reply; 20+ messages in thread
From: Rajat Jain @ 2013-11-05 22:33 UTC (permalink / raw)
  To: linux-pci, linux-hotplug, Bjorn Helgaas, Kenji Kaneshige,
	Yijing Wang
  Cc: Guenter Roeck, Rajat Jain, Greg KH, Tom Nguyen, Kristen Accardi,
	Rajat Jain

In case of a spurious "cmd completed", pcie_write_cmd() does not
clear it, but yet expects more "cmd completed" events to be generated.
This does not happen because the previous (spurious) event has not
been acknowledged. Fix that.

Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
---
This is how I saw it in action: my controller does not implement any
hot-plug elements (LED, power ctrl, EMI etc) but still supports Command
completed bit.
 - During initialization,
      pcie_disable_notification()
      -> pcie_write_cmd()
         -> writes to Slot control register
            -> which causes PCI_EXP_SLTSTA_CC to get set, which is not
               cleared, because IRQ is not generated (we just disabled
               notifications).
 - After some time,
      pcie_enable_notification()
      -> pcie_write_cmd()
          -> finds PCI_EXP_SLTSTA_CC is set, assumes it is spurious.
          -> Does not clear it, yet expects more command completed
             events to be generated (never happens).

 drivers/pci/hotplug/pciehp_hpc.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 5b8d749..ba8e06f 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -185,6 +185,7 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
 	}
 
 	if (slot_status & PCI_EXP_SLTSTA_CC) {
+		pciehp_writew(ctrl, PCI_EXP_SLTSTA, PCI_EXP_SLTSTA_CC);
 		if (!ctrl->no_cmd_complete) {
 			/*
 			 * After 1 sec and CMD_COMPLETED still not set, just
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 20+ messages in thread
* [PATCH] pciehp: Acknowledge the spurious "cmd completed" event.
@ 2014-02-21  1:42 Rajat Jain
  2014-04-24 22:48 ` Bjorn Helgaas
  0 siblings, 1 reply; 20+ messages in thread
From: Rajat Jain @ 2014-02-21  1:42 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci, linux-kernel, Alex Williamson
  Cc: Rajat Jain, Guenter Roeck

In case of a spurious "cmd completed", pcie_write_cmd() does not
clear it, but yet expects more "cmd completed" events to be generated.
This does not happen because the previous (spurious) event has not
been acknowledged. Fix that.

Signed-off-by: Rajat Jain <rajatxjain@gmail.com>
Signed-off-by: Rajat Jain <rajatjain@juniper.net>
Signed-off-by: Guenter Roeck <groeck@juniper.net>
---
 drivers/pci/hotplug/pciehp_hpc.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index d7d058f..1463412 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -159,6 +159,8 @@ static void pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
 
 	pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status);
 	if (slot_status & PCI_EXP_SLTSTA_CC) {
+		pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
+					   PCI_EXP_SLTSTA_CC);
 		if (!ctrl->no_cmd_complete) {
 			/*
 			 * After 1 sec and CMD_COMPLETED still not set, just
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-04-24 22:48 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-05 22:33 [PATCH] pciehp: Acknowledge the spurious "cmd completed" event Rajat Jain
2013-11-06  0:25 ` Bjorn Helgaas
2013-11-06  2:38   ` Rajat Jain
2013-11-07 21:53     ` Rajat Jain
2013-11-08  1:23       ` Bjorn Helgaas
2013-11-08 17:30         ` Rajat Jain
2013-11-08 23:15           ` Bjorn Helgaas
2013-11-11 21:26             ` Rajat Jain
2013-11-23  0:51               ` Bjorn Helgaas
2013-11-23  1:59                 ` Guenter Roeck
2013-11-23 14:56                 ` Rajat Jain
2013-11-23 19:32                   ` Bjorn Helgaas
2013-11-25 19:03                     ` Rajat Jain
2014-02-12  0:34                       ` Bjorn Helgaas
2014-02-12  1:08                         ` Rajat Jain
2014-02-20  7:42                           ` Rajat Jain
2014-02-20 22:20                             ` Bjorn Helgaas
2014-02-21  1:43                               ` Rajat Jain
  -- strict thread matches above, loose matches on Subject: below --
2014-02-21  1:42 Rajat Jain
2014-04-24 22:48 ` Bjorn Helgaas

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).