Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1521915pxb; Thu, 16 Sep 2021 09:10:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwx4tkrkwNfcwPJOgJKZF8xfoZTAUM8R5YUVj4joYDyP5s4YuVaM74fvJsM+ef/H34UCMfu X-Received: by 2002:a17:906:c205:: with SMTP id d5mr7204828ejz.74.1631808608213; Thu, 16 Sep 2021 09:10:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631808608; cv=none; d=google.com; s=arc-20160816; b=dnL2bwjtukcsbvJJ38ifeAPCl0hexYFCkrC5t6YyGQse9fcXqH+XNLTE+qOV9voF/t SLJofjpCLYDxLQPA9+RdE2fgHI9fWHcJaBTTAqA9ScLXO3I6YahXQoFL0fntVqVTtBE/ vPuSQQsKQefRxE2VjiUE7G6/Pv1oKP/BXxGFD9h3jSYfMaTeos/Uw0w83bXqw/QA0+IF ZPPsXkSS4P2zYopmrjThzIdYrogNbdBpspw4f2Q1axGnslG5iqez2sY6r4xxEYqgQURN tLSxUCRLbF4Ji1iB2Kj/d1OpZ7LoshS+qpqyVVZmo84zjYIaWni8FhJeGOuhgB0v9cjN xVfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=W8nVZqzaz4WPzpCB4ahV5cvwGyhYqtDMANtB4jScrIs=; b=JQGw55XvlNc2msQYob692G2s+enLSj1swNfGuYSw8kCF3L5wuA6m5zPge+cCOTte/h kIEB2Cve++wMpV2WAxjnOPFGjcpZDmO3r4difWyWa2PtNQ6AXqA/97ZxQ5liC9fXQFLF CIoOaJ6KTy1170wMqlxhd8ixqjSRE0sABZq+lPVw2LkDr33yNpC1LJq6nhcZWajxQzCb 8JriQcogHkEpODhSqY8ATACot9DG/aKs3qX3WUTfjqidcb/FdIBK1AziG8waUQFjFCDS 08Cgt6NeekkaCftI2gFAOlH69wwpQc4bz9u46WQ2HPY+lLo8zCdyzyiLtwIXHCWwobD2 u4KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="cdU5d/gy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si3182830edz.139.2021.09.16.09.09.44; Thu, 16 Sep 2021 09:10:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="cdU5d/gy"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235114AbhIPQJD (ORCPT + 99 others); Thu, 16 Sep 2021 12:09:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:46114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235355AbhIPQGm (ORCPT ); Thu, 16 Sep 2021 12:06:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F31A761250; Thu, 16 Sep 2021 16:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808321; bh=6tItJVs226dgQFi8nVcJYCNi5xl2xLQ138Uh+jQO3vI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cdU5d/gyLFDJ1iCAGm14wd/huhuAdCedhYRe6kVO4P9ahaRjHNsYiXhuP1v0tm8fK SL8NMGDVbIvmqtoOGOD51CU4MBVlFAbg9KK+sBQHRDi2EzdIok8QiFN8aEEfFLRqcM 5MVNFcuIZ6dc9GrBQ2X4TusjKIK/+TRhJqWShkiw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stuart Hayes , Bjorn Helgaas , Lukas Wunner Subject: [PATCH 5.10 046/306] PCI/portdrv: Enable Bandwidth Notification only if port supports it Date: Thu, 16 Sep 2021 17:56:31 +0200 Message-Id: <20210916155755.520590203@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stuart Hayes commit 00823dcbdd415c868390feaca16f0265101efab4 upstream. Previously we assumed that all Root Ports and Switch Downstream Ports supported Link Bandwidth Notification. Per spec, this is only required for Ports supporting Links wider than x1 and/or multiple Link speeds (PCIe r5.0, sec 7.5.3.6). Because we assumed all Ports supported it, we tried to set up a Bandwidth Notification IRQ, which failed for devices that don't support IRQs at all, which meant pcieport didn't attach to the Port at all. Check the Link Bandwidth Notification Capability bit and enable the service only when the Port supports it. [bhelgaas: commit log] Fixes: e8303bb7a75c ("PCI/LINK: Report degraded links via link bandwidth notification") Link: https://lore.kernel.org/r/20210512213314.7778-1-stuart.w.hayes@gmail.com Signed-off-by: Stuart Hayes Signed-off-by: Bjorn Helgaas Reviewed-by: Lukas Wunner Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pcie/portdrv_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -260,8 +260,13 @@ static int get_port_device_capability(st services |= PCIE_PORT_SERVICE_DPC; if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM || - pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) - services |= PCIE_PORT_SERVICE_BWNOTIF; + pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) { + u32 linkcap; + + pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &linkcap); + if (linkcap & PCI_EXP_LNKCAP_LBNC) + services |= PCIE_PORT_SERVICE_BWNOTIF; + } return services; }