From patchwork Mon Jan 22 20:12:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10179145 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6A86860390 for ; Mon, 22 Jan 2018 20:12:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59DE6206E2 for ; Mon, 22 Jan 2018 20:12:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E09228468; Mon, 22 Jan 2018 20:12:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E34EE206E2 for ; Mon, 22 Jan 2018 20:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=u4H9/w6KJbZyI5t5MqX6eD0YlXIR7zbVdx0n0lmG2uU=; b=JgW BZJ3jMqsjZDtbP9jSWZs+3Ce6PJ+kGM9+LZCihDnSnqskbKAkGL9qlXSwmz6PVUoz/bC6VWx5EPju NH+3LGLPt3uhDMdK1tscSA8OoZVzFw2G+BDV5pQbJ59rgd64+MUM0ULAGXiTjvLC8Bl2ftAjJWM/w F3BeojF6wlIcvmODcaNyQdNe6PxNn+drUYSCg+9/JzjcPr2SOMjLy0wei10gZlDrUWxs99z8NPsiQ +4HdghUqRAzVa1y+H2OikRv2C5MRUlKPbXgdvQ/JYW7g372QUJBAgari4TaG9nN4+bKsRs0shduc8 BLUa3skkijnZ4IZl3Ew671QhSZToUng==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ediSA-0007E2-NN; Mon, 22 Jan 2018 20:12:26 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ediS8-0007DF-2w for linux-arm-kernel@lists.infradead.org; Mon, 22 Jan 2018 20:12:25 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BB2A960A63; Mon, 22 Jan 2018 20:12:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1516651933; bh=svwoARHCwTpOlkGaRmzJRr3N+zNfchHVhw+uCdDyjT8=; h=From:To:Cc:Subject:Date:From; b=pC6GaAvPazVclyklMnNFO5gBSvB+ni42lv/BReMiVlH0Y6MOEsjW68krTk8P68zTK JYiHfWSq6LxVJg9Wj4unVuzRcweRRGjm8teSMTlqm8ZC+UNcxcbZS97IGAoJsIvHwU 3Y3XRC48scOzUfU7DPaubKtDAn1g/616gNfb7V28= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9E0D7600E6; Mon, 22 Jan 2018 20:12:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1516651932; bh=svwoARHCwTpOlkGaRmzJRr3N+zNfchHVhw+uCdDyjT8=; h=From:To:Cc:Subject:Date:From; b=Y2DnCXnT/zK7TeLLPnetEUTtM1hsP0X6dOcbbBkxvE/WOIbnPBCftoAGzXR6PW6v2 O6nbhbNdAYfO0RwcU7hiTz844L0vPJuvMdptKS+r4BbwTHOpNpebugSP1v6Lcl8hCG e8HuBZ4nR2gxZmRJ3BKAFXuWnRDvDgWOI/TgBNBA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9E0D7600E6 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: linux-pci@vger.kernel.org, timur@codeaurora.org Subject: [PATCH V2] PCI/ASPM: Suppress common clock mode setting failure Date: Mon, 22 Jan 2018 15:12:01 -0500 Message-Id: <1516651924-21820-1-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kees Cook , Ard Biesheuvel , linux-arm-msm@vger.kernel.org, open list , Vidya Sagar , Sinan Kaya , Greg Kroah-Hartman , Bjorn Helgaas , Rajat Jain , Yinghai Lu , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Code is emitting warnings when it tries to set the common clock mode for ASPM and ASPM is already configured to common clock mode by the UEFI BIOS. Let's bail out silently in such a case. pci 0004:00:00.0: ASPM: Could not configure common clock Signed-off-by: Sinan Kaya --- drivers/pci/pcie/aspm.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 9783e10..913b90d 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -240,6 +240,24 @@ static void pcie_aspm_configure_common_clock(struct pcie_link_state *link) if (!(reg16 & PCI_EXP_LNKSTA_SLC)) same_clock = 0; + /* Port might be already in common clock mode */ + pcie_capability_read_word(parent, PCI_EXP_LNKCTL, ®16); + if (same_clock && (reg16 & PCI_EXP_LNKCTL_CCC)) { + bool consistent = true; + + list_for_each_entry(child, &linkbus->devices, bus_list) { + pcie_capability_read_word(child, PCI_EXP_LNKCTL, + ®16); + if (!(reg16 & PCI_EXP_LNKCTL_CCC)) { + consistent = false; + break; + } + } + if (consistent) + return; + dev_warn(&parent->dev, "ASPM: current common clock configuration is broken, reconfiguring\n"); + } + /* Configure downstream component, all functions */ list_for_each_entry(child, &linkbus->devices, bus_list) { pcie_capability_read_word(child, PCI_EXP_LNKCTL, ®16);