From nobody Thu Nov 5 07:33:59 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=1793369355; cv=none; d=zohomail.com; s=zohoarc; b=IyHhCsrDh9sHAAj2Lse0CC8pHYmtkhu5kpIz1U/xQaC5vSkFJTSGTTyn8En/GKEesaRWSr6vOU8RKbyZVadD34SSxt4GegG57oivW7N0yLlhjGpCnogJnRVNmV9A0W4Zj8FRis8XeP+F9N+2Nrvji2IPi0DrTIbL5TLRdh07/Bc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793369355; 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=I0GWl54gYW9YA5U403LKvyRlmOrgH7YQjnZvSskAg7I=; b=S5dcaclGxqCjbtmMf/e+JX2SknO8r6X0sTFxbOYNS/rbi3nPqCJl2UGrfkm58TTjT4C5rKSkcfh041X5CLGcSlpEJdlc7Ic21nXr2S3h0s06EQTK5p2hUbHsABgojacQ/5nENMBlFq2vZdUxR7iqw1rfP78l1lQDXXyigPA4lIk= 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 179336935504634.774110929001154; Fri, 30 Oct 2026 07:09:15 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1465713.1676173 (Exim 4.92) (envelope-from ) id 1xMnHt-0008Js-Cj; Fri, 30 Oct 2026 14:08:57 +0000 Received: by outflank-mailman (output) from mailman id 1465713.1676173; Fri, 30 Oct 2026 14:08:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xMnHt-0008Jl-9x; Fri, 30 Oct 2026 14:08:57 +0000 Received: by outflank-mailman (input) for mailman id 1465713; Fri, 30 Oct 2026 14:08:55 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xMnHr-0008JZ-Nl for xen-devel@lists.xenproject.org; Fri, 30 Oct 2026 14:08:55 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xMnHr-000Afr-4P for xen-devel@lists.xenproject.org; Fri, 30 Oct 2026 15:08:55 +0100 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ae4a4f3-8faa-0a2a0a5109dd-0a2a450c83b6-10 for ; Fri, 30 Oct 2026 15:08:55 +0100 Received: from [185.255.28.18] (helo=prod-mta-13.swg-srv.net) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ae4a4f6-f479-0a2a450c0019-b9ff1c1298d7-3 for ; Fri, 30 Oct 2026 15:08:55 +0100 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.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id 1a18d245cab000cae1.003 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 30 Oct 2026 14:08:52 +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 BFD4781C1D; Fri, 30 Oct 2026 15:08:51 +0100 (CET) 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=I0GWl54gYW9YA5U403LKvyRlmOrgH7YQjnZvSskAg7I=; h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references:feedback-id; b=W2ddJ4AU/BwUQLzbUn8/X/1eLDrwMkFQBzGYotnB9e11Qbg2gwucBfK7mnpqmyDWiRrXjMLhb zmX+z8bw8Oa7LRMtvI45yZW1BxIL9c56Y+Cy8E0VP+i0tbMiOIFOVwGRK+sVbE+mKfbjC+9JyQR nOm5MG44yoMJm5tPuEbs953bMzwBIRO/+fWXfQa/NNdu+fJwQyfOFja0lGP4REZQlTf9+v8WXru HseFEIjVO2MGBQJaRjDW/CeicZG3XhezBDBsx5SEhFRaSYpcMbQiCPthbGO9XmovGw5K+0usDD6 ZkbH/WunSr/z2rc9KL8u22lQRyYYB8DjDP5agwB5CJFg== X-Zone-Loop: 96153a55cb84203ebdffed98da797e3e1eca41511439 x-campaign-type: default x-transaction-id: 89358555-8257-477e-aad6-ad1c66c61ed5 x-swg-uid: 01-a9c21b65-f16e-4d30-968f-dc6cf764c965 X-Mailer: Sweego Message-ID: <1793369332.8631fc262581453bbf619ec5b2062170.1a18d245cab000cae1@vates.tech> x-swg-bid: 1793369332.8631fc262581453bbf619ec5b2062170.1a18d245cab000cae1 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 , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Michal Orzel , Julian Vetter Subject: [PATCH 1/4] tools/ocaml: expose the supported guest GIC versions in physinfo Date: Fri, 30 Oct 2026 15:08:44 +0100 In-Reply-To: <1793369135.8631fc262581453bbf619ec5b2062170.1a18d215a7f000cae1@vates.tech> References: <1793369135.8631fc262581453bbf619ec5b2062170.1a18d215a7f000cae1@vates.tech> MIME-Version: 1.0 X-BM-Disclaimer: Yes Content-Type: multipart/alternative; boundary="-=Part.333.dcc6e9d84d26e262.1a18d245a2b.4ee1619b60fdcd0a=-" X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1793369332268 X-purgate-ID: tlsNG-d25034/1793369335-01CC3A5B-1A50D061/0/0 X-purgate-type: clean X-purgate-size: 3009 X-ZohoMail-DKIM: pass (identity @vates.tech) X-ZM-MESSAGEID: 1793369357739158500 ---=Part.333.dcc6e9d84d26e262.1a18d245a2b.4ee1619b60fdcd0a=- Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since XEN_DOMCTL_CONFIG_GIC_NATIVE was removed, the toolstack has to choose a concrete GIC_V2 or GIC_V3 version itself when creating an ARM domain. libxl and the Python bindings do so via XEN_SYSCTL_physinfo, but the OCaml physinfo stub only extracts the SVE vector length on ARM, so an OCaml toolstack has no way to select the GIC version. Add gic_v2 and gic_v3 to arm_physinfo_caps and populate them using arch_capabilities_arm_gic_v2/v3(), as is done for the Python bindings. Signed-off-by: Julian Vetter --- Changes in v2: - No changes --- tools/ocaml/libs/xc/xenctrl.ml | 2 ++ tools/ocaml/libs/xc/xenctrl.mli | 2 ++ tools/ocaml/libs/xc/xenctrl_stubs.c | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 582897af6d..37e41879bb 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -134,6 +134,8 @@ type physinfo_cap_flag =3D type arm_physinfo_caps =3D { sve_vl: int; + gic_v2: bool; + gic_v3: bool; } =20 type x86_physinfo_cap_flag diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.= mli index 9414b87164..7a0dd7d8ba 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -119,6 +119,8 @@ type physinfo_cap_flag =3D type arm_physinfo_caps =3D { sve_vl: int; + gic_v2: bool; + gic_v3: bool; } =20 type x86_physinfo_cap_flag diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index c15a3428da..e0c435e346 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -35,6 +35,7 @@ #define XC_WANT_COMPAT_MAP_FOREIGN_API #include #include +#include #include =20 #include "mmap_stubs.h" @@ -880,11 +881,15 @@ CAMLprim value physinfo_arch_caps(const xc_physinfo_t= *info) =20 tag =3D 0; /* tag ARM */ =20 - arch_obj =3D caml_alloc_tuple(1); + arch_obj =3D caml_alloc_tuple(3); =20 Store_field(arch_obj, 0, Val_int(MASK_EXTR(info->arch_capabilities, XEN_SYSCTL_PHYSCAP_ARM_SVE_MASK) * 128)); + Store_field(arch_obj, 1, + Val_bool(arch_capabilities_arm_gic_v2(info->arch_capabilities))); + Store_field(arch_obj, 2, + Val_bool(arch_capabilities_arm_gic_v3(info->arch_capabilities))); =20 #elif defined(__i386__) || defined(__x86_64__) =20 --=20 2.53.0 --=20 Julian Vetter | Vates Hypervisor & Kernel Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ---=Part.333.dcc6e9d84d26e262.1a18d245a2b.4ee1619b60fdcd0a=--- From nobody Thu Nov 5 07:33:59 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=1793369367; cv=none; d=zohomail.com; s=zohoarc; b=VC+9Nwta69i8jig7uYMiZon/mhXBs60fKF+HvZywUb70rupVkZnFkrQjqRkuSBMT7ALCw6JqueftktQfUKAOf1q9bIdbGzO/XKiDPPu2fD4z66LmrC2lr21jYi4KE9YF9QF/fZHzBlohiVzMAANi+bmYo/5FXlkzZRurc5uyrlE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793369367; 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=k92DauRa8Aq7sk1kAZZmTjvyGWcyOii8gIYs1IrbVOQ=; b=O8GhDM64mH2L/xDUVdVhHTgyf5524DtB+XvXR5qVui3rRPkKBpcPFReAyZb4Qt4TWB7WSIF0HpYrZzPjAEIRQjmnFGCj1/P/dfUExyjEewPIJCwNc8wNEtB4VTIQSobsPwiGcem2aDtg4G49dLASDn59ikEKWJNbF2WAJ38F24s= 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 179336936764584.80920975364143; Fri, 30 Oct 2026 07:09:27 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1465714.1676182 (Exim 4.92) (envelope-from ) id 1xMnHu-0008WR-K1; Fri, 30 Oct 2026 14:08:58 +0000 Received: by outflank-mailman (output) from mailman id 1465714.1676182; Fri, 30 Oct 2026 14:08: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 1xMnHu-0008WI-HE; Fri, 30 Oct 2026 14:08:58 +0000 Received: by outflank-mailman (input) for mailman id 1465714; Fri, 30 Oct 2026 14:08:56 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xMnHs-0008Jf-DK for xen-devel@lists.xenproject.org; Fri, 30 Oct 2026 14:08:56 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xMnHr-000Afr-Q9 for xen-devel@lists.xenproject.org; Fri, 30 Oct 2026 15:08:55 +0100 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ae4a4f3-8faa-0a2a0a5109dd-0a2a450c83b6-14 for ; Fri, 30 Oct 2026 15:08:55 +0100 Received: from [185.255.28.18] (helo=prod-mta-13.swg-srv.net) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ae4a4f6-f479-0a2a450c0019-b9ff1c1298d7-4 for ; Fri, 30 Oct 2026 15:08:55 +0100 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.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id 1a18d245f17000cae1.003 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 30 Oct 2026 14:08:53 +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 96EEF82EC1; Fri, 30 Oct 2026 15:08:52 +0100 (CET) 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=k92DauRa8Aq7sk1kAZZmTjvyGWcyOii8gIYs1IrbVOQ=; h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references:feedback-id; b=jmeyNGCyNfpQSxIg64Bz4VRiU1Nlu/nxJirkrq/vXcTzsKHqLNtbe77f39TN6qiViUJgFrY94 /RDxJDSYydMdZAq+UnZIJnRho+FXt/5U9rELKmoAkaIrksGKK+IzpDkQQuaJFLqDTzCKMmBMhAG b67QxAnp11IZYzTEGvjJG0Wg5lvfVMKFqrf9VtFkeFK2+7Y7PiWBMr6UqrwZaEHmhFNgiumlWzo JFOLiNnaPSvoeunHAELx8+AsDuWWtpDe/KBT1y8KhOeqhJd0YaGIIFz5896JAC/yZPjE0eAjfUv Ph9gdB4ZOwc8EUv+PKmYfhxzt6JElEvOn8buTQuR8lKQ== X-Zone-Loop: 832c1f6d32c9db4b28ee4aa0e7a238a43bacfbc0fac7 x-campaign-type: default x-transaction-id: a06ed042-90e2-44be-9d0b-03f5893b6457 x-swg-uid: 01-a15a7726-933b-49ab-8ac6-a7d521099dbf X-Mailer: Sweego Message-ID: <1793369333.8631fc262581453bbf619ec5b2062170.1a18d245f17000cae1@vates.tech> x-swg-bid: 1793369333.8631fc262581453bbf619ec5b2062170.1a18d245f17000cae1 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 , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Michal Orzel , Julian Vetter Subject: [PATCH 2/4] tools/ocaml: add bindings for the paging mempool size Date: Fri, 30 Oct 2026 15:08:45 +0100 In-Reply-To: <1793369135.8631fc262581453bbf619ec5b2062170.1a18d215a7f000cae1@vates.tech> References: <1793369135.8631fc262581453bbf619ec5b2062170.1a18d215a7f000cae1@vates.tech> MIME-Version: 1.0 X-BM-Disclaimer: Yes Content-Type: multipart/alternative; boundary="-=Part.334.6bba1527ddbe6e60.1a18d245d6a.bf2e308db7509232=-" X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1793369333098 X-purgate-ID: tlsNG-d25034/1793369335-030D9A5B-68128364/0/0 X-purgate-type: clean X-purgate-size: 4422 X-ZohoMail-DKIM: pass (identity @vates.tech) X-ZM-MESSAGEID: 1793369369373154100 ---=Part.334.6bba1527ddbe6e60.1a18d245d6a.bf2e308db7509232=- Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The OCaml bindings only expose the shadow_allocation_{get,set} functions, which use XEN_DOMCTL_SHADOW_OP_{GET,SET}_ALLOCATION. These are x86-only, on ARM they fail with -ENOSYS. So, an OCaml toolstack has no way to size the P2M pool of an ARM domain, which libxl does via XEN_DOMCTL_set_paging_mempool_size. So, add a pair of functions paging_mempool_size_{get,set}, which just wrap xc_{get,set}_paging_mempool_size(). Signed-off-by: Julian Vetter --- Changes in v2: - Convert domid before blocking section - Check domid for truncation --- tools/ocaml/libs/xc/xenctrl.ml | 5 ++++ tools/ocaml/libs/xc/xenctrl.mli | 4 +++ tools/ocaml/libs/xc/xenctrl_stubs.c | 41 +++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 37e41879bb..55cfc2e9a2 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -283,6 +283,11 @@ external shadow_allocation_set: handle -> domid -> int= -> unit external shadow_allocation_get: handle -> domid -> int =3D "stub_shadow_allocation_get" =20 +external paging_mempool_size_set: handle -> domid -> int64 -> unit + =3D "stub_xc_set_paging_mempool_size" +external paging_mempool_size_get: handle -> domid -> int64 + =3D "stub_xc_get_paging_mempool_size" + external evtchn_alloc_unbound: handle -> domid -> domid -> int =3D "stub_xc_evtchn_alloc_unbound" external evtchn_reset: handle -> domid -> unit =3D "stub_xc_evtchn_reset" diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.= mli index 7a0dd7d8ba..0d5cc94198 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -210,6 +210,10 @@ external shadow_allocation_set : handle -> domid -> in= t -> unit =3D "stub_shadow_allocation_set" external shadow_allocation_get : handle -> domid -> int =3D "stub_shadow_allocation_get" +external paging_mempool_size_set : handle -> domid -> int64 -> unit + =3D "stub_xc_set_paging_mempool_size" +external paging_mempool_size_get : handle -> domid -> int64 + =3D "stub_xc_get_paging_mempool_size" external evtchn_alloc_unbound : handle -> domid -> domid -> int =3D "stub_xc_evtchn_alloc_unbound" external evtchn_reset : handle -> domid -> unit =3D "stub_xc_evtchn_reset" diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index e0c435e346..307bfa031d 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -1259,6 +1259,47 @@ CAMLprim value stub_shadow_allocation_set(value xch_= val, value domid, CAMLreturn(Val_unit); } =20 +CAMLprim value stub_xc_get_paging_mempool_size(value xch_val, value domid) +{ + CAMLparam2(xch_val, domid); + xc_interface *xch =3D xch_of_val(xch_val); + uint32_t c_domid =3D Long_val(domid); + uint64_t c_size; + int ret; + + if (c_domid !=3D Long_val(domid)) + caml_invalid_argument("domid"); + + caml_enter_blocking_section(); + ret =3D xc_get_paging_mempool_size(xch, c_domid, &c_size); + caml_leave_blocking_section(); + if (ret !=3D 0) + failwith_xc(xch); + + CAMLreturn(caml_copy_int64(c_size)); +} + +CAMLprim value stub_xc_set_paging_mempool_size(value xch_val, value domid, + value size) +{ + CAMLparam3(xch_val, domid, size); + xc_interface *xch =3D xch_of_val(xch_val); + uint32_t c_domid =3D Long_val(domid); + uint64_t c_size =3D Int64_val(size); + int ret; + + if (c_domid !=3D Long_val(domid)) + caml_invalid_argument("domid"); + + caml_enter_blocking_section(); + ret =3D xc_set_paging_mempool_size(xch, c_domid, c_size); + caml_leave_blocking_section(); + if (ret !=3D 0) + failwith_xc(xch); + + CAMLreturn(Val_unit); +} + CAMLprim value stub_xc_domain_ioport_permission(value xch_val, value domid, value start_port, value nr_ports, value allow) --=20 2.53.0 --=20 Julian Vetter | Vates Hypervisor & Kernel Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ---=Part.334.6bba1527ddbe6e60.1a18d245d6a.bf2e308db7509232=--- From nobody Thu Nov 5 07:33:59 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=1793369355; cv=none; d=zohomail.com; s=zohoarc; b=S89aWPn/mWx8K8kBci7j0i0L81jDL3dKSHkD79lAyKCdpK4jlR4dbyMLScrrLKDLy1fbWmgU2i4FKe352qbn4WEVNeJE/9x51ENdXB6W6UNokgo2NjiwSn/5zHLtyvETImFfqi3z5m0KwsundQUM9Xwy1SMupcbVOWscybxZ/Fk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793369355; 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=o8TQ1P+wa0K8JL4R/1ysdsCGqdnNB6/v7Ew2w/ReJkA=; b=nSCAzte4TYEFBgksfdWS4T0wIZAOPAWQbD/2arlaR3Lci40C/MiuJe+penk4NQfttp1d2Sv+D1Y+kUt/hCBml+sn3q77g/+X/pPc3y7jv216R6LWRkADi/eScmopSJnGqUP9TBe7zZXNwzFJUlV39ZQmck4VtOKaJVR30tApukE= 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 1793369355736463.4295090471734; Fri, 30 Oct 2026 07:09:15 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1465715.1676189 (Exim 4.92) (envelope-from ) id 1xMnHv-0000B3-2S; Fri, 30 Oct 2026 14:08:59 +0000 Received: by outflank-mailman (output) from mailman id 1465715.1676189; Fri, 30 Oct 2026 14:08:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xMnHu-0000AA-Rz; Fri, 30 Oct 2026 14:08:58 +0000 Received: by outflank-mailman (input) for mailman id 1465715; Fri, 30 Oct 2026 14:08:58 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xMnHu-0008Rs-Cr for xen-devel@lists.xenproject.org; Fri, 30 Oct 2026 14:08:58 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xMnHt-003DNt-IZ for xen-devel@lists.xenproject.org; Fri, 30 Oct 2026 15:08:57 +0100 Received: from [10.42.69.8] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ae4a4f6-e002-0a2a0a5209dd-0a2a4508e452-14 for ; Fri, 30 Oct 2026 15:08:57 +0100 Received: from [185.255.28.34] (helo=prod-mta-13-01.swg-srv.net) by tlsNG-c1860d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ae4a4f9-f659-0a2a45080019-b9ff1c22a4e9-3 for ; Fri, 30 Oct 2026 15:08:57 +0100 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 1a18d24619c000cae1.003 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 30 Oct 2026 14:08:54 +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 4252E82F34; Fri, 30 Oct 2026 15:08:53 +0100 (CET) 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=o8TQ1P+wa0K8JL4R/1ysdsCGqdnNB6/v7Ew2w/ReJkA=; h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references:feedback-id; b=oq9v0sN7MfJQY9qzHGqmMuJ7AqkrSB94v67yTMb0pDBEgO78vdDuvZ0dPBY+KqzLYlVYfEL1M SHjDInjc8gZzpzXcAXIklrp91pD2aYQ+Mr0fL37aluSBNzWjleb4pfdRIgyJYAv9WUCQLK9X30E 99ejrld9kzUzb48ZSv3ngN/SNN2S1RQ09Xa/R8St6vvhMgiptyLK7TXFZ/8JqQb3h7IxlgOKVCE Yv/ycp4i5LwUSjHwreKVAG6YoJQAgIvZReG7Y2F/vjhOwbJkaDqX63CCiZER0twys9ofkHkiMgq hKtihEVOFondYIgkM2rVAjoeoSgQBSwZbB1tCsbj2L6g== X-Zone-Loop: 1d7ce52e3cd5272d3e7e1565dfb9c714c9d91c70a5f8 x-campaign-type: default x-transaction-id: f55b60e1-8ad0-4ca6-a326-cbd06090976f x-swg-uid: 01-97ce384e-d3dc-4328-97b3-d89d795e1be6 X-Mailer: Sweego Message-ID: <1793369334.8631fc262581453bbf619ec5b2062170.1a18d24619c000cae1@vates.tech> x-swg-bid: 1793369334.8631fc262581453bbf619ec5b2062170.1a18d24619c000cae1 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 , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Michal Orzel , Julian Vetter Subject: [PATCH 3/4] x86/paging: allow the paging mempool size domctls for PV domains Date: Fri, 30 Oct 2026 15:08:46 +0100 In-Reply-To: <1793369135.8631fc262581453bbf619ec5b2062170.1a18d215a7f000cae1@vates.tech> References: <1793369135.8631fc262581453bbf619ec5b2062170.1a18d215a7f000cae1@vates.tech> MIME-Version: 1.0 X-BM-Disclaimer: Yes Content-Type: multipart/alternative; boundary="-=Part.335.19dd3c1b8ec5f8d1.1a18d245ff7.2292b32db68e63d3=-" X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1793369333751 X-purgate-ID: tlsNG-c1860d/1793369337-CCB7187B-7DA21E8F/0/0 X-purgate-type: clean X-purgate-size: 2243 X-ZohoMail-DKIM: pass (identity @vates.tech) X-ZM-MESSAGEID: 1793369357015154101 ---=Part.335.19dd3c1b8ec5f8d1.1a18d245ff7.2292b32db68e63d3=- Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" To have a more generic interface for sizing a domain's paging pool, replace XEN_DOMCTL_SHADOW_OP_{GET,SET}_ALLOCATION by XEN_DOMCTL_{get,set}_paging_mempool_size. These functions works on both x86 and ARM, and take an exact size in bytes instead of whole MBytes. But on x86, the paging mempool domctls currently reject PV domains with -EOPNOTSUPP. Toolstacks use SHADOW_OP_SET_ALLOCATION to size the shadow pool of PV domains too. So, as long as this restriction exists, x86 toolstacks can't switch to the new interface. The check is only needed on builds without CONFIG_SHADOW_PAGING, where shadow_set_allocation() is a stub containing ASSERT_UNREACHABLE(). So, only reject PV domains without CONFIG_SHADOW_PAGING. Signed-off-by: Julian Vetter --- Changes in v2: - New patch --- xen/arch/x86/mm/paging.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c index 4bb8d169de..2ea7a472ab 100644 --- a/xen/arch/x86/mm/paging.c +++ b/xen/arch/x86/mm/paging.c @@ -959,7 +959,7 @@ int arch_get_paging_mempool_size(struct domain *d, uint= 64_t *size) { unsigned long pages; =20 - if ( is_pv_domain(d) ) /* TODO: Relax in due course */ + if ( is_pv_domain(d) && !IS_ENABLED(CONFIG_SHADOW_PAGING) ) return -EOPNOTSUPP; =20 pages =3D d->arch.paging.total_pages; @@ -976,7 +976,7 @@ int arch_set_paging_mempool_size(struct domain *d, uint= 64_t size) bool preempted =3D false; int rc; =20 - if ( is_pv_domain(d) ) /* TODO: Relax in due course */ + if ( is_pv_domain(d) && !IS_ENABLED(CONFIG_SHADOW_PAGING) ) return -EOPNOTSUPP; =20 if ( size & ~PAGE_MASK || /* Non page-sized request? */ --=20 2.53.0 --=20 Julian Vetter | Vates Hypervisor & Kernel Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ---=Part.335.19dd3c1b8ec5f8d1.1a18d245ff7.2292b32db68e63d3=--- From nobody Thu Nov 5 07:33:59 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=1793369362; cv=none; d=zohomail.com; s=zohoarc; b=gNKW+fjX1bGCDdlaBWagAB5/90KKEsT6W08sDvZ39ta4yj7Xn1TtS2Y2wnnIlo+4FWslM7W/5LG49hSVfFnDJyjxXgS2EF2w+zEgNzlgQ2tXOcWBUQx1LdWpPreKKF2RkJkY79YJd1rMwtAc2U/3LbDrGM5B5229RgF5n5bTqzY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793369362; 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=akRbpxa6rSSnB9kOmzAWy65Mp6pHVNxd97FBerNkZVA=; b=YSKemeLA63PDA2nYMT/Ucod+U65ZWRgyJOBHz0QlS83tw7eXwe2Nt1DxMLvpkdHjGNa6P+CH3at0mguSNaBLRuTwFsq36jsU8Lv4reA8RPy9DerTvInUdmecBf8P9kjQ3HBIH59vcYcp4suw57YSyWUj6d9qI2cECJrdpKdSD6s= 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 1793369362240299.06313665630785; Fri, 30 Oct 2026 07:09:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1465716.1676200 (Exim 4.92) (envelope-from ) id 1xMnHy-0000YT-69; Fri, 30 Oct 2026 14:09:02 +0000 Received: by outflank-mailman (output) from mailman id 1465716.1676200; Fri, 30 Oct 2026 14:09:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xMnHy-0000YL-36; Fri, 30 Oct 2026 14:09:02 +0000 Received: by outflank-mailman (input) for mailman id 1465716; Fri, 30 Oct 2026 14:09:01 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xMnHw-0000Wx-Vn for xen-devel@lists.xenproject.org; Fri, 30 Oct 2026 14:09:01 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xMnHw-000AjJ-Ca for xen-devel@lists.xenproject.org; Fri, 30 Oct 2026 15:09:00 +0100 Received: from [10.42.69.7] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ae4a4f7-8faa-0a2a0a5109dd-0a2a4507d978-10 for ; Fri, 30 Oct 2026 15:09:00 +0100 Received: from [185.255.28.35] (helo=prod-mta-13-02.swg-srv.net) by tlsNG-ef75cf.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ae4a4fa-b4ea-0a2a45070019-b9ff1c23b66f-3 for ; Fri, 30 Oct 2026 15:08:58 +0100 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-02.swg-srv.net (ZoneMTA - prod-mta-13) with ESMTPSA id 1a18d24641a000cae1.003 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 30 Oct 2026 14:08:54 +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 E0DE782EC1; Fri, 30 Oct 2026 15:08:53 +0100 (CET) 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=akRbpxa6rSSnB9kOmzAWy65Mp6pHVNxd97FBerNkZVA=; h=from:subject:date:message-id:to:cc:mime-version:content-type:in-reply-to:references:feedback-id; b=Nv2sJwg+RGQitsmZZbcgq78yCyswVX/Y0bnScEUZSV9ULw0yD8e9ZkocAl1tcqLXzh6SUoT+v YWWZxyV6132ogqJmq5ASc9vj71/BaOr0zpFXdlp2paK4MCdME86l8CR43TlBD8XiCWFj90U+5rI J/+mC6L/rWZq5Xnug5CUYTRBs4Si/wgu4/9bpKAFr2e0uF6schh6NCY8Pvd+iZnUrhNqCECYw40 lNJp9ofK6q+BtilPn2oahivdGl8hu82f6f6tPURAOwzi7DCEEToPkwywrLXM00D77S//XZt01Sj 4i8qlsmmUBmiiSmc4eao/HIsN/PORysNDKk1NK6Flwsw== X-Zone-Loop: 309c804213f67ee15da7d8131c69896683c29de84b98 x-campaign-type: default x-transaction-id: b05c41c3-0672-411d-80b0-44bb3e884cda x-swg-uid: 01-e5c6d8da-120c-4b28-b559-2cac11e6c6b0 X-Mailer: Sweego Message-ID: <1793369334.8631fc262581453bbf619ec5b2062170.1a18d24641a000cae1@vates.tech> x-swg-bid: 1793369334.8631fc262581453bbf619ec5b2062170.1a18d24641a000cae1 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 , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Michal Orzel , Julian Vetter Subject: [PATCH 4/4] tools/ocaml: implement shadow_allocation_{get,set} via the paging mempool Date: Fri, 30 Oct 2026 15:08:47 +0100 In-Reply-To: <1793369135.8631fc262581453bbf619ec5b2062170.1a18d215a7f000cae1@vates.tech> References: <1793369135.8631fc262581453bbf619ec5b2062170.1a18d215a7f000cae1@vates.tech> MIME-Version: 1.0 X-BM-Disclaimer: Yes Content-Type: multipart/alternative; boundary="-=Part.336.1d4a8481e7c47b6.1a18d246284.ce8a5cbd54ae1175=-" X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1793369334405 X-purgate-ID: tlsNG-ef75cf/1793369338-A4ECEAE4-B3EEAAFD/0/0 X-purgate-type: clean X-purgate-size: 5603 X-ZohoMail-DKIM: pass (identity @vates.tech) X-ZM-MESSAGEID: 1793369365218154101 ---=Part.336.1d4a8481e7c47b6.1a18d246284.ce8a5cbd54ae1175=- Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" To have a more generic interface for sizing a domain's paging pool, replace XEN_DOMCTL_SHADOW_OP_{GET,SET}_ALLOCATION by XEN_DOMCTL_{get,set}_paging_mempool_size. These functions works on both x86 and ARM, and take an exact size in bytes instead of whole MBytes. But the shadow_allocation_{get,set} functions can't be removed yet, because Xapi still uses them, and is built against the installed Xen's OCaml bindings, so removing them would break building existing Xapi releases against newer versions of Xen. Instead, reimplement them on top of paging_mempool_size_{get,set}, keeping their MBytes based interface and rounding the size up in the get function, and drop their C stubs. Once Xapi uses the new functions, the wrappers can be removed as well. Signed-off-by: Julian Vetter --- Changes in v2: - New patch --- tools/ocaml/libs/xc/xenctrl.ml | 18 +++++++++---- tools/ocaml/libs/xc/xenctrl.mli | 6 ++--- tools/ocaml/libs/xc/xenctrl_stubs.c | 40 ----------------------------- 3 files changed, 15 insertions(+), 49 deletions(-) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 55cfc2e9a2..1f81bd3c4e 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -278,16 +278,24 @@ external sched_credit_domain_set: handle -> domid -> = sched_control -> unit external sched_credit_domain_get: handle -> domid -> sched_control =3D "stub_sched_credit_domain_get" =20 -external shadow_allocation_set: handle -> domid -> int -> unit - =3D "stub_shadow_allocation_set" -external shadow_allocation_get: handle -> domid -> int - =3D "stub_shadow_allocation_get" - external paging_mempool_size_set: handle -> domid -> int64 -> unit =3D "stub_xc_set_paging_mempool_size" external paging_mempool_size_get: handle -> domid -> int64 =3D "stub_xc_get_paging_mempool_size" =20 +(* Compatibility wrappers for the old MiB based shadow_allocation_{get,set} + bindings, which used XEN_DOMCTL_SHADOW_OP_{GET,SET}_ALLOCATION. *) +let shadow_allocation_set handle domid mb =3D + let size =3D Int64.shift_left (Int64.of_int mb) 20 in + if mb < 0 || Int64.shift_right size 20 <> Int64.of_int mb then + invalid_arg "shadow_allocation_set"; + paging_mempool_size_set handle domid size + +(* Round up to whole MiB, like XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION did. *) +let shadow_allocation_get handle domid =3D + let size =3D paging_mempool_size_get handle domid in + Int64.to_int (Int64.shift_right_logical (Int64.add size 0xfffffL) 20) + external evtchn_alloc_unbound: handle -> domid -> domid -> int =3D "stub_xc_evtchn_alloc_unbound" external evtchn_reset: handle -> domid -> unit =3D "stub_xc_evtchn_reset" diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.= mli index 0d5cc94198..1083255f6d 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -206,10 +206,8 @@ external sched_credit_domain_set : handle -> domid -> = sched_control -> unit =3D "stub_sched_credit_domain_set" external sched_credit_domain_get : handle -> domid -> sched_control =3D "stub_sched_credit_domain_get" -external shadow_allocation_set : handle -> domid -> int -> unit - =3D "stub_shadow_allocation_set" -external shadow_allocation_get : handle -> domid -> int - =3D "stub_shadow_allocation_get" +val shadow_allocation_set : handle -> domid -> int -> unit +val shadow_allocation_get : handle -> domid -> int external paging_mempool_size_set : handle -> domid -> int64 -> unit =3D "stub_xc_set_paging_mempool_size" external paging_mempool_size_get : handle -> domid -> int64 diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index 307bfa031d..42402ef6e8 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -1219,46 +1219,6 @@ CAMLprim value stub_sched_credit_domain_set(value xc= h_val, value domid, CAMLreturn(Val_unit); } =20 -CAMLprim value stub_shadow_allocation_get(value xch_val, value domid) -{ - CAMLparam2(xch_val, domid); - CAMLlocal1(mb); - xc_interface *xch =3D xch_of_val(xch_val); - unsigned int c_mb; - int ret; - - caml_enter_blocking_section(); - ret =3D xc_shadow_control(xch, Int_val(domid), - XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION, - &c_mb, 0); - caml_leave_blocking_section(); - if (ret !=3D 0) - failwith_xc(xch); - - mb =3D Val_int(c_mb); - CAMLreturn(mb); -} - -CAMLprim value stub_shadow_allocation_set(value xch_val, value domid, - value mb) -{ - CAMLparam3(xch_val, domid, mb); - xc_interface *xch =3D xch_of_val(xch_val); - unsigned int c_mb; - int ret; - - c_mb =3D Int_val(mb); - caml_enter_blocking_section(); - ret =3D xc_shadow_control(xch, Int_val(domid), - XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, - &c_mb, 0); - caml_leave_blocking_section(); - if (ret !=3D 0) - failwith_xc(xch); - - CAMLreturn(Val_unit); -} - CAMLprim value stub_xc_get_paging_mempool_size(value xch_val, value domid) { CAMLparam2(xch_val, domid); --=20 2.53.0 --=20 Julian Vetter | Vates Hypervisor & Kernel Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ---=Part.336.1d4a8481e7c47b6.1a18d246284.ce8a5cbd54ae1175=---