[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <691f880c7811c_1eb851006e@dwillia2-mobl4.notmuch>
Date: Thu, 20 Nov 2025 13:28:44 -0800
From: <dan.j.williams@...el.com>
To: Alexey Kardashevskiy <aik@....com>, Jonathan Cameron
<jonathan.cameron@...wei.com>
CC: <linux-kernel@...r.kernel.org>, <linux-crypto@...r.kernel.org>,
<linux-pci@...r.kernel.org>, Tom Lendacky <thomas.lendacky@....com>, "John
Allen" <john.allen@....com>, Herbert Xu <herbert@...dor.apana.org.au>, "David
S. Miller" <davem@...emloft.net>, Ashish Kalra <ashish.kalra@....com>, "Joerg
Roedel" <joro@...tes.org>, Suravee Suthikulpanit
<suravee.suthikulpanit@....com>, Will Deacon <will@...nel.org>, Robin Murphy
<robin.murphy@....com>, Dan Williams <dan.j.williams@...el.com>, "Bjorn
Helgaas" <bhelgaas@...gle.com>, Eric Biggers <ebiggers@...gle.com>, "Brijesh
Singh" <brijesh.singh@....com>, Gary R Hook <gary.hook@....com>, "Borislav
Petkov (AMD)" <bp@...en8.de>, Kim Phillips <kim.phillips@....com>, "Vasant
Hegde" <vasant.hegde@....com>, Jason Gunthorpe <jgg@...pe.ca>, Michael Roth
<michael.roth@....com>, Xu Yilun <yilun.xu@...ux.intel.com>, Gao Shiyuan
<gaoshiyuan@...du.com>, Sean Christopherson <seanjc@...gle.com>, "Nikunj A
Dadhania" <nikunj@....com>, Dionna Glaze <dionnaglaze@...gle.com>,
<iommu@...ts.linux.dev>, <linux-coco@...ts.linux.dev>
Subject: Re: [PATCH kernel 6/6] crypto/ccp: Implement SEV-TIO PCIe IDE
(phase1)
Alexey Kardashevskiy wrote:
[..]
> >> +/*to_pci_tsm_pf0((pdev)->tsm)*/
> >
> > Left over of something?
>
> Actually not, to_pci_tsm_pf0() is a static helper in drivers/pci/tsm.c
> and pdev_to_tsm_pf0() (below) is the same thing defined for
> drivers/crypto/ccp/sev-dev-tsm.c and I wonder if to_pci_tsm_pf0() is
> better be exported. pdev_to_tsm_pf0() does not need all the checks as
> if we are that far past the initial setup, we can skip on some checks
> which to_pci_tsm_pf0() performs so I have not exported
> to_pci_tsm_pf0() but left the comment. Thanks,
Why does the low-level TSM driver need to_pci_tsm_pf0() when it
allocated the container for @tsm in the first place?
For example, samples/devsec/ does this:
static void devsec_link_tsm_pci_remove(struct pci_tsm *tsm)
{
struct pci_dev *pdev = tsm->pdev;
dev_dbg(pci_tsm_host(pdev), "%s\n", pci_name(pdev));
if (is_pci_tsm_pf0(pdev)) {
struct devsec_tsm_pf0 *devsec_tsm = to_devsec_tsm_pf0(tsm);
pci_tsm_pf0_destructor(&devsec_tsm->pci);
kfree(devsec_tsm);
} else {
struct devsec_tsm_fn *devsec_tsm = to_devsec_tsm_fn(tsm);
kfree(devsec_tsm);
}
}
...where that to_devsec_tsm_pf0() is:
static struct devsec_tsm_pf0 *to_devsec_tsm_pf0(struct pci_tsm *tsm)
{
return container_of(tsm, struct devsec_tsm_pf0, pci.base_tsm);
}
Powered by blists - more mailing lists