Using reserved-memory node in dts file


#1

I have a dragonboard410c which is based on arm64, I want to reserve a memory range to be used by a kernel module that will map this range to userspace. I added memory-reserve node to the dtsi file:

reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
my_mem: my@90000000 {
reg = <0 0x90000000 0 0x100000>;
};
I wrote a kernel module that implements the mmap function:

int mymmap (struct file *file, struct vm_area_struct *vma)
{
     unsigned long mmap_size;
     phys_addr_t ramdisk =  0x0000000090000000;

     mmap_size = vma->vm_end - vma->vm_start;

 if(remap_pfn_range(vma, vma->vm_start, ramdisk, mmap_size, vma->vm_page_prot)){
dev_warn(my_dev,"remap_pfn_range failed\n");
return -EAGAIN;
}
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);  
return 0;
}

I get “Unhandled fault: level 3 address size fault (0x92000043) at 0x0000007fa49ef000”

What is the problem? how should I use the reserved-memory node?