Difference dma_alloc_coherent() in x86_32 and x86_64
Hello! I have a driver for PCI device which uses CMA framework for allocating big coherent blocks of memory for DMA. Allocation looks like: typedef struct { struct list_head list; uint32_t size8; void *kaddr; dma_addr_t paddr; } dma_region_t; LIST_HEAD(region_list); .. void* AllocDMA( size_t size ) { dma_region_t *new_region; new_region = kmalloc(sizeof(dma_region_t), GFP_KERNEL); new_region->size8 = size; new_region->kaddr = dma_alloc_coherent( NULL, size, _region->paddr, GFP_KERNEL | GFP_DMA32 ); list_add(_region->list, _list); printk("pcidev: cma_alloc paddr %pad kaddr %p size %d\n", _region->paddr, new_region->kaddr, new_region->size8); return new_region->kaddr; } It works fine on kernel 3.18.26 in 32bit mode. When I reconfigure same kernel to run in 64bit mode(enabling in 'menuconfig' option '64-bit kernel') and trying to use this driver with it allocation failed with message in dmesg: ... [ 1393.835535] fallback device: swiotlb buffer is full (sz: 8388608 bytes) [ 1393.835579] pcidev: cma_alloc paddr 0x880234861220 kaddr (null) size 8388608 ... My kernel command line is: swiotlb=16384 iommu=soft cma=256M Anyone can explain this strange behavior? -- D ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
How to use uio_pci_generic driver.
Hello! I have a problem writing application using uio subsystem. As described at http://www.kernel.org/doc/htmldocs/uio-howto.html#uio_pci_generic, I bind my device to uio. Files in /sys/class/uio/uio0/ appears, dmesg say no problems. But when I trying to mmap regions of device file /sys/class/uio/uio0/.../mapX not created. A mmap part of code: uint32_t UioMap(int devnum, int map_num) { char *u = (char *) calloc(64, 1); sprintf(u, /sys/class/uio/uio%d/device/resource%d, devnum, map_num); int fd = open(u, O_RDONLY); if(fd 0) { fprintf(stderr,Error on open!\n); return NULL; } else fprintf(stderr,fd = %d\n, fd); void* map_addr = mmap(NULL, 0x80, PROT_READ, MAP_SHARED, fd, map_num * getpagesize()); if(map_addr == MAP_FAILED) { perror(mmap); } free(u); return (uint32_t *) map_addr; } Is there any examples of usage uio_pci_generic in realworld? -- Dmitriy ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies