Skip to content

Conversation

@Elwimen
Copy link

@Elwimen Elwimen commented Dec 1, 2025

This complements the existing xen_domctl_assign_dt_device() helper by exposing the XEN_DOMCTL_deassign_device domctl for Device Tree devices, allowing Dom0 to cleanly revoke a previously assigned device.

Implementation details

  • Add xen_domctl_deassign_dt_device() in drivers/xen/dom0/domctl.c:
    • Initializes xen_domctl_t with cmd = XEN_DOMCTL_deassign_device.
    • Uses XEN_DOMCTL_DEV_DT and sets u.assign_device.u.dt.size based on the DT path length.
    • Uses set_xen_guest_handle() to point to the DT path and calls do_domctl().
  • Declare the new helper and document its semantics in include/zephyr/xen/dom0/domctl.h.

Rationale

  • Provides a symmetric API to xen_domctl_assign_dt_device() for DT devices.
  • Makes it possible for Zephyr-based Dom0 code to explicitly deassign passthrough devices without re-implementing the domctl call.

Testing

  • Built Zephyr that is running under Xen as Dom0 with this change.
  • Verified device assignment and subsequent deassignment via xen_domctl_assign_dt_device() / xen_domctl_deassign_dt_device() in a Xen + Zephyr Dom0
    environment.

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Hello @Elwimen, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

Add wrapper function for XEN_DOMCTL_deassign_device hypercall to
support deassigning device tree devices from guest domains.

Signed-off-by: Damjan Belavic <damjan_belavic@epam.com>
@Elwimen Elwimen force-pushed the xen-dom0-deassign-device branch from 8988855 to f5b235b Compare December 1, 2025 23:14
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 1, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants