Re: [PATCH 1/5] iommu/virtio: Break out bypass identity support into a global static

Jason Gunthorpe
2025-02-18T18:21:54Z

On Tue, Feb 11, 2025 at 04:43:55PM -0800, Jacob Pan wrote:
> > +static int viommu_send_attach_req(struct viommu_dev *viommu, struct
> > device *dev,
> > + struct virtio_iommu_req_attach
> > *req) +{
> > + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
> > + int ret;
> > + int i;
> nit: coding style inconsistent within this patch. Inverted xmas tree
> here.

Ok

> > + /* Reserve an ID to use as the bypass domain */
> > + if (virtio_has_feature(viommu->vdev,
> > VIRTIO_IOMMU_F_BYPASS_CONFIG)) {
> > + viommu->identity_domain_id = viommu->first_domain;
> > + viommu->first_domain++;
> Could also use ida_alloc() instead of special treatment, it would be
> consistent with the paging identity domain ID.

Could do, but that would allocate memory and we already have
first_domain which is free

Thanks,
Jason