* Re: usb_get_status(): what a weird implementation !
[not found] ` <38b2ab8a0806300541q756e9b6fl445a5ee69d403ce7@mail.gmail.com>
@ 2008-06-30 13:51 ` Oliver Neukum
2008-06-30 14:03 ` Francis Moreau
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Neukum @ 2008-06-30 13:51 UTC (permalink / raw)
To: Francis Moreau; +Cc: David Brownell, linux-usb, Linux Kernel Mailing List
Am Montag 30 Juni 2008 14:41:37 schrieb Francis Moreau:
> On Mon, Jun 30, 2008 at 1:46 PM, Oliver Neukum <oliver@neukum.org> wrote:
> > Am Montag 30 Juni 2008 13:04:21 schrieb Francis Moreau:
> >> well, it wouldn't be hard to allocated a buf on the stack with correct
> >> alignement
> >> and size for DMA mapping.
> >
> > Where would you put it and meet the alignment requirements?
> >
>
> wouldn't this code below do the trick ?
>
> void foo(void)
> {
> unsigned char __buf[2 * CACHE_LINE_SIZE];
> unsigned char *buf;
>
> buf = ((unsigned long)__buf) + CACHE_LINE_SIZE-1) & ~(CACHE_LINE_SIZE-1);
> }
>
> but I agree it looks hackish.
If your buffer is smaller than CACHE_LINE_SIZE it should work.
However, this needs input from people who understand DMA in and out.
But how large is 2 * CACHE_LINE_SIZE compared to the kernel stack?
Regards
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: usb_get_status(): what a weird implementation !
2008-06-30 13:51 ` usb_get_status(): what a weird implementation ! Oliver Neukum
@ 2008-06-30 14:03 ` Francis Moreau
2008-06-30 14:11 ` Oliver Neukum
0 siblings, 1 reply; 4+ messages in thread
From: Francis Moreau @ 2008-06-30 14:03 UTC (permalink / raw)
To: Oliver Neukum; +Cc: David Brownell, linux-usb, Linux Kernel Mailing List
On Mon, Jun 30, 2008 at 3:51 PM, Oliver Neukum <oliver@neukum.org> wrote:
>
> If your buffer is smaller than CACHE_LINE_SIZE it should work.
> However, this needs input from people who understand DMA in and out.
yeah, that's the reason why it's a hack.
Maybe adding a new helper in the dma API would be better...
> But how large is 2 * CACHE_LINE_SIZE compared to the kernel stack?
CACHE_LINE_SIZE = 32 bytes is common for embedded systems I guess.
For big system, I dunno.
Kernel stack size is usually 4KiB.
--
Francis
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: usb_get_status(): what a weird implementation !
2008-06-30 14:03 ` Francis Moreau
@ 2008-06-30 14:11 ` Oliver Neukum
2008-06-30 14:22 ` Francis Moreau
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Neukum @ 2008-06-30 14:11 UTC (permalink / raw)
To: Francis Moreau; +Cc: David Brownell, linux-usb, Linux Kernel Mailing List
Am Montag 30 Juni 2008 16:03:52 schrieb Francis Moreau:
> On Mon, Jun 30, 2008 at 3:51 PM, Oliver Neukum <oliver@neukum.org> wrote:
> >
> > If your buffer is smaller than CACHE_LINE_SIZE it should work.
> > However, this needs input from people who understand DMA in and out.
>
> yeah, that's the reason why it's a hack.
>
> Maybe adding a new helper in the dma API would be better...
>
> > But how large is 2 * CACHE_LINE_SIZE compared to the kernel stack?
>
> CACHE_LINE_SIZE = 32 bytes is common for embedded systems I guess.
> For big system, I dunno.
>
> Kernel stack size is usually 4KiB.
>
Well, we have:
asm-mips/mach-ip32/kmalloc.h:#define ARCH_KMALLOC_MINALIGN 128
That's 256 bytes, that is 1/16 of the stack.
Regards
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: usb_get_status(): what a weird implementation !
2008-06-30 14:11 ` Oliver Neukum
@ 2008-06-30 14:22 ` Francis Moreau
0 siblings, 0 replies; 4+ messages in thread
From: Francis Moreau @ 2008-06-30 14:22 UTC (permalink / raw)
To: Oliver Neukum; +Cc: David Brownell, linux-usb, Linux Kernel Mailing List
On Mon, Jun 30, 2008 at 4:11 PM, Oliver Neukum <oliver@neukum.org> wrote:
>
> Well, we have:
> asm-mips/mach-ip32/kmalloc.h:#define ARCH_KMALLOC_MINALIGN 128
> That's 256 bytes, that is 1/16 of the stack.
yep but I wouldn't call such beast an embedded system ;)
And on this system stack size is 8 KiB.
But I agree a plain stack allocation as I showed is not usable.
--
Francis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-06-30 14:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200806261011.00287.oliver@neukum.org>
[not found] ` <200806301346.11267.oliver@neukum.org>
[not found] ` <38b2ab8a0806300541q756e9b6fl445a5ee69d403ce7@mail.gmail.com>
2008-06-30 13:51 ` usb_get_status(): what a weird implementation ! Oliver Neukum
2008-06-30 14:03 ` Francis Moreau
2008-06-30 14:11 ` Oliver Neukum
2008-06-30 14:22 ` Francis Moreau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®