On Mon, Mar 03, 2008 at 12:04:37PM -0800, Linus Torvalds wrote: > > > On Mon, 3 Mar 2008, Jared Hulbert wrote: > > > > By 1:1 you mean virtual + offset == physical + offset right? > > Right. It's a special case, and it's an important special case because > it's the only one that is fast to do. > > It's not very common, but it's common enough that it's worth doing. > > That said, xip should probably never have used virt_to_phys() in the first > place. It should be limited to purely architecture-specific memory > management routines. Actually, xip in your kernel doesn't, it was just a patch I proposed. Basically I wanted to get a pfn from a kva, however that kva might be ioremapped which I didn't actually worry about because only testing a plain RAM backed system. > [ There's a number of drivers that need "physical" addresses for DMA, and > that use virt_to_phys, but they should use the DMA interfaces > that do this right, and even for legacy things that don't use the proper > DMA allocator things virt_to_phys is wrong, because it's about _bus_ > addresses, not CPU physical addresses. Only architecture code can know > when the two actually mean the same thing ] > > Quite frankly, I think it's totally wrong to use kernel-virtual addresses > in those interfaces in first place. Either you use "struct page *" or you > use a pfn number. Nothing else is simply valid. Although they were already using kernel-virtual addresses before I got there, we want to remove the requirement to have a struct page, and there are no good accessors to kmap a pfn (AFAIK) otherwise we could indeed just use a pfn. We'll scrap the virt_to_phys idea and make the interface return both the kaddr and the pfn, I think. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html