From nobody Mon Nov 23 22:40:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=vates.tech ARC-Seal: i=1; a=rsa-sha256; t=1792658433; cv=none; d=zohomail.com; s=zohoarc; b=LgWtv/uZ0qvj53JC+YqrbKuh913W2qRbjHGCeA+OHh0uFAtwiCoIamvyJyZPMO52xufFVPjlDLFlzgd7WYs5KAq10de9KNf5KZt2R34Wh39q+02JmgEE2rNmbc0Jk5V+1AlQ1wGZF0rB6SZ5vATZT5CnGD7D0qS+4L2V8Yvg8UM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792658433; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VNulx1bCrzh3vCxQgjHzJKXhADx3kPT4J+dx0mPyvrk=; b=iTiTLwNK59VZBB3Lg7K8zrh20/GvyNek0t0YwDHmfF+AQ1qtxP5gY2+Fu5HuFtK4ZJs45qqHbVuzijXCsDx0nJMHtHS74AifmxCgRTdFkCdJ+uRYWXHt41YqeXxj8GfiFd0gEwGiYCK8SQ3aQ9eqU2xM0gGB3PKMc3AaDTU4zjk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1792658433723150.6254669352553; Thu, 22 Oct 2026 01:40:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1457871.1670377 (Exim 4.92) (envelope-from ) id 1xJoLS-0000Lt-WF; Thu, 22 Oct 2026 08:40:19 +0000 Received: by outflank-mailman (output) from mailman id 1457871.1670377; Thu, 22 Oct 2026 08:40:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xJoLS-0000Lm-TU; Thu, 22 Oct 2026 08:40:18 +0000 Received: by outflank-mailman (input) for mailman id 1457871; Thu, 22 Oct 2026 08:40:17 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xJoLR-0000Lg-N5 for xen-devel@lists.xenproject.org; Thu, 22 Oct 2026 08:40:17 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xJoLQ-0067Xm-Sv for xen-devel@lists.xenproject.org; Thu, 22 Oct 2026 10:40:16 +0200 Received: from [10.42.69.3] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ad9cbee-8faa-0a2a0a5109dd-0a2a4503ca14-10 for ; Thu, 22 Oct 2026 10:40:16 +0200 Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net) by tlsNG-33051d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ad9cbf0-fae8-0a2a45030019-b9ff1c22b46f-3 for ; Thu, 22 Oct 2026 10:40:16 +0200 Received: from mail2.vates.fr ([37.26.189.201] mail2.vates.fr) (Authenticated sender: 8631fc262581453bbf619ec5b2062170/smtp/7773de5a-2839-4720-82ee-e06722ae1d3e) by prod-mta-13-01.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id 1a162c493a1000f79f.002 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 22 Oct 2026 08:40:12 +0000 Received: from julian.home (82-67-211-29.subs.proxad.net [82.67.211.29]) (Authenticated sender: julian.vetter@vates.tech) by mail2.vates.fr (Postfix) with ESMTPSA id 9468881AD1; Thu, 22 Oct 2026 10:40:11 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; q=dns/txt; s=selector1; bh=VNulx1bCrzh3vCxQgjHzJKXhADx3kPT4J+dx0mPyvrk=; h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references:feedback-id; b=T5u+tLMcutQbUyz/3RzVCeK6aH83ijK1+ywdqLWfALK3HOy8XkAoM7EfuT1I7Qk0kzwXx1xaP tZwST/AxyLlwtJRk9+vlquLNhPcMBp/tlqcxQhJeGGGx4TQVmC3/+JO2vJqlMglNj5m7WKMaqNc tyJ93RQMCuGJDsYUk7sKaNPuyRXbPbxgBq3N2agOHgRLu4Y6rtQ0H7VnKZI0E0Ow7LYw3l9g5bP 0sk+yn60Co43NfHpwXEQ47rWe0WrtEBD3anMa0qkCVIUQ4qexa4QhtVj2Y4QxQlxYc+8tLImObz fhfgLzG33+hE2UOIVQE2RNlZHIuWkWRl8DunFfQuDjrQ== X-Zone-Loop: 5d41ae2aaa3941fc047d6f4a1b62fcbdcf1f5a2f86b6 x-campaign-type: default x-transaction-id: 376ad652-e5a2-433e-af6f-165e3bdeaf6f x-swg-uid: 01-89d541bb-a469-4923-98b6-66337ef28a97 X-Mailer: Sweego Message-ID: <1792658412.8631fc262581453bbf619ec5b2062170.1a162c493a1000f79f@vates.tech> x-swg-bid: 1792658412.8631fc262581453bbf619ec5b2062170.1a162c493a1000f79f Feedback-ID: default:8631fc262581453bbf619ec5b2062170:Sweego x-campaign-id: default x-client-id: 8631fc262581453bbf619ec5b2062170 X-Originating-IP: [37.26.189.201] From: Julian Vetter To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , Andrii Sultanov , Guillaume Thouvenin , Anthony PERARD , Julian Vetter Subject: [PATCH v2 1/1] tools/ocaml: implement stub_xc_domain_create() for ARM Date: Thu, 22 Oct 2026 10:40:06 +0200 In-Reply-To: <1792658248.8631fc262581453bbf619ec5b2062170.1a162c2110b000f79f@vates.tech> References: <1792658248.8631fc262581453bbf619ec5b2062170.1a162c2110b000f79f@vates.tech> MIME-Version: 1.0 X-BM-Disclaimer: Yes Content-Type: multipart/alternative; boundary="-=Part.ea.1ddfb3026dc806c1.1a162c4919c.2982aacf828e1b70=-" X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1792658411933 X-purgate-ID: tlsNG-33051d/1792658416-6DED24E9-D503E236/0/0 X-purgate-type: clean X-purgate-size: 2831 X-ZohoMail-DKIM: pass (identity @vates.tech) X-ZM-MESSAGEID: 1792658437404158500 ---=Part.ea.1ddfb3026dc806c1.1a162c4919c.2982aacf828e1b70=- Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Andrii Sultanov stub_xc_domain_create() fails unconditionally with "Unhandled: ARM" for the ARM variant of arch_domainconfig, so no OCaml toolstack (e.g. xenopsd) can create an ARM domain. To fix this, convert the two fields of xen_arm_arch_domainconfig, gic_version and nr_spis, into the corresponding fields of struct xen_arch_domainconfig and reject values that do not fit, as is already done for other parameters. The remaining fields (sve_vl, tee_type, arm_sci_type and v8r_el1_msa) aren't exposed to OCaml yet, so they stay zero. Also add a BUILD_BUG_ON() on the size of the createdomain struct, just like the x86 case, to catch future ABI changes. Signed-off-by: Andrii Sultanov Signed-off-by: Julian Vetter Reviewed-by: Andrew Cooper --- Changes in v2: - Reduce comment to just /* ARM */ - Use narrow types with Long_val() to detect truncation --- tools/ocaml/libs/xc/xenctrl_stubs.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index 180f2fbf45..c15a3428da 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -257,8 +257,34 @@ CAMLprim value stub_xc_domain_create(value xch_val, va= lue wanted_domid, value co arch_domconfig =3D Field(VAL_ARCH, 0); switch ( Tag_val(VAL_ARCH) ) { - case 0: /* ARM - nothing to do */ + case 0: /* ARM */ +#if defined(__arm__) || defined(__aarch64__) + { + /* Quick & dirty check for ABI changes. */ + BUILD_BUG_ON(sizeof(cfg) !=3D 72); + + /* Mnemonics for the named fields inside xen_arm_arch_domainconfig */ +#define VAL_GIC_VERSION Field(arch_domconfig, 0) +#define VAL_NR_SPIS Field(arch_domconfig, 1) + + uint8_t gic_version =3D Long_val(VAL_GIC_VERSION); + uint32_t nr_spis =3D Long_val(VAL_NR_SPIS); + + if ( gic_version !=3D Long_val(VAL_GIC_VERSION) ) + caml_invalid_argument("gic_version"); + + if ( nr_spis !=3D Long_val(VAL_NR_SPIS) ) + caml_invalid_argument("nr_spis"); + + cfg.arch.gic_version =3D gic_version; + cfg.arch.nr_spis =3D nr_spis; + +#undef VAL_NR_SPIS +#undef VAL_GIC_VERSION + } +#else caml_failwith("Unhandled: ARM"); +#endif break; =20 case 1: /* X86 - emulation flags in the block */ --=20 2.53.0 --=20 Julian Vetter | Vates Hypervisor & Kernel Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ---=Part.ea.1ddfb3026dc806c1.1a162c4919c.2982aacf828e1b70=---