refactor: adopt virtual-ID ABI and per-device context for SCMI protocols - #110
Open
agicy wants to merge 13 commits into
Open
refactor: adopt virtual-ID ABI and per-device context for SCMI protocols#110agicy wants to merge 13 commits into
agicy wants to merge 13 commits into
Conversation
agicy
force-pushed
the
refactor/virtio-scmi
branch
from
July 27, 2026 14:18
132b15e to
11651d3
Compare
agicy
force-pushed
the
refactor/virtio-scmi
branch
from
July 29, 2026 07:22
11651d3 to
57a8665
Compare
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.
Summary
Refactor the virtio-scmi implementation to replace the phandle-based ABI with a virtual-ID ABI, and move from global protocol registration to per-device context. This prepares the way for multi-device SCMI support and eliminates dependencies on static phandle values.
Driver changes (
driver/)scmi_server.cinto per-protocol files underdriver/virtio/scmi/{server,clock,power,reset}.c. Each protocol is independently initialized from the hvisor DT node'sclocks/resets/power-domainsproperties usingof_count_phandle_with_args().SET_PHANDLEioctl subcommands are removed.hvisor_scmi_init()/hvisor_scmi_cleanup()provide symmetric init/teardown with proper error-path rollback.of_clk_get/__of_reset_control_get) and released at module exit, avoiding repeated DT traversals.reset-domains.c: The old dynamic reset-controller walk was replaced by direct DT property access, matching the approach used for clocks and power domains.Tools changes (
tools/)scmi_protocoltable withscmi_dev_register_protocol(), storing protocol handlers inSCMIDev. This allows multiple SCMI device instances with different protocol sets.clock_ids/reset_ids/power_idsarrays instead of*_phandle+*_max_num+allowed_list+*_map. The wildcard"*"syntax is replaced by explicit ID enumeration.scmi_resp_ctxfor safe response buffer tracking: all protocol handlers now usescmi_resp_write()to advance a write cursor, catching buffer overflows at write time.hvisor_scmi_ioctl_cmd()uses the persistentko_fd(opened once invirtio_start()), removing repeatedopen/closeof/dev/hvisor.ENABLE_VIRTIO_SCMIis gone — SCMI is always compiled in, reducing build complexity.Compatibility
All kernel APIs used (
genpd_dev_pm_attach_by_id,__of_reset_control_get, etc.) are available since Linux v5.1 or earlier. The code builds and runs on Linux 6.1 without regression.References
Closes: #106, #107.
Refactor: #84.