For tools such as lsevtchn to enumerate through event channels, they
need an upper bound on the port number.

Add the highest allocated event channel port number for a domain in the
xen_domctl_getdomaininfo struct, and populate it.

The field is added above the padding to avoid implicit padding.

Signed-off-by: Matthew Barnes <matthew.bar...@cloud.com>
---
 xen/common/domctl.c         | 1 +
 xen/include/public/domctl.h | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 43b0b074c3a6..1d1ee17f6f91 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -73,6 +73,7 @@ void getdomaininfo(struct domain *d, struct 
xen_domctl_getdomaininfo *info)
 
     info->domain = d->domain_id;
     info->max_vcpu_id = XEN_INVALID_MAX_VCPU_ID;
+    info->highest_evtchn_port = read_atomic(&d->valid_evtchns);
 
     /*
      * - domain is marked as blocked only if all its vcpus are blocked
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index a33f9ec32b08..d28d29180c75 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -145,7 +145,8 @@ struct xen_domctl_getdomaininfo {
     xen_domain_handle_t handle;
     uint32_t cpupool;
     uint8_t gpaddr_bits; /* Guest physical address space size. */
-    uint8_t pad2[7];
+    uint8_t pad2[3];
+    evtchn_port_t highest_evtchn_port; /* Highest allocated event channel 
port. Used for enumeration */
     struct xen_arch_domainconfig arch_config;
 };
 typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
-- 
2.34.1


Reply via email to