]> git.itanic.dy.fi Git - linux-stable/commitdiff
PCI: pciehp: Enable Command Completed Interrupt only if supported
authorPali Rohár <pali@kernel.org>
Tue, 27 Sep 2022 14:19:17 +0000 (16:19 +0200)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 7 Dec 2022 14:27:20 +0000 (08:27 -0600)
The No Command Completed Support bit in the Slot Capabilities register
indicates whether Command Completed Interrupt Enable is unsupported.

We already check whether No Command Completed Support bit is set in
pcie_wait_cmd(), and do not wait in this case.

Don't enable this Command Completed Interrupt at all if NCCS is set, so
that when users dump configuration space from userspace, the dump does not
confuse them by saying that Command Completed Interrupt is not supported,
but it is enabled.

Link: https://lore.kernel.org/r/20220927141926.8895-2-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
drivers/pci/hotplug/pciehp_hpc.c

index 040ae076ec0e98b0f4731ec0e275514dbd75e2c8..10e9670eea0b06fafb82e945d23d0cbe6e4a9b31 100644 (file)
@@ -811,7 +811,9 @@ static void pcie_enable_notification(struct controller *ctrl)
        else
                cmd |= PCI_EXP_SLTCTL_PDCE;
        if (!pciehp_poll_mode)
-               cmd |= PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_CCIE;
+               cmd |= PCI_EXP_SLTCTL_HPIE;
+       if (!pciehp_poll_mode && !NO_CMD_CMPL(ctrl))
+               cmd |= PCI_EXP_SLTCTL_CCIE;
 
        mask = (PCI_EXP_SLTCTL_PDCE | PCI_EXP_SLTCTL_ABPE |
                PCI_EXP_SLTCTL_PFDE |