linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* 8260 CPM DP ram free function
@ 2004-05-21 17:35 Rune Torgersen
  2004-05-21 19:23 ` Tom Rini
  2004-05-21 21:44 ` Dan Malek
  0 siblings, 2 replies; 16+ messages in thread
From: Rune Torgersen @ 2004-05-21 17:35 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 554 bytes --]

Hi

I hope someone on this list can push the following patch to one of the
ppc trees.

It adds functionality to the 8260 CPM to free() allocated host and dp
ram memory. (nice for loadable drivers that use DP ram)

The functions that are added are m8260_cpm_dpfree() and
m8260_cpm_hostfree()

This patch is agains 2.6.5, but it should apply cleanly agains any 2.4.x
and 2.6.x, since it only touches arch/ppc/8260_io/commproc.c and
include/asm-ppc/cpm_8260.h

This could possibly also be used on the 8xx CPUs, since the code is
identical.

[-- Attachment #2: cpm_dpfree.patch.gz --]
[-- Type: application/x-gzip, Size: 3496 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: 8260 CPM DP ram free function
  2004-05-21 17:35 8260 CPM DP ram free function Rune Torgersen
@ 2004-05-21 19:23 ` Tom Rini
  2004-05-24 13:50   ` Wolfgang Denk
  2004-05-21 21:44 ` Dan Malek
  1 sibling, 1 reply; 16+ messages in thread
From: Tom Rini @ 2004-05-21 19:23 UTC (permalink / raw)
  To: Rune Torgersen; +Cc: linuxppc-embedded


On Fri, May 21, 2004 at 12:35:01PM -0500, Rune Torgersen wrote:

> It adds functionality to the 8260 CPM to free() allocated host and dp
> ram memory. (nice for loadable drivers that use DP ram)

First, when this has come up in the past, the first question is why is
this useful, given that with the hardware and peripherals in question,
loadable drivers aren't really useful (and don't shoot the messenger
please).

Second, you removed the EXPORT_SYMBOL for the old alloc, but I didn't
see quickly how a module would make use of the new infrastructure since
there weren't any new EXPORT_SYMBOLs.

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: 8260 CPM DP ram free function
@ 2004-05-21 19:34 Rune Torgersen
  2004-05-21 19:50 ` Tom Rini
  0 siblings, 1 reply; 16+ messages in thread
From: Rune Torgersen @ 2004-05-21 19:34 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-embedded


> First, when this has come up in the past, the first question
> is why is this useful, given that with the hardware and
> peripherals in question, loadable drivers aren't really
> useful (and don't shoot the messenger please).

Right now I mainly use it to debug a driver, which would run out of host
ram when I reloaded it

> Second, you removed the EXPORT_SYMBOL for the old alloc, but
> I didn't see quickly how a module would make use of the new
> infrastructure since there weren't any new EXPORT_SYMBOLs.

This is because I did my patch against 2.6.5, and all the EXPORT sympols
are in arch/ppc/kernel/ppc_ksyms.c
and not in commprocs.c

In ppc_ksyms.c I have:
extern uint m8260_cpm_dpalloc(uint size, uint align);
extern uint m8260_cpm_hostalloc(uint size, uint align);
extern uint m8260_cpm_hostfree(uint ptr);
extern uint m8260_cpm_dpfree(uint ptr);

EXPORT_SYMBOL(m8260_cpm_dpalloc);
EXPORT_SYMBOL(m8260_cpm_hostalloc);
EXPORT_SYMBOL(m8260_cpm_dpfree);
EXPORT_SYMBOL(m8260_cpm_hostfree);


>
> --
> Tom Rini
> http://gate.crashing.org/~trini/
>

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: 8260 CPM DP ram free function
  2004-05-21 19:34 Rune Torgersen
@ 2004-05-21 19:50 ` Tom Rini
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2004-05-21 19:50 UTC (permalink / raw)
  To: Rune Torgersen; +Cc: linuxppc-embedded


On Fri, May 21, 2004 at 02:34:08PM -0500, Rune Torgersen wrote:

>
> > First, when this has come up in the past, the first question
> > is why is this useful, given that with the hardware and
> > peripherals in question, loadable drivers aren't really
> > useful (and don't shoot the messenger please).
>
> Right now I mainly use it to debug a driver, which would run out of host
> ram when I reloaded it
>
> > Second, you removed the EXPORT_SYMBOL for the old alloc, but
> > I didn't see quickly how a module would make use of the new
> > infrastructure since there weren't any new EXPORT_SYMBOLs.
>
> This is because I did my patch against 2.6.5, and all the EXPORT sympols
> are in arch/ppc/kernel/ppc_ksyms.c
> and not in commprocs.c
>
> In ppc_ksyms.c I have:
> extern uint m8260_cpm_dpalloc(uint size, uint align);
> extern uint m8260_cpm_hostalloc(uint size, uint align);
> extern uint m8260_cpm_hostfree(uint ptr);
> extern uint m8260_cpm_dpfree(uint ptr);
>
> EXPORT_SYMBOL(m8260_cpm_dpalloc);
> EXPORT_SYMBOL(m8260_cpm_hostalloc);
> EXPORT_SYMBOL(m8260_cpm_dpfree);
> EXPORT_SYMBOL(m8260_cpm_hostfree);

Er?  Aren't dpfree/hostfree new functions?  I didn't see them added as
exports in your patch, and regardless they belong in comproc.c now.

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: 8260 CPM DP ram free function
@ 2004-05-21 20:16 Rune Torgersen
  2004-05-21 20:26 ` Tom Rini
  0 siblings, 1 reply; 16+ messages in thread
From: Rune Torgersen @ 2004-05-21 20:16 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

> Er?  Aren't dpfree/hostfree new functions?  I didn't see them 
> added as exports in your patch, and regardless they belong in 
> comproc.c now.

Try this then

The problem is that on 2.6.x I have never gotten EXPORT() in commproc.c
(or anywhere else) to work, I have had to put them on ppc_ksyms.c to be
able to load my modules

I do not know if there is some magic thatI have forgotten to do.




[-- Attachment #2: cpm_dpfree.patch.gz --]
[-- Type: application/x-gzip, Size: 3509 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: 8260 CPM DP ram free function
  2004-05-21 20:16 Rune Torgersen
@ 2004-05-21 20:26 ` Tom Rini
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Rini @ 2004-05-21 20:26 UTC (permalink / raw)
  To: Rune Torgersen; +Cc: linuxppc-embedded


On Fri, May 21, 2004 at 03:16:10PM -0500, Rune Torgersen wrote:
> > Er?  Aren't dpfree/hostfree new functions?  I didn't see them
> > added as exports in your patch, and regardless they belong in
> > comproc.c now.
>
> Try this then
>
> The problem is that on 2.6.x I have never gotten EXPORT() in commproc.c
> (or anywhere else) to work, I have had to put them on ppc_ksyms.c to be
> able to load my modules
>
> I do not know if there is some magic thatI have forgotten to do.

Did you run 'make clean' before trying?  Perhaps there's still a bug
when you add exports to a file that previously didn't have any..

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: 8260 CPM DP ram free function
@ 2004-05-21 21:41 Rune Torgersen
  0 siblings, 0 replies; 16+ messages in thread
From: Rune Torgersen @ 2004-05-21 21:41 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-embedded


> Did you run 'make clean' before trying?  Perhaps there's
> still a bug when you add exports to a file that previously
> didn't have any..

Tried that, it did not work. I get Unknown symbol errors when loading
the module.

BTW there is a an error in the patch file I sendt... No Idea how that
snuck in there before I did the diff..., line 103 of commproc.c has one
too many closing parens

-	init_rt_alloc(&dp_heap, (void*)dp_alloc_base, CPM_DATAONLY_SIZE
));
+	init_rt_alloc(&dp_heap, (void*)dp_alloc_base, CPM_DATAONLY_SIZE
);

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: 8260 CPM DP ram free function
  2004-05-21 17:35 8260 CPM DP ram free function Rune Torgersen
  2004-05-21 19:23 ` Tom Rini
@ 2004-05-21 21:44 ` Dan Malek
  1 sibling, 0 replies; 16+ messages in thread
From: Dan Malek @ 2004-05-21 21:44 UTC (permalink / raw)
  To: Rune Torgersen; +Cc: linuxppc-embedded


On May 21, 2004, at 1:35 PM, Rune Torgersen wrote:


> I hope someone on this list can push the following patch to one of the
> ppc trees.

Will you please get rid of those #ifdefs?  If the code works, just
use it, if not, don't ask for a patch to be applied.  There is no
reason for this.

> The functions that are added are m8260_cpm_dpfree() and
> m8260_cpm_hostfree()

The "host" functions should simply be removed and drivers should
use kmalloc()/kfree(), manage their own alignment restrictions, since
the 82xx is cache coherent.

Let's clean this up and do it right if we are going to do it at all.

Thanks.

	-- Dan


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: 8260 CPM DP ram free function
@ 2004-05-21 21:52 Rune Torgersen
  0 siblings, 0 replies; 16+ messages in thread
From: Rune Torgersen @ 2004-05-21 21:52 UTC (permalink / raw)
  To: Dan Malek; +Cc: linuxppc-embedded


> Will you please get rid of those #ifdefs?  If the code works,
> just use it, if not, don't ask for a patch to be applied.
> There is no reason for this.

Ok

> The "host" functions should simply be removed and drivers
> should use kmalloc()/kfree(), manage their own alignment
> restrictions, since the 82xx is cache coherent.

Not sure how easy that would be. The host_alloc and dp_alloc gets called
at few times _before_ kmem_cache_init() is called, so a kmalloc call
panic()s the kernel.
I know, because I tried to use kmalloc for handling the linked lists for
the dp_alloc/free functions.

It would make allocating buffers in drivers easier.

> Let's clean this up and do it right if we are going to do it at all.
Cleaning up is always good.

Any more suggestions before I remove the #ifdefs and resubmit?

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: 8260 CPM DP ram free function
  2004-05-21 19:23 ` Tom Rini
@ 2004-05-24 13:50   ` Wolfgang Denk
  2004-05-24 14:06     ` Pantelis Antoniou
  2004-05-24 15:24     ` Tom Rini
  0 siblings, 2 replies; 16+ messages in thread
From: Wolfgang Denk @ 2004-05-24 13:50 UTC (permalink / raw)
  To: Tom Rini; +Cc: Rune Torgersen, linuxppc-embedded


In message <20040521192333.GI6763@smtp.west.cox.net> you wrote:
>
> First, when this has come up in the past, the first question is why is
> this useful, given that with the hardware and peripherals in question,
> loadable drivers aren't really useful (and don't shoot the messenger
> please).

As has been discussed before, too, loadable drivers are  very  useful
during  development;  they  can  even be useful in production systems
when you need and easy way to update software updates  in  a  running
system.

The fact that hte existing drivers don't support this is IMHO more of
an historical lapse than an argument for or against such a feature.

The fact alone that this is at least  the  third  implementation  and
this  feature which was submitted for inclusion with the public trees
should make clear that there is some need for it.

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Little known fact about Middle Earth:   The Hobbits had a very sophi-
sticated computer network!   It was a Tolkien Ring...

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: 8260 CPM DP ram free function
  2004-05-24 13:50   ` Wolfgang Denk
@ 2004-05-24 14:06     ` Pantelis Antoniou
  2004-05-24 14:28       ` Wolfgang Denk
  2004-05-24 15:24     ` Tom Rini
  1 sibling, 1 reply; 16+ messages in thread
From: Pantelis Antoniou @ 2004-05-24 14:06 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: Tom Rini, Rune Torgersen, linuxppc-embedded


Wolfgang Denk wrote:

>In message <20040521192333.GI6763@smtp.west.cox.net> you wrote:
>
>>First, when this has come up in the past, the first question is why is
>>this useful, given that with the hardware and peripherals in question,
>>loadable drivers aren't really useful (and don't shoot the messenger
>>please).
>>
>
>As has been discussed before, too, loadable drivers are  very  useful
>during  development;  they  can  even be useful in production systems
>when you need and easy way to update software updates  in  a  running
>system.
>
>The fact that hte existing drivers don't support this is IMHO more of
>an historical lapse than an argument for or against such a feature.
>
>The fact alone that this is at least  the  third  implementation  and
>this  feature which was submitted for inclusion with the public trees
>should make clear that there is some need for it.
>
>Best regards,
>
>Wolfgang Denk
>
>
I'll just pop in here and say that I already have & maintain
a proper dpalloc for 8xx.

Tom I would very much like either Rune's or my version gets
included at least in 2.6.

The argument for not needing modules is not very convincing IMHO.

Just my €0.02.

>--
>Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
>Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
>Little known fact about Middle Earth:   The Hobbits had a very sophi-
>sticated computer network!   It was a Tolkien Ring...
>
>
>
>
>
Regards

Pantelis


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: 8260 CPM DP ram free function
  2004-05-24 14:06     ` Pantelis Antoniou
@ 2004-05-24 14:28       ` Wolfgang Denk
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Denk @ 2004-05-24 14:28 UTC (permalink / raw)
  To: Pantelis Antoniou; +Cc: Tom Rini, Rune Torgersen, linuxppc-embedded


In message <40B2016F.3070206@intracom.gr> you wrote:
>
> I'll just pop in here and say that I already have & maintain
> a proper dpalloc for 8xx.

Yes, your implementation was the second of the three I  am  aware  of
that have been submitted through this list.

> The argument for not needing modules is not very convincing IMHO.

Do we really need a poll?

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
What was sliced bread the greatest thing since?

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: 8260 CPM DP ram free function
  2004-05-24 13:50   ` Wolfgang Denk
  2004-05-24 14:06     ` Pantelis Antoniou
@ 2004-05-24 15:24     ` Tom Rini
  1 sibling, 0 replies; 16+ messages in thread
From: Tom Rini @ 2004-05-24 15:24 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: Rune Torgersen, linuxppc-embedded


On Mon, May 24, 2004 at 03:50:36PM +0200, Wolfgang Denk wrote:

> In message <20040521192333.GI6763@smtp.west.cox.net> you wrote:
> >
> > First, when this has come up in the past, the first question is why is
> > this useful, given that with the hardware and peripherals in question,
> > loadable drivers aren't really useful (and don't shoot the messenger
> > please).
>
> As has been discussed before, too, loadable drivers are  very  useful
> during  development;  they  can  even be useful in production systems
> when you need and easy way to update software updates  in  a  running
> system.

I suppose once Dan's comments are addressed, since I thought he's been
the biggest objector to all of the previous implementations (or, my
memory is faulty, and every one of them just fell on the ground), we can
push this out, at least for cpm2 stuff.

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: 8260 CPM DP ram free function
@ 2004-05-24 16:03 Rune Torgersen
       [not found] ` <20040524161520.GQ6763@smtp.west.cox.net>
  0 siblings, 1 reply; 16+ messages in thread
From: Rune Torgersen @ 2004-05-24 16:03 UTC (permalink / raw)
  To: Tom Rini, Wolfgang Denk; +Cc: linuxppc-embedded


> I suppose once Dan's comments are addressed, since I thought
> he's been the biggest objector to all of the previous
> implementations (or, my memory is faulty, and every one of
> them just fell on the ground), we can push this out, at least
> for cpm2 stuff.

I have fixed the #ifdefs Dan complained about, but I cannot really do
much about changing hostalloc to kfree for the stuff in the kernel,
since hostalloc gets called a few times before kalloc is initialized.

What else should I do before resubmitting?

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: 8260 CPM DP ram free function
       [not found] ` <20040524161520.GQ6763@smtp.west.cox.net>
@ 2004-05-25 11:00   ` Dan Malek
  0 siblings, 0 replies; 16+ messages in thread
From: Dan Malek @ 2004-05-25 11:00 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-embedded, Rune Torgersen, Wolfgang Denk


On May 24, 2004, at 12:15 PM, Tom Rini wrote:


> Dan?

Check it in!

Thanks.

	-- Dan


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: 8260 CPM DP ram free function
@ 2004-05-25 16:04 Rune Torgersen
  0 siblings, 0 replies; 16+ messages in thread
From: Rune Torgersen @ 2004-05-25 16:04 UTC (permalink / raw)
  To: Tom Rini, linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 180 bytes --]

Ok, here is the revised version of the dpalloc/free patch

Rune Torgersen
System Developer
Innovative Systems LLC
1000 Innovative Drive
Mitchell, SD 57301
www.innovsys.com

[-- Attachment #2: cpm_alloc_free.patch.gz --]
[-- Type: application/x-gzip, Size: 3854 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2004-05-25 16:04 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-21 17:35 8260 CPM DP ram free function Rune Torgersen
2004-05-21 19:23 ` Tom Rini
2004-05-24 13:50   ` Wolfgang Denk
2004-05-24 14:06     ` Pantelis Antoniou
2004-05-24 14:28       ` Wolfgang Denk
2004-05-24 15:24     ` Tom Rini
2004-05-21 21:44 ` Dan Malek
  -- strict thread matches above, loose matches on Subject: below --
2004-05-21 19:34 Rune Torgersen
2004-05-21 19:50 ` Tom Rini
2004-05-21 20:16 Rune Torgersen
2004-05-21 20:26 ` Tom Rini
2004-05-21 21:41 Rune Torgersen
2004-05-21 21:52 Rune Torgersen
2004-05-24 16:03 Rune Torgersen
     [not found] ` <20040524161520.GQ6763@smtp.west.cox.net>
2004-05-25 11:00   ` Dan Malek
2004-05-25 16:04 Rune Torgersen

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).