Re: [PATCH v5 09/23] iommu/vt-d: add svm/sva invalidate function

From: Jacob Pan
Date: Mon May 14 2018 - 16:46:48 EST


On Mon, 14 May 2018 11:35:05 +0800
Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx> wrote:

> > + switch (inv_info->hdr.type) {
> > + case IOMMU_INV_TYPE_TLB:
> > + if (inv_info->size &&
> > + (inv_info->addr & ((1 << (VTD_PAGE_SHIFT +
> > inv_info->size)) - 1))) {
> > + pr_err("Addr out of range, addr 0x%llx,
> > size order %d\n",
> > + inv_info->addr, inv_info->size);
> > + ret = -ERANGE;
> > + goto out_unlock;
> > + }
> > +
> > + qi_flush_eiotlb(iommu, did,
> > mm_to_dma_pfn(inv_info->addr),
> > + inv_info->pasid,
> > + inv_info->size, granu,
> > + inv_info->flags &
> > IOMMU_INVALIDATE_GLOBAL_PAGE);
> > + /**
> > + * Always flush device IOTLB if ATS is enabled
> > since guest
> > + * vIOMMU exposes CM = 1, no device IOTLB flush
> > will be passed
> > + * down.
> > + */
> > + info = iommu_support_dev_iotlb(dmar_domain, iommu,
> > bus, devfn);
> > + if (info && info->ats_enabled) {
> > + qi_flush_dev_eiotlb(iommu, sid,
> > + inv_info->pasid,
> > info->ats_qdep,
> > + inv_info->addr,
> > inv_info->size,
> > + granu);
> > + }
> > + break;
> > + case IOMMU_INV_TYPE_PASID:
> > + qi_flush_pasid(iommu, did, granu, inv_info->pasid);
> > +
> > + break;
> > + default:
> > + dev_err(dev, "Unknown IOMMU invalidation type
> > %d\n",
> > + inv_info->hdr.type);
>
> There are three types of invalidation:
>
> enum iommu_inv_type {
> IOMMU_INV_TYPE_DTLB,
> IOMMU_INV_TYPE_TLB,
> IOMMU_INV_TYPE_PASID,
> IOMMU_INV_NR_TYPE
> };
>
> So "unsupported" looks better than "unknown" in the message.
>
agreed, makes more sense.
> [...]