From: Xu Yilun <yilun.xu@linux.intel.com>
To: linux-coco@lists.linux.dev, linux-pci@vger.kernel.org,
dan.j.williams@intel.com
Cc: yilun.xu@intel.com, yilun.xu@linux.intel.com,
baolu.lu@linux.intel.com, zhenzhong.duan@intel.com,
aneesh.kumar@kernel.org, bhelgaas@google.com, aik@amd.com,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] PCI/IDE: Add/export mini helpers for platform TSM drivers
Date: Sun, 28 Sep 2025 14:27:54 +0800 [thread overview]
Message-ID: <20250928062756.2188329-2-yilun.xu@linux.intel.com> (raw)
In-Reply-To: <20250928062756.2188329-1-yilun.xu@linux.intel.com>
These mini helpers are mainly for platform TSM drivers to setup root
port side configuration. Root port side IDE settings may require
platform specific firmware calls (e.g. TDX Connect [1]) so could not use
pci_ide_stream_setup(), but may still share these mini helpers cause
they also refer to definitions in IDE specification.
[1]: https://lore.kernel.org/linux-coco/20250919142237.418648-28-dan.j.williams@intel.com/
Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
---
include/linux/pci-ide.h | 6 ++++++
drivers/pci/ide.c | 8 +++-----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/include/linux/pci-ide.h b/include/linux/pci-ide.h
index a30f9460b04a..5adbd8b81f65 100644
--- a/include/linux/pci-ide.h
+++ b/include/linux/pci-ide.h
@@ -6,6 +6,11 @@
#ifndef __PCI_IDE_H__
#define __PCI_IDE_H__
+#define PREP_PCI_IDE_SEL_RID_2(base, domain) \
+ (FIELD_PREP(PCI_IDE_SEL_RID_2_VALID, 1) | \
+ FIELD_PREP(PCI_IDE_SEL_RID_2_BASE, (base)) | \
+ FIELD_PREP(PCI_IDE_SEL_RID_2_SEG, (domain)))
+
enum pci_ide_partner_select {
PCI_IDE_EP,
PCI_IDE_RP,
@@ -61,6 +66,7 @@ struct pci_ide {
struct tsm_dev *tsm_dev;
};
+int pci_ide_domain(struct pci_dev *pdev);
struct pci_ide_partner *pci_ide_to_settings(struct pci_dev *pdev, struct pci_ide *ide);
struct pci_ide *pci_ide_stream_alloc(struct pci_dev *pdev);
void pci_ide_stream_free(struct pci_ide *ide);
diff --git a/drivers/pci/ide.c b/drivers/pci/ide.c
index 10603f2d2319..7633b8e52399 100644
--- a/drivers/pci/ide.c
+++ b/drivers/pci/ide.c
@@ -345,12 +345,13 @@ void pci_ide_stream_unregister(struct pci_ide *ide)
}
EXPORT_SYMBOL_GPL(pci_ide_stream_unregister);
-static int pci_ide_domain(struct pci_dev *pdev)
+int pci_ide_domain(struct pci_dev *pdev)
{
if (pdev->fm_enabled)
return pci_domain_nr(pdev->bus);
return 0;
}
+EXPORT_SYMBOL_GPL(pci_ide_domain);
struct pci_ide_partner *pci_ide_to_settings(struct pci_dev *pdev, struct pci_ide *ide)
{
@@ -420,10 +421,7 @@ void pci_ide_stream_setup(struct pci_dev *pdev, struct pci_ide *ide)
val = FIELD_PREP(PCI_IDE_SEL_RID_1_LIMIT, settings->rid_end);
pci_write_config_dword(pdev, pos + PCI_IDE_SEL_RID_1, val);
- val = FIELD_PREP(PCI_IDE_SEL_RID_2_VALID, 1) |
- FIELD_PREP(PCI_IDE_SEL_RID_2_BASE, settings->rid_start) |
- FIELD_PREP(PCI_IDE_SEL_RID_2_SEG, pci_ide_domain(pdev));
-
+ val = PREP_PCI_IDE_SEL_RID_2(settings->rid_start, pci_ide_domain(pdev));
pci_write_config_dword(pdev, pos + PCI_IDE_SEL_RID_2, val);
/*
--
2.25.1
next prev parent reply other threads:[~2025-09-28 6:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-28 6:27 [PATCH 0/3] Address Association Register setup for RP Xu Yilun
2025-09-28 6:27 ` Xu Yilun [this message]
2025-10-01 0:24 ` [PATCH 1/3] PCI/IDE: Add/export mini helpers for platform TSM drivers dan.j.williams
2025-10-03 1:59 ` Xu Yilun
2025-10-03 2:26 ` dan.j.williams
2025-09-28 6:27 ` [PATCH 2/3] PCI/IDE: Add Address Association Register setup for RP Xu Yilun
2025-09-30 12:29 ` Ilpo Järvinen
2025-10-01 0:52 ` dan.j.williams
2025-10-01 10:55 ` Ilpo Järvinen
2025-10-01 19:58 ` dan.j.williams
2025-10-01 20:20 ` dan.j.williams
2025-10-02 13:30 ` Ilpo Järvinen
2025-10-02 15:58 ` dan.j.williams
2025-10-03 5:42 ` Xu Yilun
2025-10-03 18:18 ` dan.j.williams
2025-10-06 3:05 ` Xu Yilun
2025-09-28 6:27 ` [PATCH 3/3] coco/tdx-host: Illustrate IDE Address Association Register setup Xu Yilun
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=20250928062756.2188329-2-yilun.xu@linux.intel.com \
--to=yilun.xu@linux.intel.com \
--cc=aik@amd.com \
--cc=aneesh.kumar@kernel.org \
--cc=baolu.lu@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=yilun.xu@intel.com \
--cc=zhenzhong.duan@intel.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®