On 30/05/17 10:48, Joerg Roedel wrote:
> On Fri, May 26, 2017 at 07:31:26PM +0100, Robin Murphy wrote:
>> Unlike the old allocator, alloc_iova_fast() will return 0 if it failed
>> to allocate a PFN. Since the callers of dma_ops_alloc_iova() would end
>> up treating that as a valid address, translate it to the DMA_ERROR_CODE
>> that they would expect.
>>
>> Fixes: 256e4621c21a ("iommu/amd: Make use of the generic IOVA allocator")
>> Signed-off-by: Robin Murphy <[email protected]>
>> ---
>>
>> Just something I spotted whilst comparing dma_map_page() callchains...
>>
>>  drivers/iommu/amd_iommu.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
>> index 63cacf5d6cf2..489dc302899e 100644
>> --- a/drivers/iommu/amd_iommu.c
>> +++ b/drivers/iommu/amd_iommu.c
>> @@ -1555,6 +1555,9 @@ static unsigned long dma_ops_alloc_iova(struct device 
>> *dev,
>>      if (!pfn)
>>              pfn = alloc_iova_fast(&dma_dom->iovad, pages, 
>> IOVA_PFN(dma_mask));
>>  
>> +    if (!pfn)
>> +            return DMA_ERROR_CODE;
>> +
> 
> That shouldn't make a difference on x86 because the DMA_ERROR_CODE is 0
> as well.

Ha, now that I did manage to overlook. Oh well, never mind then :)

Thanks,
Robin.

> 
> 
>       Joerg
> 

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to