tools/ocaml: Add missing X86_EMU_VPCI
PATCH 1/3 tools/ocaml: Add missing X86_EMU_VPCI
This was missing from x86_arch_emulation_flags.
--- tools/ocaml/libs/xc/xenctrl.ml | 1 + tools/ocaml/libs/xc/xenctrl.mli | 1 + 2 files changed, 2 insertions(+)
tools/ocaml/libs/xc/xenctrl.ml +1 -0
@@ -46,6 +46,7 @@ type x86_arch_emulation_flags = | X86_EMU_IOMMU | X86_EMU_PIT | X86_EMU_USE_PIRQ + | X86_EMU_VPCI type xen_x86_arch_domainconfig = {
tools/ocaml/libs/xc/xenctrl.mli +1 -0
@@ -40,6 +40,7 @@ type x86_arch_emulation_flags = | X86_EMU_IOMMU | X86_EMU_PIT | X86_EMU_USE_PIRQ + | X86_EMU_VPCI type xen_x86_arch_domainconfig = { emulation_flags: x86_arch_emulation_flags list;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/3 tools/ocaml: Add missing CAP_PV
From: Andrew Cooper <[email protected]>
c/s f089fddd941 broke the Ocaml ABI by renumering XEN_SYSCTL_PHYSCAP_directio without adjusting the Ocaml physinfo_cap_flag enumeration. Fix this by inserting CAP_PV between CAP_HVM and CAP_DirectIO.
---
v2: Split this into its own patch.
--- tools/ocaml/libs/xc/xenctrl.ml | 1 + tools/ocaml/libs/xc/xenctrl.mli | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)
tools/ocaml/libs/xc/xenctrl.ml +1 -0
@@ -100,6 +100,7 @@ type sched_control = type physinfo_cap_flag = | CAP_HVM + | CAP_PV | CAP_DirectIO type physinfo =
tools/ocaml/libs/xc/xenctrl.mli +4 -1
@@ -83,7 +83,10 @@ type domaininfo = { arch_config : arch_domainconfig; } type sched_control = { weight : int; cap : int; } -type physinfo_cap_flag = CAP_HVM | CAP_DirectIO +type physinfo_cap_flag = + | CAP_HVM + | CAP_PV + | CAP_DirectIO type physinfo = { threads_per_core : int; cores_per_socket : int;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 3/3 tools/ocaml: Introduce xenctrl ABI build-time checks
In reply to Ian Jacksonc/s f089fddd941 broke the Ocaml ABI by renumering XEN_SYSCTL_PHYSCAP_directio without adjusting the Ocaml physinfo_cap_flag enumeration.
Add build machinery which will check the ABI correspondence.
This will result in a compile time failure whenever constants get renumbered/added without a compatible adjustment to the Ocaml ABI.
---
v2: Script with ad-hoc parsers rather than handwritten BUILD_BUG_ON
list (which was out of date even in v1 of this patch!)
--- .gitignore | 1 + tools/ocaml/libs/xc/Makefile | 5 +++ tools/ocaml/libs/xc/abi-check | 84 +++++++++++++++++++++++++++++++++++++ tools/ocaml/libs/xc/xenctrl_stubs.c | 69 +++++++++++++++++++++--------- xen/include/public/sysctl.h | 4 ++ 5 files changed, 143 insertions(+), 20 deletions(-) create mode 100755 tools/ocaml/libs/xc/abi-check
.gitignore +1 -0
@@ -392,6 +392,7 @@ tools/ocaml/libs/xentoollog/_xtl_levels.* tools/ocaml/libs/xentoollog/xentoollog.ml tools/ocaml/libs/xentoollog/xentoollog.mli tools/ocaml/libs/xs/paths.ml +tools/ocaml/libs/xc/xenctrl_abi_check.h tools/ocaml/xenstored/_paths.h tools/ocaml/xenstored/oxenstored tools/ocaml/xenstored/oxenstored.conf
tools/ocaml/libs/xc/Makefile +5 -0
@@ -31,4 +31,9 @@ install: $(LIBS) META uninstall: $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenctrl +xenctrl_stubs.o: xenctrl_abi_check.h + +xenctrl_abi_check.h: abi-check xenctrl_stubs.c xenctrl.ml + $(PERL) -w $^ >[email protected] && mv -f [email protected] $@ + include $(TOPLEVEL)/Makefile.rules
tools/ocaml/libs/xc/abi-check new file +84 -0
84 lines not on this page · raw message
tools/ocaml/libs/xc/xenctrl_stubs.c +49 -20
99 lines not on this page · raw message
xen/include/public/sysctl.h +4 -0
@@ -90,6 +90,10 @@ struct xen_sysctl_tbuf_op {/* The platform supports direct access to I/O devices with IOMMU. */ #define _XEN_SYSCTL_PHYSCAP_directio 2#define XEN_SYSCTL_PHYSCAP_directio (1u<<_XEN_SYSCTL_PHYSCAP_directio) + +/* Max XEN_SYSCTL_PHYSCAP_* constant. Used for ABI checking. */ +#define XEN_SYSCTL_PHYSCAP_MAX XEN_SYSCTL_PHYSCAP_directio +struct xen_sysctl_physinfo {uint32_t threads_per_core;uint32_t cores_per_socket;
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 3/3] tools/ocaml: Introduce xenctrl ABI build-time checks
Quoted 9 lines · Ian Jackson
Add build machinery which will check the ABI correspondence.
This will result in a compile time failure whenever constants get renumbered/added without a compatible adjustment to the Ocaml ABI.
I understand the desire to automate this but would have kept the original proposal for these reasons: changes are rare enough, it is obvious how to extend the scheme, the approach stayed well within the respective languages. Adding parsers and code generators to the build system will make it more difficult to improve it, which at least for the OCaml part is very desirable. However, I’m not going to object to the patch.
— Christian
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 3/3] tools/ocaml: Introduce xenctrl ABI build-time checks
Christian Lindig writes ("Re: [PATCH 3/3] tools/ocaml: Introduce xenctrl ABI build-time checks"):
Quoted 7 lines
I understand the desire to automate this but would have kept the original proposal for these reasons: changes are rare enough, it is obvious how to extend the scheme, the approach stayed well within the respective languages. Adding parsers and code generators to the build system will make it more difficult to improve it, which at least for the OCaml part is very desirable. However, I’m not going to object to the patch.
I would love to have this all done in a more "proper" way.
However, in the meantime I do think it is essential to have a check which actually ties the ocaml code right back to the Xen headers (the latter being the canonical ABI definition). Indeed the v1 patch in this very thread had a mismatch between the ocaml and the BUILD_BUG_ON list, which I only discovered when my checker threw an unexpected error.
If there are other language bindings which have similar issues we should check them too.
Ultimately I would prefer it if the Xen ABI were provided in a way that was useable for automatically generating bindings.
Quoted 1 line
Acked-by Christian Lindig <[email protected]>
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel