Re: Copying user space data to PCI memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 18, 2009 at 11:15:31AM +0530, arun c wrote:
> Hi,
> > Sorry, I don't think so.
> >
> > Copying stuff to non-cacheable addresses can have other side effects.
> 
> My destination memory is a PCI pre-fetchable memory. I am not sure
> this is cacheable or not.

Yes, it is cacheable.  "Pre-fetchable" implies there are no side effects
from reading the data AND the data is only modified by the CPU.

> > That's why we have copy_from_user_toio()
> 
> I greped for  copy_from_user_toio, only some files in the sound/pci
> folder seems to be using it.

Yeah, most devices use DMA for accessing data in host memory.
The remainder mostly only write a few words at a time to uncachable
MMIO address.

> I make my scenario more clear here.
> 
> I want to transfer data in and out from user space to PCI memory.
> I know I can do a copy_from_user to get data to kernel and do any
> iowrite* flavours to eventually write to PCI memory, and do the exact
> reverse to transfer data to user.
> 
> I just wanted to eliminate the unnecessary buffering of data in kernel
> for which kernel has no interest. copy_from_user_toio and
> copy_to_user_fromio are designed for this purpose?

Yes.

> I can test my driver on PPC and X86 machines, rest of the
> platforms are not available with me. That is why I wanted a
> bullet proof implementation.

I would just add a comment at the top of the file to indicate
which platforms you have tested on and how to contact you
if there are problems with other architectures (e.g. MAINTAINERS file).

There are many caveats to porting drivers to non-x86 architectures
and very few drivers get everything right. But they still work.
If something works on x86 and PPC, you've probably gotten the
most important stuff "good enough". Just ship it. :)

thanks,
grant

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux