ioatdma fixes for 2.6.33-rc
cover ioatdma fixes for 2.6.33-rc
These fix recently discovered issues with the ioatdma driver and are tagged for -stable. They are currently on the 'fixes' branch of async_tx.git and will head upstream shortly.
git://git.kernel.org/linux/kernel/git/djbw/async_tx.git fixes
---
Dan Williams (3):
ioat2,3: put channel hardware in known state at init
async_tx: expand async raid6 test to cover ioatdma corner case
ioat3: fix p-disabled q-continuation
crypto/async_tx/raid6test.c | 7 ++++ drivers/dma/ioat/dma.c | 2 + drivers/dma/ioat/dma.h | 18 +++++++++++ drivers/dma/ioat/dma_v2.c | 69 ++++++++++++++++++++++++++++++++---------- drivers/dma/ioat/dma_v2.h | 2 + drivers/dma/ioat/dma_v3.c | 60 +++++++++++++++++++++++++++---------- drivers/dma/ioat/registers.h | 1 + 7 files changed, 125 insertions(+), 34 deletions(-)
PATCH 1/3 ioat3: fix p-disabled q-continuation
When continuing a pq calculation the driver needs 3 extra sources. The driver can perform a 3 source calculation with a single descriptor, but needs an extended descriptor to process up to 8 sources in one operation. However, in the p-disabled case only one extra source is needed. When continuing a p-disabled operation there are occasions (i.e. 0 < src_cnt % 8 < 3) where the tail operation does not need an extended descriptor. Properly account for this fact otherwise invalid 'dmacount' values will be written to hardware usually causing the channel to halt with 'invalid descriptor' errors.
---
drivers/dma/ioat/dma_v3.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/dma/ioat/dma_v3.c +4 -2
@@ -650,9 +650,11 @@ __ioat3_prep_pq_lock(struct dma_chan *c, enum sum_check_flags *result, num_descs =ioat2_xferlen_to_descs (ioat, len);/* we need 2x the number of descriptors to cover greater than 3 -* sources +* sources (we need 1 extra source in the q-only continuation +* case and 3 extra sources in the p+q continuation case. */ -if (src_cnt >3 || flags &DMA_PREP_CONTINUE ) { +if (src_cnt +dmaf_p_disabled_continue (flags) >3 || + (dmaf_continue (flags) && !dmaf_p_disabled_continue (flags))) { with_ext =1 ; num_descs *=2 ; }else
RE: [PATCH 1/3] ioat3: fix p-disabled q-continuation
Quoted 10 lines · Dan J
When continuing a pq calculation the driver needs 3 extra sources. The driver can perform a 3 source calculation with a single descriptor, but needs an extended descriptor to process up to 8 sources in one operation. However, in the p-disabled case only one extra source is needed. When continuing a p-disabled operation there are occasions (i.e. 0 <
src_cnt% 8 < 3) where the tail operation does not need an extended descriptor. Properly account for this fact otherwise invalid 'dmacount' values will be written to hardware usually causing the channel to halt with 'invalid descriptor' errors.
Quoted 3 lines
Cc <[email protected]>Signed-off-by Dan Williams <[email protected]>---
PATCH 2/3 async_tx: expand async raid6 test to cover ioatdma corner case
In reply to Dan WilliamsAdd explicit 11 and 12 disks cases to exercise the 0 < src_cnt % 8 < 3 corner case in the ioatdma driver.
---
crypto/async_tx/raid6test.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
crypto/async_tx/raid6test.c +7 -0
@@ -214,6 +214,13 @@ static int raid6_test(void) err +=test (4 , &tests);if (NDISKS >5 ) err +=test (5 , &tests); +/* the 11 and 12 disk cases are special for ioatdma (p-disabled +* q-continuation without extended descriptor) +*/ +if (NDISKS >12 ) { + err +=test (11 , &tests); + err +=test (12 , &tests); + } err +=test (NDISKS , &tests);pr ("\n" );
RE: [PATCH 2/3] async_tx: expand async raid6 test to cover ioatdma corner case
Quoted 5 lines · Dan J
Add explicit 11 and 12 disks cases to exercise the 0 <
src_cnt% 8 < 3 corner case in the ioatdma driver.Signed-off-by Dan Williams <[email protected]>---
PATCH 3/3 ioat2,3: put channel hardware in known state at init
In reply to Dan WilliamsPut the ioat2 and ioat3 state machines in the halted state with all errors cleared.
The ioat1 init path is not disturbed for stability, there are no reported ioat1 initiaization issues.
---
drivers/dma/ioat/dma.c | 2 + drivers/dma/ioat/dma.h | 18 +++++++++++ drivers/dma/ioat/dma_v2.c | 69 ++++++++++++++++++++++++++++++++---------- drivers/dma/ioat/dma_v2.h | 2 + drivers/dma/ioat/dma_v3.c | 54 ++++++++++++++++++++++++--------- drivers/dma/ioat/registers.h | 1 + 6 files changed, 114 insertions(+), 32 deletions(-)
drivers/dma/ioat/dma.c +1 -1
@@ -1032,7 +1032,7 @@ int __devinit ioat_probe(struct ioatdma_device *device) dma->dev = &pdev->dev;if (!dma->chancnt) { -dev_err (dev,"zero channels detected\n" ); +dev_err (dev,"channel enumeration error\n" ); goto err_setup_interrupts; }
drivers/dma/ioat/dma.h +18 -0
@@ -60,6 +60,7 @@* @dca: direct cache access context * @intr_quirk: interrupt setup quirk (for ioat_v1 devices) * @enumerate_channels: hw version specific channel enumeration +* @reset_hw: hw version specific channel (re)initialization * @cleanup_tasklet: select between the v2 and v3 cleanup routines * @timer_fn: select between the v2 and v3 timer watchdog routines * @self_test: hardware version specific self test for each supported op type
@@ -78,6 +79,7 @@ struct ioatdma_device {struct dca_provider *dca;void (*intr_quirk)(struct ioatdma_device *device);int (*enumerate_channels)(struct ioatdma_device *device); +int (*reset_hw)(struct ioat_chan_common *chan);void (*cleanup_tasklet)(unsigned long data);void (*timer_fn)(unsigned long data);int (*self_test)(struct ioatdma_device *device);
@@ -264,6 +266,22 @@ static inline void ioat_suspend(struct ioat_chan_common *chan)writeb (IOAT_CHANCMD_SUSPEND , chan->reg_base +IOAT_CHANCMD_OFFSET (ver)); } +static inline void ioat_reset (struct ioat_chan_common *chan) +{ +u8 ver = chan->device->version; + +writeb (IOAT_CHANCMD_RESET , chan->reg_base +IOAT_CHANCMD_OFFSET (ver)); +} + +static inline bool ioat_reset_pending (struct ioat_chan_common *chan) +{ +u8 ver = chan->device->version; +u8 cmd; + + cmd =readb (chan->reg_base +IOAT_CHANCMD_OFFSET (ver)); +return (cmd &IOAT_CHANCMD_RESET ) ==IOAT_CHANCMD_RESET ; +} +static inline void ioat_set_chainaddr (struct ioat_dma_chan *ioat,u64 addr) {struct ioat_chan_common *chan = &ioat->base;
drivers/dma/ioat/dma_v2.c +52 -17
122 lines not on this page · raw message
drivers/dma/ioat/dma_v2.h +2 -0
@@ -185,6 +185,8 @@ bool reshape_ring(struct ioat2_dma_chan *ioat, int order);void __ioat2_issue_pending (struct ioat2_dma_chan *ioat);void ioat2_cleanup_tasklet (unsigned long data);void ioat2_timer_event (unsigned long data); +int ioat2_quiesce (struct ioat_chan_common *chan,unsigned long tmo); +int ioat2_reset_sync (struct ioat_chan_common *chan,unsigned long tmo);extern struct kobj_type ioat2_ktype;extern struct kmem_cache *ioat2_cache;#endif /* IOATDMA_V2_H */
drivers/dma/ioat/dma_v3.c +40 -14
75 lines not on this page · raw message
drivers/dma/ioat/registers.h +1 -0
@@ -27,6 +27,7 @@#define IOAT_PCI_DEVICE_ID_OFFSET 0x02#define IOAT_PCI_DMAUNCERRSTS_OFFSET 0x148 +#define IOAT_PCI_CHANERR_INT_OFFSET 0x180#define IOAT_PCI_CHANERRMASK_INT_OFFSET 0x184/* MMIO Device Registers */
RE: [PATCH 3/3] ioat2,3: put channel hardware in known state at init
Quoted 6 lines · Dan J
Put the ioat2 and ioat3 state machines in the halted state with all errors cleared.
The ioat1 init path is not disturbed for stability, there are no reported ioat1 initiaization issues.
Quoted 6 lines
Cc <[email protected]>Reported-by Roland Dreier <[email protected]>Tested-by Roland Dreier <[email protected]>Acked-by Simon Horman <[email protected]>Signed-off-by Dan Williams <[email protected]>---