[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62b47e7f-8704-24b1-2a94-bc456e7ad3a0@linux.intel.com>
Date: Tue, 25 Jan 2022 12:42:50 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: baolu.lu@...ux.intel.com, Joerg Roedel <joro@...tes.org>,
Jason Gunthorpe <jgg@...dia.com>,
Ben Skeggs <bskeggs@...hat.com>,
Kevin Tian <kevin.tian@...el.com>,
Ashok Raj <ashok.raj@...el.com>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Alex Williamson <alex.williamson@...hat.com>,
Eric Auger <eric.auger@...hat.com>,
Liu Yi L <yi.l.liu@...el.com>,
Jacob jun Pan <jacob.jun.pan@...el.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 7/7] iommu: Add iommu_domain::domain_ops
On 1/24/22 5:37 PM, Christoph Hellwig wrote:
> On Mon, Jan 24, 2022 at 03:11:02PM +0800, Lu Baolu wrote:
>> Add a domain specific callback set, domain_ops, for vendor iommu driver
>> to provide domain specific operations. Move domain-specific callbacks
>> from iommu_ops to the domain_ops and hook them when a domain is allocated.
>
> Ah, that's what I meant earlier. Perfect!
>
> Nit: I don't think vendor is the right term here.
>
> Maybe something like:
>
> iommut: split struct iommu_ops
>
> Move the domain specific operations out of struct iommu_ops into a new
> structure that only has domain specific operations. This solves
> the problem of needing to know if the method vector for a given
> operation needs to be retreived from the device or th domain.
Sure. Will use above description.
>
>> +struct domain_ops {
>
> This needs to keep an iommu in the name, i.e. iommu_domain_ops.
Sure.
>
>> + phys_addr_t (*iova_to_phys)(struct iommu_domain *domain, dma_addr_t iova);
>
> Overly long line.
./scripts/checkpatch.pl --strict *.patch
didn't give me a WARN or CHECK. I will make it short anyway.
>
>> +static inline void iommu_domain_set_ops(struct iommu_domain *domain,
>> + const struct domain_ops *ops)
>> +{
>> + domain->ops = ops;
>> +}
>
> Do we really need this helper?
Unnecessary. I can set the pointer directly in the drivers.
>
>> +static const struct domain_ops amd_domain_ops;
>
> Can we avoid these forward declarations or would that cause too much
> churn?
>
I don't like this either. But it's common to put the ops at the bottom
of the file in almost all iommu drivers.
Best regards,
baolu
Powered by blists - more mailing lists