Hi Christoph,

On Fri, Jun 15, 2018 at 01:08:47PM +0200, Christoph Hellwig wrote:
> -static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
> -     dma_addr_t dma_addr)
> -{
> -#if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT)
> -     return (dma_addr > 0x8fffffff) ? dma_addr : (dma_addr & 0x0fffffff);
> -#else
> -     return dma_addr & 0x7fffffff;
> -#endif
> -}

...

> +phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr)
> +{
> +#if defined(CONFIG_CPU_LOONGSON2F) && defined(CONFIG_64BIT)
> +     if (dma_addr > 0x8fffffff)
> +             return dma_addr;
> +#endif
> +     return dma_addr & 0x0fffffff;
> +}

Thanks for putting in the work here - I've applied patches 1-17 to
mips-next so far, but I'm struggling to convince myself that the above
is correct.

In the original code we have 3 distinct cases:

  64b Loongson2F, dma_addr > 0x8fffffff  -> dma_addr
  64b Loongson2F, dma_addr <= 0x8fffffff -> dma_addr & 0x0fffffff
  Everything else                        -> dma_addr & 0x7fffffff

In the new __dma_to_phys() though only the first case remains the same.

Is this intentional or a mixup?

Thanks,
    Paul
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to