From: Nicolin Chen Subject: Do we always need to reserve an iova before iommu_map? Date: Tue, 9 Apr 2019 15:47:19 -0700 Message-ID: <20190409224718.GA3281@Asurada-Nvidia.nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Ohad Ben-Cohen , Bjorn Andersson , Joerg Roedel Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-remoteproc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: iommu@lists.linux-foundation.org Hi all, According to the routine of iommu_dma_alloc(), it allocates an iova then does iommu_map() to map the iova to a physical address of new allocated pages. However, in remoteproc_core.c, I see its code try to iommu_map() without having an alloc_iova() or alloc_iova_fast(). Is it safe to do so? If an iova range is not allocated but mapped, would a later iommu_dma_alloc() happen to hit this iova range when doing its alloc_iova() and then fail to map? And I am not very familiar with remoteproc code, so if I am missing something, please kindly educate me. Thanks Nicolin