From patchwork Mon Jun 10 17:10:47 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: 13692317 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 1A823C27C7A for ; Mon, 10 Jun 2024 17:11:19 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.737476.1143879 (Exim 4.92) (envelope-from ) id 1sGiXw-0002yI-NB; Mon, 10 Jun 2024 17:11:04 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 737476.1143879; Mon, 10 Jun 2024 17:11:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sGiXw-0002y3-Iv; Mon, 10 Jun 2024 17:11:04 +0000 Received: by outflank-mailman (input) for mailman id 737476; Mon, 10 Jun 2024 17:11:03 +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 1sGiXv-0000kq-DE for xen-devel@lists.xenproject.org; Mon, 10 Jun 2024 17:11:03 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 696d7dd0-274c-11ef-b4bb-af5377834399; Mon, 10 Jun 2024 19:11:01 +0200 (CEST) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-57a1fe63a96so6034508a12.0 for ; Mon, 10 Jun 2024 10:11:01 -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 4fb4d7f45d1cf-57c76740d6asm3233169a12.7.2024.06.10.10.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 10:11:00 -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: 696d7dd0-274c-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718039460; x=1718644260; 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=gMdK+Jvhj1V77/a0DgjcEJwq1OtvW7iw1n5SJqbw9Ys=; b=eZqSHRLH0qFfjnwyaa2iELeT3PzLEoKlQp+bqt/4wUErho+T08vRP1/0VZBGtlicJz PIQbaHpMiGbo5Z7EtBmVt3MsmXK57B21L1eG72CmnI3LDRLRKf1EML0bsZsD9jA3W9wT 5EShInB7s+cy40KHDtdOK59uI4SPRCRT7vCpRA/Vdqgt2H8ICyH3cZHc5NdI6KcRK5Iv F0MK1C3zBGkPdnOknqlFmEV7yrywVFhzyu683y1g1HX7mF1dxqVyIcajHhHMOizdeLQf nbFC7eEPkRWJoDJ205CNrHBRWtZa7rtoliynaktxV0SK+caYXlwChWAjtBnKd9ZDwtXt dlpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718039460; x=1718644260; 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=gMdK+Jvhj1V77/a0DgjcEJwq1OtvW7iw1n5SJqbw9Ys=; b=EKw+s+m2FoK9E01JOB66qtZ8/u7+IwNobdD3YFawKQbeN39gy3jzjyPhENt8AqKDhW ygtLBV3B1hj+CYWqieEnsSff3GHl7U8Y9fnwgzkcACux2O7x86hv7UAd4IFfZf6pCSzd eHMx4FX74qd+I/zcBsFcwSBeG8zNukVx1G6MXr8ogx4mxiv56F2FohcNhWrgBHgTVMon WnIVr9kQoc7j7PS1+EdoWvvidTiTpYwIkNxxzrBxqnJ5seUZLdP5D/Cq4vZaSlUDMB1L 74GdYM7QcMeye/wche8enxuKYQihFfv7P7ip9ecEffx1JVhhZkO8TVM7eKuaQuuRe8PL tuAQ== X-Gm-Message-State: AOJu0YxBc/HhKgkc8I68bMH5dSHliBnvlDxPFQqTzP1Ivzx10rQCrSNB LXxkAxl5Hh9Lqzoa9C9NTPwxZVuSjkdEm4Iwq+OCWnjmsSHTK3ziSxweWg== X-Google-Smtp-Source: AGHT+IEihXCzU827XqqARib1MQU3lplFIw2//ymH9ABmt/wth7JA8G74o5NW1SYyKq7UL8yerUguhQ== X-Received: by 2002:a50:c2d9:0:b0:57c:5fc8:c95d with SMTP id 4fb4d7f45d1cf-57c5fc8ca83mr5564429a12.18.1718039460428; Mon, 10 Jun 2024 10:11:00 -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 , Christian Lindig Subject: [PATCH for-4.19? v6 9/9] tools/ocaml: Add altp2m_count parameter Date: Mon, 10 Jun 2024 17:10:47 +0000 Message-Id: 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š Acked-by: Christian Lindig --- 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