* [PATCH] PCI,pciehp: Skip not changed command write
@ 2017-02-24 6:54 Yinghai Lu
0 siblings, 0 replies; only message in thread
From: Yinghai Lu @ 2017-02-24 6:54 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Ashok Raj, james puthukattukaran, Yinghai Lu, linux-pci,
linux-kernel, Yinghai Lu
Notice two systems with different cpu hve different print out when power on
slots:
First one:
pciehp 0000:60:03.2:pcie004: pciehp_green_led_on: SLOTCTRL a8 write cmd 100
pciehp 0000:60:03.2:pcie004: pciehp_set_attention_status: SLOTCTRL a8 write cmd c0
pciehp 0000:60:03.2:pcie004: pending interrupts 0x0010 from Slot Status
Second one:
pciehp 0000:73:00.0:pcie004: pciehp_green_led_on: SLOTCTRL a8 write cmd 100
pciehp 0000:73:00.0:pcie004: pciehp_set_attention_status: SLOTCTRL a8 write cmd c0
pciehp 0000:73:00.0:pcie004: pending interrupts 0x0010 from Slot Status
pciehp 0000:73:00.0:pcie004: pending interrupts 0x0010 from Slot Status
Actually attention is not changed on both.
First one will not generate CC if write not change cmd.
Second one will generate CC even if write not change cmd.
To avoid those difference interrupts, check if we are trying to
write same cmd, if so skip writing.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/pci/hotplug/pciehp_hpc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Index: linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- linux-2.6.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ linux-2.6/drivers/pci/hotplug/pciehp_hpc.c
@@ -186,7 +186,7 @@ static void pcie_do_write_cmd(struct con
u16 mask, bool wait)
{
struct pci_dev *pdev = ctrl_dev(ctrl);
- u16 slot_ctrl;
+ u16 slot_ctrl, old_slot_ctrl;
mutex_lock(&ctrl->ctrl_lock);
@@ -201,8 +201,14 @@ static void pcie_do_write_cmd(struct con
goto out;
}
+ old_slot_ctrl = slot_ctrl;
slot_ctrl &= ~mask;
slot_ctrl |= (cmd & mask);
+ if (slot_ctrl == old_slot_ctrl) {
+ ctrl_dbg(ctrl, "%s: mask/cmd %x/%x no change\n", __func__,
+ mask, cmd & mask);
+ goto out;
+ }
ctrl->cmd_busy = 1;
smp_mb();
pcie_capability_write_word(pdev, PCI_EXP_SLTCTL, slot_ctrl);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-02-24 6:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-24 6:54 [PATCH] PCI,pciehp: Skip not changed command write Yinghai Lu
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).