tools/libxc: use uint32_t for pirq in xc_domain_irq_permission
PATCH v2 1/1 tools/libxc: use uint32_t for pirq in xc_domain_irq_permission
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.
---
Changes in v2:
- extra wording for clarity in commit message (Julien)
- change allow_access to bool (Andrew)
- add padding (Jan)
--- tools/include/xenctrl.h | 4 ++-- tools/libs/ctrl/xc_domain.c | 4 ++-- tools/ocaml/libs/xc/xenctrl_stubs.c | 4 ++-- xen/include/public/domctl.h | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-)
tools/include/xenctrl.h +2 -2
@@ -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,
tools/libs/ctrl/xc_domain.c +2 -2
@@ -1384,8 +1384,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 ;
tools/ocaml/libs/xc/xenctrl_stubs.c +2 -2
@@ -1077,8 +1077,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);
xen/include/public/domctl.h +2 -1
@@ -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 ]; };
Signature · 1 line
2.7.4
Hi Igor,
Quoted 12 lines · Igor Druzhinin
Current
unit8_tfor pirq argument in this interface is too restrictive causing failures on modern hardware with lots of GSIs. That extends down toXEN_DOMCTL_irq_permissionABI 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_tnow 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.
Quoted 7 lines
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_el1touint64_t") in this release cycle.Additionally, take a change and convert
allow_accessargument to bool.Reviewed-by Jan Beulich <[email protected]>
The reviewed tags are generally added after the signed-off-by.
The reshuffle can be done on commit.
Quoted 2 lines
Signed-off-by Igor Druzhinin <[email protected]>Acked-by Christian Lindig <[email protected]>
Cheers,
Signature · 1 line
Julien Grall