tools/libxc: use uint32_t for pirq in xc_domain_irq_permission
authorIgor Druzhinin <igor.druzhinin@citrix.com>
Tue, 13 Jul 2021 01:31:41 +0000 (02:31 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 26 Jul 2021 09:32:04 +0000 (10:32 +0100)
Current unit8_t for pirq argument in this interface is too restrictive
causing failures on modern hardware with lots of GSIs. That extends down to
XEN_DOMCTL_irq_permission ABI structure where it needs to be fixed up
as well.

Internal Xen structures appear to be fine. Existing users of the interface
in tree (libxl, ocaml and python bindings) are currently using signed int
for pirq representation which should be wide enough. Converting them to
uint32_t now is desirable to avoid accidental passing of a negative
number (probably denoting an error code) by caller as pirq, but left for
the future clean up.

Domctl interface version is needed to be bumped with this change but that
was already done by 918b8842a8 ("arm64: Change type of hsr, cpsr, spsr_el1
to uint64_t") in this release cycle.

Additionally, take a change and convert allow_access argument to bool.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Acked-by: Julien Grall <jgrall@amazon.com>
tools/include/xenctrl.h
tools/libs/ctrl/xc_domain.c
tools/ocaml/libs/xc/xenctrl_stubs.c
xen/include/public/domctl.h

index 2a7c836a021a8064e0dce9a3a5da929a460728ac..14adaa0c100b953026dc7d10aa22f6b17e7069da 100644 (file)
@@ -1385,8 +1385,8 @@ int xc_domain_ioport_permission(xc_interface *xch,
 
 int xc_domain_irq_permission(xc_interface *xch,
                              uint32_t domid,
-                             uint8_t pirq,
-                             uint8_t allow_access);
+                             uint32_t pirq,
+                             bool allow_access);
 
 int xc_domain_iomem_permission(xc_interface *xch,
                                uint32_t domid,
index 38038715381702a576b6cf6c1a75b422f7445a84..a20e081b51fa4ea09687ee03ddf0c77e02cdd387 100644 (file)
@@ -1385,8 +1385,8 @@ int xc_vcpu_setcontext(xc_interface *xch,
 
 int xc_domain_irq_permission(xc_interface *xch,
                              uint32_t domid,
-                             uint8_t pirq,
-                             uint8_t allow_access)
+                             uint32_t pirq,
+                             bool allow_access)
 {
     DECLARE_DOMCTL;
 
index a6756c4a8c2b09426948a4cb97c47045189388a8..dd09cb90aa0e3bc55b8228ccfdaad58a0afc2797 100644 (file)
@@ -1075,8 +1075,8 @@ CAMLprim value stub_xc_domain_irq_permission(value xch, value domid,
                                             value pirq, value allow)
 {
        CAMLparam4(xch, domid, pirq, allow);
-       uint8_t c_pirq;
-       uint8_t c_allow;
+       uint32_t c_pirq;
+       bool c_allow;
        int ret;
 
        c_pirq = Int_val(pirq);
index d576bfabd6f0679884492bcabf31b43154f4e790..96696e3842da1cb97d6316371fa88e62630a5c5a 100644 (file)
@@ -441,8 +441,9 @@ struct xen_domctl_setdebugging {
 
 /* XEN_DOMCTL_irq_permission */
 struct xen_domctl_irq_permission {
-    uint8_t pirq;
+    uint32_t pirq;
     uint8_t allow_access;    /* flag to specify enable/disable of IRQ access */
+    uint8_t pad[3];
 };