From patchwork Fri Dec 2 10:55:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= X-Patchwork-Id: 13062626 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42E85C4321E for ; Fri, 2 Dec 2022 10:57:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.451790.709569 (Exim 4.92) (envelope-from ) id 1p13io-00047F-Ow; Fri, 02 Dec 2022 10:56:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 451790.709569; Fri, 02 Dec 2022 10:56:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p13io-000478-M9; Fri, 02 Dec 2022 10:56:46 +0000 Received: by outflank-mailman (input) for mailman id 451790; Fri, 02 Dec 2022 10:56:44 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p13im-0003rQ-RP for xen-devel@lists.xenproject.org; Fri, 02 Dec 2022 10:56:44 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ffb426cf-722f-11ed-91b6-6bf2151ebd3b; Fri, 02 Dec 2022 11:56:42 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ffb426cf-722f-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1669978602; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kvmroc4UWt6I3gO1OX/SxhaVKAh4s5W8paVaKox+rwU=; b=dMxxnxDUCjAVTg1Cj8joz8HqRCzIc0D14BjacK8ijsDzblSTyUf8PuG9 DrRyyM9iW0HmH5F7eX7L6ZpLjEw7Lwp0mAkTyRkdQo4SZpOJQIocajy0B 3Js/s+r3TRngq5VsbjsmShdkGhqviFQ+jM181qnBRGeZZHGLFFUp+2jkC o=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 86240592 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:lyG66qJ526X53XfKFE+R4pUlxSXFcZb7ZxGr2PjKsXjdYENS0DZTx zMZWj/TMvaCamOjcth2YNmx9hkGvJ+Ey4MyTQVlqX01Q3x08seUXt7xwmUcnc+xBpaaEB84t ZV2hv3odp1coqr0/0/1WlTZhSAgk/rOHv+kUrWs1hlZHWdMUD0mhQ9oh9k3i4tphcnRKw6Ws Jb5rta31GWNglaYCUpJrfPdwP9TlK6q4mlB5ARkPaojUGL2zBH5MrpOfcldEFOgKmVkNrbSb /rOyri/4lTY838FYj9yuu+mGqGiaue60Tmm0hK6aYD76vRxjnVaPpIAHOgdcS9qZwChxLid/ jnvWauYEm/FNoWU8AgUvoIx/ytWZcWq85efSZSzXFD6I+QrvBIAzt03ZHzaM7H09c4nOzgWt q0iDwkUVRqlnvmWx7GqV/Zj05FLwMnDZOvzu1llxDDdS/0nXYrCU+PB4towMDUY354UW6yEP oxANGQpPE+ojx5nYz/7DLozkPmpgD/jdCdfq3qepLYt4niVxwt0uFToGIqLIIDSGJQP9qqej nn9p1/AXg8TDcC8mWSL3kqPn8HSuQquDer+E5Xnr6U30TV/3Fc7CgASVFa9iem0jAi5Qd03A 1MQ0jojq+417kPDZsLmQxSyrXqAvxgdc9ldCes37EeK0KW8yxaUAC0IQyBMbPQitdQqXno62 1mRhdTrCDdz9rqPRhq19L2ZsDezMig9NnIZaGkPSg5t3jX4iNht1FSVFI8lSfPryI2ucd3t/ 9yUhHgE3u1Q3PQs7ryA93bemBKrpYnUUQFgs207QVmZxg9+YYekYamh5l7a8etMIe6lc7WRg JQXs5PAtb5TVPlhgATIGbxQR+/xu55pJRWG2TZS848dGyNBEpJJVaRZ+3lAKUhgKa7okhe5M RaI6Wu9CHK+VUZGjJObgarrU6zGLoC6T7wJs8w4ifIQCqWdjCfdoElTibe4hggBanQEn6AlI ou8es2xF3scAqkP5GPoGbZMiO51n3tgnD67qXXHI/OPiOr2WZJoYe1dbAvmgh4Rs8toXzk5A /4AbpDXmn2zocX1YzXN8J57ELz5BSFTOHwCkOQOLrTrClM/SAkc5wr5netJl3pNw/4EyY8lP xiVBidl9bYIrSaYc1jaMC04NumHsFQWhStTABHA9G2AgxALCbtDJo9OKvPboZFPGDRf8MNJ IronPort-HdrOrdr: A9a23:7IxO8qo6e8hvFRPCEtX1cZQaV5rveYIsimQD101hICG9Evb0qy nOpoV/6faQslwssR4b9uxoVJPvfZq+z+8W3WByB9eftWDd0QPFEGgL1+DfKlbbak7DH4BmtJ uJc8JFeafN5VoRt7eG3OFveexQvOVu88qT9JjjJ28Gd3APV0n5hT0JcjpyFCdNNW57LKt8Lr WwzOxdqQGtfHwGB/7LfUXsD4D41rv2fIuNW29+OyIa X-IronPort-AV: E=Sophos;i="5.96,212,1665460800"; d="scan'208";a="86240592" From: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= To: CC: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= , "Andrew Cooper" , George Dunlap , Jan Beulich , Julien Grall , "Stefano Stabellini" , Wei Liu Subject: [PATCH v2 1/4] CODING-STYLE: add .editorconfig to clarify indentation uses spaces Date: Fri, 2 Dec 2022 10:55:56 +0000 Message-ID: <01afbbbc15332aedcdccba75cb1f5edd538c4492.1669978356.git.edvin.torok@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add an .editorconfig to make it easier to keep patches compatible with Xen's coding style, and to reemphasize what Xen's coding style is. I thought that Xen demands tabs rather than spaces (which is more difficult with OCaml because indentation tools use spaces, and the use of tabs requires changing editor settings), however CODING-STYLE says it is spaces. Document this explicitly by adding a .editorconfig file (see editorconfig.org), which is an editor agnostic format for specifying basic style properties like indentation, either with native support in editors or via plugins. It is safer than modelines because it only supports controlling a restricted set of editor properties and not arbitrary commands as Vim modelines would have, and works with editors other than Vim too. (Vim has a deny list for modeline sandboxing, which is error-prone because every time a new command gets added it needs to be added to the deny list, which has been the source of a few CVEs in the past and I disable Vim modelines everywhere as a precaution). This file is added as a convenience for those who might have an editor that supports it, and its presence should have no impact on those that do not (want to) use it. It also won't cause re-indentation of existing files when edited, only newly added lines would follow the convention. No functional change. Signed-off-by: Edwin Török --- .editorconfig | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..cb2f27c581 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# See ./CODING_STYLE +root = true + +[*] +end_of_line = lf +indent_style = space +charset = utf-8 +max_line_length = 79 +trim_trailing_whitespace = true +insert_final_newline = true + +# Makefiles must use tabs, otherwise they don't work +[{Makefile,*.mk,Makefile.rules}] +indent_style = tabs + +[*.{c,h}] +indent_size = 4 + +[*.{ml,mli}] +indent_size = 2 From patchwork Fri Dec 2 10:55:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= X-Patchwork-Id: 13062629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21C23C4321E for ; Fri, 2 Dec 2022 10:57:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.451792.709591 (Exim 4.92) (envelope-from ) id 1p13j0-0004ms-Dj; Fri, 02 Dec 2022 10:56:58 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 451792.709591; Fri, 02 Dec 2022 10:56:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p13j0-0004mj-A8; Fri, 02 Dec 2022 10:56:58 +0000 Received: by outflank-mailman (input) for mailman id 451792; Fri, 02 Dec 2022 10:56:57 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p13iz-0003rQ-0F for xen-devel@lists.xenproject.org; Fri, 02 Dec 2022 10:56:57 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 07415175-7230-11ed-91b6-6bf2151ebd3b; Fri, 02 Dec 2022 11:56:55 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 07415175-7230-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1669978615; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bOQ3oRol1JrYqAer48HmKkncGmJC2gDM4u9fgjLBE4w=; b=PwUcsH1Sd6ese38RgEAqgl/itElvM4QLSH4HKAtEliMYWLKWPdrVVhlh HLUZOLiPJFYh5G1/u6BIqo8yyJLNK6a5f3dPMG6LGzUvdGhDwDAqoxbfv dbn97ijudYO7ZG2IpfpLQ02f+iwsM7orI3VPJkHPIhPHb6OTCnMbL6tqY U=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 86249443 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:9+w8H60VYJD1MzPDD/bD5cBxkn2cJEfYwER7XKvMYLTBsI5bpzdSz jcZDTrSb/aDa2umc48iPITl8UoP78KDmIcwTQM6pC1hF35El5HIVI+TRqvS04F+DeWYFR46s J9OAjXkBJppJpMJjk71atANlVEliefTAOK5ULSfUsxIbVcMYD87jh5+kPIOjIdtgNyoayuAo tq3qMDEULOf82cc3lk8tuTS9nuDgNyo4GlC5wZmP6gR1LPjvyJ94Kw3dPnZw0TQGuG4LsbiL 87fwbew+H/u/htFIrtJRZ6iLyXm6paLVeS/oiI+t5qK23CulQRrukoPD9IOaF8/ttm8t4sZJ OOhF3CHYVxB0qXkwIzxWvTDes10FfUuFLTveRBTvSEPpqFvnrSFL/hGVSkL0YMkFulfJ1Nq5 KYydg80dDufpbyn6rfrTMNiiZF2RCXrFNt3VnBIyDjYCbAtQIzZQrWM7thdtNsyrpkQR7CEP ZNfMGcxKkSbC/FMEg5/5JYWkeu2h3+5bzpCr1G9rqsr+WnDigd21dABNfKFJIbWFJkJxS50o Erq3XyoMBJLLeWF2BaA0nOju8zUzTnkDdd6+LqQqacx3Qz7KnYoIA0bUx63rOe0jma6WslDM AoE9yw2t68w+Ue3CN7nUHWQrHeaszYGVtFXEul87xuCooLL5y6JC25CSSROAOHKr+dvG2Zsj AXQ2Yq0W3o/69V5VE5x6J+ynxejYwJLElYYTjMmExov5onlio8820enoslYLIa5idj8GDfVy j+MrTQji7h7sfPnx5lX7nic3Wvy+8Ghohodo1yOAzn7tl8RiJuNPdTA1LTN0RpXwG91pHGlt WNMpcWR5ftm4XqlxH3UG7Vl8F1ECp+43NzgbbxHRcFJG9eFoSTLkWVsDNZWei9U3j4sI2OBX aMphStf5YVIIFyhZrJtboS6BqwClPa+RIW8B66NNYQXP/CdkTNrGwk3NSatM53FyhBwwcnTx 7/EGSpTMZrqIfs+l2fnLwvs+bQq2jo/1QvuqWPTlnyaPU6lTCfNE98taQLeBt3VGYvY+G396 chEDcKWxn13CaumCsUh2dJJfA9iwLlSLcyelvG7gcbYfVA7SDt8UKGLqV7jEqQ895loei7z1 inVcidlJJDX3yScQelWQhiPsI/SYKs= IronPort-HdrOrdr: A9a23:fTToYqNaVxtv/sBcTvWjsMiBIKoaSvp037BL7TEXdfUxSKelfq +V8sjzuSWUtN9uYgBDpTnwAtjlfVr67tpO7Y4deZ2iVA7gtG7AFvAF0WKK+VSJdxEWkNQ86U 5OScdD4bbLfD1HZKjBkWqF+55J+rO6GOrBv4rj80s= X-IronPort-AV: E=Sophos;i="5.96,212,1665460800"; d="scan'208";a="86249443" From: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= To: CC: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= , Christian Lindig , David Scott , Wei Liu , Anthony PERARD Subject: [PATCH v2 2/4] tools/ocaml/libs/xc: add binding to xc_evtchn_status Date: Fri, 2 Dec 2022 10:55:57 +0000 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 There is no API or ioctl to query event channel status, it is only present in xenctrl.h The C union is mapped to an OCaml variant exposing just the value from the correct union tag. The information provided here is similar to 'lsevtchn', but rather than parsing its output it queries the underlying API directly. Signed-off-by: Edwin Török Acked-by: Christian Lindig --- Changes since v1: * drop paragraph about where this is used * add comment about max port * use Xeneventchn.virq_t instead of int, add a dependency: xc -> eventchn * initialize struct without memset-ing first * use 2 CAMLreturn, I found an example in the OCaml stdlib that does that so should be future-proof https://github.com/ocaml/ocaml/blob/663e8d219f566095e3a9497c5bae07b6a95cae39/otherlibs/unix/dup_win32.c#L52-L77 * use Tag_some, defining it if needed * fix typo on failwith --- tools/ocaml/libs/Makefile | 2 +- tools/ocaml/libs/xc/META.in | 2 +- tools/ocaml/libs/xc/Makefile | 2 +- tools/ocaml/libs/xc/xenctrl.ml | 15 +++++++ tools/ocaml/libs/xc/xenctrl.mli | 15 +++++++ tools/ocaml/libs/xc/xenctrl_stubs.c | 67 +++++++++++++++++++++++++++++ 6 files changed, 100 insertions(+), 3 deletions(-) diff --git a/tools/ocaml/libs/Makefile b/tools/ocaml/libs/Makefile index 7e7c27e2d5..15f45a6d66 100644 --- a/tools/ocaml/libs/Makefile +++ b/tools/ocaml/libs/Makefile @@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk SUBDIRS= \ mmap \ xentoollog \ - xc eventchn \ + eventchn xc\ xb xs xl .PHONY: all diff --git a/tools/ocaml/libs/xc/META.in b/tools/ocaml/libs/xc/META.in index 2ff4dcb6bf..6a273936a3 100644 --- a/tools/ocaml/libs/xc/META.in +++ b/tools/ocaml/libs/xc/META.in @@ -1,5 +1,5 @@ version = "@VERSION@" description = "Xen Control Interface" -requires = "unix,xenmmap" +requires = "unix,xenmmap,xeneventchn" archive(byte) = "xenctrl.cma" archive(native) = "xenctrl.cmxa" diff --git a/tools/ocaml/libs/xc/Makefile b/tools/ocaml/libs/xc/Makefile index 3b76e9ad7b..1d9fecb06e 100644 --- a/tools/ocaml/libs/xc/Makefile +++ b/tools/ocaml/libs/xc/Makefile @@ -4,7 +4,7 @@ include $(OCAML_TOPLEVEL)/common.make CFLAGS += -I../mmap $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) CFLAGS += $(APPEND_CFLAGS) -OCAMLINCLUDE += -I ../mmap +OCAMLINCLUDE += -I ../mmap -I ../eventchn OBJS = xenctrl INTF = xenctrl.cmi diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 2ed7454b16..5dac47991e 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -267,6 +267,21 @@ external evtchn_alloc_unbound: handle -> domid -> domid -> int = "stub_xc_evtchn_alloc_unbound" external evtchn_reset: handle -> domid -> unit = "stub_xc_evtchn_reset" +(* FIFO has theoretical maximum of 2^28 ports, fits in an int *) +type evtchn_interdomain = { dom: domid; port: int} + +type evtchn_stat = + | EVTCHNSTAT_unbound of domid + | EVTCHNSTAT_interdomain of evtchn_interdomain + | EVTCHNSTAT_pirq of int + | EVTCHNSTAT_virq of Xeneventchn.virq_t + | EVTCHNSTAT_ipi + +type evtchn_status = { vcpu: int; status: evtchn_stat } + +external evtchn_status: handle -> domid -> int -> evtchn_status option = + "stub_xc_evtchn_status" + external readconsolering: handle -> string = "stub_xc_readconsolering" external send_debug_keys: handle -> string -> unit = "stub_xc_send_debug_keys" diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli index 0f80aafea0..6c9206bc74 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -206,6 +206,21 @@ external shadow_allocation_get : handle -> domid -> int external evtchn_alloc_unbound : handle -> domid -> domid -> int = "stub_xc_evtchn_alloc_unbound" external evtchn_reset : handle -> domid -> unit = "stub_xc_evtchn_reset" + +type evtchn_interdomain = { dom: domid; port: int} + +type evtchn_stat = + | EVTCHNSTAT_unbound of domid + | EVTCHNSTAT_interdomain of evtchn_interdomain + | EVTCHNSTAT_pirq of int + | EVTCHNSTAT_virq of Xeneventchn.virq_t + | EVTCHNSTAT_ipi + +type evtchn_status = { vcpu: int; status: evtchn_stat } + +external evtchn_status: handle -> domid -> int -> evtchn_status option = + "stub_xc_evtchn_status" + external readconsolering : handle -> string = "stub_xc_readconsolering" external send_debug_keys : handle -> string -> unit = "stub_xc_send_debug_keys" external physinfo : handle -> physinfo = "stub_xc_physinfo" diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c index d30585f21c..a492ea17fd 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -44,6 +44,10 @@ #define Val_none (Val_int(0)) #endif +#ifndef Tag_some +#define Tag_some 0 +#endif + #define string_of_option_array(array, index) \ ((Field(array, index) == Val_none) ? NULL : String_val(Field(Field(array, index), 0))) @@ -641,6 +645,69 @@ CAMLprim value stub_xc_evtchn_reset(value xch, value domid) CAMLreturn(Val_unit); } +CAMLprim value stub_xc_evtchn_status(value xch, value domid, value port) +{ + CAMLparam3(xch, domid, port); + CAMLlocal4(result, result_status, stat, interdomain); + xc_evtchn_status_t status = { + .dom = _D(domid), + .port = Int_val(port), + }; + int rc; + + caml_enter_blocking_section(); + rc = xc_evtchn_status(_H(xch), &status); + caml_leave_blocking_section(); + + if ( rc < 0 ) + failwith_xc(_H(xch)); + + if ( status.status == EVTCHNSTAT_closed ) + CAMLreturn(Val_none); + + switch ( status.status ) + { + case EVTCHNSTAT_unbound: + stat = caml_alloc(1, 0); /* 1st non-constant constructor */ + Store_field(stat, 0, Val_int(status.u.unbound.dom)); + break; + + case EVTCHNSTAT_interdomain: + interdomain = caml_alloc_tuple(2); + Store_field(interdomain, 0, Val_int(status.u.interdomain.dom)); + Store_field(interdomain, 1, Val_int(status.u.interdomain.port)); + stat = caml_alloc(1, 1); /* 2nd non-constant constructor */ + Store_field(stat, 0, interdomain); + break; + case EVTCHNSTAT_pirq: + stat = caml_alloc(1, 2); /* 3rd non-constant constructor */ + Store_field(stat, 0, Val_int(status.u.pirq)); + break; + + case EVTCHNSTAT_virq: + stat = caml_alloc(1, 3); /* 4th non-constant constructor */ + Store_field(stat, 0, Val_int(status.u.virq)); + break; + + case EVTCHNSTAT_ipi: + stat = Val_int(0); /* 1st constant constructor */ + break; + + default: + caml_failwith("Unknown evtchn status"); + + } + result_status = caml_alloc_tuple(2); + Store_field(result_status, 0, Val_int(status.vcpu)); + Store_field(result_status, 1, stat); + + /* caml_alloc_some is missing in older versions of OCaml + */ + result = caml_alloc_small(1, Tag_some); + Store_field(result, 0, result_status); + + CAMLreturn(result); +} CAMLprim value stub_xc_readconsolering(value xch) { From patchwork Fri Dec 2 10:55:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= X-Patchwork-Id: 13062628 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3051C47089 for ; Fri, 2 Dec 2022 10:57:02 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.451791.709574 (Exim 4.92) (envelope-from ) id 1p13ip-0004Ao-3b; Fri, 02 Dec 2022 10:56:47 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 451791.709574; Fri, 02 Dec 2022 10:56:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p13io-0004Ag-Vw; Fri, 02 Dec 2022 10:56:46 +0000 Received: by outflank-mailman (input) for mailman id 451791; Fri, 02 Dec 2022 10:56:46 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p13in-0003rQ-Rj for xen-devel@lists.xenproject.org; Fri, 02 Dec 2022 10:56:45 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 02088ada-7230-11ed-91b6-6bf2151ebd3b; Fri, 02 Dec 2022 11:56:43 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 02088ada-7230-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1669978603; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/QgjMO2gIB8QWUK5sjC9SR0sZ2xWrGexC5cYmAhj6F4=; b=IcR0B3Tbf5MWEM+QbsGobvstwY9iTYwZyFdjC9VSBXojNM9Sxnoo4edG ivq2lZI9banzy9JaGl63sc73WHXEVib+OyoDa3ARTF3LwX8ji1/sXKNP7 zPD6Mi5h7Eq6mKUDyABUUXG3BuOv3wyIaZQ/ts/DQpWmNHzvlOxWuOHpq 4=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 86240596 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:G4HeNat/U8aAxXcQb5bfg3KsNufnVF5eMUV32f8akzHdYApBsoF/q tZmKT+Fa63bZmSkL90kaomy/E0HsZ7WnNBrTFRorHoyRiNE+JbJXdiXEBz9bniYRiHhoOCLz O1FM4Wdc5pkJpP4jk3wWlQ0hSAkjclkfpKlVKiffHg0HVU/IMsYoUoLs/YjhYJ1isSODQqIu Nfjy+XSI1bg0DNvWo4uw/vrRChH4bKj5lv0gnRkPaoR5QWGzSFPZH4iDfrZw0XQE9E88tGSH 44v/JnhlkvF8hEkDM+Sk7qTWiXmlZaLYGBiIlIPM0STqkAqSh4ai87XB9JFAatjsB2bnsgZ9 Tl4ncfYpTHFnEH7sL91vxFwS0mSNEDdkVPNCSDXXce7lyUqf5ZwqhnH4Y5f0YAwo45K7W9yG fMweCIWZTWPnOCK5rfqQ8tx1997PeDNM9ZK0p1g5Wmx4fcORJnCR+PB5MNC3Sd2jcdLdRrcT 5NHM3w1Nk2GOkARfAdMYH49tL7Aan3XfjFGqVTTua0t5Gv7xw1tyrn9dtHSf7RmQO0FwBzE/ j+XoQwVBDkKOIyR8iaO0Evvj//2nQPFdY00L+a3o6sCbFq7mTVIVUx+uUGAiem0jAuyVsxSL 2QQ+zEytu4i+UqzVN7/Uhak5nmesXY0V9NOHsUg5QqKy66S5ByWbkAbShZRZdpgs9U5LQHGz XfQwYmvX2Y29uTIFzTNrd94sA9eJwBFP3QJQCMfTzcj5ojqgpxilUreZ/BsRfvdYsLOJRn8x DWDrS4bjroVjNIW26jTwW0rkw5AtbCSEFdru1y/snaNq1ogOdX7P9DABU3zt64oEWqPcrWWU JHoceC65ftGM5yCnTflrA4lTODwvKbt3NExbDdS83gdG9aFoSbLkWN4umsWyKJV3iEsJ1fUj Lf741852XOqFCLCgVVLS4ywEd826qPrCM7oUPvZBvIXPMYgJVbWong1OxfNt4wIrKTLufhvU ap3jO72VSpKYUiZ5GXeqxghPU8DmXllmDK7qWHTxBW7y7uODEN5up9cWGZimtsRtfveyC2Mq oY3Cid/40kHOAEISnWNoNF7wJFjBSRTOK0aXOQMKbTeclA7Qz97YxITqJt4E7FYc21uvr+g1 hmAtoVwkQKm7ZEbAW1mskxeVY4= IronPort-HdrOrdr: A9a23:HjWhT6CUP2uayUrlHemU55DYdb4zR+YMi2TC1yhKJyC9Ffbo7v xG/c5rsyMc5wxwZJhNo7y90ey7MBbhHP1OkO4s1NWZLWrbUQKTRekIh+bfKn/baknDH4ZmpN 9dmsNFaeEYY2IUsS+D2njbL+od X-IronPort-AV: E=Sophos;i="5.96,212,1665460800"; d="scan'208";a="86240596" From: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= To: CC: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= , Christian Lindig , David Scott , Wei Liu , Anthony PERARD Subject: [PATCH v2 3/4] tools/ocaml/libs/xc: add hvm_param_get binding Date: Fri, 2 Dec 2022 10:55:58 +0000 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Not to be confused which hvm_get_param, which also exists and has a different, more error-prone interface. This one always returns a 64-bit value, and that is retained in the OCaml binding as well, returning 'int64' (and not int, or nativeint which might have a different size). The integer here is unsigned in the C API, however OCaml only has signed integers. No bits are lost, it is just a matter of interpretation when printing and for certain arithmetic operations, however in the cases where the MSB is set it is very likely that the value is an address and no arithmetic should be performed on the OCaml side on it. (this is not a new problem with this binding, but worth mentioning given the difference in types) Signed-off-by: Edwin Török Reviewed-by: Andrew Cooper Acked-by: Christian Lindig --- Changes since v1: * drop accidental extra numbers in variant names * use 'val' instead of 'result' for local var * add binding for hvm_param_set --- tools/ocaml/libs/xc/xenctrl.ml | 47 ++++++++++++++++++++++++++++ tools/ocaml/libs/xc/xenctrl.mli | 48 +++++++++++++++++++++++++++++ tools/ocaml/libs/xc/xenctrl_stubs.c | 32 +++++++++++++++++++ 3 files changed, 127 insertions(+) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 5dac47991e..370dac3fc8 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -299,6 +299,53 @@ external map_foreign_range: handle -> domid -> int -> nativeint -> Xenmmap.mmap_interface = "stub_map_foreign_range" +type hvm_param = + | HVM_PARAM_CALLBACK_IRQ + | HVM_PARAM_STORE_PFN + | HVM_PARAM_STORE_EVTCHN + | HVM_PARAM_UNDEF_3 + | HVM_PARAM_PAE_ENABLED + | HVM_PARAM_IOREQ_PFN + | HVM_PARAM_BUFIOREQ_PFN + | HVM_PARAM_UNDEF_7 + | HVM_PARAM_UNDEF_8 + | HVM_PARAM_VIRIDIAN + | HVM_PARAM_TIMER_MODE0 + | HVM_PARAM_HPET_ENABLED1 + | HVM_PARAM_IDENT_PT2 + | HVM_PARAM_UNDEF_13 + | HVM_PARAM_ACPI_S_STATE + | HVM_PARAM_VM86_TSS + | HVM_PARAM_VPT_ALIGN + | HVM_PARAM_CONSOLE_PFN + | HVM_PARAM_CONSOLE_EVTCHN + | HVM_PARAM_ACPI_IOPORTS_LOCATION + | HVM_PARAM_MEMORY_EVENT_CR0 + | HVM_PARAM_MEMORY_EVENT_CR3 + | HVM_PARAM_MEMORY_EVENT_CR4 + | HVM_PARAM_MEMORY_EVENT_INT3 + | HVM_PARAM_NESTEDHVM + | HVM_PARAM_MEMORY_EVENT_SINGLE_STEP + | HVM_PARAM_UNDEF_26 + | HVM_PARAM_PAGING_RING_PFN + | HVM_PARAM_MONITOR_RING_PFN + | HVM_PARAM_SHARING_RING_PFN + | HVM_PARAM_MEMORY_EVENT_MSR + | HVM_PARAM_TRIPLE_FAULT_REASON + | HVM_PARAM_IOREQ_SERVER_PFN + | HVM_PARAM_NR_IOREQ_SERVER_PAGES + | HVM_PARAM_VM_GENERATION_ID_ADDR + | HVM_PARAM_ALTP2M + | HVM_PARAM_X87_FIP_WIDTH6 + | HVM_PARAM_VM86_TSS_SIZED + | HVM_PARAM_MCA_CAP + +external hvm_param_get: handle -> domid -> hvm_param -> int64 + = "stub_xc_hvm_param_get" + +external hvm_param_set: handle -> domid -> hvm_param -> int64 -> unit + = "stub_xc_hvm_param_set" + external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit = "stub_xc_domain_assign_device" external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli index 6c9206bc74..e18d5cddb7 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -236,6 +236,54 @@ external map_foreign_range : handle -> domid -> int -> nativeint -> Xenmmap.mmap_interface = "stub_map_foreign_range" +(* needs to be sorted according to its numeric value, watch out for gaps! *) +type hvm_param = + | HVM_PARAM_CALLBACK_IRQ + | HVM_PARAM_STORE_PFN + | HVM_PARAM_STORE_EVTCHN + | HVM_PARAM_UNDEF_3 + | HVM_PARAM_PAE_ENABLED + | HVM_PARAM_IOREQ_PFN + | HVM_PARAM_BUFIOREQ_PFN + | HVM_PARAM_UNDEF_7 + | HVM_PARAM_UNDEF_8 + | HVM_PARAM_VIRIDIAN + | HVM_PARAM_TIMER_MODE0 + | HVM_PARAM_HPET_ENABLED1 + | HVM_PARAM_IDENT_PT2 + | HVM_PARAM_UNDEF_13 + | HVM_PARAM_ACPI_S_STATE + | HVM_PARAM_VM86_TSS + | HVM_PARAM_VPT_ALIGN + | HVM_PARAM_CONSOLE_PFN + | HVM_PARAM_CONSOLE_EVTCHN + | HVM_PARAM_ACPI_IOPORTS_LOCATION + | HVM_PARAM_MEMORY_EVENT_CR0 + | HVM_PARAM_MEMORY_EVENT_CR3 + | HVM_PARAM_MEMORY_EVENT_CR4 + | HVM_PARAM_MEMORY_EVENT_INT3 + | HVM_PARAM_NESTEDHVM + | HVM_PARAM_MEMORY_EVENT_SINGLE_STEP + | HVM_PARAM_UNDEF_26 + | HVM_PARAM_PAGING_RING_PFN + | HVM_PARAM_MONITOR_RING_PFN + | HVM_PARAM_SHARING_RING_PFN + | HVM_PARAM_MEMORY_EVENT_MSR + | HVM_PARAM_TRIPLE_FAULT_REASON + | HVM_PARAM_IOREQ_SERVER_PFN + | HVM_PARAM_NR_IOREQ_SERVER_PAGES + | HVM_PARAM_VM_GENERATION_ID_ADDR + | HVM_PARAM_ALTP2M + | HVM_PARAM_X87_FIP_WIDTH6 + | HVM_PARAM_VM86_TSS_SIZED + | HVM_PARAM_MCA_CAP + +external hvm_param_get: handle -> domid -> hvm_param -> int64 + = "stub_xc_hvm_param_get" + +external hvm_param_set: handle -> domid -> hvm_param -> int64 -> unit + = "stub_xc_hvm_param_set" + external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit = "stub_xc_domain_assign_device" external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c index a492ea17fd..d042edb495 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -1178,6 +1178,38 @@ CAMLprim value stub_xc_domain_irq_permission(value xch, value domid, CAMLreturn(Val_unit); } +CAMLprim value stub_xc_hvm_param_get(value xch, value domid, value param) +{ + CAMLparam3(xch, domid, param); + uint64_t val; + int ret; + + caml_enter_blocking_section(); + ret = xc_hvm_param_get(_H(xch), _D(domid), Int_val(param), &val); + caml_leave_blocking_section(); + + if ( ret ) + failwith_xc(_H(xch)); + + CAMLreturn(caml_copy_int64(val)); +} + +CAMLprim value stub_xc_hvm_param_set(value xch, value domid, value param, value val) +{ + CAMLparam4(xch, domid, param, val); + int ret; + + caml_enter_blocking_section(); + ret = xc_hvm_param_set(_H(xch), _D(domid), Int_val(param), Int64_val(val)); + caml_leave_blocking_section(); + + if ( ret ) + failwith_xc(_H(xch)); + + CAMLreturn(Val_unit); +} + + static uint32_t encode_sbdf(int domain, int bus, int dev, int func) { return ((uint32_t)domain & 0xffff) << 16 | From patchwork Fri Dec 2 10:55:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= X-Patchwork-Id: 13062634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28956C4321E for ; Fri, 2 Dec 2022 11:04:04 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.451830.709623 (Exim 4.92) (envelope-from ) id 1p13pf-0008Un-O8; Fri, 02 Dec 2022 11:03:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 451830.709623; Fri, 02 Dec 2022 11:03:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p13pf-0008Ug-LK; Fri, 02 Dec 2022 11:03:51 +0000 Received: by outflank-mailman (input) for mailman id 451830; Fri, 02 Dec 2022 11:03:51 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p13jX-0005B6-Vi for xen-devel@lists.xenproject.org; Fri, 02 Dec 2022 10:57:32 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 15f668ba-7230-11ed-8fd2-01056ac49cbb; Fri, 02 Dec 2022 11:57:23 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 15f668ba-7230-11ed-8fd2-01056ac49cbb DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1669978650; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UY5V1ztvLDHDeM6oRGbllgDT8thJsbWRrKuqMI5IDOE=; b=aADnUJYBoV5l3PmH4WogsKtAJ2htxGZ8GEfiSHHvipDRUbrQvZPNOUyS MZk/skEuW6ywvOdyN4u3NJWpsbAbKIJB3NT9kSd/6XrxxQ48jdO7f7f1Q fOzhngvRO+6ZD+pPWTQ/0sUCuUD/k7sGQOYUENZQsI4mI1/MuY5R9EMfy A=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 4.0 X-MesageID: 88766325 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:h7whramvFpViImZ7eQqQgGbo5gyJJkRdPkR7XQ2eYbSJt1+Wr1Gzt xJKD2iOMv/cY2rwKdkjPd7n9RkDuJHRn9YwTQA9pH80HyMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icf3grHmeIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE4p7aqaVA8w5ARkP6kR5AWGzRH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 dlGEmkUMzGevd2/xevmFsNLu/4AMNa+aevzulk4pd3YJfMvQJSFSKTW/95Imjw3g6iiH96HO ZBfM2A2Kk2dPVsfYT/7C7pn9AusrnTzbTxe7k6Sv600y2PS0BZwwP7mN9+9ltmiFZUKwBjD/ D+uE2LRPzQeNNCx0TO/40mSjMDChTLqBtoLPejtnhJtqALKnTFCYPEMbnOrrP/8hkOgVtZ3L 00P5jFovaU07FasTNT2Q1u/unHslhIVRdd4CeAx7wCJjK3O7G6xGWwsXjNHLts8u6cLqScCj wHT2YmzXHo27ePTGSn1GqqoQS2aHHYvdHZfRDI+cgIAuoS/iqYOtDHTUYM2eEKqteHdFTb1y jGMiSExgbQPkMIGv5mGEUD7byGE/caQEFNsjunDdif8t14iOtb5D2C9wQKDhcusOrp1WbVoU JIsv8GFpN4DApiW/MBmaLVcRer5jxpp3dC1vLKOI3XD3271k5JAVdoKiN2bGKuOGphsRNMRS BWP0T69HbcKVJdQUYd5YpiqF+MhxrX6GNLuW5j8N4QQM8koJVHep383OCZ8OlwBd2B1wckC1 WqzK57wXR7294w4pNZJewvt+eBynX1vrY8ibZv60w6mwdKjiI29EN843K+1Rrlhtsus+VyFm +uzwuPWk32zpsWiOHiImWPSRHhWRUUG6Wfe8JMNK77Zf1E4QgnMyZb5mNscRmCspIwN/s+gw 513chQEkjITWVWvxd22V01e IronPort-HdrOrdr: A9a23:c3YxjKzE1kqWzBQM45gCKrPw6L1zdoMgy1knxilNoHxuH/Bw9v re+cjzsCWftN9/Yh4dcLy7VpVoIkmsl6Kdg7NwAV7KZmCP1FdARLsI0WKI+UyCJ8SRzI9gPa cLSdkFNDXzZ2IK8PoTNmODYqodKNrsytHWuQ/HpU0dKT2D88tbnn9E4gDwKDwQeCB2QaAXOb C7/cR9qz+paR0sH7+G7ilsZZmkmzXT/qiWGCI7Ow== X-IronPort-AV: E=Sophos;i="5.96,212,1665460800"; d="scan'208";a="88766325" From: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= To: CC: =?utf-8?b?RWR3aW4gVMO2csO2aw==?= , Christian Lindig , David Scott , Wei Liu , Anthony PERARD Subject: [PATCH v2 4/4] tools/ocaml: add .clang-format Date: Fri, 2 Dec 2022 10:55:59 +0000 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add a .clang-format configuration that tries to match CODING_STYLE where possible. I was not able to express the special casing of braces after 'do' though, this can only be controlled generally for all control statements. It is imperfect, but should be better than the existing bindings, which do not follow Xen coding style. Add this to tools/ocaml first because: * there are relatively few C files here, and it is a good place to start with * it'd be useful to make these follow Xen's CODING_STYLE (which they currently do not because they use tabs for example) * they change relatively infrequently, so shouldn't cause issues with backporting security fixes (could either backport the reindentation patch too, or use git cherry-pick with `-Xignore-space-change`) Does not yet reformat any code. No functional change. Signed-off-by: Edwin Török Acked-by: Christian Lindig --- Changes since v1: * change commit title to reflect this is for OCaml subtree only * don't mention stdint.h here, that may be fixed in a different way elsewhere --- tools/ocaml/.clang-format | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tools/ocaml/.clang-format diff --git a/tools/ocaml/.clang-format b/tools/ocaml/.clang-format new file mode 100644 index 0000000000..7ff88ee043 --- /dev/null +++ b/tools/ocaml/.clang-format @@ -0,0 +1,9 @@ +BasedOnStyle: GNU +IndentWidth: 4 + +# override GNU to match Xen ../../CODING_STYLE more closely +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +SpacesInConditionalStatement: true +SpaceBeforeParens: ControlStatements +BreakBeforeBraces: Allman