Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2023803lqe; Tue, 9 Apr 2024 07:34:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDuLmaZkSNa9SFr08GlL9aEQuzlYJ3Ip8S+9dFL11q6UsR6H1lVU5+7Yf1d3dxZ5A9cR+DK3wCk32R5FknQGiKkZZRfVHaUGNXbYixjw== X-Google-Smtp-Source: AGHT+IEWNK5hUk6kxD6WcHdDf9Xz1+yIkDm+WSL8GNRXjNBxZZxR62ueF75SH9Wh1P62Rc0QQpSh X-Received: by 2002:a05:620a:1123:b0:78d:635c:91e1 with SMTP id p3-20020a05620a112300b0078d635c91e1mr6642639qkk.75.1712673243457; Tue, 09 Apr 2024 07:34:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712673243; cv=pass; d=google.com; s=arc-20160816; b=EL5JHA6xG7m67MIoORRctY/xbvgoD+mpqV8+VHUxa8fuS5uClG5MrXi9VDStZr2vLi U9b1qVrronYyrrg7lWdFzqeWzrE2T2LaA1BjLjL4PEmS9qwH47j9174+FKnIdL+CsLaC ZyFDXanB+gcPuEwNoT+mCso25AknMrWHdkCYi8e3dCubZ80dL6TaaBHrO6FmSrJo2iwG UaNvcvo/ACQ7EKQx/AGvwJMAZRzi7+fLeuGnX24beDTQD9pDqXH4aFH013GhTTSAo6yX Qj/ZzHNT1BIMGwXVlo3Zeqnzv8njRBZ9yF6VTKJBa1EXd81zeCubqSCk0XIO3UIGggTx 9E5w== 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=4z1vM6vFHV/yTZWaOoqyjhGW2u8mZS+dijJV/Itm9AA=; fh=tTxmcxe2mcfQqTvgzVqaxob5UzMCOAQsHC2kWP1oyUw=; b=VWGu72f3L+cT/ktLaYuppAm8JMgAFsE0ju+n6HQm87P7/lcH5vXN4q9zHaptTBI1oF 4glaVjZ/ibfFwZZV5aoxrtWJ+ZY+nFVGhucHGGMBXxOd2Ktr7Hp1diGZzuB7k4rPm6q6 gy1iyIu5ksFgBz56Jlq4Zx6k+AxDkyQk9son17BqT8+J4nYJuQY4OUWlfkq9GaIMOgPO mAcNVXmSExALeV+TkoihqEXn/iqyVjqB1yP3ronc5ZQzPzQRxjaS22GFvVHH1/RUlaQQ jdApzCiwrQ4sDSCZO+7RL0k5J4ykYGovLH3oup+g/Fr53TO2hAc7Nbs1WHHHOZdr2IEI 90jA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bs/SHK6C"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-137098-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137098-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ye20-20020a05620a3b9400b0078a4cc85415si7931354qkn.42.2024.04.09.07.34.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 07:34:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137098-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=@kernel.org header.s=k20201202 header.b="bs/SHK6C"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-137098-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137098-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 34B2A1C21444 for ; Tue, 9 Apr 2024 14:34:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56D702D781; Tue, 9 Apr 2024 14:33:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bs/SHK6C" 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 7771CA94A; Tue, 9 Apr 2024 14:33:55 +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=1712673235; cv=none; b=UTbMtgbpnaES/UU7lwWm2aVS9TuJkkW2AHSOdzTYQnLnCcbZh5H33qEaVT/kGTqOn9zsksmSxvGVgcbLcuI/sS2tzBTWbnUnpnStPrALt2pnlBLjpOvtnqdP6fOZPBhl34CMbZOL3moPuy9Gl1ZfhWXCMuiTeqFRd/F3ivKKqq8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712673235; c=relaxed/simple; bh=if366ozc5ZQv7pHljSsCus/73omwjt2XrkVWvzIwwuc=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=JyPjAWIQfw580cQ2OfkjqblbmhkA75MMAWozsV13w7vsKyr6OV58ypF+vuoh4GPlr4VhyWfkap3u9X+OIhfTVvLS6oNpdUCzA6TkoAFYP+IPzWz6UEPnvex/Ql2bzpfZFPtJoI/gKlDD6RadyPyBAJgrzZitjS71LUBKy6rKDtQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bs/SHK6C; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA4CAC433F1; Tue, 9 Apr 2024 14:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712673235; bh=if366ozc5ZQv7pHljSsCus/73omwjt2XrkVWvzIwwuc=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=bs/SHK6C9sDdNlJRHQvFBhssB7MdhjNVWEDrJS5zORQCjbuEigkO6Xi/J3mhxcyRV b7sPnrM1eWeu7jv/cFsjiGgepz2LX29RDjx2AMxx/lkTJ6BoN7P5cCx5U0tB8uZVOU 9+uT616/GCvEyyNhu5pPt67q1TDNkYt3UdORSvLv4K8fxG2E013s+OeJGsCji6c0fF W6VnSKBy2eYyRv4sgDmSuWJC2DWn/G7BZm20bjX5qkMK0zPd3Y0iq8/SB6WBp4lCOK SDAWzBXVOHWc316iqGUj1zXneVHY+px88oNxpfdtEt8IUV+yOA4bj+3GpbW9LQ71dT 4WNZpQx2nvG7Q== Date: Tue, 9 Apr 2024 09:33:53 -0500 From: Bjorn Helgaas To: Alexey Kardashevskiy Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , Ira Weiny , Dan Williams , Jonathan Cameron , Lukas Wunner Subject: Re: [PATCH kernel v3] PCI/DOE: Support discovery version 2 Message-ID: <20240409143353.GA2073836@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: <20240307022006.3657433-1-aik@amd.com> On Thu, Mar 07, 2024 at 01:20:06PM +1100, Alexey Kardashevskiy wrote: > PCIe r6.1, sec 6.30.1.1 defines a "DOE Discovery Version" field in > the DOE Discovery Request Data Object Contents (3rd DW) as: > > 15:8 DOE Discovery Version – must be 02h if the Capability Version in > the Data Object Exchange Extended Capability is 02h or greater. > > Add support for the version on devices with the DOE v2 capability. > > Signed-off-by: Alexey Kardashevskiy Applied with Sathy's reviewed-by to pci/doe for v6.10, thanks! > --- > Changes: > v3: > * updated subject line > * dropped "DISCOVER_" from the new field macro > > v2: > * added the section number to the commit log > --- > include/uapi/linux/pci_regs.h | 1 + > drivers/pci/doe.c | 11 ++++++++--- > 2 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h > index a39193213ff2..fbca743b2b86 100644 > --- a/include/uapi/linux/pci_regs.h > +++ b/include/uapi/linux/pci_regs.h > @@ -1144,6 +1144,7 @@ > #define PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH 0x0003ffff > > #define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX 0x000000ff > +#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER 0x0000ff00 > #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID 0x0000ffff > #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL 0x00ff0000 > #define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX 0xff000000 > diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c > index 61f0531d2b1d..c94c2b0767f3 100644 > --- a/drivers/pci/doe.c > +++ b/drivers/pci/doe.c > @@ -381,11 +381,13 @@ static void pci_doe_task_complete(struct pci_doe_task *task) > complete(task->private); > } > > -static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 *index, u16 *vid, > +static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 capver, u8 *index, u16 *vid, > u8 *protocol) > { > u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX, > - *index); > + *index) | > + FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER, > + (capver >= 2) ? 2 : 0); > __le32 request_pl_le = cpu_to_le32(request_pl); > __le32 response_pl_le; > u32 response_pl; > @@ -419,13 +421,16 @@ static int pci_doe_cache_protocols(struct pci_doe_mb *doe_mb) > { > u8 index = 0; > u8 xa_idx = 0; > + u32 hdr = 0; > + > + pci_read_config_dword(doe_mb->pdev, doe_mb->cap_offset, &hdr); > > do { > int rc; > u16 vid; > u8 prot; > > - rc = pci_doe_discovery(doe_mb, &index, &vid, &prot); > + rc = pci_doe_discovery(doe_mb, PCI_EXT_CAP_VER(hdr), &index, &vid, &prot); > if (rc) > return rc; > > -- > 2.41.0 >