From: Aksh Garg <a-garg7@ti.com>
To: <linux-pci@vger.kernel.org>, <linux-doc@vger.kernel.org>,
<bhelgaas@google.com>, <corbet@lwn.net>, <cassel@kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <s-vadapalli@ti.com>,
<danishanwar@ti.com>, <srk@ti.com>, <a-garg7@ti.com>
Subject: [RFC PATCH 2/4] PCI/DOE: Move common definitions to the header file
Date: Fri, 13 Feb 2026 18:06:01 +0530 [thread overview]
Message-ID: <20260213123603.420941-3-a-garg7@ti.com> (raw)
In-Reply-To: <20260213123603.420941-1-a-garg7@ti.com>
From: Aksh Garg <a-garg7@ti.com>
Move common macros and structures from drivers/pci/doe.c to
include/linux/pci-doe.h to allow reuse across root complex and
endpoint DOE implementations.
Also add CONFIG_PCI_DOE guards around the root complex DOE APIs to
maintain proper conditional compilation.
These changes prepare the groundwork for the DOE endpoint implementation
that will reuse these common definitions.
Co-developed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Signed-off-by: Aksh Garg <a-garg7@ti.com>
---
drivers/pci/doe.c | 11 -----------
include/linux/pci-doe.h | 38 +++++++++++++++++++++++++++++++++-----
2 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/doe.c b/drivers/pci/doe.c
index 62be9c8dbc52..0171ef3215a7 100644
--- a/drivers/pci/doe.c
+++ b/drivers/pci/doe.c
@@ -28,12 +28,6 @@
#define PCI_DOE_TIMEOUT HZ
#define PCI_DOE_POLL_INTERVAL (PCI_DOE_TIMEOUT / 128)
-#define PCI_DOE_FLAG_CANCEL 0
-#define PCI_DOE_FLAG_DEAD 1
-
-/* Max data object length is 2^18 dwords */
-#define PCI_DOE_MAX_LENGTH (1 << 18)
-
/**
* struct pci_doe_mb - State for a single DOE mailbox
*
@@ -63,11 +57,6 @@ struct pci_doe_mb {
#endif
};
-struct pci_doe_feature {
- u16 vid;
- u8 type;
-};
-
/**
* struct pci_doe_task - represents a single query/response
*
diff --git a/include/linux/pci-doe.h b/include/linux/pci-doe.h
index bd4346a7c4e7..a966626c47f9 100644
--- a/include/linux/pci-doe.h
+++ b/include/linux/pci-doe.h
@@ -13,12 +13,25 @@
#ifndef LINUX_PCI_DOE_H
#define LINUX_PCI_DOE_H
-struct pci_doe_mb;
+/* Mailbox state flags */
+#define PCI_DOE_FLAG_CANCEL 0
+#define PCI_DOE_FLAG_DEAD 1
+
+/* Max data object length is 2^18 dwords */
+#define PCI_DOE_MAX_LENGTH (1 << 18)
-#define PCI_DOE_FEATURE_DISCOVERY 0
-#define PCI_DOE_FEATURE_CMA 1
-#define PCI_DOE_FEATURE_SSESSION 2
+#define PCI_DOE_FEATURE_DISCOVERY 0
+#define PCI_DOE_FEATURE_CMA 1
+#define PCI_DOE_FEATURE_SSESSION 2
+struct pci_doe_feature {
+ u16 vid;
+ u8 type;
+};
+
+struct pci_doe_mb;
+
+#ifdef CONFIG_PCI_DOE
struct pci_doe_mb *pci_find_doe_mailbox(struct pci_dev *pdev, u16 vendor,
u8 type);
@@ -26,4 +39,19 @@ int pci_doe(struct pci_doe_mb *doe_mb, u16 vendor, u8 type,
const void *request, size_t request_sz,
void *response, size_t response_sz);
-#endif
+#else
+static inline struct pci_doe_mb *pci_find_doe_mailbox(struct pci_dev *pdev,
+ u16 vendor, u8 type)
+{
+ return NULL;
+}
+
+static inline int pci_doe(struct pci_doe_mb *doe_mb, u16 vendor, u8 type,
+ const void *request, size_t request_sz,
+ void *response, size_t response_sz)
+{
+ return -EOPNOTSUPP;
+}
+#endif /* CONFIG_PCI_DOE */
+
+#endif /* LINUX_PCI_DOE_H */
--
2.34.1
next prev parent reply other threads:[~2026-02-13 12:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 12:35 [RFC PATCH 0/4] PCI: Add DOE support for endpoint Aksh Garg
2026-02-13 12:36 ` [RFC PATCH 1/4] PCI: Add documentation for DOE endpoint support Aksh Garg
2026-02-13 20:33 ` Niklas Cassel
2026-02-18 11:21 ` Aksh Garg
2026-02-13 12:36 ` Aksh Garg [this message]
2026-02-22 13:01 ` [RFC PATCH 2/4] PCI/DOE: Move common definitions to the header file Lukas Wunner
2026-02-23 7:30 ` Aksh Garg
2026-02-13 12:36 ` [RFC PATCH 3/4] PCI/DOE: Add DOE mailbox support for endpoint functions Aksh Garg
2026-02-13 13:21 ` Niklas Cassel
2026-02-18 4:28 ` Alistair Francis
2026-03-04 14:18 ` Manivannan Sadhasivam
2026-03-06 12:14 ` Aksh Garg
2026-02-22 13:06 ` Lukas Wunner
2026-02-23 10:44 ` Aksh Garg
2026-03-04 14:17 ` Manivannan Sadhasivam
2026-03-06 8:17 ` Aksh Garg
2026-02-13 12:36 ` [RFC PATCH 4/4] PCI: Document APIs for endpoint DOE implementation Aksh Garg
2026-02-13 13:16 ` [RFC PATCH 0/4] PCI: Add DOE support for endpoint Niklas Cassel
2026-03-04 14:22 ` Manivannan Sadhasivam
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=20260213123603.420941-3-a-garg7@ti.com \
--to=a-garg7@ti.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=corbet@lwn.net \
--cc=danishanwar@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=s-vadapalli@ti.com \
--cc=srk@ti.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®