Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp622434img; Fri, 22 Mar 2019 05:20:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5zfBbnc7vHJs5NJVLbtAMrFMiPVPJ6VzAj1hcW37iWCbLjIw6fIyefqw1zgOwqSkLN+98 X-Received: by 2002:a17:902:e85:: with SMTP id 5mr9250194plx.13.1553257253529; Fri, 22 Mar 2019 05:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553257253; cv=none; d=google.com; s=arc-20160816; b=w9CZBdzxKynzU4NSN6vueXuk5pZ/D7E6gCUnGFwrad9+DfMyjm9PTgyi+q+7BNo0Ym 6367jV+0rNPdd9EcgQF3/Ek1SriBK8XKEgyWQPm98fh81F35t8v0lo+eLQBOQYfxAap4 f9GCdTaU0ioUW+vQYzlpilavM3TEZ/m7/FOJ3BDYTil/QwnGDf6cErP3u9t30fPqN4N3 XNJRy4SdhnG2zDTXvCkawT75Oqk6E41jMFm8/U4BT981Kg9ajVf5Rwm0RePTk3vS2Otc KYFz2HDYVCACndc2QOSr2jlVKk/tOOMldDxEc6Hy48UAf5Ayw5Ral3DMC+yCHehvBWYF WKoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BmzBHCgwbr07AvuCuPKkL7oMsSV/edqwcSTskmPLffU=; b=kPYHX9mU8D+eHkv3Fqr3P4Y8gushpVmaCMBq3dJ6jUDOxPWoopQFjqsfHDW3kITa/Y IjP0qBNPk35lVAOtscWcx99P5q8BW1Ur6HWt2i8nVCDjI4sPatVTQh6BcWDDbow7CLsP 2upD8vcbf+SOfvxx93uLnmPDRiLfOE0sm9GswG21EFeym8UQHFWazOh5h730yLywDSy+ 3olX6HysJZTmO0AjLwJNDYeIsOcJwu6Fxd9cl56uUBp0qevFncxO3WKCForCK5ibKLD2 nGcU9gKZ/mWEiuwVO4z9DebbgKXwkWVW3JaKMkWcUEkRRcGdMWlf6cn6xUcRtY6J43Gn FPlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p16v9Ob0; 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 b2si1077383pgt.494.2019.03.22.05.20.38; Fri, 22 Mar 2019 05:20:53 -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; dkim=pass header.i=@kernel.org header.s=default header.b=p16v9Ob0; 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 S2390702AbfCVMUH (ORCPT + 99 others); Fri, 22 Mar 2019 08:20:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:58994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390673AbfCVMUA (ORCPT ); Fri, 22 Mar 2019 08:20:00 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7775B21900; Fri, 22 Mar 2019 12:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553257199; bh=TRgFqfXBxRYsK7Yo4zv/Deih6TEcR2qf4nAvuZ4X3NA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p16v9Ob0KDUkCupEAIn1rID83nDNxfP1H56BX0veJvYI0L7TlBVg0Iqag/EdfqMQB USEj+h0j3XKbU0rA69z79EXmLAZvYCf+Kp/sNLGUAsUtPqMSxPZfPYIfnXBETTAQlv gem26Git08reNpurqsVkBXtTEIIpFMPjEH1J0GqM= 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" Subject: [PATCH 5.0 131/238] PCI: pciehp: Disable Data Link Layer State Changed event on suspend Date: Fri, 22 Mar 2019 12:15:50 +0100 Message-Id: <20190322111306.217018026@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111258.383569278@linuxfoundation.org> References: <20190322111258.383569278@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 5.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mika Westerberg commit bbe54ea5330d828cc396d451c0e1e5c3f9764c1e upstream. Commit 0e157e528604 ("PCI/PME: Implement runtime PM callbacks") tried to solve an issue where the hierarchy immediately wakes up when it is transitioned into D3cold. However, it turns out to prevent PME propagation on some systems that do not support D3cold. I looked more closely at what might cause the immediate wakeup. It happens when the ACPI power resource of the root port is turned off. The AML code associated with the _OFF() method of the ACPI power resource starts a PCIe L2/L3 Ready transition and waits for it to complete. Right after the L2/L3 Ready transition is started the root port receives a PME from the downstream port. The simplest hierarchy where this happens looks like this: 00:1d.0 PCIe Root Port ^ | v 05:00.0 PCIe switch #1 upstream port 06:01.0 PCIe switch #1 downstream hotplug port ^ | v 08:00.0 PCIe switch #2 upstream port It seems that the PCIe link between the two switches, before PME_Turn_Off/PME_TO_Ack is complete for the whole hierarchy, goes inactive and triggers PME towards the root port bringing it back to D0. The L2/L3 Ready sequence is described in PCIe r4.0 spec sections 5.2 and 5.3.3 but unfortunately they do not state what happens if DLLSCE is enabled during the sequence. Disabling Data Link Layer State Changed event (DLLSCE) seems to prevent the issue and still allows the downstream hotplug port to notice when a device is plugged/unplugged. Link: https://bugzilla.kernel.org/show_bug.cgi?id=202593 Fixes: 0e157e528604 ("PCI/PME: Implement runtime PM callbacks") Signed-off-by: Mika Westerberg Signed-off-by: Bjorn Helgaas Reviewed-by: Rafael J. Wysocki CC: stable@vger.kernel.org # v4.20+ Signed-off-by: Greg Kroah-Hartman --- drivers/pci/hotplug/pciehp_hpc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -736,12 +736,25 @@ void pcie_clear_hotplug_events(struct co void pcie_enable_interrupt(struct controller *ctrl) { - pcie_write_cmd(ctrl, PCI_EXP_SLTCTL_HPIE, PCI_EXP_SLTCTL_HPIE); + u16 mask; + + mask = PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_DLLSCE; + pcie_write_cmd(ctrl, mask, mask); } void pcie_disable_interrupt(struct controller *ctrl) { - pcie_write_cmd(ctrl, 0, PCI_EXP_SLTCTL_HPIE); + u16 mask; + + /* + * Mask hot-plug interrupt to prevent it triggering immediately + * when the link goes inactive (we still get PME when any of the + * enabled events is detected). Same goes with Link Layer State + * changed event which generates PME immediately when the link goes + * inactive so mask it as well. + */ + mask = PCI_EXP_SLTCTL_HPIE | PCI_EXP_SLTCTL_DLLSCE; + pcie_write_cmd(ctrl, 0, mask); } /*