[PATCH] Staging: VME: Correct TSI148 DMA handling on Intel platforms

Dan Carpenter dan.carpenter at oracle.com
Wed Mar 21 17:48:35 UTC 2012

On Wed, Mar 21, 2012 at 03:33:14PM +0000, Martyn Welch wrote:
> The DMA functionality fails to work on Intel based platforms. There are
> two reasons for this:
> 1) Some recent Intel platforms have an IOMMU. Transferring the DMA
>    descriptors, which were mapped using virt_to_phys(), failed. This
>    patch updates the driver to use dma_map_single().
> 2) The DMA copies the link list descriptors from memory into big endian
>    registers. On little endian systems this results in the values being
>    byte swapped. This patch uses standard kernel functionality to ensure
>    that the descriptors are stored in big endian format.

In some ways, I can see why you did this as one patch because it
makes it work on one system.  But could you send it as two patches?

The endian fixes are incomplete and buggy.  I could point the
problems, but it's probably easier if you just run Sparse yourself.
It's really easy.  http://lwn.net/Articles/205624/

Mostly it's just a matter of changing u32 declarations to __be32 but
there are places like this as well where we try doing bitwise OR
big endian data like this:

> -			entry->descriptor.dsat |= TSI148_LCSR_DSAT_PSZ;
> +			entry->descriptor.dsat |=
> +				cpu_to_be32(TSI148_LCSR_DSAT_PSZ);

dan carpenter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/attachments/20120321/f6675c7d/attachment.asc>

More information about the devel mailing list