[v7,3/6] public/xen.h: add a definition for a 'valid domid' mask
diff mbox series

Message ID 20200221112049.3077-4-pdurrant@amazon.com
State New
Headers show
Series
  • xl/libxl: domid allocation/preservation changes
Related show

Commit Message

Paul Durrant Feb. 21, 2020, 11:20 a.m. UTC
A subsequent patch will modify libxl to allow selection of a random domid
value when creating domains. Valid values are limited to a width of 15 bits,
so add an appropriate mask definition to the public header.

NOTE: It is reasonable for this mask definition to be in a Xen public header
      rather than in, say, a libxenctrl header since it relates to the
      validity of a value passed to XEN_DOMCTL_createdomain. This new
      definition is placed in xen.h rather than domctl.h only to co-locate
      it with other domid-related defitions.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Julien Grall <julien@xen.org>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Wei Liu <wl@xen.org>

v6:
 - New in v6 (split out from another patch)
---
 xen/include/public/xen.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Julien Grall Feb. 21, 2020, 8:47 p.m. UTC | #1
On 21/02/2020 11:20, Paul Durrant wrote:
> A subsequent patch will modify libxl to allow selection of a random domid
> value when creating domains. Valid values are limited to a width of 15 bits,
> so add an appropriate mask definition to the public header.
> 
> NOTE: It is reasonable for this mask definition to be in a Xen public header
>        rather than in, say, a libxenctrl header since it relates to the
>        validity of a value passed to XEN_DOMCTL_createdomain. This new
>        definition is placed in xen.h rather than domctl.h only to co-locate
>        it with other domid-related defitions.
> 
> Signed-off-by: Paul Durrant <pdurrant@amazon.com>
> Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>

Acked-by: Julien Grall <julien@xen.org>

Cheers,

Patch
diff mbox series

diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index d2198dffad..75b1619d0d 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -614,6 +614,9 @@  DEFINE_XEN_GUEST_HANDLE(mmuext_op_t);
 /* Idle domain. */
 #define DOMID_IDLE           xen_mk_uint(0x7FFF)
 
+/* Mask for valid domain id values */
+#define DOMID_MASK           xen_mk_uint(0x7FFF)
+
 #ifndef __ASSEMBLY__
 
 typedef uint16_t domid_t;