Re: [PATCH v6 15/20] vfio/mdev: idxd: ims domain setup for the vdcm
From: Jason Gunthorpe
Date: Sun May 23 2021 - 19:50:31 EST
On Fri, May 21, 2021 at 05:20:37PM -0700, Dave Jiang wrote:
> @@ -77,8 +80,18 @@ int idxd_mdev_host_init(struct idxd_device *idxd, struct mdev_driver *drv)
> return rc;
> }
>
> + ims_info.max_slots = idxd->ims_size;
> + ims_info.slots = idxd->reg_base + idxd->ims_offset;
> + idxd->ims_domain = pci_ims_array_create_msi_irq_domain(idxd->pdev, &ims_info);
> + if (!idxd->ims_domain) {
> + dev_warn(dev, "Fail to acquire IMS domain\n");
> + iommu_dev_disable_feature(dev, IOMMU_DEV_FEAT_AUX);
> + return -ENODEV;
> + }
I'm quite surprised that every mdev doesn't create its own ims_domain
in its probe function.
This places a global total limit on the # of vectors which makes me
ask what was the point of using IMS in the first place ?
The entire idea for IMS was to make the whole allocation system fully
dynamic based on demand.
> rc = mdev_register_device(dev, drv);
> if (rc < 0) {
> + irq_domain_remove(idxd->ims_domain);
> iommu_dev_disable_feature(dev, IOMMU_DEV_FEAT_AUX);
> return rc;
> }
This really wants a goto error unwind
Jason