[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a9cb5ce0-7042-420f-a2a4-e05b1dee9548@amd.com>
Date: Fri, 21 Nov 2025 12:40:22 +1100
From: Alexey Kardashevskiy <aik@....com>
To: dan.j.williams@...el.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>,
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)
On 21/11/25 08:28, dan.j.williams@...el.com wrote:
> 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?
If the question "can I skip pci_tsm_pf0 and cast straight to tsm_dsm_tio" - yes I can and probably will, so so many leftovers are still there :)
If the question why I need pf0 in the TSM driver - for things like tdi_bind/unbind which take VFs pdev and I'll need PF0 for DOE.
Thanks,
> 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);
> }
--
Alexey
Powered by blists - more mailing lists