On 09/06/2023 9:17 am, Christian Lindig wrote: >> On 8 Jun 2023, at 20:33, Andrew Cooper <andrew.coop...@citrix.com> wrote: >> >> +type arm_physinfo_caps = >> + { >> + sve_vl: int; >> + } >> + > > Does the OCaml side need to know about the structure of this value or is it > enough to pass it around as an abstract value because all logic is on the C > side? I assume the OCaml side needs at least a way to persist the value and > hence needs to know some representation.
Yes, Ocaml does need to know about the structure. info->arch_capabilities is a collection of misc info. It was intended to be just a bitmap of things, hence why it's a list on the x86 side (We added fields, then had to revert and I haven't got back around to reworking that yet). But now ARM have put a non-bit field field into it, where a toolstack needs to select a domain_create sve_vl setting between min(0, physinfo.sve_vl) The Ocaml code doesn't have an #include <public/sysctl.h> so doesn't have the masks/constants required to decompose the integer into it's constitute parts. > >> Store_field(arch_obj, 0, >> + Val_int(MASK_EXTR(info->arch_capabilities, >> + XEN_SYSCTL_PHYSCAP_ARM_SVE_MASK) * 128)); >> + > What is the “* 128” achieving as part of this encoding? No functional change from before... except it was previously hidden in a different header file which I'm in the process of deleting. The vector length is a multiple of 128. This value is more amenable to being understood in a log file by a human. ~Andrew