lib/dma: introduce inter-process and inter-OS DMA
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/1 lib/dma: introduce inter-process and inter-OS DMA
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan configuration. Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
---
V3 changes:
* Fix v2 review comments
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enums
lib/dmadev/rte_dmadev.c | 19 +++++++++++ lib/dmadev/rte_dmadev.h | 59 +++++++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 81 insertions(+)
lib/dmadev/rte_dmadev.c +19 -0
@@ -659,6 +659,21 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,RTE_DMA_LOG (ERR ,"Device %d vchan out range!" , dev_id);return -EINVAL ; } +if (conf->domain.type !=RTE_DMA_INTER_DOMAIN_NONE && + conf->direction !=RTE_DMA_DIR_MEM_TO_MEM ) { +RTE_DMA_LOG (ERR ,"Device %d inter domain only support mem-to-mem transfer" , dev_id); +return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter os domain" , dev_id); +return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter process domain" , dev_id); +return -EINVAL ; + } if (conf->direction != RTE_DMA_DIR_MEM_TO_MEM && conf->direction != RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM &&
@@ -805,6 +820,8 @@ dma_capability_name(uint64_t capability) { RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN, "inter_process_domain" }, + { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },
@@ -1014,6 +1031,8 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_HANDLES_ERRORS );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_M2D_AUTO_FREE );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_OS_DOMAIN );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL );
lib/dmadev/rte_dmadev.h +59 -0
85 lines not on this page · raw message
lib/dmadev/rte_dmadev_trace.h +3 -0
@@ -79,6 +79,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->domain.type); +rte_trace_point_emit_u16 (conf->domain.src_handler); +rte_trace_point_emit_u16 (conf->domain.dst_handler);rte_trace_point_emit_int (ret); )
Signature · 1 line
2.34.1
with below comment fixed:
Quoted 124 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan configuration. Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
Signed-off-by Vamsi Attunuru <[email protected]>---
V3 changes:
* Fix v2 review comments
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enumslib/dmadev/rte_dmadev.c | 19 +++++++++++ lib/dmadev/rte_dmadev.h | 59 +++++++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 81 insertions(+)lib/dmadev/rte_dmadev.c +19
-0@@ -659,6 +659,21 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,RTE_DMA_LOG (ERR ,"Device %d vchan out range!" , dev_id);return -EINVAL ; } +if (conf->domain.type !=RTE_DMA_INTER_DOMAIN_NONE && + conf->direction !=RTE_DMA_DIR_MEM_TO_MEM ) { +RTE_DMA_LOG (ERR ,"Device %d inter domain only support mem-to-mem transfer" , dev_id); +return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter os domain" , dev_id); +return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter process domain" , dev_id); +return -EINVAL ; + } if (conf->direction != RTE_DMA_DIR_MEM_TO_MEM && conf->direction != RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM &&@@ -805,6 +820,8 @@ dma_capability_name(uint64_t capability) { RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN, "inter_process_domain" }, + { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },@@ -1014,6 +1031,8 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_HANDLES_ERRORS );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_M2D_AUTO_FREE );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_OS_DOMAIN );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL );lib/dmadev/rte_dmadev.h +23
-0@@ -265,6 +265,18 @@ int16_t rte_dma_next_dev(int16_t start_dev_id);* known from 'nb_priorities' field in struct rte_dma_info. */ #define RTE_DMA_CAPA_PRI_POLICY_SP RTE_BIT64(8) +/** Support inter-process DMA transfers. +* +* When this bit is set, the DMA device can perform memory transfers between +* different process memory spaces. +*/ +#define RTE_DMA_CAPA_INTER_PROCESS_DOMAIN RTE_BIT64(9) +/** Support inter-OS domain DMA transfers. +* +* The DMA device can perform memory transfers across different operating +* system domains. +*/ +#define RTE_DMA_CAPA_INTER_OS_DOMAIN RTE_BIT64(10)/** Support copy operation. * This capability start with index of 32, so that it could leave gap between @@ -418,8 +430,13 @@ int rte_dma_close(int16_t dev_id);*/ enum rte_dma_direction {/** DMA transfer direction - from memory to memory. +* When the device supports inter-process or inter-OS domain transfers, +* the field `type` in `struct rte_dma_vchan_conf::domain` specifies the +* type of domain. For memory-to-memory transfers within the same domain +* or process, `type` should be set to `RTE_DMA_INTER_DOMAIN_NONE`. * * @see struct rte_dma_vchan_conf::direction +* @see struct rte_dma_inter_domain_param::type */ RTE_DMA_DIR_MEM_TO_MEM ,/** DMA transfer direction - from memory to device. @@ -564,6 +581,39 @@ struct rte_dma_auto_free_param {uint64_t reserved[2 ]; }; +/** +* Inter-DMA transfer domain type. +* +* This enum defines the types of transfer domains applicable to DMA operations. +* It helps categorize whether a DMA transfer is occurring within the same domain, +* across different processes, or between distinct operating system domains.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 599
Quoted 10 lines
lib/dmadev/rte_dmadev.h +10
-0+* +* @see struct rte_dma_inter_domain_param:type +*/ +enum rte_dma_inter_domain_type { +/**< No inter-domain transfer; standard DMA within same domaini. */ +RTE_DMA_INTER_DOMAIN_NONE , +/**< Transfer occurs between different user-space processes. */ +RTE_DMA_INTER_PROCESS_DOMAIN , +/**< Transfer spans across different operating system domains. */ +RTE_DMA_INTER_OS_DOMAIN ,
If comment located before define, it should prefix with ** not **<
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 608
Quoted 9 lines
lib/dmadev/rte_dmadev.h +9
-0+}; + +/** +* Parameters for inter-process or inter-OS DMA transfers. +* +* This structure defines the parameters required to perform DMA transfers +* across different domains, such as between processes or operating systems. +* It includes the domain type and handler identifiers for both the source +* and destination domains.
I think we could add more comment about how to config use the src/dst handler. as I comment in before mail:
It's mean local process if the src/dst_handler is zero?
for example, I setup a inter-os domain param, if the src_handle is none zero and dst_handle is zero, then all DMA copy will from another OS to local process.
all DMA fill will write to local process.
If the src_handle is zero and dst_handle is non-zero, then all DMA copy will from local process to another OS domain
all DMA fill will write to another OS domain.
If both src_handle and dst_handle is non-zero, then all DMA copy will from another OS to another OS domain
all DMA fill will write to another OS domain.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 614
Quoted 6 lines
lib/dmadev/rte_dmadev.h +6
-0+*/ +struct rte_dma_inter_domain_param { +enum rte_dma_inter_domain_type type;/**< Type of inter-domain. */ +uint16_t src_handler;/**< Source domain handler identifier. */ +uint16_t dst_handler;/**< Destination domain handler identifier. */ +uint64_t reserved[2 ];/**< Reserved for future fields. */
Please move above comment before define to keep the whole header-file consistency.
Quoted 26 lines
lib/dmadev/rte_dmadev.h +11
-0+}; +/** * A structure used to configure a virtual DMA channel. * @@ -601,6 +651,15 @@ struct rte_dma_vchan_conf {* @see struct rte_dma_auto_free_param */ struct rte_dma_auto_free_param auto_free; +/** Parameters for inter-process or inter-OS domain DMA transfers. This field +* specifies the source and destination domain handlers required for DMA +* operations that span across different processes or operating system domains. +* +* @see RTE_DMA_CAPA_INTER_PROCESS_DOMAIN +* @see RTE_DMA_CAPA_INTER_OS_DOMAIN +* @see struct rte_dma_inter_domain_param +*/ +struct rte_dma_inter_domain_param domain; };/** lib/dmadev/rte_dmadev_trace.h +0
-0
lib/dmadev/rte_dmadev_trace.h RTE_TRACE_POINT( · line 87
Quoted 9 lines
lib/dmadev/rte_dmadev_trace.h +3
-0@@ -79,6 +79,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->domain.type); +rte_trace_point_emit_u16 (conf->domain.src_handler); +rte_trace_point_emit_u16 (conf->domain.dst_handler);rte_trace_point_emit_int (ret); )
BTW: please add the UT (test_dmadev_api.c) for above vchan_setup modify, this could be another commit I think.
Quoted 159 lines
ZjQcmQRYFpfptBannerEnd
with below comment fixed:Acked-by Chengwen Feng <[email protected]>Quoted 11 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
Quoted 3 lines
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan
configuration.
Quoted 14 lines
Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
Signed-off-by Vamsi Attunuru <[email protected]>---
V3 changes:
* Fix v2 review comments
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enumsQuoted 2 lines
lib/dmadev/rte_dmadev.c | 19 +++++++++++ lib/dmadev/rte_dmadev.h | 59+++++++++++++++++++++++++++++++++++
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t
Quoted 8 lines
lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 81 insertions(+)lib/dmadev/rte_dmadev.c index renamed from lib/dmadev/rte_dmadev.c +0
-0
17ee0808a9..d6792449bf100644lib/dmadev/rte_dmadev.c +0
-0@@ -659,6 +659,21 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_tvchan,
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 6 lines
lib/dmadev/rte_dmadev.c +3
-0RTE_DMA_LOG (ERR ,"Device %d vchan out range!" , dev_id);return -EINVAL ; } +if (conf->domain.type !=RTE_DMA_INTER_DOMAIN_NONE && + conf->direction !=RTE_DMA_DIR_MEM_TO_MEM ) { + RTE_DMA_LOG(ERR, "Device %d inter domain only supportmem-to-mem transfer",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 5 lines
lib/dmadev/rte_dmadev.c +5
-0+return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { + RTE_DMA_LOG(ERR, "Device %d does not support inter osdomain",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 4 lines
lib/dmadev/rte_dmadev.c +4
-0+return -EINVAL ; + } + if (conf->domain.type == RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN)) {lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t · line 674
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+ RTE_DMA_LOG(ERR, "Device %d does not support interprocess domain",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 5 lines
lib/dmadev/rte_dmadev.c +2
-0+return -EINVAL ; + }if (conf->direction !=RTE_DMA_DIR_MEM_TO_MEM && conf->direction !=RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM && @@ -805,6+820,8 @@
lib/dmadev/rte_dmadev.c dma_capability_name(uint64_t capability)
Quoted 5 lines
dma_capability_name(uint64_t capability)lib/dmadev/rte_dmadev.c +1
-0{ RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN,"
inter_process_domain" },lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd
Quoted 5 lines
lib/dmadev/rte_dmadev.c +1
-0+ { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },@@ -1014,6 +1031,8 @@ dmadev_handle_dev_info(const char *cmd
__rte_unused,lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1031
Quoted 1 line
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_HANDLES_ERRORS);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1032
Quoted 1 line
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_M2D_AUTO_FREE);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1034
Quoted 2 lines
lib/dmadev/rte_dmadev.c +1
-0ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); + ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1035
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+ ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_INTER_OS_DOMAIN);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd __rte_unused,
Quoted 3 lines
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL ); diff --git
Quoted 28 lines
a/lib/dmadev/rte_dmadev.hb/lib/dmadev/rte_dmadev.hindex550dbfbf75..4f735bb0c9100644lib/dmadev/rte_dmadev.h +14
-0@@ -265,6 +265,18 @@ int16_t rte_dma_next_dev(int16_t start_dev_id);* known from 'nb_priorities' field in struct rte_dma_info. */ #define RTE_DMA_CAPA_PRI_POLICY_SP RTE_BIT64(8) +/** Support inter-process DMA transfers. +* +* When this bit is set, the DMA device can perform memory transfers +between +* different process memory spaces. +*/ +#define RTE_DMA_CAPA_INTER_PROCESS_DOMAIN RTE_BIT64(9) +/** Support inter-OS domain DMA transfers. +* +* The DMA device can perform memory transfers across different +operating +* system domains. +*/ +#define RTE_DMA_CAPA_INTER_OS_DOMAIN RTE_BIT64(10)/** Support copy operation. * This capability start with index of 32, so that it could leave gap between @@ -418,8 +430,13 @@ int
rte_dma_close(int16_t dev_id);
*/
enumrte_dma_direction{lib/dmadev/rte_dmadev.h
Quoted 2 lines
lib/dmadev/rte_dmadev.h +1
-0/** DMA transfer direction - from memory to memory. +* When the device supports inter-process or inter-OS domain transfers,
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* the field `type` in `struct rte_dma_vchan_conf::domain` specifies the
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* type of domain. For memory-to-memory transfers within the same domain
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* or process, `type` should be set to
RTE_DMA_INTER_DOMAIN_NONE.Quoted 7 lines
lib/dmadev/rte_dmadev.h +1
-0* * @see struct rte_dma_vchan_conf::direction +* @see struct rte_dma_inter_domain_param::type */ RTE_DMA_DIR_MEM_TO_MEM,/** DMA transfer direction - from memory to device. lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 587
Quoted 7 lines
lib/dmadev/rte_dmadev.h +4
-0@@ -564,6 +581,39 @@ struct rte_dma_auto_free_param {uint64_t reserved[2 ]; }; +/** +* Inter-DMA transfer domain type. +* +* This enum defines the types of transfer domains applicable to DMA operations.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 590
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+ * It helps categorize whether a DMA transfer is occurring within the +same domain, + * across different processes, or between distinct operating systemdomains.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 594
Quoted 4 lines
lib/dmadev/rte_dmadev.h +4
-0+* +* @see struct rte_dma_inter_domain_param:type */ enum +rte_dma_inter_domain_type { +/**< No inter-domain transfer; standard DMA within same domaini. */
Quoted 7 lines
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 599
Quoted 5 lines
lib/dmadev/rte_dmadev.h +5
-0+RTE_DMA_INTER_DOMAIN_NONE , +/**< Transfer occurs between different user-space processes. */ +RTE_DMA_INTER_PROCESS_DOMAIN , +/**< Transfer spans across different operating system domains. */ + RTE_DMA_INTER_OS_DOMAIN,If comment located before define, it should prefix with ** not **<
Ack, will fix it.
Quoted 11 lines
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param {
Quoted 10 lines
lib/dmadev/rte_dmadev.h +8
-0+}; + +/** +* Parameters for inter-process or inter-OS DMA transfers. +* +* This structure defines the parameters required to perform DMA +transfers +* across different domains, such as between processes or operating systems.
Quoted 7 lines
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 610
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+ * It includes the domain type and handler identifiers for both the +source + * and destination domains.I think we could add more comment about how to config use the src/dst handler.
as I comment in before mail:
Sure, will add more comments. I believe a handler value of zero is still valid for both source and destination. It typically represents the local process when the transfer direction is mem-to-mem and the inter-domain type if NONE. Handler values --whether zero or non-zero -- can be used to represent transfers
From local process to another OS domain, or vice versa.
Do you have any thoughts on this.?, Specifically, do you foresee any issues with using handler value of zero.
Thanks
Quoted 59 lines
It's mean local process if the src/dst_handler is zero?
for example, I setup a inter-os domain param, if thesrc_handleis none zero anddst_handleis zero, then all DMA copy will from another OS to local process.
all DMA fill will write to local process.If the
src_handleis zero anddst_handleis non-zero, then all DMA copy will from local process to another OS domain
all DMA fill will write to another OS domain.If both
src_handleanddst_handleis non-zero, then all DMA copy will from another OS to another OS domain
all DMA fill will write to another OS domain.lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param {
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+*/ +struct rte_dma_inter_domain_param { +enum rte_dma_inter_domain_type type;/**< Type of inter-domain. */
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 614
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+uint16_t src_handler;/**< Source domain handler identifier. */ +uint16_t dst_handler;/**< Destination domain handler identifier. */ +uint64_t reserved[2 ];/**< Reserved for future fields. */ Please move above comment before define to keep the whole header-file consistency.
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 654
Quoted 10 lines
lib/dmadev/rte_dmadev.h +3
-0+}; +/** * A structure used to configure a virtual DMA channel. * @@ -601,6 +651,15 @@ struct rte_dma_vchan_conf {* @see struct rte_dma_auto_free_param */ struct rte_dma_auto_free_param auto_free; +/** Parameters for inter-process or inter-OS domain DMA transfers. This field
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 655
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* specifies the source and destination domain handlers required for DMA
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 656
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* operations that span across different processes or operating system domains.
Quoted 18 lines
lib/dmadev/rte_dmadev.h +6
-0+* +* @see RTE_DMA_CAPA_INTER_PROCESS_DOMAIN +* @see RTE_DMA_CAPA_INTER_OS_DOMAIN +* @see struct rte_dma_inter_domain_param +*/ +struct rte_dma_inter_domain_param domain; };/** (quoted diff) +0
-0
b/lib/dmadev/rte_dmadev_trace.hindex1de92655f2..fa619c4090100644lib/dmadev/rte_dmadev_trace.h +1
-0@@ -79,6 +79,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->domain.type);
Quoted 9 lines
lib/dmadev/rte_dmadev_trace.h RTE_TRACE_POINT( · line 87
Quoted 5 lines
lib/dmadev/rte_dmadev_trace.h +2
-0+rte_trace_point_emit_u16 (conf->domain.src_handler); +rte_trace_point_emit_u16 (conf->domain.dst_handler);rte_trace_point_emit_int (ret); )BTW: please add the UT (
test_dmadev_api.c) for abovevchan_setupmodify, this could be another commit I think.
Yes, will add it.
Quoted 183 lines · Vamsi Krishna Attunuru
Quoted 159 lines
ZjQcmQRYFpfptBannerEnd
with below comment fixed:Acked-by Chengwen Feng <[email protected]>Quoted 11 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
Quoted 3 lines
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan
configuration.
Quoted 14 lines
Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
Signed-off-by Vamsi Attunuru <[email protected]>---
V3 changes:
* Fix v2 review comments
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enumsQuoted 2 lines
lib/dmadev/rte_dmadev.c | 19 +++++++++++ lib/dmadev/rte_dmadev.h | 59+++++++++++++++++++++++++++++++++++
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t
Quoted 8 lines
lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 81 insertions(+)lib/dmadev/rte_dmadev.c index renamed from lib/dmadev/rte_dmadev.c +0
-0
17ee0808a9..d6792449bf100644lib/dmadev/rte_dmadev.c +0
-0@@ -659,6 +659,21 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_tvchan,
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 6 lines
lib/dmadev/rte_dmadev.c +3
-0RTE_DMA_LOG (ERR ,"Device %d vchan out range!" , dev_id);return -EINVAL ; } +if (conf->domain.type !=RTE_DMA_INTER_DOMAIN_NONE && + conf->direction !=RTE_DMA_DIR_MEM_TO_MEM ) { + RTE_DMA_LOG(ERR, "Device %d inter domain only supportmem-to-mem transfer",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 5 lines
lib/dmadev/rte_dmadev.c +5
-0+return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { + RTE_DMA_LOG(ERR, "Device %d does not support inter osdomain",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 4 lines
lib/dmadev/rte_dmadev.c +4
-0+return -EINVAL ; + } + if (conf->domain.type == RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN)) {lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t · line 674
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+ RTE_DMA_LOG(ERR, "Device %d does not support interprocess domain",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 5 lines
lib/dmadev/rte_dmadev.c +2
-0+return -EINVAL ; + }if (conf->direction !=RTE_DMA_DIR_MEM_TO_MEM && conf->direction !=RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM && @@ -805,6+820,8 @@
lib/dmadev/rte_dmadev.c dma_capability_name(uint64_t capability)
Quoted 5 lines
dma_capability_name(uint64_t capability)lib/dmadev/rte_dmadev.c +1
-0{ RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN,"
inter_process_domain" },lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd
Quoted 5 lines
lib/dmadev/rte_dmadev.c +1
-0+ { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },@@ -1014,6 +1031,8 @@ dmadev_handle_dev_info(const char *cmd
__rte_unused,lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1031
Quoted 1 line
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_HANDLES_ERRORS);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1032
Quoted 1 line
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_M2D_AUTO_FREE);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1034
Quoted 2 lines
lib/dmadev/rte_dmadev.c +1
-0ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); + ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1035
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+ ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_INTER_OS_DOMAIN);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd __rte_unused,
Quoted 3 lines
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL ); diff --git
Quoted 28 lines
a/lib/dmadev/rte_dmadev.hb/lib/dmadev/rte_dmadev.hindex550dbfbf75..4f735bb0c9100644lib/dmadev/rte_dmadev.h +14
-0@@ -265,6 +265,18 @@ int16_t rte_dma_next_dev(int16_t start_dev_id);* known from 'nb_priorities' field in struct rte_dma_info. */ #define RTE_DMA_CAPA_PRI_POLICY_SP RTE_BIT64(8) +/** Support inter-process DMA transfers. +* +* When this bit is set, the DMA device can perform memory transfers +between +* different process memory spaces. +*/ +#define RTE_DMA_CAPA_INTER_PROCESS_DOMAIN RTE_BIT64(9) +/** Support inter-OS domain DMA transfers. +* +* The DMA device can perform memory transfers across different +operating +* system domains. +*/ +#define RTE_DMA_CAPA_INTER_OS_DOMAIN RTE_BIT64(10)/** Support copy operation. * This capability start with index of 32, so that it could leave gap between @@ -418,8 +430,13 @@ int
rte_dma_close(int16_t dev_id);
*/
enumrte_dma_direction{lib/dmadev/rte_dmadev.h
Quoted 2 lines
lib/dmadev/rte_dmadev.h +1
-0/** DMA transfer direction - from memory to memory. +* When the device supports inter-process or inter-OS domain transfers,
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* the field `type` in `struct rte_dma_vchan_conf::domain` specifies the
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* type of domain. For memory-to-memory transfers within the same domain
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* or process, `type` should be set to
RTE_DMA_INTER_DOMAIN_NONE.Quoted 7 lines
lib/dmadev/rte_dmadev.h +1
-0* * @see struct rte_dma_vchan_conf::direction +* @see struct rte_dma_inter_domain_param::type */ RTE_DMA_DIR_MEM_TO_MEM,/** DMA transfer direction - from memory to device. lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 587
Quoted 7 lines
lib/dmadev/rte_dmadev.h +4
-0@@ -564,6 +581,39 @@ struct rte_dma_auto_free_param {uint64_t reserved[2 ]; }; +/** +* Inter-DMA transfer domain type. +* +* This enum defines the types of transfer domains applicable to DMA operations.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 590
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+ * It helps categorize whether a DMA transfer is occurring within the +same domain, + * across different processes, or between distinct operating systemdomains.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 594
Quoted 4 lines
lib/dmadev/rte_dmadev.h +4
-0+* +* @see struct rte_dma_inter_domain_param:type */ enum +rte_dma_inter_domain_type { +/**< No inter-domain transfer; standard DMA within same domaini. */
Quoted 7 lines
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 599
Quoted 5 lines
lib/dmadev/rte_dmadev.h +5
-0+RTE_DMA_INTER_DOMAIN_NONE , +/**< Transfer occurs between different user-space processes. */ +RTE_DMA_INTER_PROCESS_DOMAIN , +/**< Transfer spans across different operating system domains. */ + RTE_DMA_INTER_OS_DOMAIN,If comment located before define, it should prefix with ** not **<
Ack, will fix it.
Quoted 15 lines
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param {
Quoted 10 lines
lib/dmadev/rte_dmadev.h +8
-0+}; + +/** +* Parameters for inter-process or inter-OS DMA transfers. +* +* This structure defines the parameters required to perform DMA +transfers +* across different domains, such as between processes or operating systems.
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+ * It includes the domain type and handler identifiers for both the +source + * and destination domains.
Quoted 7 lines
Quoted 3 lines
I think we could add more comment about how to config use the src/dst handler.
as I comment in before mail:Sure, will add more comments. I believe a handler value of zero is still valid for both source and destination. It typically represents the local process when the transfer direction is mem-to-mem and the inter-domain type if NONE.
If the inter-domain type is None, the src/dst handler should be ignore.
As I said in comment of "control-api commit", if the group has multiple (>2) process, and the device could perform three type mem-to-mem copy:
1\ local to remote
2\ remote to local
3\ remote-A to remote-B or event remote-A to remote-A
the remote handler could get by rte_dma_access_pair_group_handle_get() does the local handler also get by rte_dma_access_pair_group_handle_get() ?
Quoted 46 lines
Handler values --whether zero or non-zero -- can be used to represent transfers
From local process to another OS domain, or vice versa.Do you have any thoughts on this.?, Specifically, do you foresee any issues with using handler value of zero.
Thanks
Quoted 39 lines
It's mean local process if the src/dst_handler is zero?
for example, I setup a inter-os domain param, if thesrc_handleis none zero anddst_handleis zero, then all DMA copy will from another OS to local process.
all DMA fill will write to local process.If the
src_handleis zero anddst_handleis non-zero, then all DMA copy will from local process to another OS domain
all DMA fill will write to another OS domain.If both
src_handleanddst_handleis non-zero, then all DMA copy will from another OS to another OS domain
all DMA fill will write to another OS domain.lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param {
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+*/ +struct rte_dma_inter_domain_param { +enum rte_dma_inter_domain_type type;/**< Type of inter-domain. */
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 614
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+uint16_t src_handler;/**< Source domain handler identifier. */ +uint16_t dst_handler;/**< Destination domain handler identifier. */ +uint64_t reserved[2 ];/**< Reserved for future fields. */ Please move above comment before define to keep the whole header-file consistency.
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 654
Quoted 10 lines
lib/dmadev/rte_dmadev.h +3
-0+}; +/** * A structure used to configure a virtual DMA channel. * @@ -601,6 +651,15 @@ struct rte_dma_vchan_conf {* @see struct rte_dma_auto_free_param */ struct rte_dma_auto_free_param auto_free; +/** Parameters for inter-process or inter-OS domain DMA transfers. This field
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 655
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* specifies the source and destination domain handlers required for DMA
Quoted 8 lines
Quoted 8 lines
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 656
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* operations that span across different processes or operating system domains.
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 662
Quoted 6 lines
lib/dmadev/rte_dmadev.h +6
-0+* +* @see RTE_DMA_CAPA_INTER_PROCESS_DOMAIN +* @see RTE_DMA_CAPA_INTER_OS_DOMAIN +* @see struct rte_dma_inter_domain_param +*/ +struct rte_dma_inter_domain_param domain;
BTW: I remember the originl rfc only support inter-os domain, because Intel has inter-process rfc, so we add it. now Intel has not follow this feature, I think we could drop inter-process support (such as RTE_DMA_CAPA_INTER_PROCESS_XXX ) but keep the extend ability.
Quoted 23 lines
Quoted 12 lines
Quoted 12 lines
lib/dmadev/rte_dmadev.h +0
-0};/** (quoted diff) +0
-0
b/lib/dmadev/rte_dmadev_trace.hindex1de92655f2..fa619c4090100644lib/dmadev/rte_dmadev_trace.h +1
-0@@ -79,6 +79,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->domain.type);Quoted 9 lines
lib/dmadev/rte_dmadev_trace.h RTE_TRACE_POINT( · line 87
Quoted 5 lines
lib/dmadev/rte_dmadev_trace.h +2
-0+rte_trace_point_emit_u16 (conf->domain.src_handler); +rte_trace_point_emit_u16 (conf->domain.dst_handler);rte_trace_point_emit_int (ret); )BTW: please add the UT (
test_dmadev_api.c) for abovevchan_setupmodify, this could be another commit I think.Yes, will add it.
Quoted 192 lines
ZjQcmQRYFpfptBannerEnd
Quoted 97 lines · Vamsi Krishna Attunuru
Quoted 97 lines
ZjQcmQRYFpfptBannerEnd
with below comment fixed:Acked-by Chengwen Feng <[email protected]>Quoted 11 lines · Vamsi Krishna
From: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
Quoted 3 lines
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan
configuration.
Quoted 14 lines
Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
Signed-off-by Vamsi Attunuru <[email protected]>---
V3 changes:
* Fix v2 review comments
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enumsQuoted 2 lines
lib/dmadev/rte_dmadev.c | 19 +++++++++++ lib/dmadev/rte_dmadev.h | 59+++++++++++++++++++++++++++++++++++
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t
Quoted 8 lines
lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 81 insertions(+)lib/dmadev/rte_dmadev.c index renamed from lib/dmadev/rte_dmadev.c +0
-0
17ee0808a9..d6792449bf100644lib/dmadev/rte_dmadev.c +0
-0@@ -659,6 +659,21 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_tvchan,
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 6 lines
lib/dmadev/rte_dmadev.c +3
-0RTE_DMA_LOG (ERR ,"Device %d vchan out range!" , dev_id);return -EINVAL ; } +if (conf->domain.type !=RTE_DMA_INTER_DOMAIN_NONE && + conf->direction !=RTE_DMA_DIR_MEM_TO_MEM ) { + RTE_DMA_LOG(ERR, "Device %d inter domain only supportmem-to-mem transfer",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 5 lines
lib/dmadev/rte_dmadev.c +5
-0+return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { + RTE_DMA_LOG(ERR, "Device %d does not support inter osdomain",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 4 lines
lib/dmadev/rte_dmadev.c +4
-0+return -EINVAL ; + } + if (conf->domain.type == RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa &
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN)) {lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t · line 674
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+ RTE_DMA_LOG(ERR, "Device %d does not support interprocess domain",
dev_id);lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,
Quoted 5 lines
lib/dmadev/rte_dmadev.c +2
-0+return -EINVAL ; + }if (conf->direction !=RTE_DMA_DIR_MEM_TO_MEM && conf->direction !=RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM && @@ -805,6+820,8 @@
lib/dmadev/rte_dmadev.c dma_capability_name(uint64_t capability)
Quoted 5 lines
dma_capability_name(uint64_t capability)lib/dmadev/rte_dmadev.c +1
-0{ RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN,"
inter_process_domain" },lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd
Quoted 5 lines
lib/dmadev/rte_dmadev.c +1
-0+ { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },@@ -1014,6 +1031,8 @@ dmadev_handle_dev_info(const char *cmd
__rte_unused,lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1031
Quoted 1 line
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_HANDLES_ERRORS);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1032
Quoted 1 line
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_M2D_AUTO_FREE);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1034
Quoted 2 lines
lib/dmadev/rte_dmadev.c +1
-0ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); + ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_INTER_PROCESS_DOMAIN);lib/dmadev/rte_dmadev.c dmadev_handle_dev_info(const char *cmd · line 1035
Quoted 1 line
lib/dmadev/rte_dmadev.c +1
-0+ ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_INTER_OS_DOMAIN);Quoted 3 lines
lib/dmadev/rte_dmadev.c +0
-0ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL ); diff --Quoted 6 lines
Quoted 6 lines
git
lib/dmadev/rte_dmadev.h int16_t rte_dma_next_dev(int16_t
Quoted 5 lines
a/lib/dmadev/rte_dmadev.hb/lib/dmadev/rte_dmadev.hindex550dbfbf75..4f735bb0c9100644lib/dmadev/rte_dmadev.h +0
-0@@ -265,6 +265,18 @@ int16_t rte_dma_next_dev(int16_t
start_dev_id);Quoted 86 lines
Quoted 58 lines
Quoted 23 lines
lib/dmadev/rte_dmadev.h +14
-0* known from 'nb_priorities' field in struct rte_dma_info. */ #define RTE_DMA_CAPA_PRI_POLICY_SP RTE_BIT64(8) +/** Support inter-process DMA transfers. +* +* When this bit is set, the DMA device can perform memory +transfers between +* different process memory spaces. +*/ +#define RTE_DMA_CAPA_INTER_PROCESS_DOMAIN RTE_BIT64(9) +/** Support inter-OS domain DMA transfers. +* +* The DMA device can perform memory transfers across different +operating +* system domains. +*/ +#define RTE_DMA_CAPA_INTER_OS_DOMAIN RTE_BIT64(10)/** Support copy operation. * This capability start with index of 32, so that it could leave gap between @@ -418,8 +430,13 @@ int
rte_dma_close(int16_t dev_id);
*/
enumrte_dma_direction{lib/dmadev/rte_dmadev.h
Quoted 2 lines
lib/dmadev/rte_dmadev.h +1
-0/** DMA transfer direction - from memory to memory. +* When the device supports inter-process or inter-OS domain transfers,
lib/dmadev/rte_dmadev.h
Quoted 2 lines
lib/dmadev/rte_dmadev.h +2
-0+ * the field `type` in `struct rte_dma_vchan_conf::domain` +specifiesthe
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* type of domain. For memory-to-memory transfers within the same domain
lib/dmadev/rte_dmadev.h
Quoted 1 line
lib/dmadev/rte_dmadev.h +1
-0+* or process, `type` should be set to
RTE_DMA_INTER_DOMAIN_NONE.Quoted 7 lines
lib/dmadev/rte_dmadev.h +1
-0* * @see struct rte_dma_vchan_conf::direction +* @see struct rte_dma_inter_domain_param::type */ RTE_DMA_DIR_MEM_TO_MEM,/** DMA transfer direction - from memory to device. lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 588
Quoted 8 lines
lib/dmadev/rte_dmadev.h +5
-0@@ -564,6 +581,39 @@ struct rte_dma_auto_free_param {uint64_t reserved[2 ]; }; +/** +* Inter-DMA transfer domain type. +* +* This enum defines the types of transfer domains applicable to +DMA operations.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 591
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+ * It helps categorize whether a DMA transfer is occurring within +the same domain, + * across different processes, or between distinct operating systemdomains.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 595
Quoted 4 lines
lib/dmadev/rte_dmadev.h +4
-0+* +* @see struct rte_dma_inter_domain_param:type */ enum +rte_dma_inter_domain_type { +/**< No inter-domain transfer; standard DMA within same domaini. */
Quoted 7 lines
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 599
Quoted 5 lines
lib/dmadev/rte_dmadev.h +5
-0+RTE_DMA_INTER_DOMAIN_NONE , +/**< Transfer occurs between different user-space processes. */ +RTE_DMA_INTER_PROCESS_DOMAIN , +/**< Transfer spans across different operating system domains. */ + RTE_DMA_INTER_OS_DOMAIN,If comment located before define, it should prefix with ** not **<
Ack, will fix it.
Quoted 18 lines
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param {
Quoted 10 lines
lib/dmadev/rte_dmadev.h +8
-0+}; + +/** +* Parameters for inter-process or inter-OS DMA transfers. +* +* This structure defines the parameters required to perform DMA +transfers +* across different domains, such as between processes or operating systems.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 611
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+ * It includes the domain type and handler identifiers for both the +source + * and destination domains.I think we could add more comment about how to config use the src/dst handler.
as I comment in before mail:
Quoted 7 lines
Quoted 3 lines
Sure, will add more comments. I believe a handler value of zero is still valid for both source and destination. It typically represents the local process when the transfer direction is mem-to-mem and the inter-
domain type if NONE.
If the inter-domain type is None, the src/dst handler should be ignore.
Right, if direction is mem-to-mem and type is NONE, it's local to local copy.
Quoted 10 lines
As I said in comment of "control-api commit", if the group has multiple (>2) process, and the device could perform three type mem-to-mem copy:
1\ local to remote
2\ remote to local
3\ remote-A to remote-B or event remote-A to remote-Athe remote handler could get by
rte_dma_access_pair_group_handle_get()does the local handler also get byrte_dma_access_pair_group_handle_get()?
Yes, local handler is also get from handle_get() which is used for local to remote, Remote to local copies.
Quoted 86 lines
Quoted 51 lines
Handler values --whether zero or non-zero -- can be used to represent transfers From local process to another OS domain, or vice versa.
Do you have any thoughts on this.?, Specifically, do you foresee any issues with using handler value of zero.
Thanks
Quoted 43 lines
It's mean local process if the src/dst_handler is zero? for example, I setup a inter-os domain param, if the
src_handleis none zero anddst_handleis zero, then all DMA copy will from another OS to local process.
all DMA fill will write to local process.If the
src_handleis zero anddst_handleis non-zero, then all DMA copy will from local process to another OS domain
all DMA fill will write to another OS domain.If both
src_handleanddst_handleis non-zero, then all DMA copy will from another OS to another OS domain
all DMA fill will write to another OS domain.lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param {
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+*/ +struct rte_dma_inter_domain_param { +enum rte_dma_inter_domain_type type;/**< Type of inter-domain. */
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 614
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+uint16_t src_handler;/**< Source domain handler identifier. */ +uint16_t dst_handler;/**< Destination domain handler identifier. */ +uint64_t reserved[2 ];/**< Reserved for future fields. */ Please move above comment before define to keep the whole header-file consistency.
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 654
Quoted 10 lines
lib/dmadev/rte_dmadev.h +3
-0+}; +/** * A structure used to configure a virtual DMA channel. * @@ -601,6 +651,15 @@ struct rte_dma_vchan_conf {* @see struct rte_dma_auto_free_param */ struct rte_dma_auto_free_param auto_free; +/** Parameters for inter-process or inter-OS domain DMA transfers. This field
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 656
Quoted 2 lines
lib/dmadev/rte_dmadev.h +2
-0+ * specifies the source and destination domain handlers required +forDMA
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 658
Quoted 2 lines
lib/dmadev/rte_dmadev.h +2
-0+ * operations that span across different processes or operating +systemdomains.
Quoted 6 lines
Quoted 6 lines
lib/dmadev/rte_dmadev.h struct rte_dma_vchan_conf { · line 662
Quoted 6 lines
lib/dmadev/rte_dmadev.h +6
-0+* +* @see RTE_DMA_CAPA_INTER_PROCESS_DOMAIN +* @see RTE_DMA_CAPA_INTER_OS_DOMAIN +* @see struct rte_dma_inter_domain_param +*/ +struct rte_dma_inter_domain_param domain;BTW: I remember the originl rfc only support inter-os domain, because Intel has inter-process rfc, so we add it. now Intel has not follow this feature, I think we could drop inter-process support (such as
RTE_DMA_CAPA_INTER_PROCESS_XXX) but keep the extend ability.Quoted 23 lines
Quoted 12 lines
Quoted 12 lines
lib/dmadev/rte_dmadev.h +0
-0};/** (quoted diff) +0
-0
b/lib/dmadev/rte_dmadev_trace.hindex1de92655f2..fa619c4090100644lib/dmadev/rte_dmadev_trace.h +1
-0@@ -79,6 +79,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->domain.type);Quoted 9 lines
lib/dmadev/rte_dmadev_trace.h RTE_TRACE_POINT( · line 87
Quoted 5 lines
lib/dmadev/rte_dmadev_trace.h +2
-0+rte_trace_point_emit_u16 (conf->domain.src_handler); +rte_trace_point_emit_u16 (conf->domain.dst_handler);rte_trace_point_emit_int (ret); )BTW: please add the UT (
test_dmadev_api.c) for abovevchan_setupmodify, this could be another commit I think.Yes, will add it.
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param { · line 615
Quoted 6 lines · On Mon, 13 Oct 2025 09:51:36 +0530 Vamsi Krishna <[email protected]> wrote:
lib/dmadev/rte_dmadev.h +6
-0+struct rte_dma_inter_domain_param { +enum rte_dma_inter_domain_type type;/**< Type of inter-domain. */ +uint16_t src_handler;/**< Source domain handler identifier. */ +uint16_t dst_handler;/**< Destination domain handler identifier. */ +uint64_t reserved[2 ];/**< Reserved for future fields. */ +};
If you have reserved fields in API, need to validate they are zero for future compatibility.
Quoted 8 lines
ZjQcmQRYFpfptBannerEnd
Review
Quoted 2 lines · On Mon, 13 Oct 2025 09:51:36 +0530 Vamsi Krishna <[email protected]> wrote:
(quoted diff) +2
-0+struct rte_dma_inter_domain_param { + enum rte_dma_inter_domain_type type; /**< Type of inter-domain.*/
Quoted 6 lines
lib/dmadev/rte_dmadev.h struct rte_dma_auto_free_param {
Quoted 3 lines
lib/dmadev/rte_dmadev.h +3
-0+uint16_t src_handler;/**< Source domain handler identifier. */ +uint16_t dst_handler;/**< Destination domain handler identifier. */ +uint64_t reserved[2 ];/**< Reserved for future fields. */ };If you have reserved fields in API, need to validate they are zero for future compatibility.
Ack, will add it in next version. Thanks.
Quoted 5 lines · On Mon, 13 Oct 2025 09:51:36 +0530 Vamsi Krishna <[email protected]> wrote:
lib/dmadev/rte_dmadev.c +5
-0+if (conf->domain.type !=RTE_DMA_INTER_DOMAIN_NONE && + conf->direction !=RTE_DMA_DIR_MEM_TO_MEM ) { +RTE_DMA_LOG (ERR ,"Device %d inter domain only support mem-to-mem transfer" , dev_id); +return -EINVAL ; + }
lib/dmadev/rte_dmadev.c rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan, · line 676
Quoted 10 lines
lib/dmadev/rte_dmadev.c +10
-0+if (conf->domain.type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter os domain" , dev_id); +return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter process domain" , dev_id); +return -EINVAL ; + }
Why is dev_id of type int16_t, seems like a limiting and poor choice. Would expect it to be unsigned and 32 bits?
PATCH v4 1/1 lib/dma: introduce inter-process and inter-OS DMA
In reply to Vamsi KrishnaFrom: Vamsi Attunuru <[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan configuration. Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
---
V4 changes:
* Move comments before defination
* Validate reserved fields are zero or not.
* Add more comments to new fields.
* UT for this feature will be added in another commit. V3 changes:
* Fix v2 review comments
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enums
lib/dmadev/rte_dmadev.c | 25 +++++++++++++ lib/dmadev/rte_dmadev.h | 69 +++++++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 97 insertions(+)
lib/dmadev/rte_dmadev.c +25 -0
@@ -665,6 +665,27 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,RTE_DMA_LOG (ERR ,"Device %d vchan out range!" , dev_id);return -EINVAL ; } +if (conf->domain.type !=RTE_DMA_INTER_DOMAIN_NONE && + conf->direction !=RTE_DMA_DIR_MEM_TO_MEM ) { +RTE_DMA_LOG (ERR ,"Device %d inter domain only support mem-to-mem transfer" , dev_id); +return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter os domain" , dev_id); +return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter process domain" , dev_id); +return -EINVAL ; + } +if ((conf->domain.type ==RTE_DMA_INTER_PROCESS_DOMAIN || + conf->domain.type ==RTE_DMA_INTER_OS_DOMAIN ) && + (conf->domain.reserved[0 ] !=0 || conf->domain.reserved[1 ] !=0 )) { +RTE_DMA_LOG (ERR ,"Device %d does not support non-zero reserved fields" , dev_id); +return -EINVAL ; + } if (conf->direction != RTE_DMA_DIR_MEM_TO_MEM && conf->direction != RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM &&
@@ -811,6 +832,8 @@ dma_capability_name(uint64_t capability) { RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN, "inter_process_domain" }, + { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },
@@ -1040,6 +1063,8 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_HANDLES_ERRORS );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_M2D_AUTO_FREE );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_OS_DOMAIN );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL );
lib/dmadev/rte_dmadev.h +69 -0
95 lines not on this page · raw message
lib/dmadev/rte_dmadev_trace.h +3 -0
@@ -79,6 +79,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->domain.type); +rte_trace_point_emit_u16 (conf->domain.src_handler); +rte_trace_point_emit_u16 (conf->domain.dst_handler);rte_trace_point_emit_int (ret); )
Signature · 1 line
2.34.1
Quoted 205 lines · Vamsi Krishna
From: Vamsi Attunuru<[email protected]>
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan configuration. Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
Signed-off-by Vamsi Attunuru<[email protected]>---
V4 changes:
* Move comments before defination
* Validate reserved fields are zero or not.
* Add more comments to new fields.
* UT for this feature will be added in another commit. V3 changes:
* Fix v2 review comments
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enumslib/dmadev/rte_dmadev.c | 25 +++++++++++++ lib/dmadev/rte_dmadev.h | 69 +++++++++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 97 insertions(+)lib/dmadev/rte_dmadev.c +25
-0@@ -665,6 +665,27 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan,RTE_DMA_LOG (ERR ,"Device %d vchan out range!" , dev_id);return -EINVAL ; } +if (conf->domain.type !=RTE_DMA_INTER_DOMAIN_NONE && + conf->direction !=RTE_DMA_DIR_MEM_TO_MEM ) { +RTE_DMA_LOG (ERR ,"Device %d inter domain only support mem-to-mem transfer" , dev_id); +return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_OS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter os domain" , dev_id); +return -EINVAL ; + } +if (conf->domain.type ==RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa &RTE_DMA_CAPA_INTER_PROCESS_DOMAIN )) { +RTE_DMA_LOG (ERR ,"Device %d does not support inter process domain" , dev_id); +return -EINVAL ; + } +if ((conf->domain.type ==RTE_DMA_INTER_PROCESS_DOMAIN || + conf->domain.type ==RTE_DMA_INTER_OS_DOMAIN ) && + (conf->domain.reserved[0 ] !=0 || conf->domain.reserved[1 ] !=0 )) { +RTE_DMA_LOG (ERR ,"Device %d does not support non-zero reserved fields" , dev_id); +return -EINVAL ; + } if (conf->direction != RTE_DMA_DIR_MEM_TO_MEM && conf->direction != RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM &&@@ -811,6 +832,8 @@ dma_capability_name(uint64_t capability) { RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN, "inter_process_domain" }, + { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" },@@ -1040,6 +1063,8 @@ dmadev_handle_dev_info(const char *cmd __rte_unused,ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_HANDLES_ERRORS );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_M2D_AUTO_FREE );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_PROCESS_DOMAIN ); +ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_INTER_OS_DOMAIN );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_COPY_SG );ADD_CAPA (dma_caps, dev_capa,RTE_DMA_CAPA_OPS_FILL );lib/dmadev/rte_dmadev.h +69
-0@@ -265,6 +265,18 @@ int16_t rte_dma_next_dev(int16_t start_dev_id);* known from 'nb_priorities' field in struct rte_dma_info. */ #define RTE_DMA_CAPA_PRI_POLICY_SP RTE_BIT64(8) +/** Support inter-process DMA transfers. +* +* When this bit is set, the DMA device can perform memory transfers between +* different process memory spaces. +*/ +#define RTE_DMA_CAPA_INTER_PROCESS_DOMAIN RTE_BIT64(9) +/** Support inter-OS domain DMA transfers. +* +* The DMA device can perform memory transfers across different operating +* system domains. +*/ +#define RTE_DMA_CAPA_INTER_OS_DOMAIN RTE_BIT64(10)/** Support copy operation. * This capability start with index of 32, so that it could leave gap between @@ -426,8 +438,13 @@ int rte_dma_close(int16_t dev_id);*/ enum rte_dma_direction {/** DMA transfer direction - from memory to memory. +* When the device supports inter-process or inter-OS domain transfers, +* the field `type` in `struct rte_dma_vchan_conf::domain` specifies the +* type of domain. For memory-to-memory transfers within the same domain +* or process, `type` should be set to `RTE_DMA_INTER_DOMAIN_NONE`. * * @see struct rte_dma_vchan_conf::direction +* @see struct rte_dma_inter_domain_param::type */ RTE_DMA_DIR_MEM_TO_MEM ,/** DMA transfer direction - from memory to device. @@ -572,6 +589,49 @@ struct rte_dma_auto_free_param {uint64_t reserved[2 ]; }; +/** +* Inter-DMA transfer domain type. +* +* This enum defines the types of transfer domains applicable to DMA operations. +* It helps categorize whether a DMA transfer is occurring within the same domain, +* across different processes, or between distinct operating system domains. +* +* @see struct rte_dma_inter_domain_param:type +*/ +enum rte_dma_inter_domain_type { +/** No inter-domain transfer; standard DMA within same domain. */ +RTE_DMA_INTER_DOMAIN_NONE , +/** Transfer occurs between different user-space processes. */ +RTE_DMA_INTER_PROCESS_DOMAIN , +/** Transfer spans across different operating system domains. */ +RTE_DMA_INTER_OS_DOMAIN , +}; + +/** +* Parameters for inter-process or inter-OS DMA transfers. +* +* This structure defines the parameters required to perform DMA transfers +* across different domains, such as between processes or operating systems. +* It includes the domain type and handler identifiers for both the source +* and destination domains. +* +* When domain type is RTE_DMA_INTER_DOMAIN_NONE, both source and destination +* handlers are invalid, DMA operation is confined within the local process. +* +* For DMA transfers between the local process or OS domain to another process +* or OS domain, valid source and destination handlers must be provided. +*/ +struct rte_dma_inter_domain_param { +/** Type of inter-domain. */ +enum rte_dma_inter_domain_type type; +/** Source domain handler identifier. */ +uint16_t src_handler; +/** Destination domain handler identifier. */ +uint16_t dst_handler; +/** Reserved for future fields. */ +uint64_t reserved[2 ]; +}; +/** * A structure used to configure a virtual DMA channel. * @@ -609,6 +669,15 @@ struct rte_dma_vchan_conf {* @see struct rte_dma_auto_free_param */ struct rte_dma_auto_free_param auto_free; +/** Parameters for inter-process or inter-OS domain DMA transfers. This field +* specifies the source and destination domain handlers required for DMA +* operations that span across different processes or operating system domains. +* +* @see RTE_DMA_CAPA_INTER_PROCESS_DOMAIN +* @see RTE_DMA_CAPA_INTER_OS_DOMAIN +* @see struct rte_dma_inter_domain_param +*/ +struct rte_dma_inter_domain_param domain; };/** lib/dmadev/rte_dmadev_trace.h +3
-0@@ -79,6 +79,9 @@ RTE_TRACE_POINT(rte_trace_point_emit_int (conf->dst_port.port_type);rte_trace_point_emit_u64 (conf->dst_port.pcie.val);rte_trace_point_emit_ptr (conf->auto_free.m2d.pool); +rte_trace_point_emit_int (conf->domain.type); +rte_trace_point_emit_u16 (conf->domain.src_handler); +rte_trace_point_emit_u16 (conf->domain.dst_handler);rte_trace_point_emit_int (ret); )
Ping for apply.
Thanks
Vamsi
Quoted 298 lines
-----Original Message-----
From: fengchengwen <[email protected]>
Sent: Friday, October 17, 2025 6:44 PM
To: Vamsi Krishna Attunuru <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Jerin Jacob <[email protected]>; [email protected]
Subject: [EXTERNAL] Re: [PATCH v4 1/1] lib/dma: introduce inter-process and inter-OS DMAAcked-by Chengwen Feng <fengchengwen@ huawei. com> On 2025/10/1713: 42, Vamsi Krishna wrote: From: Vamsi Attunuru <vattunuru@ marvell. com> Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data ZjQcmQRYFpfptBannerStart Prioritize security for external emails:
Confirm sender and content safety before clicking links or opening attachments <https://us-phishalarm-
ewt.proofpoint.com/EWT/v1/CRVmXkqW!tg3T1fUeg1V6HqwW2f3ajfUSFVFe SbtXJSSGR1d3qnuqzo3OfbjKl24ZuXOC375prAstNSCkOPXj96o4H2iZsGSW94E7 UAoZMQE$>
Report SuspiciousZjQcmQRYFpfptBannerEnd
Acked-by Chengwen Feng <[email protected]><mailto:[email protected]>
On 2025/10/17 13:42, Vamsi Krishna wrote:
From: Vamsi Attunuru <[email protected]>
<mailto:[email protected]>Modern DMA hardware supports data transfers between multiple
DMA
devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or
destination
addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a
mechanism
to specify source and destination handlers via the vchan configuration. Until standardized control-plane APIs are defined for various
categories
of DMA devices, these handler details can be exchanged through
private
driver mechanisms.Signed-off-by Vamsi Attunuru <[email protected]><mailto:[email protected]>
---
V4 changes:
* Move comments before defination
* Validate reserved fields are zero or not.
* Add more comments to new fields.
* UT for this feature will be added in another commit. V3 changes:
* Fix v2 review comments
V2 changes:
* Seperate out the control-plane APIs
* Address v0 review comments
* Add validation checks
* Rename the enums
lib/dmadev/rte_dmadev.c| 25 +++++++++++++
lib/dmadev/rte_dmadev.h| 69
+++++++++++++++++++++++++++++++++++lib/dmadev/rte_dmadev_trace.h | 3 ++ 3 files changed, 97 insertions(+) diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c index 73d24f8ff3..30c3db3a98 100644 --- a/lib/dmadev/rte_dmadev.c +++ b/lib/dmadev/rte_dmadev.c @@ -665,6 +665,27 @@ rte_dma_vchan_setup(int16_t dev_id, uint16_t vchan, RTE_DMA_LOG(ERR, "Device %d vchan out range!", dev_id); return -EINVAL; } + if (conf->domain.type != RTE_DMA_INTER_DOMAIN_NONE && + conf->direction != RTE_DMA_DIR_MEM_TO_MEM) { + RTE_DMA_LOG(ERR, "Device %d inter domain only support mem-to-mem transfer", dev_id); + return -EINVAL; + } + if (conf->domain.type == RTE_DMA_INTER_OS_DOMAIN && + !(dev_info.dev_capa & RTE_DMA_CAPA_INTER_OS_DOMAIN)) { + RTE_DMA_LOG(ERR, "Device %d does not support inter os domain", dev_id); + return -EINVAL; + } + if (conf->domain.type == RTE_DMA_INTER_PROCESS_DOMAIN && + !(dev_info.dev_capa & RTE_DMA_CAPA_INTER_PROCESS_DOMAIN)) { + RTE_DMA_LOG(ERR, "Device %d does not support inter process domain", dev_id); + return -EINVAL; + } + if ((conf->domain.type == RTE_DMA_INTER_PROCESS_DOMAIN || + conf->domain.type == RTE_DMA_INTER_OS_DOMAIN) && + (conf->domain.reserved[0] != 0 || conf-Quoted 1 line
domain.reserved[1] != 0)) {
+ RTE_DMA_LOG(ERR, "Device %d does not support
non-zero reserved fields", dev_id); + return -EINVAL; + } if (conf->direction != RTE_DMA_DIR_MEM_TO_MEM && conf->direction != RTE_DMA_DIR_MEM_TO_DEV && conf->direction != RTE_DMA_DIR_DEV_TO_MEM && @@ -811,6 +832,8 @@ dma_capability_name(uint64_t capability) { RTE_DMA_CAPA_HANDLES_ERRORS, "handles_errors" }, { RTE_DMA_CAPA_M2D_AUTO_FREE, "m2d_auto_free" }, { RTE_DMA_CAPA_PRI_POLICY_SP, "pri_policy_sp" }, + { RTE_DMA_CAPA_INTER_PROCESS_DOMAIN, "inter_process_domain" }, + { RTE_DMA_CAPA_INTER_OS_DOMAIN, "inter_os_domain" }, { RTE_DMA_CAPA_OPS_COPY, "copy" }, { RTE_DMA_CAPA_OPS_COPY_SG, "copy_sg" }, { RTE_DMA_CAPA_OPS_FILL, "fill" }, @@ -1040,6 +1063,8 @@ dmadev_handle_dev_info(const char *cmd
__rte_unused,
ADD_CAPA(dma_caps,dev_capa,RTE_DMA_CAPA_HANDLES_ERRORS);
ADD_CAPA(dma_caps,dev_capa,RTE_DMA_CAPA_M2D_AUTO_FREE);
ADD_CAPA(dma_caps,dev_capa,RTE_DMA_CAPA_PRI_POLICY_SP); + ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_INTER_PROCESS_DOMAIN); + ADD_CAPA(dma_caps, dev_capa,
RTE_DMA_CAPA_INTER_OS_DOMAIN);
ADD_CAPA(dma_caps,dev_capa,RTE_DMA_CAPA_OPS_COPY);
ADD_CAPA(dma_caps,dev_capa,RTE_DMA_CAPA_OPS_COPY_SG);
ADD_CAPA(dma_caps,dev_capa,RTE_DMA_CAPA_OPS_FILL); diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h index 30e168825e..1708311c5b 100644 --- a/lib/dmadev/rte_dmadev.h +++ b/lib/dmadev/rte_dmadev.h @@ -265,6 +265,18 @@ int16_t rte_dma_next_dev(int16_t
start_dev_id);
* known from 'nb_priorities' field in structrte_dma_info. */
#defineRTE_DMA_CAPA_PRI_POLICY_SPRTE_BIT64(8)
+/** Support inter-process DMA transfers.
+ *
+ * When this bit is set, the DMA device can perform memory
transfers between
+ * different process memory spaces.
+ */
+#defineRTE_DMA_CAPA_INTER_PROCESS_DOMAINRTE_BIT64(9)
+/** Support inter-OS domain DMA transfers.
+ *
+ * The DMA device can perform memory transfers across different
operating
+ * system domains.
+ */
+#defineRTE_DMA_CAPA_INTER_OS_DOMAIN
RTE_BIT64(10)/** Support copy operation.
* This capability start with index of 32, so that it could leave gap
between@@ -426,8 +438,13 @@ int rte_dma_close(int16_t dev_id); */ enum rte_dma_direction { /** DMA transfer direction - from memory to memory. + * When the device supports inter-process or inter-OS domaintransfers,
+ * the fieldtypeinstruct rte_dma_vchan_conf::domain
specifies the
+ * type of domain. For memory-to-memory transfers within
the same domain
+ * or process,typeshould be set toRTE_DMA_INTER_DOMAIN_NONE.* * @see struct rte_dma_vchan_conf::direction + * @see struct rte_dma_inter_domain_param::type */ RTE_DMA_DIR_MEM_TO_MEM, /** DMA transfer direction - from memory to device. @@ -572,6 +589,49 @@ struct rte_dma_auto_free_param { uint64_t reserved[2]; }; +/** + * Inter-DMA transfer domain type. + * + * This enum defines the types of transfer domains applicable toDMA operations.
+ * It helps categorize whether a DMA transfer is occurring within the
same domain,
+ * across different processes, or between distinct operating system
domains.
+ *
+ * @see struct rte_dma_inter_domain_param:type
+ */
+enumrte_dma_inter_domain_type{
+ /** No inter-domain transfer; standard DMA within same
domain. */
+RTE_DMA_INTER_DOMAIN_NONE,
+ /** Transfer occurs between different user-space processes.
*/
+RTE_DMA_INTER_PROCESS_DOMAIN,
+ /** Transfer spans across different operating system
domains. */+ RTE_DMA_INTER_OS_DOMAIN, +}; + +/** + * Parameters for inter-process or inter-OS DMA transfers. + * + * This structure defines the parameters required to perform DMAtransfers
+ * across different domains, such as between processes or operating
systems.
+ * It includes the domain type and handler identifiers for both the
source
+ * and destination domains.
+ *
+ * When domain type isRTE_DMA_INTER_DOMAIN_NONE, both
source and destination
+ * handlers are invalid, DMA operation is confined within the local
process.
+ *
+ * For DMA transfers between the local process or OS domain to
another process
+ * or OS domain, valid source and destination handlers must be
provided.+ */ +struct rte_dma_inter_domain_param { + /** Type of inter-domain. */ + enum rte_dma_inter_domain_type type; + /** Source domain handler identifier. */ + uint16_t src_handler; + /** Destination domain handler identifier. */ + uint16_t dst_handler; + /** Reserved for future fields. */ + uint64_t reserved[2]; +}; + /** * A structure used to configure a virtual DMA channel. * @@ -609,6 +669,15 @@ struct rte_dma_vchan_conf { * @see struct rte_dma_auto_free_param */ struct rte_dma_auto_free_param auto_free; + /** Parameters for inter-process or inter-OS domain DMAtransfers. This field
+ * specifies the source and destination domain handlers
required for DMA
+ * operations that span across different processes or
operating system domains.+ * + * @see RTE_DMA_CAPA_INTER_PROCESS_DOMAIN + * @see RTE_DMA_CAPA_INTER_OS_DOMAIN + * @see struct rte_dma_inter_domain_param + */ + struct rte_dma_inter_domain_param domain; }; /** diff --git a/lib/dmadev/rte_dmadev_trace.h b/lib/dmadev/rte_dmadev_trace.h index 04d9a2741b..f1a178eeb5 100644 --- a/lib/dmadev/rte_dmadev_trace.h +++ b/lib/dmadev/rte_dmadev_trace.h @@ -79,6 +79,9 @@ RTE_TRACE_POINT( rte_trace_point_emit_int(conf->dst_port.port_type); rte_trace_point_emit_u64(conf->dst_port.pcie.val); rte_trace_point_emit_ptr(conf->auto_free.m2d.pool); + rte_trace_point_emit_int(conf->domain.type); + rte_trace_point_emit_u16(conf->domain.src_handler); + rte_trace_point_emit_u16(conf->domain.dst_handler); rte_trace_point_emit_int(ret); )
Quoted 16 lines
Quoted 16 lines
Modern DMA hardware supports data transfers between multiple DMA devices, facilitating data communication across isolated domains, containers, or operating systems. These DMA transfers function as standard memory-to-memory operations, but with source or destination addresses residing in different process or OS address space. The exchange of these addresses between processes is handled through private driver mechanism, which are beyond the scope of this specification change.
This commit introduces new capability flags to advertise driver support for inter-process and inter-OS domain DMA transfers. It adds a mechanism to specify source and destination handlers via the vchan configuration. Until standardized control-plane APIs are defined for various categories of DMA devices, these handler details can be exchanged through private driver mechanisms.
Quoted 2 lines
Quoted 1 line
Signed-off-by Vamsi Attunuru<[email protected]>Acked-by Chengwen Feng <[email protected]>
Added release notes and applied, thanks.