Re: [PATCH 1/3] PCI/IDE: Add/export mini helpers for platform TSM drivers

From: Xu Yilun
Date: Thu Oct 02 2025 - 22:12:29 EST


On Tue, Sep 30, 2025 at 05:24:06PM -0700, dan.j.williams@xxxxxxxxx wrote:
> Xu Yilun wrote:
> > 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@xxxxxxxxx/
> >
> > Signed-off-by: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>
> > ---
> > 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);
>
> So I do not think we need to export these as much as let TSM drivers
> reuse more of the common register setup logic.

Do you mean PCI IDE should provide the collapsed raw RID/Address
Association Register values for platform TSM drivers? TDX needs these
raw values for SEAMCALLs.

>
> I will flesh out more of the proposal on the next patch.