Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6150723rdb; Mon, 1 Jan 2024 10:31:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHh5H8laKClr8PLjKhZXsk0+o9HeHYMYNsO6roKaLrauCMaOkFPeibbgrW6fWjVWPeI04CR X-Received: by 2002:a9d:5605:0:b0:6dc:41c:9bc6 with SMTP id e5-20020a9d5605000000b006dc041c9bc6mr5666900oti.36.1704133919122; Mon, 01 Jan 2024 10:31:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704133919; cv=none; d=google.com; s=arc-20160816; b=b/Jua7WDTlL7X2zq6bvmbNhN6TjkY5MW9FriauexJhW4SKjoF6ELPdNODhk9aJJW+u th+/CvMD7be/NmTBJ0n2OkOXp6/s6wLLUdxV2ZsitpISmhNXd7VsKjqJErHAYOgyvQQw DGsBETBbt8dR1c65GIHMq/f9fbk5fNLTIOiwjSMCjGs5im9WsSImYXZ2KJGg2xaqZ7UX p16099lPqhR25tx0y/vVjK4qV2/qAzA6LuwrsuEAkZUxtXk1CgAimt1dRfLxKKlhLa/P bO+d+IWqsTpwloE4QIppNjeb0IGlCBTQCQHyVvc2tSjW2djWVDDUfd2c5GnyXVmjNVwd 0PbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=KnpQ45pOGnQlVPCKJdUcBfkjdeSBITb7HwGW9eLTYHU=; fh=KpuXO1Rhu2XnaR7ZqrrNqdjSxNDpF9ksF9Af/TJfAQI=; b=zaPQ8UlAk5Vdee1qH3S46+HGEDLB6Hy/Ncww5/dEuppfARd0DE9tIESw3zZAaYMxNG fsdPUkeaVp6rbHSEUvUK1/FudueeKlbtLn7iNt4WnZaWrxilpoKHvHJWND6Mfso49OHZ 6h2apEotnHOqMg3djuLzmFPHgfIzF0DFt73YNB/LobeHr6/pg69UaH00B/aqGaXLuofq caEMtLJUVho7qsRKwKth1KGdvsEMyMmnmeFILEF87gApBpqw+Ish/JZtWG8pk40KiMvl JosIaznbdbwHYJ9oGQq+wQevpftKmc77XF6Hrng5zfIRhulMHs7DroXB5an93J6mgeKT A7zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lV8z3DVn; spf=pass (google.com: domain of linux-kernel+bounces-13930-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13930-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z14-20020a05622a060e00b004277c32227esi24905818qta.302.2024.01.01.10.31.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jan 2024 10:31:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13930-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lV8z3DVn; spf=pass (google.com: domain of linux-kernel+bounces-13930-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13930-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CA9841C20E2D for ; Mon, 1 Jan 2024 18:31:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46A6DD51C; Mon, 1 Jan 2024 18:31:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lV8z3DVn" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1AE6D518; Mon, 1 Jan 2024 18:31:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704133908; x=1735669908; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=uHQYWjLuuveSvnDuj/VEd1ZDF12rii/PI2weQakgYeg=; b=lV8z3DVnp1z+wZFc24jYFvZbAMNL6Kkm81BfIwrFjUHtN0tZ9ajH7oVa jLYMG9NGirOAiOKattadR3IXRjYZoMIVja3R2IJdyPa3m2rH/cUCrwiei WhNGRRtfy3RUO0s+IdA/lz1CEUbZ0LXGLf++KpsBbuVTEgVE1OmW6hKWo S0hObpV/tdyAoxGMEca50IkkO3xgMLbzLk5m1cRw2RcFonsR3Tbdmxsc/ HDav4DNLt2qqODUPgPEC6f0Di+L9kLB4/RZwjlqFNFv7p+HgRCDbo50ox BuIx90wl9/R9O/tsI0J/zHik77pv1Yzbt0XXm/jNpZDEld9dTUpA/J4fE Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10940"; a="4141744" X-IronPort-AV: E=Sophos;i="6.04,322,1695711600"; d="scan'208";a="4141744" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jan 2024 10:31:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,322,1695711600"; d="scan'208";a="27877970" Received: from amazouz-mobl.ger.corp.intel.com ([10.251.210.158]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jan 2024 10:31:43 -0800 Date: Mon, 1 Jan 2024 20:31:39 +0200 (EET) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Lukas Wunner cc: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , Krzysztof Wilczy??ski , Alexandru Gagniuc , Krishna chaitanya chundru , Srinivas Pandruvada , "Rafael J . Wysocki" , linux-pm@vger.kernel.org, Bjorn Helgaas , LKML , Alex Deucher , Daniel Lezcano , Amit Kucheria , Zhang Rui Subject: Re: [PATCH v3 06/10] PCI: Cache PCIe device's Supported Speed Vector In-Reply-To: <20231230151931.GA25718@wunner.de> Message-ID: <94973372-91fc-27fc-b187-7427af9e4b7d@linux.intel.com> References: <20230929115723.7864-1-ilpo.jarvinen@linux.intel.com> <20230929115723.7864-7-ilpo.jarvinen@linux.intel.com> <20231230151931.GA25718@wunner.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-122494420-1704133906=:7866" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-122494420-1704133906=:7866 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT On Sat, 30 Dec 2023, Lukas Wunner wrote: > On Fri, Sep 29, 2023 at 02:57:19PM +0300, Ilpo J?rvinen wrote: > > The Supported Link Speeds Vector in the Link Capabilities Register 2 > > corresponds to the bus below on Root Ports and Downstream Ports, > > whereas it corresponds to the bus above on Upstream Ports and > > Endpoints. > > It would be good to add a pointer to the spec here. I think the > relevant section is PCIe r6.1 sec 7.5.3.18 which says: > > "Supported Link Speeds Vector - This field indicates the supported > Link speed(s) of the associated Port." > ^^^^^^^^^^^^^^^ > > Obviously the associated port is upstream on a Switch Upstream Port > or Endpoint, whereas it is downstream on a Switch Downstream Port > or Root Port. > > Come to think of it, what about edge cases such as RCiEPs? On real HW I've seen, RCiEPs don't seem to have these speeds at all (PCIe r6.1, sec 7.5.3): "The Link Capabilities, Link Status, and Link Control registers are required for all Root Ports, Switch Ports, Bridges, and Endpoints that are not RCiEPs. For Functions that do not implement the Link Capabilities, Link Status, and Link Contro registers, these spaces must be hardwired to 0. Link Capabilities 2, Link Status 2, and Link Control 2 registers are required for all Root Ports, Switch Ports, Bridges, and Endpoints (except for RCiEPs) that implement capabilities requiring those registers. For Functions that do not implement the Link Capabilities 2, Link Status 2, and Link Control 2 registers, these spaces must be hardwired to 0b." > > Only the former is currently cached in pcie_bus_speeds in > > the struct pci_bus. The link speeds that are supported is the > > intersection of these two. > > I'm wondering if caching both is actually necessary. Why not cache > just the intersection? Do we need either of the two somewhere? Intersection is enough at least for bwctrl. The only downside that is barely worth mentioning is that the bus SLSV has to be re-read when function 0 sets the intersection. I can think of somebody wanting to expose the list of both supported speed to userspace though sysfs (not done by this patch series), but they could be read from the registers in that case so that use case doesn't really matter much, IMO. > > Store the device's Supported Link Speeds Vector into the struct pci_bus > > when the Function 0 is enumerated (the Multi-Function Devices must have > > same speeds the same for all Functions) to be easily able to calculate > > the intersection of Supported Link Speeds. > > Might want to add an explanation what you're going to need this for, > I assume it's accessed frequently by the bandwidth throttling driver > in a subsequent patch? Yes. I tend to try to avoid forward references because some maintainers complain about them (leading to minimal changes where true motivations have to be hidden because "future" cannot be used to motivate a change even if that's often the truest motivation within a patch series). But I'll add a fwd ref here to make it more obvious. :-) -- i. --8323329-122494420-1704133906=:7866--