From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jared Hulbert" Subject: Re: [patch 4/6] xip: support non-struct page backed memory Date: Sat, 1 Mar 2008 00:14:35 -0800 Message-ID: <6934efce0803010014p2cc9a5edu5fee2029c0104a07@mail.gmail.com> References: <20080118045649.334391000@suse.de> <20080118045755.735923000@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: "Linus Torvalds" , "Andrew Morton" , "Carsten Otte" , "Martin Schwidefsky" , "Heiko Carstens" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org To: npiggin@suse.de Return-path: Received: from ug-out-1314.google.com ([66.249.92.173]:4356 "EHLO ug-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754248AbYCAIOk (ORCPT ); Sat, 1 Mar 2008 03:14:40 -0500 Received: by ug-out-1314.google.com with SMTP id z38so745092ugc.16 for ; Sat, 01 Mar 2008 00:14:37 -0800 (PST) In-Reply-To: <20080118045755.735923000@suse.de> Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: > (The kaddr->pfn conversion may not be quite right for all architectures or XIP > memory mappings, and the cacheflushing may need to be added for some archs). > > This scheme has been tested and works for Jared's work-in-progress filesystem, Opps. I screwed up testing this. It doesn't work with MTD devices and ARM.... The problem is that virt_to_phys() gives bogus answer for a mtd->point()'ed address. It's a ioremap()'ed address which doesn't work with the ARM virt_to_phys(). I can get a physical address from mtd->point() with a patch I dropped a little while back. So I was thinking how about instead of: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> void * get_xip_address(struct address_space *mapping, pgoff_t pgoff, int create); xip_mem = mapping->a_ops->get_xip_address(mapping, vmf->pgoff, 0); pfn = virt_to_phys((void *)xip_mem) >> PAGE_SHIFT; err = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address, pfn); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Could we do? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> int get_xip_address(struct address_space *mapping, pgoff_t pgoff, int create, unsigned long *address); if(mapping->a_ops->get_xip_address(mapping, vmf->pgoff, 0, &xip_mem)){ /* virtual address */ pfn = virt_to_phys((void *)xip_mem) >> PAGE_SHIFT; } else { /* physical address */ pfn = xip_mem >> PAGE_SHIFT; } err = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address, pfn); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Or maybe like... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> unsigned long get_xip_address(struct address_space *mapping, pgoff_t pgoff, int create, int *switch); xip_mem = mapping->a_ops->get_xip_address(mapping, vmf->pgoff, 0, &switch); if(switch){ /* virtual address */ pfn = virt_to_phys((void *)xip_mem) >> PAGE_SHIFT; } else { /* physical address */ pfn = xip_mem >> PAGE_SHIFT; } err = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address, pfn); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Or... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> void get_xip_address(struct address_space *mapping, pgoff_t pgoff, int create, unsigned long *phys, void **virt); mapping->a_ops->get_xip_address(mapping, vmf->pgoff, 0, &phys, &virt); if(phys){ /* physical address */ pfn = phys >> PAGE_SHIFT; } else { /* physical address */ pfn = virt_to_phys(virt) >> PAGE_SHIFT; } err = vm_insert_mixed(vma, (unsigned long)vmf->virtual_address, pfn); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<