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

From: Linh Dang
Date: Fri Dec 03 2004 - 09:48:15 EST


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

>
> > The patch also changes virt_to_phys()/phys_to_virt() in a similar way.
>
> What do you want to use them for? They are only for use in low-level
> memory management code.

Any driver for a DMA-capable device would use them and the way
virt_to_phys/phys_to_virt is currently written, you can't used them
with vmalloced buffers.

>
> Paul.
>
Thanx for the feedback
--
Linh Dang
-
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/