[RFC PATCH 20/45] KVM: arm64: iommu: Add map() and unmap() operations

Jean-Philippe Brucker jean-philippe at linaro.org
Tue Apr 4 09:00:46 PDT 2023


Hi Mostafa,

On Thu, Mar 30, 2023 at 06:14:04PM +0000, Mostafa Saleh wrote:
> > +err_unmap:
> > +	__kvm_iommu_unmap_pages(&iopt, iova_orig, pgsize, pgcount_orig - pgcount);
> On error here, this unmaps (and unshares) only pages that has been
> mapped.
> But all pages where shared with IOMMU before (via
> __pkvm_host_share_dma) and this corrupts the other pages state as
> they are marked as shared while they are not.

Right, I'll fix this

> I see we can add a "bool unshare" arg to __kvm_iommu_unmap_pages which
> will be called with false on error from here after calling
> __pkvm_host_unshare_dma for the whole range.

I think it's simpler to call iopt_unmap_pages() directly here, followed by
__pkvm_host_unshare_dma(). It even saves us a few lines

Thanks,
Jean




More information about the linux-arm-kernel mailing list