diff mbox series

[v6,10/13] dmadev: add flag for error handling support

Message ID 20210924103113.2878126-1-bruce.richardson@intel.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series add test suite for DMA drivers | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Bruce Richardson Sept. 24, 2021, 10:31 a.m. UTC
Due to HW or driver limiations, not all dmadevs may support full error
handling e.g. safely managing and reporting an invalid address to a copy
operation. The skeleton dmadev, for example, being pure software will
always seg-fault if passed an invalid address. To indicate the
availability of safe error handling by a device, we add a capability
flag for it.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/dmadev/rte_dmadev.c | 1 +
 lib/dmadev/rte_dmadev.h | 9 +++++++++
 2 files changed, 10 insertions(+)

Comments

Conor Walsh Sept. 24, 2021, 2:52 p.m. UTC | #1
On 24/09/2021 11:31, Bruce Richardson wrote:
> Due to HW or driver limiations, not all dmadevs may support full error
> handling e.g. safely managing and reporting an invalid address to a copy
> operation. The skeleton dmadev, for example, being pure software will
> always seg-fault if passed an invalid address. To indicate the
> availability of safe error handling by a device, we add a capability
> flag for it.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

<snip>

This is very useful for the IOAT driver too, thanks!

Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Kevin Laatz Sept. 24, 2021, 3:58 p.m. UTC | #2
On 24/09/2021 11:31, Bruce Richardson wrote:
> Due to HW or driver limiations, not all dmadevs may support full error
> handling e.g. safely managing and reporting an invalid address to a copy
> operation. The skeleton dmadev, for example, being pure software will
> always seg-fault if passed an invalid address. To indicate the
> availability of safe error handling by a device, we add a capability
> flag for it.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>   lib/dmadev/rte_dmadev.c | 1 +
>   lib/dmadev/rte_dmadev.h | 9 +++++++++
>   2 files changed, 10 insertions(+)

Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
diff mbox series

Patch

diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index a761fe1a91..c9224035dc 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -665,6 +665,7 @@  dma_capability_name(uint64_t capability)
 		{ RTE_DMA_CAPA_DEV_TO_DEV,  "dev2dev" },
 		{ RTE_DMA_CAPA_SVA,         "sva"     },
 		{ RTE_DMA_CAPA_SILENT,      "silent"  },
+		{ RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" },
 		{ RTE_DMA_CAPA_OPS_COPY,    "copy"    },
 		{ RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" },
 		{ RTE_DMA_CAPA_OPS_FILL,    "fill"    },
diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h
index 04565f8c5b..ae0b357343 100644
--- a/lib/dmadev/rte_dmadev.h
+++ b/lib/dmadev/rte_dmadev.h
@@ -273,6 +273,15 @@  int16_t rte_dma_next_dev(int16_t start_dev_id);
  * @see struct rte_dma_conf::silent_mode
  */
 #define RTE_DMA_CAPA_SILENT		RTE_BIT64(5)
+/** DMA device supports error handling
+ *
+ * With this bit set, invalid input addresses will be reported as operation failures
+ * to the user but other operations can continue.
+ * Without this bit set, invalid data is not handled by either HW or driver, so user
+ * must ensure that all memory addresses are valid and accessible by HW.
+ */
+#define RTE_DMA_CAPA_HANDLES_ERRORS	RTE_BIT64(6)
+
 /** DMA device support copy ops.
  * This capability start with index of 32, so that it could leave gap between
  * normal capability and ops capability.