From patchwork Wed Oct 23 03:15:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1181756 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZiBbkvsb"; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46yb9Q2626z9sPc; Wed, 23 Oct 2019 14:15:38 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1iN77V-00060k-Ua; Wed, 23 Oct 2019 03:15:34 +0000 Received: from mail-pf1-f193.google.com ([209.85.210.193]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iN77T-0005y2-Ao for kernel-team@lists.ubuntu.com; Wed, 23 Oct 2019 03:15:31 +0000 Received: by mail-pf1-f193.google.com with SMTP id y5so11961385pfo.4 for ; Tue, 22 Oct 2019 20:15:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=dvNGSXlaKpr9lYFxnC2nHewKW5T/h6jhqfJV6afXXAA=; b=ZiBbkvsb7URNAUegLYW3xJnuxo68WOb+mdZkOrHh6s5HP0I2aynkGzKI1k73fENv1I rQfSVsS9/G7OiSNLrTPsw+z12UDDbZSnsAleavHRjbVnCgWftUoL28IN4pfxiqofxxhy 3/hHDJR+ETR30UwIrpFloRrrwutzW/xhVQMPNJk19B+mPYaxyFAwMar3/IFqDWs4tbJn sNPfPPIiGnVk8SV4sNMH09vbzRZAQRKAN2Y7DG5nTs0lWND284BNoaCdwYQgXObJSeEK IBupHLm/Fgj3MF613ycoJQIxFzKX+6zANv6TeeL1wGqI0HlMubCO9mdiKmL/UUkAYYal EeWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=dvNGSXlaKpr9lYFxnC2nHewKW5T/h6jhqfJV6afXXAA=; b=ufCqpt/gswn4R4D9pq2t4tKIECwZX/RveobwAdldg21P2t9Tih+36e9UBxeNJZLCkO ISpCoNfkR8HKSjOEKS89CLi/pNsNfaPF3ik2OZzjBKkHbHk6pXE0XEwOjg5BP0WBiG6x P+9baTysRhEGceYneD+1Jk3ULaIre1s25sszeEUDN8vaA52bh+6VOOXDvcuGxOKzOsu/ GETxXGTqcphNEziCiN8hgy8NDKbIq98SrN1FY47JzX+CDPHklTyloei8ainSuXk3xV5b RkqBjQaBCyuad38fFQmXU7o3upG/8vvfBdZzIEZnrKZqK27MGF/gWMcZoDRU+yGTUON7 v3vA== X-Gm-Message-State: APjAAAXrDN7bjExwo+8vLU70jyLpZ1j9DEdoN8jaNduzZCDJRv7XoEA8 ToyMV9cOEGWiC3EGDicsnCROSW+AB+k= X-Google-Smtp-Source: APXvYqxKhP6qZxLK7DYl5jBRs5XGiPKvg02GIcY2k0tq4mujNe/wdQHBH32+/RNfNcerK9QY2yBUQg== X-Received: by 2002:a17:90a:ba8d:: with SMTP id t13mr8694227pjr.129.1571800528892; Tue, 22 Oct 2019 20:15:28 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id q13sm23602778pfn.150.2019.10.22.20.15.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Oct 2019 20:15:28 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/2][SRU][UNSTABLE] UBUNTU: SAUCE: PCI: pciehp: Do not disable interrupt twice on suspend Date: Wed, 23 Oct 2019 11:15:08 +0800 Message-Id: <20191023031509.23554-10-acelan.kao@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023031509.23554-1-acelan.kao@canonical.com> References: <20191023031509.23554-1-acelan.kao@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mika Westerberg BugLink: https://bugs.launchpad.net/bugs/1849269 We try to keep PCIe hotplug ports runtime suspended when entering system suspend. Due to the fact that the PCIe portdrv sets NEVER_SKIP driver PM flag the PM core always calls system suspend/resume hooks even if the device is left runtime suspended. Since PCIe hotplug driver re-uses the same function for both it ends up disabling hotplug interrupt twice and the second time following is printed: pciehp 0000:03:01.0:pcie204: pcie_do_write_cmd: no response from device Prevent this from happening by checking whether the device is already runtime suspended when system suspend hook is called. Link: https://patchwork.kernel.org/patch/11089971/ Fixes: 9c62f0bfb832 ("PCI: pciehp: Implement runtime PM callbacks") Reported-by: Kai-Heng Feng Tested-by: Kai-Heng Feng Signed-off-by: Mika Westerberg Reviewed-by: Rafael J. Wysocki Signed-off-by: AceLan Kao --- drivers/pci/hotplug/pciehp_core.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index b3122c151b80..56daad828c9e 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c @@ -253,7 +253,7 @@ static bool pme_is_native(struct pcie_device *dev) return pcie_ports_native || host->native_pme; } -static int pciehp_suspend(struct pcie_device *dev) +static void pciehp_disable_interrupt(struct pcie_device *dev) { /* * Disable hotplug interrupt so that it does not trigger @@ -261,7 +261,19 @@ static int pciehp_suspend(struct pcie_device *dev) */ if (pme_is_native(dev)) pcie_disable_interrupt(get_service_data(dev)); +} +#ifdef CONFIG_PM_SLEEP +static int pciehp_suspend(struct pcie_device *dev) +{ + /* + * If the port is already runtime suspended we can keep it that + * way. + */ + if (dev_pm_smart_suspend_and_suspended(&dev->port->dev)) + return 0; + + pciehp_disable_interrupt(dev); return 0; } @@ -279,6 +291,7 @@ static int pciehp_resume_noirq(struct pcie_device *dev) return 0; } +#endif static int pciehp_resume(struct pcie_device *dev) { @@ -292,6 +305,12 @@ static int pciehp_resume(struct pcie_device *dev) return 0; } +static int pciehp_runtime_suspend(struct pcie_device *dev) +{ + pciehp_disable_interrupt(dev); + return 0; +} + static int pciehp_runtime_resume(struct pcie_device *dev) { struct controller *ctrl = get_service_data(dev); @@ -318,10 +337,12 @@ static struct pcie_port_service_driver hpdriver_portdrv = { .remove = pciehp_remove, #ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP .suspend = pciehp_suspend, .resume_noirq = pciehp_resume_noirq, .resume = pciehp_resume, - .runtime_suspend = pciehp_suspend, +#endif + .runtime_suspend = pciehp_runtime_suspend, .runtime_resume = pciehp_runtime_resume, #endif /* PM */ };