refactor(mx_dma): extract common code from core_v1/v2 into core_common#13
Closed
daeyeong-XCENA wants to merge 2 commits into
Closed
refactor(mx_dma): extract common code from core_v1/v2 into core_common#13daeyeong-XCENA wants to merge 2 commits into
daeyeong-XCENA wants to merge 2 commits into
Conversation
Eliminate code duplication between core_v1.c and core_v2.c by extracting shared logic into core_common.c and unifying submit/complete handlers through a per-queue operations vtable (struct mx_queue_ops). Changes: - Extract descriptor list utilities (mx_get_list_count, mx_get_total_desc_count, mx_desc_list_init) to core_common.c. The v1/v2 behavioral difference (v2 skips the first SG entry) is handled via skip_first/skip_first_entry parameters. - Extract kthread_stop helper (mx_stop_queue_threads) to core_common.c. - Add struct mx_queue_ops vtable with is_pushable, push_command, post_submit, is_popable, pop_completion, post_complete callbacks. - Implement unified mx_submit_handler/mx_complete_handler in core_common.c that dispatch through the ops vtable. - Add v1_queue_ops/v2_queue_ops adapter wrappers using container_of (safe since common is the first member in both queue structs). - Remove duplicated submit_handler/complete_handler from both files. - Add .clang-format to disable auto-formatting for this kernel module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Details
core_common.cwith unifiedsubmit_handlerandcomplete_handlerusingstruct queue_opsvtablecore_v1.candcore_v2.cto register hardware-specific ops instead of duplicating handler logicstruct queue_opsand related declarations tomx_dma.hcore_common.oTests
make(CXL mode) andmake WO_CXL=1(standalone mode)