All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Dan Malek <dan@embeddededge.com>
Cc: linux-ppc-embedded <linuxppc-embedded@ozlabs.org>
Subject: Re: [PATCH] allow coherent DMA API to work before main page allocator is set up
Date: Fri, 20 May 2005 14:51:52 -0300	[thread overview]
Message-ID: <20050520175152.GB26221@logos.cnet> (raw)
In-Reply-To: <e503cf4ab6d2d389b29474561048f2f2@embeddededge.com>

On Fri, May 20, 2005 at 05:03:59PM -0400, Dan Malek wrote:
> 
> On May 20, 2005, at 10:12 AM, Marcelo Tosatti wrote:
> 
> >The following patch changes dma_alloc_coherent() to, in case the
> >main page allocator is not yet up and running, use the bootmem
> >allocator instead.
> 
> I'm concerned about this ...  Why did the drivers change in 2.6
> such that they now call dma_alloc_coherent() prior to the VM set up?

Well, as far as I can see, it is expected that console_init() gets called
before the main page allocator.

The startup sequence, on both v2.4 and v2.6, is:

setup_arch()
...
	console_init()
		console_8xx_init()
			register_console()
				release_console_sem() 
...
	mem_init()

register_console calls the driver ->setup method, and release_console_sem() 
is going to ->write pending data from the log buffer to the device.

As you well know, ->setup calls m8xx_cpm_hostalloc(). 

I must be missing something very obvious here, can you explain how 
did you arrange things in v2.4 such that the console's ->setup 
method is called _after_ mem_init() ? 

> >It also adds a new parameter to m8xx_cpm_hostalloc() to send back
> >the physical address to its caller.
> 
> Anyone calling m8xx_cpm_hostalloc() is likely to be immediately
> calling dma_alloc_coherent().  There is some design problem here
> if we can't properly use these interfaces and get the mapping we
> need.  The TLB pinning option won't work if we can't do this.
> 
> 
> > ..... Special casing such as
> >drivers/serial/cpm_uart/cpm_uart_cpm1.c's cpm_uart_allocbuf() can be
> >removed:
> >
> >        if (is_con) {
> >                mem_addr = (u8 *) m8xx_cpm_hostalloc(memsz);
> >                dma_addr = 0;
> >        } else
> >                mem_addr = dma_alloc_coherent(NULL, memsz, &dma_addr,
> >                                              GFP_KERNEL);
> 
> This is bogus and should not be necessary.  The original serial
> driver was able to work without doing this, I spent lots of time so
> stuff like this wasn't necessary, and it's sad to see us take such
> a step backward. 

Well, if you got this right in v2.4 then it must be possible to get 
it right in v2.6 too...

Thanks!

  reply	other threads:[~2005-05-20 23:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-20 14:12 [PATCH] allow coherent DMA API to work before main page allocator is set up Marcelo Tosatti
2005-05-20 21:03 ` Dan Malek
2005-05-20 17:51   ` Marcelo Tosatti [this message]
2005-05-21 21:21     ` Dan Malek
2005-05-21 22:27       ` [RFT] 8xx cpm_hostalloc patch was: " Marcelo Tosatti
2005-05-23  6:27         ` Pantelis Antoniou
2005-05-23 15:19           ` Dan Malek
2005-05-27 15:48         ` [PATCH] PSC with devfs on 5200 Mark Chambers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050520175152.GB26221@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=dan@embeddededge.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.