RE: [PATCH 5/5] I/OAT: Add completion callback for async_tx interface use
>From: David Miller [mailto:[EMAIL PROTECTED] > >From: Andrew Morton <[EMAIL PROTECTED]> >Date: Wed, 17 Oct 2007 17:44:38 -0700 > >> On Wed, 17 Oct 2007 17:14:39 -0700 >> Shannon Nelson <[EMAIL PROTECTED]> wrote: >> >> > + tx->callback = (void *)ioat_dma_test_callback; >> >> and when I remove this cast I get >> >> drivers/dma/ioat_dma.c: In function 'ioat_dma_self_test': >> drivers/dma/ioat_dma.c:718: warning: assignment from >incompatible pointer type >> >> because ioat_dma_test_callback isn't void-returning. >Something is wrong >> here. I assume that ioat_dma_test_callback() should just be >> void-returning? > >In fact this might crash on systems that conditionally pop >return values based upon whether the function is void or not. > Yep - thanks. That's my misuse of Dan's dma_async_tx_callback typedef. sln - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] I/OAT: Add completion callback for async_tx interface use
From: Andrew Morton <[EMAIL PROTECTED]> Date: Wed, 17 Oct 2007 17:44:38 -0700 > On Wed, 17 Oct 2007 17:14:39 -0700 > Shannon Nelson <[EMAIL PROTECTED]> wrote: > > > + tx->callback = (void *)ioat_dma_test_callback; > > and when I remove this cast I get > > drivers/dma/ioat_dma.c: In function 'ioat_dma_self_test': > drivers/dma/ioat_dma.c:718: warning: assignment from incompatible pointer type > > because ioat_dma_test_callback isn't void-returning. Something is wrong > here. I assume that ioat_dma_test_callback() should just be > void-returning? In fact this might crash on systems that conditionally pop return values based upon whether the function is void or not. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH 5/5] I/OAT: Add completion callback for async_tx interface use
>From: Andrew Morton [mailto:[EMAIL PROTECTED] > >On Wed, 17 Oct 2007 17:14:39 -0700 >Shannon Nelson <[EMAIL PROTECTED]> wrote: [...] >> +static dma_async_tx_callback ioat_dma_test_callback(void >*dma_async_param) >> +{ >> +printk(KERN_ERR "ioatdma: ioat_dma_test_callback(0x%04llx)\n", >> +(u64)dma_async_param); >> +return 0; >> +} > >This wanted to be `return NULL'. I'll fix. Thanks. > >> /** >> * ioat_dma_self_test - Perform a IOAT transaction to >verify the HW works. >> * @device: device to be tested >> @@ -691,6 +715,8 @@ static int ioat_dma_self_test(struct >ioatdma_device *device) >> addr = dma_map_single(dma_chan->device->dev, dest, >IOAT_TEST_SIZE, >> DMA_FROM_DEVICE); >> ioat_set_dest(addr, tx, 0); >> +tx->callback = (void *)ioat_dma_test_callback; > >This cast is unneeded, surely? It had better be.. > >> +tx->callback_param = (void *)0x8086; > >eh? I suppose I could have used "42"... sln - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] I/OAT: Add completion callback for async_tx interface use
On Wed, 17 Oct 2007 17:14:39 -0700 Shannon Nelson <[EMAIL PROTECTED]> wrote: > + printk(KERN_ERR "ioatdma: ioat_dma_test_callback(0x%04llx)\n", > + (u64)dma_async_param); Generates a warning on 32-bit: drivers/dma/ioat_dma.c: In function 'ioat_dma_test_callback': drivers/dma/ioat_dma.c:660: warning: cast from pointer to integer of different size and we can never ever print u64's anwyay: we dont' know what type the arch uses to implement them. The usual fix is to cast to unsigned long long, but in this case %p will work nicely, no? > + tx->callback = (void *)ioat_dma_test_callback; and when I remove this cast I get drivers/dma/ioat_dma.c: In function 'ioat_dma_self_test': drivers/dma/ioat_dma.c:718: warning: assignment from incompatible pointer type because ioat_dma_test_callback isn't void-returning. Something is wrong here. I assume that ioat_dma_test_callback() should just be void-returning? diff -puN drivers/dma/ioat_dma.c~i-oat-add-completion-callback-for-async_tx-interface-use-fix drivers/dma/ioat_dma.c --- a/drivers/dma/ioat_dma.c~i-oat-add-completion-callback-for-async_tx-interface-use-fix +++ a/drivers/dma/ioat_dma.c @@ -654,11 +654,10 @@ static void ioat_dma_start_null_desc(str */ #define IOAT_TEST_SIZE 2000 -static dma_async_tx_callback ioat_dma_test_callback(void *dma_async_param) +static void ioat_dma_test_callback(void *dma_async_param) { - printk(KERN_ERR "ioatdma: ioat_dma_test_callback(0x%04llx)\n", - (u64)dma_async_param); - return 0; + printk(KERN_ERR "ioatdma: ioat_dma_test_callback(0x%p)\n", + dma_async_param); } /** @@ -715,7 +714,7 @@ static int ioat_dma_self_test(struct ioa addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, DMA_FROM_DEVICE); ioat_set_dest(addr, tx, 0); - tx->callback = (void *)ioat_dma_test_callback; + tx->callback = ioat_dma_test_callback; tx->callback_param = (void *)0x8086; cookie = ioat_tx_submit(tx); if (cookie < 0) { _ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] I/OAT: Add completion callback for async_tx interface use
On Wed, 17 Oct 2007 17:14:39 -0700 Shannon Nelson <[EMAIL PROTECTED]> wrote: > The async_tx interface includes a completion callback. This adds support > for using that callback, including using interrupts on completion. > > Signed-off-by: Shannon Nelson <[EMAIL PROTECTED]> > --- > > drivers/dma/ioat_dma.c | 26 ++ > 1 files changed, 26 insertions(+), 0 deletions(-) > > diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c > index 117ac38..f560527 100644 > --- a/drivers/dma/ioat_dma.c > +++ b/drivers/dma/ioat_dma.c > @@ -212,6 +212,18 @@ static dma_cookie_t ioat_tx_submit(struct > dma_async_tx_descriptor *tx) > } while (len && (new = ioat_dma_get_next_descriptor(ioat_chan))); > > hw->ctl = IOAT_DMA_DESCRIPTOR_CTL_CP_STS; > + if (new->async_tx.callback) { > + hw->ctl |= IOAT_DMA_DESCRIPTOR_CTL_INT_GN; > + if (first != new) { > + /* move callback into to last desc */ > + new->async_tx.callback = first->async_tx.callback; > + new->async_tx.callback_param > + = first->async_tx.callback_param; > + first->async_tx.callback = NULL; > + first->async_tx.callback_param = NULL; > + } > + } > + > new->tx_cnt = desc_count; > new->async_tx.ack = orig_ack; /* client is in control of this ack */ > > @@ -516,6 +528,11 @@ static void ioat_dma_memcpy_cleanup(struct ioat_dma_chan > *ioat_chan) > pci_unmap_addr(desc, src), > pci_unmap_len(desc, len), > PCI_DMA_TODEVICE); > + if (desc->async_tx.callback) { > + desc->async_tx.callback( > + desc->async_tx.callback_param); > + desc->async_tx.callback = NULL; > + } > } > > if (desc->async_tx.phys != phys_complete) { > @@ -637,6 +654,13 @@ static void ioat_dma_start_null_desc(struct > ioat_dma_chan *ioat_chan) > */ > #define IOAT_TEST_SIZE 2000 > > +static dma_async_tx_callback ioat_dma_test_callback(void *dma_async_param) > +{ > + printk(KERN_ERR "ioatdma: ioat_dma_test_callback(0x%04llx)\n", > + (u64)dma_async_param); > + return 0; > +} This wanted to be `return NULL'. I'll fix. > /** > * ioat_dma_self_test - Perform a IOAT transaction to verify the HW works. > * @device: device to be tested > @@ -691,6 +715,8 @@ static int ioat_dma_self_test(struct ioatdma_device > *device) > addr = dma_map_single(dma_chan->device->dev, dest, IOAT_TEST_SIZE, > DMA_FROM_DEVICE); > ioat_set_dest(addr, tx, 0); > + tx->callback = (void *)ioat_dma_test_callback; This cast is unneeded, surely? It had better be.. > + tx->callback_param = (void *)0x8086; eh? > cookie = ioat_tx_submit(tx); > if (cookie < 0) { > dev_err(&device->pdev->dev, - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/