DMA buffers in >4G address space using ioremap?

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

 



Hi,

I'm trying to test some HW that need a large buffer in memory above 4G. I
have a dual Opteron PC with 8G RAM and use the boot option "mem=7G" to allow
myself to ioremap(0x1C0000000, 0x320000) (allocate 50MB at offset 7G).

I am only interested to test this on the amd64 platform, so portability is
not an issue, I only intend to test the HW can actually make a DMA into that
memory area and that I from userland can mmap it.

So far the mmap between the kernel and userland is ok. I use the return
value from ioremap as kernel virtual pointer and use the 0x1C0000000 as
physical address to the remap_page_range call, e.g.: 

 
remap_page_range(vma,vma->vm_start,0x1C000000,PAGE_ALIGN(size),vma->vm_page_
prot);

The HW tries to make a DMA transfer to 0x1C000000 but cannot read the test
pattern I have put into the area. It just read 0x00 or 0xFF.

Here is some pseudo code on what I try to do:

------ code snip ----
pci_enable_device(PciDevice);
pci_set_dma_mask(PciDevice, DMA_64BIT_MASK); 
pci_request_regions(PciDevice, "Test"); 
pci_set_master(PciDevice); 
pciBase= ioremap(PciDevice->resource[0].start, ....); 
InitDevice(pciBase, ....);

pVirtualReservedMem = ioremap_nocache(0x000001C0000000ll /* 7GB */, 0x320000
/* 50MB */); memset(pVirtualReservedMem, 0xab, 0x320000);

WriteDmaBufferAddressToHW(0x1C0000000);
StartHWDmaReadFromDmaBuffer();
------ code snip end ----

The thing is that the above work if i use a combination of "mem=xx" and
ioremap that is below the 4G border. Has anyone an idea on what I'm doing
wrong, or is it just a HW bug?

Regards,
Michael




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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