On Fri, Oct 31, 2025 at 03:02:08PM -0700, Nicolin Chen wrote:
> On Fri, Oct 31, 2025 at 10:49:45AM +0000, Shameer Kolothum wrote:
> > +static bool smmuv3_accel_set_iommu_device(PCIBus *bus, void *opaque, int
> > devfn,
> > + HostIOMMUDevice *hiod, Error
> > **errp)
> [...]
> > + if (!smmuv3_accel_dev_alloc_viommu(accel_dev, idev, errp)) {
> > + error_append_hint(errp, "Device 0x%x: Unable to alloc viommu",
> > sid);
> > + return false;
> > + }
>
> And here:
>
> if (!s_accel->vsmmu && !smmuv3_accel_alloc_viommu(s_accel, idev, errp)) {
> error_append_hint(errp, "Device 0x%x: Unable to alloc viommu", sid);
> return false;
> }
>
> accel_dev->idev = idev;
> accel_dev->vsmmu = s_accel->vsmmu;
>
> Feels slightly cleaner.
Also, because we set accel_dev->vsmmu under the hood, we missed
"accel_dev->vsmmu = NULL" in the revert path and unset().