failed to access memory according to the from PCI bus address?

H

hust_gaoyi

Guest
I am now trying to develope the DMA part for a PCI driver on X86_64. I firstly allocated a buffer for DMA transaction as following:

virt = dma_alloc_coherent(&dev, size , &dma_handle, GFP_KERNEL);
if(!virt)goto err_exit;
copy_from_user();

Then I checked the memory content according to the physical memory address, using the following command on the shell:
dd if=/dev/mem bs=1 skip=$(( dma_handle )) count=128 | hexdump
However, the shell reports:
dd: reading `/dev/mem': Operation not permitted
2056+0 records in
2056+0 records out
1052672 bytes (1.1 MB) copied, 0.44834 s, 2.3 MB/s
Hope anyone can provide some help. The total physical memory size is 4GB.
 

Members online


Latest posts

Top