From patchwork Sun Jun 2 20:04:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_Bene=C5=A1?= X-Patchwork-Id: 13682997 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 221C7C27C5E for ; Sun, 2 Jun 2024 20:04:57 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.734563.1140729 (Exim 4.92) (envelope-from ) id 1sDrRb-0001W0-2h; Sun, 02 Jun 2024 20:04:43 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 734563.1140729; Sun, 02 Jun 2024 20:04:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sDrRa-0001Tk-Nd; Sun, 02 Jun 2024 20:04:42 +0000 Received: by outflank-mailman (input) for mailman id 734563; Sun, 02 Jun 2024 20:04:41 +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 1sDrRZ-0007mz-Cw for xen-devel@lists.xenproject.org; Sun, 02 Jun 2024 20:04:41 +0000 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [2a00:1450:4864:20::331]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 58a538a6-211b-11ef-90a1-e314d9c70b13; Sun, 02 Jun 2024 22:04:40 +0200 (CEST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-421396e3918so7393745e9.0 for ; Sun, 02 Jun 2024 13:04:40 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35dd064bb21sm6879280f8f.102.2024.06.02.13.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:04:39 -0700 (PDT) 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: 58a538a6-211b-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717358680; x=1717963480; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c0MyFioV4z3Djhi95Acx+wxEtRnsa4FRDnKsyuw+8Ys=; b=SWmrMUSFY75yV/4WAgIuVxwBDnymKm/0pMtWHMRyQehAflR+AADJIfMuH56Ai+PYjI XUajNO9PYI60pGr2MdBB7VyG5xX6tOFQ6q/DjvhgMRbJ4W+epdwLr492bZ3Ypqq/X7MN v4hX8JzPQMX+xitMo1kgERnpJsBvmZv7olCdbC3BqGkyjurDGJcPl+k0g93hrBeiNpIq 6PwacaRKQeR0afUsoeI9gnYsRkB9kInp84sU44fYPwnN6VN5BU/qMJzp0eREEJKQMdjO pD5t1KikTq568l0axBeVk5/2KzQjzn0z4/qWeOnH687JT6JBNOuFRn4L4a87GfvRlPE+ cPMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717358680; x=1717963480; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c0MyFioV4z3Djhi95Acx+wxEtRnsa4FRDnKsyuw+8Ys=; b=quEVRcIECWmfzTGoMfSPSpYmQzNJ8PDwbpGtC0+hE3QNe6rh/xXP5fCSBhGgHw672i emqE8pabubhItTqKIIlt5j13IQOIiANvRCU2bV73162uzcC4l6BrHTD5YaV/Rl8HFoRc 6mEcvAj9ipVnG/nQnJp/ag/7qbgKcheZdkJG7PABRZ4aJVfrt5V6iva52M2uQn9K01V/ t5gWUpfGzF9Zwy66hKCNjEIUKGsTkHfJX0WgYon4d0pNPkHysOhhRscxWjY04H4l3ZtE QMtEfI9PsDG5euRxKNM8+2G9y5aji9iUUTqAqhqiTHGGW8rpbElRsdy25sxQoKdytkkX gKSQ== X-Gm-Message-State: AOJu0Yy57cy8M/u1p7LRixPhzxQ+VQ3NufTgVIlOzQE+CJmu9mndNwqp NYEv8AuSaGtTf5fVFaG7zMvBKOUh82Pyzigq7C3DNxZ0nCSMnJiwKGWrDA== X-Google-Smtp-Source: AGHT+IFVrhWJGp3BxPBC/kC6EdkM0rGsj0Uk09uo4DBxfEUzOlI675CDh+2WakaL9NAfhvrZjM2hhA== X-Received: by 2002:adf:e6d2:0:b0:354:f489:faf with SMTP id ffacd0b85a97d-35e0f254f71mr7026169f8f.1.1717358679823; Sun, 02 Jun 2024 13:04:39 -0700 (PDT) From: " =?utf-8?q?Petr_Bene=C5=A1?= " X-Google-Original-From: =?utf-8?q?Petr_Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?utf-8?q?Petr_Bene=C5=A1?= , Christian Lindig , David Scott , Anthony PERARD Subject: [PATCH for-4.19? v5 10/10] tools/ocaml: Add altp2m_count parameter Date: Sun, 2 Jun 2024 20:04:23 +0000 Message-Id: <3c92a64c23cca81e88c94bf7b85e5e3633fd88f0.1717356829.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Petr Beneš Allow developers using the OCaml bindings to set the altp2m_count parameter. Signed-off-by: Petr Beneš --- tools/ocaml/libs/xc/xenctrl.ml | 1 + tools/ocaml/libs/xc/xenctrl.mli | 1 + tools/ocaml/libs/xc/xenctrl_stubs.c | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) -- 2.34.1 diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 2690f9a923..a3e50ac394 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -86,6 +86,7 @@ type domctl_create_config = max_maptrack_frames: int; max_grant_version: int; altp2m_opts: int32; + altp2m_count: int32; vmtrace_buf_kb: int32; cpupool_id: int32; arch: arch_domainconfig; diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli index febbe1f6ae..b97021d3d2 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -78,6 +78,7 @@ type domctl_create_config = { max_maptrack_frames: int; max_grant_version: int; altp2m_opts: int32; + altp2m_count: int32; vmtrace_buf_kb: int32; cpupool_id: int32; arch: arch_domainconfig; diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c index e6c977521f..78ae4967e6 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -211,13 +211,22 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co #define VAL_MAX_MAPTRACK_FRAMES Field(config, 7) #define VAL_MAX_GRANT_VERSION Field(config, 8) #define VAL_ALTP2M_OPTS Field(config, 9) -#define VAL_VMTRACE_BUF_KB Field(config, 10) -#define VAL_CPUPOOL_ID Field(config, 11) -#define VAL_ARCH Field(config, 12) +#define VAL_ALTP2M_COUNT Field(config, 10) +#define VAL_VMTRACE_BUF_KB Field(config, 11) +#define VAL_CPUPOOL_ID Field(config, 12) +#define VAL_ARCH Field(config, 13) uint32_t domid = Int_val(wanted_domid); + uint32_t altp2m_opts = Int32_val(VAL_ALTP2M_OPTS); + uint32_t altp2m_nr = Int32_val(VAL_ALTP2M_COUNT); uint64_t vmtrace_size = Int32_val(VAL_VMTRACE_BUF_KB); + if ( altp2m_opts != (uint16_t)altp2m_opts ) + caml_invalid_argument("altp2m_opts"); + + if ( altp2m_nr != (uint16_t)altp2m_nr ) + caml_invalid_argument("altp2m_count"); + vmtrace_size = ROUNDUP(vmtrace_size << 10, XC_PAGE_SHIFT); if ( vmtrace_size != (uint32_t)vmtrace_size ) caml_invalid_argument("vmtrace_buf_kb"); @@ -232,7 +241,8 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co .grant_opts = XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)), .altp2m = { - .opts = Int32_val(VAL_ALTP2M_OPTS), + .opts = altp2m_opts, + .nr = altp2m_nr, }, .vmtrace_size = vmtrace_size, .cpupool_id = Int32_val(VAL_CPUPOOL_ID), @@ -292,6 +302,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co #undef VAL_ARCH #undef VAL_CPUPOOL_ID #undef VAL_VMTRACE_BUF_KB +#undef VAL_ALTP2M_COUNT #undef VAL_ALTP2M_OPTS #undef VAL_MAX_GRANT_VERSION #undef VAL_MAX_MAPTRACK_FRAMES