Re: [PATCH v5] iommu/virtio: Use page size bitmap supported by endpoint

From: Jean-Philippe Brucker
Date: Tue May 12 2020 - 12:47:18 EST


On Tue, May 12, 2020 at 10:53:39AM -0400, Michael S. Tsirkin wrote:
> > static int viommu_add_resv_mem(struct viommu_endpoint *vdev,
> > struct virtio_iommu_probe_resv_mem *mem,
> > size_t len)
> > @@ -499,6 +513,9 @@ static int viommu_probe_endpoint(struct viommu_dev *viommu, struct device *dev)
> > case VIRTIO_IOMMU_PROBE_T_RESV_MEM:
> > ret = viommu_add_resv_mem(vdev, (void *)prop, len);
> > break;
> > + case VIRTIO_IOMMU_PROBE_T_PAGE_SIZE_MASK:
> > + ret = viommu_set_pgsize_bitmap(vdev, (void *)prop, len);
> > + break;
> > default:
> > dev_err(dev, "unknown viommu prop 0x%x\n", type);
> > }
>
> So given this is necessary early in boot, how about we
> add this in the config space? And maybe ACPI too ...

A page_size_mask field is already in the config space and applies to all
endpoints. Here we add a property to override the global value for
individual endpoints. It can be necessary when mixing physical (pass-
through) and virtual endpoints under the same virtio-iommu device.

Thanks,
Jean