OSDN Git Service

PCI/LINK: Clear bandwidth notification interrupt before enabling it
authorLukas Wunner <lukas@wunner.de>
Wed, 20 Mar 2019 11:05:30 +0000 (12:05 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 25 Mar 2019 22:59:06 +0000 (17:59 -0500)
commit55397ce8df48bdabe56abdc684764529e1334766
treef397a0c7d9525514c18534b016284d02de1df03e
parent3e82a7f9031f204ac0f8dea494ac3870ad111261
PCI/LINK: Clear bandwidth notification interrupt before enabling it

When booting a MacBookPro9,1, duplicate link downtraining messages are
logged for the devices directly attached to the two CPU-internal Root Ports
of the Core i7 3615QM:  Once on device enumeration and once on enablement
of the bandwidth notification interrupt on the Root Ports.

Duplicate messages do not occur with Root Ports on the PCH and Downstream
Ports on the Thunderbolt controller:  Only a single message is logged for
these, namely on device enumeration.

The reason for the duplicate messages is a stale interrupt in the Link
Status register of the 3615QM's internal Root Ports.  Avoid by clearing the
interrupt before enabling it.

An alternative approach would be to clear the interrupt already on device
enumeration or to report link downtraining only if the speed has changed.
That way, link downtraining occurring between device enumeration and
enablement of the bandwidth notification interrupt could be caught.
However clearing stale interrupts before enabling them is a standard
operating procedure for any driver and keeping the two steps in one place
makes the code easier to follow.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Alexandru Gagniuc <alex.gagniuc@dellteam.com>
drivers/pci/pcie/bw_notification.c