Skip to content

Conversation

@firscity
Copy link
Contributor

@firscity firscity commented Sep 5, 2025

This PR contains few enhancements for Xen Domain-0 and Domain-U interface parts:

  • add xen_version hypercall to allow Zephyr Domains dynamically detect Xen version they are running on;
  • add Xen sysctl hypercall to expand Zephyr Domain-0 capabilities;
  • add Xen getvcpuinfo domctl to allow Zephyr Domain-0 to gather VCPU stats and status information;
  • fixes set/get_paging_mempool_size calls to avoid parameter name confusion;
  • documents all implemented Zephyr Domain-0 domctl calls properly;
  • add flexible mechanism for Domain ID allocation in domctl createdomain.
    UPD.
  • Kconfig option for configuring domctl and sysctl version (instead of hardcoded value in header).

@firscity
Copy link
Contributor Author

firscity commented Sep 5, 2025

In last push one more commit with domain-id allocation enhancements was added.
Also, regarding failed Scancode:

Scan code for licenses: ./artifacts/report.txt

  • scan/include/zephyr/xen/public/sysctl.h has invalid license: mit
  • scan/include/zephyr/xen/public/version.h has invalid license: mit

Adding of MIT Xen public headers to Zephyr tree was approved in scope of this issue - #37239

@JarmouniA JarmouniA assigned nashif and firscity and unassigned carlocaione and nashif Sep 5, 2025
@firscity
Copy link
Contributor Author

firscity commented Sep 9, 2025

In last push added 2 commits, which allow used to directly specify Domctl and Sysctl interface version via Kconfig instead of hardcoded value in public headers.

No additional changes are planned in scope of this PR.

Copy link

@lorc lorc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For "drivers: xen: dom0: added getvcpuinfo domctl call": It should be "drivers: xen: dom0: add getvcpuinfo domctl call". Also the commit message might need some care as well.

@firscity firscity force-pushed the dom0_interfaces_sync branch from 7c321c3 to e0d9c11 Compare September 25, 2025 16:29
@firscity
Copy link
Contributor Author

@lorc

For "drivers: xen: dom0: added getvcpuinfo domctl call": It should be "drivers: xen: dom0: add getvcpuinfo domctl call". Also the commit message might need some care as well.

Thank you, reworded.

@firscity
Copy link
Contributor Author

Seems like Twister job is broken, as I see it is common for all active PRs

@soburi
Copy link
Member

soburi commented Sep 29, 2025

@firscity

In last push one more commit with domain-id allocation enhancements was added. Also, regarding failed Scancode:

Scan code for licenses: ./artifacts/report.txt

  • scan/include/zephyr/xen/public/sysctl.h has invalid license: mit
  • scan/include/zephyr/xen/public/version.h has invalid license: mit

Adding of MIT Xen public headers to Zephyr tree was approved in scope of this issue - #37239

To proceed with this,
you will need to labed this PR with "TSC" and request a review from TSC.

Note:
Another way, Separation into modules was approved in my previous issue, #91644, so I think this have a value for reconsider this.

@soburi soburi added the TSC Topics that need TSC discussion label Sep 29, 2025
@soburi soburi added the Licensing The PR has licensing issues => licensing expert to review label Sep 29, 2025
@soburi soburi self-requested a review September 29, 2025 05:48
dsemenets and others added 8 commits September 29, 2025 16:49
Xen API contains hypercall, which allows domains to identify Xen
version, that is currently used on the system. It can be used to check
if current version is supported by Zephyr or to change behavior of the
drivers or services.

Signed-off-by: Dmytro Semenets <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
This hypercall can be used get some information about physical machine
and running guests:

- sysctl hypercall "xen_sysctl_getphysinfo" allows read information about
physical machine: number CPUs, memory sizes, hardware capabilities, etc.

- sysctl hypercall "xen_sysctl_getdomaininfolist" returns array of domain
info structures that provide information about particular domain(s).

Signed-off-by: Dmytro Semenets <[email protected]>
Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
Add the XEN_DOMCTL_getvcpuinfo domain control call to allow Domain-0 to
query information about a domain's virtual CPUs. This can be used by
management tools and services for gathering statistics and monitoring
the current status of vCPUs.

Signed-off-by: Dmytro Semenets <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
The size is passed in bytes, not in megabytes. So rename the parameter
to avoid confusion.

Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
Document all of the public functions in the domctl API with doxygen

Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
If 0 is passed as domain id to the Xen createdomain hypercall, it will
allocate a new domain id and return it via the domctl structure.
Allow callers to access this new domain id via a pointer arg.
This will allow to create domains without explicitly specifying the
domain id for them.

Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
Add a new Kconfig option CONFIG_XEN_DOMCTL_INTERFACE_VERSION that allows
to change the version of the Domctl interface used by Zephyr to issue
domctl hypercalls. Add compile-time checks to enable or disable certain
Domctl operations based on the selected Domctl interface version.
For now versions 0x15, 0x16, and 0x17 are supported.

Also it required to correctly guard domctl call that were not supported
prior to specified version.

Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
Add a new Kconfig option CONFIG_XEN_SYSCTL_INTERFACE_VERSION that allows
to change the version of the Sysctl interface used by Zephyr to issue
sysctl hypercalls.
For now versions 0x15 is supported.

Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
@firscity firscity force-pushed the dom0_interfaces_sync branch from e0d9c11 to 380c25f Compare September 29, 2025 13:49
@sonarqubecloud
Copy link

@firscity
Copy link
Contributor Author

firscity commented Sep 30, 2025

In last force push:
Rebase to latest main to fix Twister errors on CI.

The license should have been a matter for TSC consideration, so I re-added it.

@soburi
Previously, new header were added normally, I believe it is OK as long as we stay inside include/zephyr/xen/public. Regarding module - discussions are ongoing, it will not be a big problem to remove this folder completely and move it to external module.

@soburi
Copy link
Member

soburi commented Oct 1, 2025

@firscity

In last force push: Rebase to latest main to fix Twister errors on CI.

The license should have been a matter for TSC consideration, so I re-added it.

@soburi Previously, new header were added normally, I believe it is OK as long as we stay inside include/zephyr/xen/public. Regarding module - discussions are ongoing, it will not be a big problem to remove this folder completely and move it to external module.

In my opinion, since the Xen public headers do not rely on the Zephyr implementation, I think it would be best to maintain and use the original as much as possible.
Additionally, the TSC approval process is required every time a change is made; therefore, this proposal intends to eliminate this inconvenience.

However, as you say, there are currently no issues from a technical standpoint,
and I believe that the decision-making will be left to you, the maintainer.

@nashif nashif moved this from Todo to In Progress in TSC Attention Needed Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Architectures area: ARM64 ARM (64-bit) Architecture area: Xen Platform Licensing The PR has licensing issues => licensing expert to review TSC Topics that need TSC discussion

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

8 participants