Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp10751208ybl; Fri, 27 Dec 2019 01:25:11 -0800 (PST) X-Google-Smtp-Source: APXvYqz6KY7XepeCX5wTEpn4Szp6tze/dsPosG5hDUsbThYJ90YhAGMEd9qCVHA3mAyQf2LdGZuK X-Received: by 2002:a05:6830:4b9:: with SMTP id l25mr57094513otd.266.1577438711489; Fri, 27 Dec 2019 01:25:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577438711; cv=none; d=google.com; s=arc-20160816; b=zEFI6+waxqiqLQ4lkO9kCO8rsGIVHK+uD1rjLdqF0MOl3BXg3zTPHCQGdRpol/oqum s7xl46rUSPhBvD+VcXcViK4/n1BaSrrRgzVMRdLYRHCNjhczjAfp3rW+NIe4LJoidgoe Fj/sizw5K1mdaOAldI5BlCMj+nM1dg+muQSawZE/HVyvn2eKoQ6wWiDBvMecK3YTheSe ErjFHJ4BsAhODQ59Q5jJOf568wE4jbo6vwvZsY6D0BPZenAKqsYv73eIumjw5LbhcOe5 estRAe8XGPC2e4MADFcazvrBR/P6rhJ/C6phH467kdjJ3AovN/O27qjSG1kkwNkYI51J 6F9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=7v//0y/K8cdMSv4rwkAATs8gz1SQ1YF0Eva26Xe/g+A=; b=sl/cTC0o2hUY+JChzau7k3mReOHh6mLUUL8DrMQT7K5crfGwZNrW9t8uu4NWRXs+bY YhLe5mdAea97fHINIkmUoQ1Dp2+ggyGXC5NCfVGMCEGpewMPpBToULh4hyywN6K6o21B v1rOt5MEfFyp57e/w2ZSKoGTSsFZRWRSja+FQweejv25YDlzQT0j9e1DjD10y0rYrVj6 R13/BK5ShxcNgkdgkCT0HCI4ukgSYk1jJs5vg7z00hFIqfl1vDalqrVFCiOYg3X2aW45 jjmb4fq9CKoeUPXS7aHc+elCmZwQ+DiewTOTlLoS6vH3im03Gk+sYv6oH8cFsD8f0nRC xSDA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5si13753928oig.75.2019.12.27.01.24.59; Fri, 27 Dec 2019 01:25:11 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726377AbfL0JYR (ORCPT + 99 others); Fri, 27 Dec 2019 04:24:17 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:44643 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725904AbfL0JYR (ORCPT ); Fri, 27 Dec 2019 04:24:17 -0500 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iklqv-000718-2j; Fri, 27 Dec 2019 09:24:13 +0000 From: Kai-Heng Feng To: bhelgaas@google.com, rafael.j.wysocki@intel.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kai-Heng Feng Subject: [PATCH] PCI/PM: Report runtime wakeup is not supported if bridge isn't bound to driver Date: Fri, 27 Dec 2019 17:24:05 +0800 Message-Id: <20191227092405.29588-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We have a Pericom USB add-on card that has three USB controller functions 06:00.[0-2], connected to bridge device 05:03.0, which is connected to another bridge device 04:00.0: -[0000:00]-+-00.0 +-1c.6-[04-06]----00.0-[05-06]----03.0-[06]--+-00.0 | +-00.1 | \-00.2 When bridge device (05:03.0) and all three USB controller functions (06:00.[0-2]) are runtime suspended, they don't get woken up by plugging USB devices into the add-on card. This is because the pcieport driver failed to probe on 04:00.0, since the device supports neither legacy IRQ, MSI nor MSI-X. Because of that, there's no native PCIe PME can work for devices connected to it. So let's correctly report runtime wakeup isn't supported when any of PCIe bridges isn't bound to pcieport driver. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=205981 Signed-off-by: Kai-Heng Feng --- drivers/pci/pci.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 951099279192..ca686cfbd65e 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2493,6 +2493,18 @@ bool pci_dev_run_wake(struct pci_dev *dev) if (!pci_pme_capable(dev, pci_target_state(dev, true))) return false; + /* If any upstream PCIe bridge isn't bound to pcieport driver, there's + * no IRQ for PME. + */ + if (pci_is_pcie(dev)) { + while (bus->parent) { + if (!bus->self->driver) + return false; + + bus = bus->parent; + } + } + if (device_can_wakeup(&dev->dev)) return true; -- 2.17.1