Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp371995lqi; Wed, 6 Mar 2024 22:32:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWx9CYS+pztnPQpmfiE8bmkIp6d+D0Vkhgsjr4P3URkKdYDICVGCo+tdHVSIZY05fK4EHHpSCTaVuuMWlqamw1lxE0G+THeVX1fPPKQVg== X-Google-Smtp-Source: AGHT+IFWPOuV/5DLuWVgR3E2Blr89FchgVCG7T82nnQ9CT2GvGzs3wlLXRG+iYLUxIUT4lD7JQvk X-Received: by 2002:a17:906:b2cf:b0:a45:b273:17c2 with SMTP id cf15-20020a170906b2cf00b00a45b27317c2mr2365768ejb.2.1709793158232; Wed, 06 Mar 2024 22:32:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709793158; cv=pass; d=google.com; s=arc-20160816; b=xs95x5k4dJrkxru9PeiVrlNj8VL8V2WGDAA6TBhfhugpl/O4LJ1pT0RwfrGi3mT3Le Xc5C5mP8K8+jR0IJTeg0Z6ZZU9wxx/Jgc9rBi16QbTpOiSCPu/P08sUuI6sbrKTQl5Vh x+x4QKN/lpURNbuboTOeqyz8pHEnf3T/Z6ByiZAZa42qp+zP56g8qPlnkA0VzpNyY2Yn HK/k2Ll2Oo2gCP7es6p8DCBYZTbA8W+IFUehI83NWv/dL2+02yayd+hAzgXP/t1yAV6V zvKUGBZM9wYmV0pJVbI6JZTGKq6NnJ6gT2ku+BEI7vDwq7qYBc7zy0mf1O9N/lCu7e9X QGpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=8p7oGzm5YEc17mr7Hc2mG+1f/a/Pw8VPdlVKrPJxZGk=; fh=3UD4H9BZjcuLIvHT2HPFyzbPt7DUGnutS3jZZvtdZpA=; b=QT8rejYW7mLh9OgSqK/3hmIMq+TXCL7ouiATfOrgM+setsM+QPmu+Sogam9D0aSA76 LJXY3Tf6Z3AAe315kohChhgvKDApasFH+BjuPaMtmfuGfVXYJcwCU54stKRq7+bk7rF4 FJZYOwHaIqm4blmmaAsePOOGYzbE/cXQTH2+SAJ0skBkrZGYw/5uxdfDfQ6ePViUg1Ar PfFVKeY7usac9F42rjvNl/DKNXU7bcKANxc/V7wvQEcZ+0lGSa6Bq0CsOI7vEgfmhz7r 5ULKv7SzYiCSdtMfbqGTu1nXKm5lLuDC3gv33qD41FFl8d0jARvc7ryaAAlno1Zw9Tgv iNXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="N/thGd/P"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-95013-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95013-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b23-20020a170906491700b00a45b8c249c8si1313460ejq.1027.2024.03.06.22.32.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 22:32:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95013-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=@gmail.com header.s=20230601 header.b="N/thGd/P"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-95013-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95013-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1B5251F274AF for ; Thu, 7 Mar 2024 06:24:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BCDD1CAA4; Thu, 7 Mar 2024 06:23:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="N/thGd/P" Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 929B2E546; Thu, 7 Mar 2024 06:22:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709792581; cv=none; b=a8vcs+ISiYRRv1TSnsiV0tmC6AVhRmmfRmgsipZWXiMKswgpJ0uspigbej1PQbrGuJ/9PkdJGgCKBLGYrZYwIVNY3VU/RBo8yZo6Yowf+YEI9arsZxmHxXa77ZwMNT+gWiIVr/xtYqapuBhkR7S7lnvBWpUE0vMRqYMzw0OgbXI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709792581; c=relaxed/simple; bh=UNCTw5D9WsoqL1Hbw+KpFJE6iW6Jly3wtcYbjgHX2cA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=DVDoEut6PV+tOOC7pzv/zoAUvZaSUP1+vqLecmCbTYNxAs9N77h1s6/Iy5kh+PLCmBYxpIMMQgEpJziDd2+VGeUjYG6oY535fxm1Xpsz2f9mgVq/3QRcjI/msMota9e74G4pSlNFV3TnYI1Ov8Muw7vXxzQWGkNbFA4XpQffsGA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=N/thGd/P; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-566e869f631so555370a12.0; Wed, 06 Mar 2024 22:22:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709792578; x=1710397378; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8p7oGzm5YEc17mr7Hc2mG+1f/a/Pw8VPdlVKrPJxZGk=; b=N/thGd/P7jXpCrZVAYWeM5jjSL/yr2JuE+kNBgexAto06k6+fT1XvuT4ULb4KnABQX 03ku/tEqLZReqX5fx1tNpCGQ+vOIhWMZ/BKFmrBjHNqxqUJgVz9PL8POl9eFo/RVlgKZ vxFJ3opyUeAod03CkI5kzDJmLtK5q4VZt6qeyRRY8DYnfI2fViecW9SspNIlqt0VSQUr MtABxJdOwYp6/ij9tm+/m/dhdgh+oUcImID+b6QcqursuxPqAktut2Tji81PeTdOHm92 W1kAZfSsoqIINTqmhWWTzrNgkWpZh1Rx5uvXC0/rFR2sisz7lGrg2wLYBRA1RwrTcbYh IW6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709792578; x=1710397378; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8p7oGzm5YEc17mr7Hc2mG+1f/a/Pw8VPdlVKrPJxZGk=; b=X7QpMsf5mF6wj60y5ygQgsRSlrcidPbfWK4Ytgfg/fPauwIT/LlH+8AfmBm1kUb5Ue JL1P4+gRa7O3SyePgJN6wpKa8kpYQWH6qzvc3ZNq9cQC/zOPjP3IeodAJ5M/z20GD2KR 5RtAhuJcNA4EWV+JC2XgAO6kY8BFgVbCXiL2uPPkUwpCI7PZmPfyh82d4oRX4A/2mK4Z g+XZsLxW/HNyscfyab+6Hb5CBm8aNKjLB8rumg7gPCdqm9oNasYmB4CrckDAc873lpDa /Hc7b/E6QeGVIArrl8rC4u2znHHBrPOvevJrZzqX/Bkxsp8uhHM/dza7xOwvgVvyGZRd ia4Q== X-Forwarded-Encrypted: i=1; AJvYcCXvXxTqmT2qqoNAF31YbrWNggzsQ14vQyfiS+xGF/4bwNJW5hXdreLYPoXmljYWPwm7M6wXHxnDWw1aJaYRH9E1tXsjcG2/sb/L6ydT X-Gm-Message-State: AOJu0YynblYJ5uD9ljMYMOjXr3UqQbudmQHwrwyWXFVsV31HJ4iLfqrL VB4aRTATchVXZ6ohzEuT10CZOhYUgUHc94rHgfKCnis24Tnz1qXnsXIvZqy4diAUxWhlIE3n8OV YEhp1BwYa02XZu5iNpMp5OzN8G88= X-Received: by 2002:a05:6402:2315:b0:566:b442:16cf with SMTP id l21-20020a056402231500b00566b44216cfmr12026391eda.13.1709792577601; Wed, 06 Mar 2024 22:22:57 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240307022006.3657433-1-aik@amd.com> <32ac2ee6-26b1-4f37-bd88-db1ef2a31267@linux.intel.com> <16120a31-c3d6-48a8-9355-7b063e28d242@amd.com> In-Reply-To: <16120a31-c3d6-48a8-9355-7b063e28d242@amd.com> From: Sathyanarayanan Kuppuswamy Natarajan Date: Wed, 6 Mar 2024 22:22:46 -0800 Message-ID: Subject: Re: [PATCH kernel v3] PCI/DOE: Support discovery version 2 To: Alexey Kardashevskiy Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , Ira Weiny , Dan Williams , Jonathan Cameron , Lukas Wunner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 6, 2024 at 10:09=E2=80=AFPM Alexey Kardashevskiy = wrote: > > > > On 7/3/24 16:06, Kuppuswamy Sathyanarayanan wrote: > > > > On 3/6/24 6:20 PM, 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 =E2=80=93 must be 02h if the Capability Ver= sion in > >> the Data Object Exchange Extended Capability is 02h or greater. > > > > Does this change fix any functional issue? If yes, please add Fixes: > > tag and probably CC stable? > > The issue is that before this patch the DOE driver was following PCIe > r6.0 and it was not working on a device with DOE cap v2 added in r6.1. > Is it "fixes"? > Since you are enabling support for the newer spec version, I think it will = not fall under bug fix. But it might be qualified for the stable branch. It depends on whether you want to support this device in older(stable) kernels. > > >> > >> Add support for the version on devices with the DOE v2 capability. > >> > >> Signed-off-by: Alexey Kardashevskiy > >> --- > > Change wise looks fine to me. > > > > Reviewed-by: Kuppuswamy Sathyanarayanan > > 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_re= gs.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 0x0003fff= f > >> > >> #define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX 0x000000f= f > >> +#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 0x00ff000= 0 > >> #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, u1= 6 *vid, > >> +static int pci_doe_discovery(struct pci_doe_mb *doe_mb, u8 capver, u8= *index, u16 *vid, > >> u8 *protocol) > >> { > >> u32 request_pl =3D FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDE= X, > >> - *index); > >> + *index) | > >> + FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_VER, > >> + (capver >=3D 2) ? 2 : 0); > >> __le32 request_pl_le =3D cpu_to_le32(request_pl); > >> __le32 response_pl_le; > >> u32 response_pl; > >> @@ -419,13 +421,16 @@ static int pci_doe_cache_protocols(struct pci_do= e_mb *doe_mb) > >> { > >> u8 index =3D 0; > >> u8 xa_idx =3D 0; > >> + u32 hdr =3D 0; > >> + > >> + pci_read_config_dword(doe_mb->pdev, doe_mb->cap_offset, &hdr); > >> > >> do { > >> int rc; > >> u16 vid; > >> u8 prot; > >> > >> - rc =3D pci_doe_discovery(doe_mb, &index, &vid, &prot); > >> + rc =3D pci_doe_discovery(doe_mb, PCI_EXT_CAP_VER(hdr), &i= ndex, &vid, &prot); > >> if (rc) > >> return rc; > >> > > > > -- > Alexey > --=20 Sathyanarayanan Kuppuswamy Linux Kernel Developer