Re: [PATCH][PPC32[NEWBIE] enhancement to virt_to_bus/bus_to_virt (try 2)

From: Eugene Surovegin
Date: Sun Dec 05 2004 - 05:12:23 EST


On Fri, Dec 03, 2004 at 09:46:00AM -0500, Linh Dang wrote:
> On Fri, 3 Dec 2004 07:31:14 +1100, Paul Mackerras <paulus@xxxxxxxxx> wrote:
> > Linh Dang writes:
> >
> > > In 2.6.9 on non-APUS ppc32 platforms, virt_to_bus() will just subtract
> > > KERNELBASE from the the virtual address. bus_to_virt() will perform
> > > the reverse operation.
> > >
> > > This patch will make virt_to_bus():
> > >
> > > - perform the current operation if the virtual address is between
> > > KERNELBASE and ioremap_bot.
> >
> > Why do you want to do this? The only code that should be using
> > virt_to_bus or bus_to_virt is the DMA API code, and it's happy with
> > them the way they are.
>
> I wrote a DMA engine (to used by other drivers) that (would like to) accept
> all kind of buffers as input (vmalloced, dual-access shared RAM mapped
> by BATs, etc). The DMA engine has to decode the virtual address of the
> input buffer to (possibly multiple) physical address(es). virt_to_phys()
> has the right name for the job except it only works for the kernel virtual
> addresses initially mapped at KERNELBASE

Unfortunately your patch doesn't achieve your goals. vmalloc space on
PPC32 will be between KERNEL_BASE and ioremap_bot anyway, so
additional check is mostly useless anyway (it will only call iopa()
for ioremaps done early during the boot).

Also, even assuming you got the range right and called iopa() for
vmalloced space, tell me how are you gonna deal with non-physically
continuous vmalloced buffers in your DMA library?

--
Eugene
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/