pb with remap_page_range 2.4.20-18.8-bigmem

From: frederic_dumoulin (frederic_dumoulin_at_eve-team.com)
Date: 09/30/03


Date: 30 Sep 2003 01:25:46 -0700

Hi,

I've devellopped a driver wich work fine on several kernel versions,
I've to port this driver under 2.4.20-18.8-bigmem.

the function remap_page_range has a new prototype, I changed this.
but it doesn't work anymore, I can see only zeroes in my shared
memory, as if I haven't reseved the mameory area!

Here is the allocation and reservation function:

_common *common = NULL;
struct page *pagePtr;
u_int index;

if ((common = (_common *) kmalloc (PAGE_SIZE, GFP_KERNEL | GFP_ATOMIC
| GFP_DMA)) == NULL)
{
        printInfo ("allocation of \"common\" failed.\n");
        return (NULL);
}

for (pagePtr = virt_to_page ((char *)common); pagePtr < virt_to_page
((char *)common + PAGE_SIZE); pagePtr++)
        mem_map_reserve (pagePtr);

Here is the mmap fops:

_common *common = (_common *)file->private_data;
u_int size = vma->vm_end - vma->vm_start;

vma->vm_flags |= (VM_SHARED | VM_RESERVED);

if (size % PAGE_SIZE)
{
        printInfo ("failed.\n");
        return (ERROR);
}

if (common != NULL)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 4, 20)
        if (remap_page_range (vma->vm_start, virt_to_phys (common), size,
vma->vm_page_prot))
#else
        if (remap_page_range (vma, vma->vm_start, virt_to_phys (common),
size, vma->vm_page_prot))
#endif
        {
                printInfo ("failed.\n");
                return (ERROR);
        }
}

Here is the mmap call in the application software:

if ((common = (_common *) mmap (NULL, PAGE_SIZE, PROT_READ |
PROT_WRITE | PROT_EXEC , MAP_SHARED, device, 0)) == NULL)
{
        printf ("mmap \"common\" failed.\n");
        return (ERROR);
}

I tryied to find some exemples such as "drivers/sound/trident.c", but
I cannot find any information

please, help you me to find what's wrong

Fred