From: Bjorn Helgaas <helgaas@kernel.org>
To: Alexey Kardashevskiy <aik@amd.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Bjorn Helgaas <bhelgaas@google.com>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Lukas Wunner <lukas@wunner.de>
Subject: Re: [PATCH kernel 2/4] pci/doe: Support discovery version
Date: Thu, 8 Feb 2024 16:00:27 -0600 [thread overview]
Message-ID: <20240208220027.GA975008@bhelgaas> (raw)
In-Reply-To: <20240201060228.3070928-3-aik@amd.com>
On Thu, Feb 01, 2024 at 05:02:26PM +1100, Alexey Kardashevskiy wrote:
> PCIe spec v6.1 defines a "DOE Discovery Version" field in the DOE Discovery
> Request Data Object Contents (3rd DW) as:
Please include spec section number, e.g., "PCIe r6.1, sec xx.xx".
(Also note PCI-SIG uses "revision" as the major, "version" as the
minor, so this would be "PCIe r6.1", not "PCIe v6.1".)
> 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 <aik@amd.com>
> ---
> 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..b9c681f14181 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_DISCOVER_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..f57def002175 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 disver = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_DISCOVER_VER,
> + (capver >= 2) ? 2 : 0);
> u32 request_pl = FIELD_PREP(PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX,
> - *index);
> + *index) | disver;
> __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
>
next prev parent reply other threads:[~2024-02-08 22:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 6:02 [PATCH kernel 0/4] pci/doe/ide: Capabilities, protocols Alexey Kardashevskiy
2024-02-01 6:02 ` [PATCH kernel 1/4] pci/doe: Define protocol types and make those public Alexey Kardashevskiy
2024-02-01 6:50 ` Lukas Wunner
2024-02-01 10:16 ` Alexey Kardashevskiy
2024-02-09 8:52 ` Lukas Wunner
2024-02-15 11:44 ` Alexey Kardashevskiy
2024-02-08 21:57 ` Bjorn Helgaas
2024-02-01 6:02 ` [PATCH kernel 2/4] pci/doe: Support discovery version Alexey Kardashevskiy
2024-02-08 22:00 ` Bjorn Helgaas [this message]
2024-02-01 6:02 ` [PATCH kernel 3/4] pci: Define TEE-IO bit in PCIe device capabilities Alexey Kardashevskiy
2024-02-01 6:02 ` [PATCH kernel 4/4] pci: Define Integrity and Data Encryption (IDE) extended capability Alexey Kardashevskiy
2024-02-08 22:02 ` Bjorn Helgaas
2024-02-08 21:55 ` [PATCH kernel 0/4] pci/doe/ide: Capabilities, protocols Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240208220027.GA975008@bhelgaas \
--to=helgaas@kernel.org \
--cc=aik@amd.com \
--cc=bhelgaas@google.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.