Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp123815lqh; Fri, 3 May 2024 15:53:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVkqQgvWsE3YbdU5E8zgq+ZaACONFdbc3tnLvKG7krBbmurAox6fi7u28BneyGsE/I4OetZX96Gfps9HOEnhFYTr2Q2G6sthN8Jz4dRCA== X-Google-Smtp-Source: AGHT+IGvv28GEPPYf/A44qj8UmoE5DzKXtZeyUP6btW6IinpjY5EgW3X30aWpSzbrj8uPSkDj7KD X-Received: by 2002:a17:906:a84a:b0:a59:5693:4707 with SMTP id dx10-20020a170906a84a00b00a5956934707mr2772011ejb.24.1714776796514; Fri, 03 May 2024 15:53:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714776796; cv=pass; d=google.com; s=arc-20160816; b=sCKA8FKNp3NR+67Q7343saR6V5KlqpOF1MK5UmaVlsBwxZAJpqUze79lWBp7G3850q fdLxIQrDIIJLDfd7bkONlKstlgFdFsNzBSvBrE470Umerq7gLL3kgWiVdGhkbQUcfyfC HQLcPNipE43uZAG6V5zmSit6MFj8jpqqKoTI03k0xL9BleN5y3AGw2LGyQzh8hS3DeyD hDSPSafgDIV5+sDKdv5KuhNBwiSunSXKoJa+kxn9Ct3IfIAABsuRJXdWH1hGRtFPwrUJ Xqg9doIZqohPsCiLX2ojJb2E5xAQ9e/hUUIOi+UJ83y27QL6/bSLNPSI86ddUTuiYpVG yoKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:subject:cc:to:from:date:dkim-signature; bh=bEzZ7F9C5hWzyXjXhX2Xcm3NN4Og4Krfn2wAeLAFBhM=; fh=bBtdP6EvC29gnwhHO3KEojb0RtNV8kbUXaJHgch8vdM=; b=eqn2pJLa+7ADRTh9oPLuuGXUf2Kl8rodg5W3dT9LNRYH++17EfFic+RQMJo4k7A3tX +rKCNEt75aC7Kioy9oKKnwGGlPij/VmcWWOVFMut8a0PmQJm/cjc4TZqkxY1aBS4zJjI 2FxHlGXsoDNtSjgw9tgq+PPqRfq1ccAgf/J8/WfHyRUFaQ8gu4JQ2F/iCZiFGym9WrKv uyhKfoso8DS9T22Hj5fgiP02RL+c/ppStPkSnQSbw5hW+mVVNlrknROh40i5CNAB/tBW dTndEFtPctprIPwhuqGd+eI4jt0EIbnUrIOZMwbv4j6YYNmYI30FS2gp89oPAYSqoUTn Rkew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oN1qhSjF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-168388-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168388-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id oz33-20020a1709077da100b00a55bd6a034dsi1994100ejc.125.2024.05.03.15.53.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 May 2024 15:53:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-168388-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oN1qhSjF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-168388-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-168388-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 397C11F23812 for ; Fri, 3 May 2024 22:53:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC37A839F5; Fri, 3 May 2024 22:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oN1qhSjF" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1181877F08; Fri, 3 May 2024 22:53:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714776788; cv=none; b=tKzJwaEmzUrxwY07b+kF3orPGxfpiFPnyD0sEwkVCJNpm4hcuVvrzmS6ELhqc4N4F1Qjw7KOVvgUoci2h07T3/wUyMvU28ntirNkzgBOS3YWZNpHD2E4B0ROEKbUfM15i5Y2MtKxiQlfEbZSjiCU7VSMlV2GWiw9/xpKxmHSJgM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714776788; c=relaxed/simple; bh=mXcYLMX35fPnLEPH9zrI4bMp+JPZC+O689bhhbTpo/o=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=fkJLHmyuo2TihCut6a3G1DZXW9EX7JuRvuLkSSX1ncGH0h5wlB7Y/TPg8x1T04mrXTJDF8+XsPxRQHcaTh+1kIWfsrwuxpuUP84iE0iIj55xQYDub61fGSQ+Ky/1EFXpLU/h7JxCT4n2KBvEMJ9VtgRg8ESeuE13bslZE6vL1Lk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oN1qhSjF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2293C116B1; Fri, 3 May 2024 22:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714776787; bh=mXcYLMX35fPnLEPH9zrI4bMp+JPZC+O689bhhbTpo/o=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=oN1qhSjFtfExfcxp83Bnx+pofMcdi/EXKHF/817yLrh6CgflKgvoJCwR2vGGsCl8W BH3uD1m9s+Y+lFfVKyFCLD5HmKBXBd4Cv8OTNmjN8FMXOu7vHV/ktIA32LAwkmJzpb SMEKKGVzYWgrVCP4JBFVtZ+bDAAWNE6BsWablP9gsqxQvdUqpRAqi7TCqG22Kg00Jr TJLehTP1MnHzrOFt3RrIlDmIx/739zyd/khyjVxrI+VT/LjQ9sgoQY14/G3e88rupv vnEmTJ0KBZeGyGQ7H18LOxlzu83Dc4xmNsZA+Pk979Ea1/wfmQn+bqC6qvw5vvzFk+ 0bFWAPvc5oMAA== Date: Fri, 3 May 2024 17:53:05 -0500 From: Bjorn Helgaas To: Ilpo =?utf-8?B?SsOkcnZpbmVu?= Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, Mahesh J Salgaonkar , Oliver O'Halloran , Lukas Wunner , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v3 1/2] PCI: Add TLP Prefix reading into pcie_read_tlp_log() Message-ID: <20240503225305.GA1609388@bhelgaas> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240412133635.3831-2-ilpo.jarvinen@linux.intel.com> On Fri, Apr 12, 2024 at 04:36:34PM +0300, Ilpo Järvinen wrote: > pcie_read_tlp_log() handles only 4 TLP Header Log DWORDs but TLP Prefix > Log (PCIe r6.1 secs 7.8.4.12 & 7.9.14.13) may also be present. > > Generalize pcie_read_tlp_log() and struct pcie_tlp_log to handle also > TLP Prefix Log. The layout of relevant registers in AER and DPC > Capability is not identical because the offsets of TLP Header Log and > TLP Prefix Log vary so the callers must pass the offsets to > pcie_read_tlp_log(). I think the layouts of the Header Log and the TLP Prefix Log *are* identical, but they are at different offsets in the AER Capability vs the DPC Capability. Lukas and I have both stumbled over this. Similar and more comments at: https://lore.kernel.org/r/20240322193011.GA701027@bhelgaas > Convert eetlp_prefix_path into integer called eetlp_prefix_max and > make is available also when CONFIG_PCI_PASID is not configured to > be able to determine the number of E-E Prefixes. s/make is/make it/ I think this could be a separate patch. > --- a/include/linux/aer.h > +++ b/include/linux/aer.h > @@ -20,6 +20,7 @@ struct pci_dev; > > struct pcie_tlp_log { > u32 dw[4]; > + u32 prefix[4]; > }; > > struct aer_capability_regs { > @@ -37,7 +38,9 @@ struct aer_capability_regs { > u16 uncor_err_source; > }; > > -int pcie_read_tlp_log(struct pci_dev *dev, int where, struct pcie_tlp_log *log); > +int pcie_read_tlp_log(struct pci_dev *dev, int where, int where2, > + unsigned int tlp_len, struct pcie_tlp_log *log); > +unsigned int aer_tlp_log_len(struct pci_dev *dev); I think it was a mistake to expose pcie_read_tlp_log() outside drivers/pci, and I don't think we should expose aer_tlp_log_len() either. We might be stuck with exposing struct pcie_tlp_log since it looks like ras_event.h uses it. Bjorn