linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Sekhar Nori <nsekhar@ti.com>, Kevin Hilman <khilman@ti.com>,
	Tony Lindgren <tony@atomide.com>,
	davinci-linux-open-source@linux.davincidsp.com,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH] Consolidate SRAM support
Date: Sat, 16 Apr 2011 14:09:29 +0100	[thread overview]
Message-ID: <20110416130929.GL4423@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <BANLkTikJwFRenjwnws+4J2ep9G0Nv-9aXw@mail.gmail.com>

On Sat, Apr 16, 2011 at 09:01:26PM +0800, Haojian Zhuang wrote:
> On Fri, Apr 15, 2011 at 9:06 PM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > This is work in progress.
> >
> > We have two SoCs using SRAM, both with their own allocation systems,
> > and both with their own ways of copying functions into the SRAM.
> >
> > Let's unify this before we have additional SoCs re-implementing this
> > obviously common functionality themselves.
> >
> > Unfortunately, we end up with code growth through doing this, but that
> > will become a win when we have another SoC using this (which I know
> > there's at least one in the pipeline).
> >
> > One of the considerations here is that we can easily convert sram-pool.c
> > to hook into device tree stuff, which can tell the sram allocator:
> >        - physical address of sram
> >        - size of sram
> >        - allocation granularity
> > and then we just need to ensure that it is appropriately mapped.
> >
> > This uses the physical address, and unlike Davinci's dma address usage,
> > it always wants to have the physical address, and will always return
> > the corresponding physical address when passed that pointer.
> >
> > OMAP could probably do with some more work to make the omapfb and other
> > allocations use the sram allocator, rather than hooking in before the
> > sram allocator is initialized - and then further cleanups so that we
> > have an initialization function which just does
> >
> > sram_create(phys, size)
> >        virt = map sram(phys, size)
> >        create sram pool(virt, phys, size, min_alloc_order)
> >
> > Another question is whether we should allow multiple SRAM pools or not -
> > this code does allow multiple pools, but so far we only have one pool
> > per SoC.  Overdesign?  Maybe, but it prevents SoCs wanting to duplicate
> > it if they want to partition the SRAM, or have peripheral-local SRAMs.
> >
> > Lastly, uio_pruss should probably take the SRAM pool pointer via
> > platform data so that it doesn't have to include Davinci specific
> > includes.
> >
> > Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
> 
> This common sram driver is good for us. It can benefit us on DMA usage.
> I just have one question on SRAM for storing instruction. We still need to
> copy code into SRAM and flush cache & TLB with this SRAM driver.

There is the fncpy API for copying code to other regions of memory,
including SRAM.  The fncpy API is explicitly designed to cope with
Thumb 2 and provide an appropriate function pointer for such code.

Such code needs to be position independent to cope with multiple SRAM
users, and also possible variability of SRAM mapping which may (eventually)
exist when DT comes along.

> TCM driver can allocate code into SRAM section in link stage. It needs to
> update link file and virtual memory layout. Is it worth to make SRAM driver
> support this behavior? The case of using SRAM as memory for instruction
> is switching frequency or entering/exiting low power mode in PXA silicons.

This is more or less the same scenario which OMAP is using its SRAM
for, although that's explicitly SRAM and not TCM.

I don't think we need position dependent code requiring fixup for
these applications as such things tend to be fairly easily coded in a
position independent way.

Also note that C functions can't be copied because C produces position
dependent code, and we have no way of extracting the relocation
dependencies from such code.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-04-16 13:09 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-15 13:06 [RFC PATCH] Consolidate SRAM support Russell King - ARM Linux
2011-04-15 13:39 ` Rob Herring
2011-04-15 14:02   ` Ithamar R. Adema
2011-04-15 14:40   ` Arnd Bergmann
2011-04-15 15:26     ` Russell King - ARM Linux
2011-04-15 15:32       ` Grant Likely
2011-04-15 15:41         ` Russell King - ARM Linux
2011-04-16  4:11           ` Magnus Damm
2011-04-17 17:47           ` Arnd Bergmann
2011-04-15 16:03   ` Russell King - ARM Linux
2011-04-15 16:18     ` Nguyen Dinh-R00091
2011-04-15 16:20       ` Russell King - ARM Linux
2011-04-15 16:58         ` Russell King - ARM Linux
2011-04-15 19:20           ` Nguyen Dinh-R00091
2011-04-15 19:40             ` Russell King - ARM Linux
2011-04-15 20:06               ` Nguyen Dinh-R00091
2011-04-15 13:52 ` Eduardo Valentin
2011-04-15 15:24   ` Russell King - ARM Linux
2011-04-15 14:50 ` Detlef Vollmann
2011-04-15 15:37   ` Russell King - ARM Linux
2011-04-15 18:12     ` Detlef Vollmann
2011-04-15 18:21       ` Russell King - ARM Linux
2011-04-15 16:04   ` Nicolas Ferre
2011-04-15 18:14     ` Detlef Vollmann
2011-04-16 11:27       ` Detlef Vollmann
2011-04-15 18:31 ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-15 20:11 ` Uwe Kleine-König
2011-04-15 20:19   ` Russell King - ARM Linux
2011-04-15 20:22     ` Uwe Kleine-König
2011-04-16 13:01 ` Haojian Zhuang
2011-04-16 13:09   ` Russell King - ARM Linux [this message]
2011-04-18  6:48     ` Tony Lindgren
2011-04-18  7:00       ` Tomi Valkeinen
2011-04-18  8:17         ` Tony Lindgren
2011-04-19 14:16           ` Tomi Valkeinen
2011-04-20  5:27             ` Tony Lindgren
2011-04-18  8:52 ` [RFC PATCH v2] " Russell King - ARM Linux
2011-04-18  9:31   ` Haojian Zhuang
2011-04-18 11:33   ` Tony Lindgren
2011-04-18 13:50   ` Detlef Vollmann
2011-04-18 16:12   ` Nori, Sekhar
2011-04-18 16:18     ` Russell King - ARM Linux
2011-04-19 16:01   ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-19 16:18     ` Russell King - ARM Linux
2011-04-19 19:05       ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-19 23:20         ` Russell King - ARM Linux
2011-04-20  4:06           ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-19  1:23 ` [RFC PATCH] " Linus Walleij
2011-05-12 17:45 ` [RFC PATCH v3] " Russell King - ARM Linux
2011-05-12 18:35   ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-13  7:30   ` Jean Pihet
2011-05-13  9:11     ` Russell King - ARM Linux
2011-05-13  9:25       ` Jean Pihet
2011-05-13  9:19   ` Santosh Shilimkar
2011-05-17 13:06   ` Nori, Sekhar
2011-05-26  1:02   ` [RFC PATCH v4] " Jean-Christophe PLAGNIOL-VILLARD
     [not found]     ` <1306371777-20431-1-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
2011-05-31 17:09       ` Nori, Sekhar
2011-05-31 21:21         ` Russell King - ARM Linux
2011-06-29 13:12     ` Nori, Sekhar
2011-07-08 16:51     ` Nori, Sekhar
2011-07-08 16:58       ` Nori, Sekhar

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=20110416130929.GL4423@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=haojian.zhuang@gmail.com \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=tony@atomide.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).