Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3068583imm; Sun, 1 Jul 2018 11:30:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKXyMcOiOgkBbvSf7tlWA4Hg96Xs9qv+eIXe4A7iuTRH1+wmB9f9Gpx3CKJ3fFKgwyTo4lu X-Received: by 2002:a63:383:: with SMTP id 125-v6mr19337237pgd.421.1530469842680; Sun, 01 Jul 2018 11:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530469842; cv=none; d=google.com; s=arc-20160816; b=Xp3bZWOqb54MbSAHTkT1nHbqLET9jm8ls4j1y/Dp1qplM3bz/dIa69AwmpW0F8RzUx GeGvblenMtobrqsh1yyyHswcery9qWcz3ONGNvRu+/jSNSANeW+LyDALkzV6F5ad+NnJ 0iqm0pmrJCBSMdn4hj5qmiXOA+88yLl/C49bRrLI8AC1LpeFlpHfshNBD6SIBWjCnK9T 7uiYkroqSVIo+qW/2G/WCWVRLofK3kK9u4z2keExpTliD7IDQVzNlMYn2WBGlG5PnHRW ysgW5nN4FwbCJH2JDSNEewmS2mEDBSjjZc4B30G0Xet9qunG5Ktx1HMM1tykzh7uN/gP 4kEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ZFjuGFpIDpHKjfKm6/WEg1DK6NwJHwBtCq8zlKxg3iA=; b=ACSvRIj1PDQULLGaot4Vi16FwiKJpyL4X7ga5lhs/djVmL1HAcFRysxKrGBGty4Dwl C4omjCfjcPy5zBVN3WrSXtPEm2Kb+OX7WOx0ca/auFGplACLLmjMMulm2AyjcHPEhyjn 3xFcW9YCzsaW24V8fxlUa1DCuvURkZPAMcC48xMp26pPecTN9iktQvlbIB1Vh0HTZBIz jTIBN2Dftc26+3f2Fg4FOLkVAhFgPVD0jC7CPlv0Vf1L3HXf+G1gDpbLeAI+vYlVFKVj qQLET6achNKMf6nu7fPszPPiqFybLzt/NTrQNqJeOkYnse4SuyFsToUYlhwNIKLjCKDe GdJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7-v6si12827952pgn.194.2018.07.01.11.30.28; Sun, 01 Jul 2018 11:30:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933849AbeGAS3U (ORCPT + 99 others); Sun, 1 Jul 2018 14:29:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:32816 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964794AbeGAQRb (ORCPT ); Sun, 1 Jul 2018 12:17:31 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B213792B; Sun, 1 Jul 2018 16:17:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , Bjorn Helgaas , "Rafael J. Wysocki" , Andy Shevchenko Subject: [PATCH 4.4 058/105] PCI: pciehp: Clear Presence Detect and Data Link Layer Status Changed on resume Date: Sun, 1 Jul 2018 18:02:08 +0200 Message-Id: <20180701153153.715691394@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701153149.382300170@linuxfoundation.org> References: <20180701153149.382300170@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mika Westerberg commit 13c65840feab8109194f9490c9870587173cb29d upstream. After a suspend/resume cycle the Presence Detect or Data Link Layer Status Changed bits might be set. If we don't clear them those events will not fire anymore and nothing happens for instance when a device is now hot-unplugged. Fix this by clearing those bits in a newly introduced function pcie_reenable_notification(). This should be fine because immediately after, we check if the adapter is still present by reading directly from the status register. Signed-off-by: Mika Westerberg Signed-off-by: Bjorn Helgaas Reviewed-by: Rafael J. Wysocki Reviewed-by: Andy Shevchenko Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/pci/hotplug/pciehp.h | 2 +- drivers/pci/hotplug/pciehp_core.c | 2 +- drivers/pci/hotplug/pciehp_hpc.c | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h @@ -134,7 +134,7 @@ struct controller *pcie_init(struct pcie int pcie_init_notification(struct controller *ctrl); int pciehp_enable_slot(struct slot *p_slot); int pciehp_disable_slot(struct slot *p_slot); -void pcie_enable_notification(struct controller *ctrl); +void pcie_reenable_notification(struct controller *ctrl); int pciehp_power_on_slot(struct slot *slot); void pciehp_power_off_slot(struct slot *slot); void pciehp_get_power_status(struct slot *slot, u8 *status); --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c @@ -295,7 +295,7 @@ static int pciehp_resume(struct pcie_dev ctrl = get_service_data(dev); /* reinitialize the chipset's event detection logic */ - pcie_enable_notification(ctrl); + pcie_reenable_notification(ctrl); slot = ctrl->slot; --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -628,7 +628,7 @@ static irqreturn_t pcie_isr(int irq, voi return IRQ_HANDLED; } -void pcie_enable_notification(struct controller *ctrl) +static void pcie_enable_notification(struct controller *ctrl) { u16 cmd, mask; @@ -666,6 +666,17 @@ void pcie_enable_notification(struct con pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, cmd); } +void pcie_reenable_notification(struct controller *ctrl) +{ + /* + * Clear both Presence and Data Link Layer Changed to make sure + * those events still fire after we have re-enabled them. + */ + pcie_capability_write_word(ctrl->pcie->port, PCI_EXP_SLTSTA, + PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC); + pcie_enable_notification(ctrl); +} + static void pcie_disable_notification(struct controller *ctrl) { u16 mask;