From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailgate2.signaal.nl (mailgate2.nl.thalesgroup.com [193.67.31.101]) by ozlabs.org (Postfix) with ESMTP id 4F8F7DDDD5 for ; Fri, 13 Jul 2007 23:52:47 +1000 (EST) Received: from mta1.nl.thales (mta1.signaal.local [193.67.31.130]) by mailgate2.signaal.nl (4.8.1.149) with ESMTP id for ; Fri, 13 Jul 2007 13:21:48 +0200 (MEST) Received: from pilf002.nl.thalesgroup.com (hglsmtp1 [10.160.61.26]) by mta1.nl.thales (4.9.7.3) with ESMTP id fk316AAG for ; Fri, 13 Jul 2007 13:21:41 +0200 (MEST) Received: from localhost (pilf002 [127.0.0.1]) by pilf002.nl.thalesgroup.com (Postfix) with ESMTP id E59BC1A1925 for ; Fri, 13 Jul 2007 13:21:40 +0200 (CEST) Received: from pilf002.nl.thalesgroup.com ([127.0.0.1]) by localhost (hglsmtp1.hengelo.nl.thales [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07755-10 for ; Fri, 13 Jul 2007 13:21:40 +0200 (CEST) Received: from [144.18.5.10] (s155291.nl.global [144.18.5.10]) by pilf002.nl.thalesgroup.com (Postfix) with ESMTP id 490941A18C5 for ; Fri, 13 Jul 2007 13:21:40 +0200 (CEST) Message-ID: <46976044.1030702@nl.thalesgroup.com> Date: Fri, 13 Jul 2007 13:21:40 +0200 From: willy jacobs To: linuxppc-embedded@ozlabs.org Subject: Strange PCI mmap problem on MPC8555 MIME-Version: 1.0 (Generated by Clearswift ES version 4.8.1.149) Content-Type: text/plain; charset=ISO-8859-1; format=flowed List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Setup: ELDK 4.1, U-Boot 1.2.0 and Linux 2.6.20.2 (arch/ppc) The PPC can communicate (memory mapped) with a FGPA through the PCI bus. A user program should be able to access (read/write) the FPGA memory areas directly via mmap() through a small Linux driver. In the driver initialisation bar0 (1 KByte memory) the PCI physical address is remapped to virtual address space via ioremap(). A memory dump (with expected values) in the kernel driver shows: 0 1 2 3 4 5 6 7 8 9 A B C D E F 0xe1056000 17 31 04 00 02 00 00 00 07 20 07 03 00 00 00 00 The mmap call in driver looks like this: static int rvc_mmap (struct file *filp, struct vm_area_struct *vma) { ... if (remap_pfn_range(vma, vma->vm_start, phys_bar0 >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot)) { printk(KERN_CRIT "rvc_mmap: remap_page bar0 failed\n"); return -EAGAIN; ... } The user space test program does a mmap() to bar0 and the memory dump (erroneous values) now shows: 0 1 2 3 4 5 6 7 8 9 A B C D E F 0x30019000 17 31 04 00 17 31 04 00 07 20 07 03 07 20 07 03 ^^^^^^^^^^^ ^^^^^^^^^^^ So the first 32-bit word is now exactly the same as the second 32-bit word, the 4th 32-bit word is the same as the 3rd 32-bit word, etc. Also the same behaviour for bar1. It looks like a 32-/64 bit problem, but the kernel I use is 32-bits. Any idea what causes this strange behaviour? -- willy Unclassified