RE: [PATCH 01/12] iommu/vt-d: Add cache tag assignment interface

From: Tian, Kevin
Date: Thu Apr 11 2024 - 23:38:13 EST


> From: Baolu Lu <baolu.lu@xxxxxxxxxxxxxxx>
> Sent: Thursday, April 11, 2024 8:39 PM
>
> On 2024/4/10 23:41, Jason Gunthorpe wrote:
> >> +struct cache_tag {
> >> + struct list_head node;
> >> + enum cache_tag_type type;
> >> + struct intel_iommu *iommu;
> >> + struct device *dev;
> > iommu and dev probably don't both need to be stored together. We have
> > iommu_get_iommu_dev() now.. I suppose this is probably a union of the
> > two pointers depending on tag. DEVTLB needs the dev and IOTLB needs
> > the iommu.
>
> I forgot to reply this comment in previous reply. Sorry about it.
>
> struct cache_tag {
> [ ... ]
> struct intel_iommu *iommu;
> struct device *dev;
> [ ... ]
> };
>
> I treat @iommu as the queued invalidation interface. All cache
> invalidation raises to hardware through the invalidation queue.
>
> The @dev field represents the location of the cache. For IOTLB cache, it
> resides on the IOMMU hardware. In this case, the field stores the device
> pointer to the IOMMU hardware. For DevTLB cache, it locates in the PCIe
> endpoint. Here, the field stores the device pointer to that endpoint.
>
> A correctly set @dev pointer allows users to see more accurate trace
> message.
>

it's not a bad to add a comment for @dev here.