Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2963409imm; Sun, 1 Jul 2018 09:15:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcDyLdku8HMhFJmZKIUfWSbBH0fPZTCx3E17jl+kFGm0tC2WSuI2fElxYDAlSVSPrPg2XQ6 X-Received: by 2002:a65:6104:: with SMTP id z4-v6mr2034570pgu.361.1530461730257; Sun, 01 Jul 2018 09:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530461730; cv=none; d=google.com; s=arc-20160816; b=mad+hzmS6NlZVwoixxuUa8pbJ2E+z2R1p5ZdKa0GLqq/xNpic3ObZ2ULg0Yk+h35/z ZdB9IMtLr4H9rsGCS1MXOHykp3y0c8edR0Wj9vD6RiKyoEzcgtgSz1YIoCK8MjPU6K2j uSSgjGbbkKgngJG52AfnGnukpJ0aO/Dli+QCmvrrXtrzsgMND//gf3L24Rw/qVxYocBa ts9iideGQajAZ3yiAFKz/pRHNAw60ERsdDprzMP4nA0gq0wnUSrnrXGEZP/s/3G3D20Z jqhQshUmE15fTRZMqbYZSjAw0wO+aL8lC2GB2M6y3gJXEHon7DyRVZaL0QsxQC90UXj5 aqeQ== 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=hDJZq8slZBflcdZgvgonRLaeyVPdx/M1paSbUkK7Ftk=; b=wZZoNP6ZCsPx7LJpS1/6nC+I0q8pKXIWz+dSYavo6WLZ0UebdmTRmmBUnpz1i4d/s5 P3xfPtX61JWhAkdSHqe0TpIR9+M9qjD/gNpmJXECN6jXKdi7LNwLkYMfQe5JynYMQoQh JmYHbIfv5h1pxiA/pKk8xRsfsbzLg+8/c8/KX/qqIOHq9zJz86PkMbfZKYBparZWY8Lg M8k975xPwoN9g7lktAsLjOJUioT9vfVBxaqIp6KbFkpyaqwzGEFiE3eCV35gdxxm2tgY korQWo/mO2LyX53fmGVdQkUk/eL+eK4sqpWhwEevzBcHwAnPqSdAi6HL1iB9NCQ6aoXc IQVA== 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 l4-v6si14292223plb.213.2018.07.01.09.15.16; Sun, 01 Jul 2018 09:15:30 -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 S932718AbeGAQN5 (ORCPT + 99 others); Sun, 1 Jul 2018 12:13:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60240 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752449AbeGAQNz (ORCPT ); Sun, 1 Jul 2018 12:13:55 -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 7448986A; Sun, 1 Jul 2018 16:13:54 +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 3.18 69/85] PCI: pciehp: Clear Presence Detect and Data Link Layer Status Changed on resume Date: Sun, 1 Jul 2018 18:02:27 +0200 Message-Id: <20180701153125.125639304@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701153122.365061142@linuxfoundation.org> References: <20180701153122.365061142@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 3.18-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 @@ -144,7 +144,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 @@ -332,7 +332,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 @@ -602,7 +602,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; @@ -642,6 +642,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;