From patchwork Sun Jun 2 20:04:14 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: 13682993 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 72105C27C50 for ; Sun, 2 Jun 2024 20:04:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.734553.1140637 (Exim 4.92) (envelope-from ) id 1sDrRS-0007nH-Ds; Sun, 02 Jun 2024 20:04:34 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 734553.1140637; Sun, 02 Jun 2024 20:04:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sDrRS-0007nA-Aa; Sun, 02 Jun 2024 20:04:34 +0000 Received: by outflank-mailman (input) for mailman id 734553; Sun, 02 Jun 2024 20:04:33 +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 1sDrRR-0007mz-GC for xen-devel@lists.xenproject.org; Sun, 02 Jun 2024 20:04:33 +0000 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [2a00:1450:4864:20::32f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 532de246-211b-11ef-90a1-e314d9c70b13; Sun, 02 Jun 2024 22:04:32 +0200 (CEST) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-421338c4c3bso15295695e9.1 for ; Sun, 02 Jun 2024 13:04:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:04:30 -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: 532de246-211b-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717358671; x=1717963471; 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=3FD00BnVK+nXxJxFCCyFQGMqQcfaH7dFaqvgbk7uc4I=; b=lsH2Pg/ZN9IG/ZAzq/QO7nIw5zRAa9YiXyWiYgiORaaSeKLc1jkHvRv+dyyQpAk7X0 +lxWQPGHizRwq5e2UCOSV4e7m9kgTmSIZZZSwa8gooQ1HRXU0GUJp6/ieCSnweIsMKxd S3DaLPupwsIsgVFkfxMKzEY251K59hLs2AlmnmwOi4zyUDPPbonWvnAlefDCDlG2XuDt +sk7c5kY+1l7AKFXm8R2fXJeap9BKIluYys65yZ37FVeZuYZTWcStz9zfhttRxrq+jZ5 MsdnyZ3uR/AdqXUyir5L3CEZVK7Lgl2OV9JC1g6qHa/BZahTIgBkkEIm8q88AOau1hw1 r/nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717358671; x=1717963471; 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=3FD00BnVK+nXxJxFCCyFQGMqQcfaH7dFaqvgbk7uc4I=; b=AEi60aHrF5Wjg1WLSBBitqOh+NjFsHu8eGHStzdmObMZq+RBFSHHXTlu1S1R/ewhLz 5c0QTjnUWWwyFIHW8dicGIzN5zR/hGNgo1W6+0RPyqfh2rjJWo5G1sXeoOOhu7Z3OEV1 1KzNkLHlhGL+jM+7rCIHD8+jR7momc2jpQtvz5p3c3kdlwv1ZNBdre9uY3yMQiodoUUA DttFiR99WSM7tDCJ4VBo4NbxdVshXogEDh0VnwYC3SvAWRgsbuF112PbgnaZi2DiNb1Y z6+hgaR9zcJp/P6u6I1RaPAod2CJyNYPU25fRz85zQgrdc7xiys1resB1DwLwv13ZTpj hA9g== X-Gm-Message-State: AOJu0YwP/58BJepgF4vVdOgcZjUkPNFOqM4UFMi0Pfu8YRIkuTMNOreQ sDfszuh1MShruGKdpzRw1sq1iZLvisUKRjolY2+F0otnxJFx9uVeIt5yJA== X-Google-Smtp-Source: AGHT+IGBccqpO9X861mA56aWUoHAjiXNV+TMR8tMrmieqJ7TIp5D3QKv1HvzGKWbPVpznVrJUrkDUA== X-Received: by 2002:a05:600c:511f:b0:41e:3272:6476 with SMTP id 5b1f17b1804b1-4212e049d8dmr67108965e9.10.1717358670709; Sun, 02 Jun 2024 13:04:30 -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 01/10] tools/ocaml: Fix mixed tabs/spaces Date: Sun, 2 Jun 2024 20:04:14 +0000 Message-Id: <7f1eb25ef6fd2ce56a8275211051d6a4a1211a6a.1717356829.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Petr Beneš No functional change. Signed-off-by: Petr Beneš --- tools/ocaml/libs/xc/xenctrl_stubs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) -- 2.34.1 diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c index c6da9bb091..e86c455802 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -138,12 +138,12 @@ static void domain_handle_of_uuid_string(xen_domain_handle_t h, * integers in the Ocaml ABI for more idiomatic handling. */ static value c_bitmap_to_ocaml_list - /* ! */ - /* + /* ! */ + /* * All calls to this function must be in a form suitable * for xenctrl_abi_check. The parsing there is ad-hoc. */ - (unsigned int bitmap) + (unsigned int bitmap) { CAMLparam0(); CAMLlocal2(list, tmp); @@ -180,8 +180,8 @@ static value c_bitmap_to_ocaml_list } static unsigned int ocaml_list_to_c_bitmap(value l) - /* ! */ - /* + /* ! */ + /* * All calls to this function must be in a form suitable * for xenctrl_abi_check. The parsing there is ad-hoc. */ @@ -259,7 +259,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co /* Quick & dirty check for ABI changes. */ BUILD_BUG_ON(sizeof(cfg) != 68); - /* Mnemonics for the named fields inside xen_x86_arch_domainconfig */ + /* Mnemonics for the named fields inside xen_x86_arch_domainconfig */ #define VAL_EMUL_FLAGS Field(arch_domconfig, 0) #define VAL_MISC_FLAGS Field(arch_domconfig, 1) @@ -351,7 +351,7 @@ static value dom_op(value xch_val, value domid, caml_enter_blocking_section(); result = fn(xch, c_domid); caml_leave_blocking_section(); - if (result) + if (result) failwith_xc(xch); CAMLreturn(Val_unit); } @@ -383,7 +383,7 @@ CAMLprim value stub_xc_domain_resume_fast(value xch_val, value domid) caml_enter_blocking_section(); result = xc_domain_resume(xch, c_domid, 1); caml_leave_blocking_section(); - if (result) + if (result) failwith_xc(xch); CAMLreturn(Val_unit); } @@ -426,7 +426,7 @@ static value alloc_domaininfo(xc_domaininfo_t * info) Store_field(result, 13, Val_int(info->max_vcpu_id)); Store_field(result, 14, caml_copy_int32(info->ssidref)); - tmp = caml_alloc_small(16, 0); + tmp = caml_alloc_small(16, 0); for (i = 0; i < 16; i++) { Field(tmp, i) = Val_int(info->handle[i]); } From patchwork Sun Jun 2 20:04:15 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: 13682992 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 651A9C27C44 for ; Sun, 2 Jun 2024 20:04:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.734555.1140657 (Exim 4.92) (envelope-from ) id 1sDrRU-0008Fs-SG; Sun, 02 Jun 2024 20:04:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 734555.1140657; Sun, 02 Jun 2024 20:04:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sDrRU-0008Fj-PH; Sun, 02 Jun 2024 20:04:36 +0000 Received: by outflank-mailman (input) for mailman id 734555; Sun, 02 Jun 2024 20:04:35 +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 1sDrRT-0007mz-59 for xen-devel@lists.xenproject.org; Sun, 02 Jun 2024 20:04:35 +0000 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [2a00:1450:4864:20::42c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 53c68629-211b-11ef-90a1-e314d9c70b13; Sun, 02 Jun 2024 22:04:32 +0200 (CEST) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-35dc1d8867eso3032945f8f.0 for ; Sun, 02 Jun 2024 13:04:32 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:04:31 -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: 53c68629-211b-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717358672; x=1717963472; 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=aBV36ZOSMPLFcAtuqEy9oKcOs0+DBw6xGfnoGAP2P0o=; b=ZHhA2bG9Z48ylIlEAvipg+fy4x5aGxH52BLytfEzr2fDID4FiGFiFA/LBstuIyzEju +Hzpf6SRajIFen7XISqfhcT0HUCTK3+3AaGK9d5A0gp4xqbl/Kmcoq6hu/xz1CPCvsFX PS6vM9ZMWOWyVpAVxwmdgleMC07I6hNOWaTY9+Ui1pfhWY+lx6BYpoN6vuy2VjXB4OS8 zgoQorAUace4/wb9hIKQxfzknM/OHSRX/0MDCNyMtEbVLcsN8aIGfNvm/8NgSbzMCy71 +5aUHvSBkeyWMI31WEv0I54kSilGlU89Cy91G/ND9JSGbUjNVm2meetMHbmUBkRKkulQ ov2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717358672; x=1717963472; 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=aBV36ZOSMPLFcAtuqEy9oKcOs0+DBw6xGfnoGAP2P0o=; b=DftpX4/8ebEzsTRXlcM5k9sDY2q5/+IlNErviHq8FCiryRT9KNH0/5Yvaa3mn7X0BE W4U4Y+lG4POYFTVQk3IUeto1sBU+OXkg9zfRLs2TNmzfJNX1UVLAYXklifnNzndWjfpa KojrkGO/+KGqinGCkEVvKauH4pFKhnZh0XbkzPrg6iyvgkIMCEbCgbd8ghnCWYFUkvF8 Vef3BNeESUDah64qPRoM8sILOJI1ejV82GlWQh0J77Uytt9pFT/oa+Qe8pXjCREZ/UC7 fRliJcOYi1Pz+JOFtFWNZiZPVQRgBIGZmFRs/mfypROPHfTIYneSkVeGQTGhTTegtcgd WWxw== X-Gm-Message-State: AOJu0Yys+S1vVk2mie1chvF8YW276CQ3LNXBmWTp7a4j8E2cVFAAXEsM msBym7N8RCfmv4gmYJNp9gbCGdqGnQEAWP+VlvtacnA2tRto2f7XZfV31g== X-Google-Smtp-Source: AGHT+IFnawVfqRSURUafZl8mA3xgcxuztZ6SJjTvV0fXeOTIvRpt9DF9hCQnHAVSeJqLoDyTctdgEw== X-Received: by 2002:adf:ef4d:0:b0:354:db85:3039 with SMTP id ffacd0b85a97d-35e0f34e789mr5289898f8f.44.1717358671689; Sun, 02 Jun 2024 13:04:31 -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 02/10] tools/ocaml: Add missing ocaml bindings for altp2m_opts Date: Sun, 2 Jun 2024 20:04:15 +0000 Message-Id: <2fcb6972bfaa59ec1184929cceeab70da709dfc0.1717356829.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Petr Beneš Fixes: 0291089f6ea8 ("xen: enable altp2m at create domain domctl") 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 | 9 ++++++--- 3 files changed, 8 insertions(+), 3 deletions(-) -- 2.34.1 diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 55923857ec..2690f9a923 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -85,6 +85,7 @@ type domctl_create_config = max_grant_frames: int; max_maptrack_frames: int; max_grant_version: int; + altp2m_opts: 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 9b4b45db3a..febbe1f6ae 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -77,6 +77,7 @@ type domctl_create_config = { max_grant_frames: int; max_maptrack_frames: int; max_grant_version: int; + altp2m_opts: 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 e86c455802..a529080129 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -210,9 +210,10 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co #define VAL_MAX_GRANT_FRAMES Field(config, 6) #define VAL_MAX_MAPTRACK_FRAMES Field(config, 7) #define VAL_MAX_GRANT_VERSION Field(config, 8) -#define VAL_VMTRACE_BUF_KB Field(config, 9) -#define VAL_CPUPOOL_ID Field(config, 10) -#define VAL_ARCH Field(config, 11) +#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) uint32_t domid = Int_val(wanted_domid); uint64_t vmtrace_size = Int32_val(VAL_VMTRACE_BUF_KB); @@ -230,6 +231,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co .max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES), .grant_opts = XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)), + .altp2m_opts = Int32_val(VAL_ALTP2M_OPTS), .vmtrace_size = vmtrace_size, .cpupool_id = Int32_val(VAL_CPUPOOL_ID), }; @@ -288,6 +290,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_OPTS #undef VAL_MAX_GRANT_VERSION #undef VAL_MAX_MAPTRACK_FRAMES #undef VAL_MAX_GRANT_FRAMES From patchwork Sun Jun 2 20:04:16 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: 13682990 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 7BB06C25B74 for ; Sun, 2 Jun 2024 20:04:54 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.734556.1140667 (Exim 4.92) (envelope-from ) id 1sDrRW-0008Ur-4I; Sun, 02 Jun 2024 20:04:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 734556.1140667; Sun, 02 Jun 2024 20:04:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sDrRW-0008Ug-15; Sun, 02 Jun 2024 20:04:38 +0000 Received: by outflank-mailman (input) for mailman id 734556; Sun, 02 Jun 2024 20:04:36 +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 1sDrRU-00084Y-52 for xen-devel@lists.xenproject.org; Sun, 02 Jun 2024 20:04:36 +0000 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [2a00:1450:4864:20::42f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 545a8b67-211b-11ef-b4bb-af5377834399; Sun, 02 Jun 2024 22:04:33 +0200 (CEST) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-35dbfe31905so3715971f8f.2 for ; Sun, 02 Jun 2024 13:04:33 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:04:32 -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: 545a8b67-211b-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717358673; x=1717963473; 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=srnMunaIVMSNKwZKkgAK+um7rawMxCtrAJXIPwRvR+M=; b=kCiy1dDrhiQ0GQh1ujBRyF8kZ+DarHa2622aU+ylXXUeyc5HqOIsjGYDkJr6zidKFq DgpLa5Xsfq6uSTaYMiu7dXzHQVSe+2mpd6W78esrVIbesyYj7zH9gCCrxU+OnRRaozWK mc3qR+O4BZADE6kSpPjrYh7kS0yO1scxDBDXW85cdcQv/i114DWQV34HvnOxJCNOs0qS mH8Npsz8E1SnqI+DHKsz5wXFD2sJv7+9J20LvFGOgh9+ze1fVvGQgKeO0lpYCxRZ22uT RPj++8diyRMEPKebaY06RrqFOrP7Dpj/ZU5+tbbLWDO3WYA/u3J4ByP1g84hHzW+cwi6 PFaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717358673; x=1717963473; 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=srnMunaIVMSNKwZKkgAK+um7rawMxCtrAJXIPwRvR+M=; b=qAZ7Zx+H6swU49QUMewopU+swZUu58MSC3r3Gu3wnd1jXxMTe6w/Zj5r7H+lsNZFe/ HuOZDe2yXd5RfZvolTxQqmvuKicw2Cy1oHgnPjbzjsD9AouGDpK2GNhEsMIxF2WoKJ1+ 3cRcslksIL0RsKZaneRYbMIeruaEZxhCtv2IxNB4DkIkK6Li30eFZz6T2py8iMfKnW/2 0OF95SffydjHsQ2TXOch9Qi+Ar5KUxj2sa+S0FyfY0Z9lBTd1pAAscjVimDAu3fI0Ko6 Xfx8Bastd1idh3OOaYr6rq1KKg17i3JvsL+qRDM5V+Eky8K9gM93lmnx2WHX157slodE B/6Q== X-Gm-Message-State: AOJu0Yy/asl1gbUbZkwdM1pUrHHjUEVO7GYRmB4XhwGQnmkt34oxv3l6 nH9Vm/tn66MWI4UvxHA87nnNSY4doiuPXjJKO5vJz1jaWEtc4GCslPXyYsh4 X-Google-Smtp-Source: AGHT+IHfZB6JtVKlc1r30NQBE/aH5henjAJM4LuXPRiH4t4jLmq5/lbGABQEBkm1Z8KP/KaK/EvG+A== X-Received: by 2002:a05:6000:90:b0:354:df59:c9a4 with SMTP id ffacd0b85a97d-35e0f259bacmr5053050f8f.9.1717358672817; Sun, 02 Jun 2024 13:04:32 -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?= , Anthony PERARD , Juergen Gross , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Christian Lindig , David Scott , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= Subject: [PATCH for-4.19? v5 03/10] xen: Refactor altp2m options into a structured format Date: Sun, 2 Jun 2024 20:04:16 +0000 Message-Id: <5dc1d0375206bd982b91f4db4bd237769a889f48.1717356829.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Petr Beneš Encapsulate the altp2m options within a struct. This change is preparatory and sets the groundwork for introducing additional parameter in subsequent commit. Signed-off-by: Petr Beneš Reviewed-by: Jan Beulich # hypervisor Acked-by: Julien Grall # arm --- tools/libs/light/libxl_create.c | 6 +++--- tools/ocaml/libs/xc/xenctrl_stubs.c | 4 +++- xen/arch/arm/domain.c | 2 +- xen/arch/x86/domain.c | 4 ++-- xen/arch/x86/hvm/hvm.c | 2 +- xen/include/public/domctl.h | 4 +++- 6 files changed, 13 insertions(+), 9 deletions(-) -- 2.34.1 diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c index edeadd57ef..569e3d21ed 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -680,17 +680,17 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, LOG(DETAIL, "altp2m: %s", libxl_altp2m_mode_to_string(b_info->altp2m)); switch(b_info->altp2m) { case LIBXL_ALTP2M_MODE_MIXED: - create.altp2m_opts |= + create.altp2m.opts |= XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_mixed); break; case LIBXL_ALTP2M_MODE_EXTERNAL: - create.altp2m_opts |= + create.altp2m.opts |= XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_external); break; case LIBXL_ALTP2M_MODE_LIMITED: - create.altp2m_opts |= + create.altp2m.opts |= XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_limited); break; diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c index a529080129..e6c977521f 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -231,7 +231,9 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co .max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES), .grant_opts = XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)), - .altp2m_opts = Int32_val(VAL_ALTP2M_OPTS), + .altp2m = { + .opts = Int32_val(VAL_ALTP2M_OPTS), + }, .vmtrace_size = vmtrace_size, .cpupool_id = Int32_val(VAL_CPUPOOL_ID), }; diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 8bde2f730d..5234b627d0 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -688,7 +688,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config) return -EINVAL; } - if ( config->altp2m_opts ) + if ( config->altp2m.opts ) { dprintk(XENLOG_INFO, "Altp2m not supported\n"); return -EINVAL; diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 536542841e..bb5ba8fc1e 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -637,7 +637,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config) bool hap = config->flags & XEN_DOMCTL_CDF_hap; bool nested_virt = config->flags & XEN_DOMCTL_CDF_nested_virt; unsigned int max_vcpus; - unsigned int altp2m_mode = MASK_EXTR(config->altp2m_opts, + unsigned int altp2m_mode = MASK_EXTR(config->altp2m.opts, XEN_DOMCTL_ALTP2M_mode_mask); if ( hvm ? !hvm_enabled : !IS_ENABLED(CONFIG_PV) ) @@ -717,7 +717,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config) return -EINVAL; } - if ( config->altp2m_opts & ~XEN_DOMCTL_ALTP2M_mode_mask ) + if ( config->altp2m.opts & ~XEN_DOMCTL_ALTP2M_mode_mask ) { dprintk(XENLOG_INFO, "Invalid altp2m options selected: %#x\n", config->flags); diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 8334ab1711..a66ebaaceb 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -659,7 +659,7 @@ int hvm_domain_initialise(struct domain *d, d->arch.hvm.params[HVM_PARAM_TRIPLE_FAULT_REASON] = SHUTDOWN_reboot; /* Set altp2m based on domctl flags. */ - switch ( MASK_EXTR(config->altp2m_opts, XEN_DOMCTL_ALTP2M_mode_mask) ) + switch ( MASK_EXTR(config->altp2m.opts, XEN_DOMCTL_ALTP2M_mode_mask) ) { case XEN_DOMCTL_ALTP2M_mixed: d->arch.hvm.params[HVM_PARAM_ALTP2M] = XEN_ALTP2M_mixed; diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index 2a49fe46ce..dea399aa8e 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -86,6 +86,7 @@ struct xen_domctl_createdomain { uint32_t grant_opts; + struct { /* * Enable altp2m mixed mode. * @@ -102,7 +103,8 @@ struct xen_domctl_createdomain { /* Altp2m mode signaling uses bits [0, 1]. */ #define XEN_DOMCTL_ALTP2M_mode_mask (0x3U) #define XEN_DOMCTL_ALTP2M_mode(m) ((m) & XEN_DOMCTL_ALTP2M_mode_mask) - uint32_t altp2m_opts; + uint32_t opts; + } altp2m; /* Per-vCPU buffer size in bytes. 0 to disable. */ uint32_t vmtrace_size; From patchwork Sun Jun 2 20:04:17 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: 13682995 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 F34F4C27C54 for ; Sun, 2 Jun 2024 20:04:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.734557.1140672 (Exim 4.92) (envelope-from ) id 1sDrRW-00006e-Ee; Sun, 02 Jun 2024 20:04:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 734557.1140672; Sun, 02 Jun 2024 20:04:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sDrRW-0008WK-7m; Sun, 02 Jun 2024 20:04:38 +0000 Received: by outflank-mailman (input) for mailman id 734557; Sun, 02 Jun 2024 20:04:36 +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 1sDrRU-0007mz-5Z for xen-devel@lists.xenproject.org; Sun, 02 Jun 2024 20:04:36 +0000 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [2a00:1450:4864:20::32c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5512c646-211b-11ef-90a1-e314d9c70b13; Sun, 02 Jun 2024 22:04:34 +0200 (CEST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-42120fc8d1dso35085015e9.2 for ; Sun, 02 Jun 2024 13:04:34 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:04:33 -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: 5512c646-211b-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717358674; x=1717963474; 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=7xYGePkFSrt21Sw0npf4IiaMWXG46KCQA4sFct5gdmA=; b=cHfv1yX176TANK09Pl0nQALKyyOnCEyYy+I/1KmDdXN1H4OYXNwzYGtUua+Vgw3PGB +IYUYwFZWGe/9GVAQzV+c0GjSAELW4Vn9KPSMQkujLpzI2CLsCKwiEji2BO8/iaj2Da+ m3jkn2EYsKI6orXBf/w3zXB1Tyf08WOmKnHnjXA0gI/q2Tj7U3tk5jN/sb1LS0ER8BYp 3IINisdKJpuaLBmn6diJVlOzdpCfbBaXmTntQjqQBWFtUEc4c89DvTrl837CsZUjsbMk Ifnj1dO+gHQy3/qnS2vxlzzaMLXUHimopU7WW7N4N9BztxRcCjLw5uRCFXJ80SuNN4/j 5FKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717358674; x=1717963474; 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=7xYGePkFSrt21Sw0npf4IiaMWXG46KCQA4sFct5gdmA=; b=hlKRtEUXswCeIJ0e52jVB2qB00MBUvHFTXpd84E5fLq72as3bLtTxTsUA1qnZs8nK6 I8ta9VvzBtw8uLpgE/oztxyZY6l5a2/vhwlP6alxfVPC52jLgDdqJR0R6XXHFy15jRI8 uFc82JOeted18EXfEOjtFBlHdMbjq31uN40m/DXEEy1LnUouYiPG/tafjUcLFzhMGdL+ sCf+ev20tjPtERkLwEMQbZ6EAJ9p9E9XdGzJsSack5UQZ7UFtUQzcwiiO2j4CVpS5vXO iMTvuWGtTdMTcsqOMZd6v6UWcvXcV1pOemMm3dyWgy5qOEs07s7tgGN7spi1W/FnzsIi 9k/w== X-Gm-Message-State: AOJu0YyontB4N9OlJJ7oF/zyUOCVizyNsWL0v3GgN4ysAq3edRjDW0Xl DlSPSASItOMdpLa6R6nEHhAik3Qp300UN7/bRr57sQ8xpdg3eL3Bm4zZow== X-Google-Smtp-Source: AGHT+IGWniMlwBg4nMNN0Azz1SJeWir1giD7TSupuiF6HMS5oCbnDlsk4XCmiaUxi/NyRQN540kPqA== X-Received: by 2002:a5d:4e03:0:b0:34d:b284:9c65 with SMTP id ffacd0b85a97d-35e0f30ed25mr4741631f8f.45.1717358673787; Sun, 02 Jun 2024 13:04:33 -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?= , George Dunlap , Nick Rosbrook , Anthony PERARD , Juergen Gross Subject: [PATCH for-4.19? v5 04/10] tools/xl: Add altp2m_count parameter Date: Sun, 2 Jun 2024 20:04:17 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Petr Beneš Introduce a new altp2m_count parameter to control the maximum number of altp2m views a domain can use. By default, if altp2m_count is unspecified and altp2m is enabled, the value is set to 10, reflecting the legacy behavior. This change is preparatory; it establishes the groundwork for the feature but does not activate it. Signed-off-by: Petr Beneš --- tools/golang/xenlight/helpers.gen.go | 2 ++ tools/golang/xenlight/types.gen.go | 1 + tools/include/libxl.h | 8 ++++++++ tools/libs/light/libxl_create.c | 9 +++++++++ tools/libs/light/libxl_types.idl | 1 + tools/xl/xl_parse.c | 9 +++++++++ 6 files changed, 30 insertions(+) -- 2.34.1 diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/helpers.gen.go index fe5110474d..0449c55f31 100644 --- a/tools/golang/xenlight/helpers.gen.go +++ b/tools/golang/xenlight/helpers.gen.go @@ -1159,6 +1159,7 @@ if err := x.ArchX86.MsrRelaxed.fromC(&xc.arch_x86.msr_relaxed);err != nil { return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err) } x.Altp2M = Altp2MMode(xc.altp2m) +x.Altp2MCount = uint32(xc.altp2m_count) x.VmtraceBufKb = int(xc.vmtrace_buf_kb) if err := x.Vpmu.fromC(&xc.vpmu);err != nil { return fmt.Errorf("converting field Vpmu: %v", err) @@ -1676,6 +1677,7 @@ if err := x.ArchX86.MsrRelaxed.toC(&xc.arch_x86.msr_relaxed); err != nil { return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err) } xc.altp2m = C.libxl_altp2m_mode(x.Altp2M) +xc.altp2m_count = C.uint32_t(x.Altp2MCount) xc.vmtrace_buf_kb = C.int(x.VmtraceBufKb) if err := x.Vpmu.toC(&xc.vpmu); err != nil { return fmt.Errorf("converting field Vpmu: %v", err) diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/types.gen.go index c9e45b306f..54607758d3 100644 --- a/tools/golang/xenlight/types.gen.go +++ b/tools/golang/xenlight/types.gen.go @@ -603,6 +603,7 @@ ArchX86 struct { MsrRelaxed Defbool } Altp2M Altp2MMode +Altp2MCount uint32 VmtraceBufKb int Vpmu Defbool } diff --git a/tools/include/libxl.h b/tools/include/libxl.h index f5c7167742..bfa06caad2 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -1250,6 +1250,14 @@ typedef struct libxl__ctx libxl_ctx; */ #define LIBXL_HAVE_ALTP2M 1 +/* + * LIBXL_HAVE_ALTP2M_COUNT + * If this is defined, then libxl supports setting the maximum number of + * alternate p2m tables. + */ +#define LIBXL_HAVE_ALTP2M_COUNT 1 +#define LIBXL_ALTP2M_COUNT_DEFAULT (~(uint32_t)0) + /* * LIBXL_HAVE_REMUS * If this is defined, then libxl supports remus. diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c index 569e3d21ed..11d2f282f5 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -482,6 +482,15 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, return -ERROR_INVAL; } + if (b_info->altp2m_count == LIBXL_ALTP2M_COUNT_DEFAULT) { + if ((libxl_defbool_val(b_info->u.hvm.altp2m) || + b_info->altp2m != LIBXL_ALTP2M_MODE_DISABLED)) + /* Reflect the default legacy count */ + b_info->altp2m_count = 10; + else + b_info->altp2m_count = 0; + } + /* Assume that providing a bootloader user implies enabling restrict. */ libxl_defbool_setdefault(&b_info->bootloader_restrict, !!b_info->bootloader_user); diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl index 4e65e6fda5..2963c5e250 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -729,6 +729,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ # Alternate p2m is not bound to any architecture or guest type, as it is # supported by x86 HVM and ARM support is planned. ("altp2m", libxl_altp2m_mode), + ("altp2m_count", uint32, {'init_val': 'LIBXL_ALTP2M_COUNT_DEFAULT'}), # Size of preallocated vmtrace trace buffers (in KBYTES). # Use zero value to disable this feature. diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index e3a4800f6e..a82b8fe6e4 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -2063,6 +2063,15 @@ void parse_config_data(const char *config_source, } } + if (!xlu_cfg_get_long(config, "altp2m_count", &l, 1)) { + if (l != (uint16_t)l) { + fprintf(stderr, "ERROR: invalid value %ld for \"altp2m_count\"\n", l); + exit (1); + } + + b_info->altp2m_count = l; + } + if (!xlu_cfg_get_long(config, "vmtrace_buf_kb", &l, 1) && l) { b_info->vmtrace_buf_kb = l; } From patchwork Sun Jun 2 20:04:18 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: 13682994 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 7FD52C27C52 for ; Sun, 2 Jun 2024 20:04:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.734558.1140679 (Exim 4.92) (envelope-from ) id 1sDrRW-0000Fe-Tn; Sun, 02 Jun 2024 20:04:38 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 734558.1140679; Sun, 02 Jun 2024 20:04:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sDrRW-0000AK-KJ; Sun, 02 Jun 2024 20:04:38 +0000 Received: by outflank-mailman (input) for mailman id 734558; Sun, 02 Jun 2024 20:04:37 +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 1sDrRV-0007mz-5d for xen-devel@lists.xenproject.org; Sun, 02 Jun 2024 20:04:37 +0000 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [2a00:1450:4864:20::436]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 55a5657c-211b-11ef-90a1-e314d9c70b13; Sun, 02 Jun 2024 22:04:35 +0200 (CEST) Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-35dcd34a69bso2430727f8f.3 for ; Sun, 02 Jun 2024 13:04:35 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:04:34 -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: 55a5657c-211b-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717358675; x=1717963475; 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=xPmb+DHWEiqVT7szGSWw+jNtsJuaWk/ic+48cvb9OAo=; b=ilCUc32sdQ1yZ8UqZyk2l/gpkY/rAFncomSay9IOsCop+OyUh3Q7ZFehB+EZG6KXpM aAUu+ac9vZfsANHUdSYgBdYlrGSJ4hIEuIA3sa6po4qncaqB69fXrAFU8euPbCGxLHzQ ZJWnHtMSzLbBptLCbgrE5MFNHXkT7e0zpY5kmd6KW6do94YY2TE72eRHfjKjzDe8gfNt FUk5tE+EG3lgwdN2HVHYG0wczX/4hisfXYZreWPKIBBgymFMdLisRGJgoBhFhebvn6aC MY2bpcb6e+UkJg1sjEeUquH3oXqVCQgRryXWeMPeuUkuHnoreQN6IjKMGouw7/MsLZYD oNtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717358675; x=1717963475; 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=xPmb+DHWEiqVT7szGSWw+jNtsJuaWk/ic+48cvb9OAo=; b=eiB8PbLHvMA5nhm1JX8LbL/AcAs4NhCUDUNUCCy0MS7w0zXL6koCHDLEnjfrP6++Sp zJFq/oldye8rYSqKRI23Aa2FYOuPydUpqRwppuWjnbM+EOMYntm7wEAZLB9D3RxL8IJm cAvWfWbFGbEV4cSpgFWYyeqIhC+vwoYHL72vCWii9Uffp8DyFK/daAgTL6HaGEqWERF0 FvpBWpYOsJeu6NFs+NuCt06l6nzbNrxQ6f26q3FHsutsObHDkKJzJDFf1Wdai9Yr37PO yJn2YV6njB/POwlxEWL8CEKbHFo5UJ8jGCl2OmrCVPQEMkL20G9SER6dOyJs7G92Ly87 3hNQ== X-Gm-Message-State: AOJu0YzDQ4s7wxB6cikzXgZ0eLWx4GlAh5ivAlHaY1HTMxcUaBqLNDcd vpMpykPXQ9AxK/pdsBM+Qk0r2SGg0x8DgOzhKscrVEj8pFzca5zsL6HzTQ== X-Google-Smtp-Source: AGHT+IEi2D35Tnzu3IULZGk73EEhgGMItbZSQo70nq+seXU5oU0ENSxO0/uCFi2K2/onl2P+Lh15vQ== X-Received: by 2002:a5d:4005:0:b0:354:f1de:33eb with SMTP id ffacd0b85a97d-35e0f2836b3mr4900489f8f.26.1717358674817; Sun, 02 Jun 2024 13:04:34 -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?= , Anthony PERARD Subject: [PATCH for-4.19? v5 05/10] docs/man: Add altp2m_count parameter to the xl.cfg manual Date: Sun, 2 Jun 2024 20:04:18 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Petr Beneš Update manual pages to include detailed information about the altp2m_count configuration parameter. Signed-off-by: Petr Beneš --- docs/man/xl.cfg.5.pod.in | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.34.1 diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index ac3f88fd57..ff03b43884 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -2039,6 +2039,20 @@ a single guest HVM domain. B: While the option "altp2mhvm" is deprecated, legacy applications for x86 systems will continue to work using it. +=item B + +Specifies the maximum number of alternate-p2m views available to the guest. +This setting is crucial in domain introspection scenarios that require +multiple physical-to-machine (p2m) memory mappings to be established +simultaneously. + +Enabling multiple p2m views may increase memory usage. It is advisable to +review and adjust the B setting as necessary to accommodate +the additional memory requirements. + +B: This option is ignored if B is disabled. The default value +is 10. + =item B Enable or disables guest access to hardware virtualisation features, From patchwork Sun Jun 2 20:04:19 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: 13682999 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 E48F5C25B74 for ; Sun, 2 Jun 2024 20:04:58 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.734559.1140697 (Exim 4.92) (envelope-from ) id 1sDrRY-0000mQ-4X; Sun, 02 Jun 2024 20:04:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 734559.1140697; Sun, 02 Jun 2024 20:04:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sDrRX-0000l3-V3; Sun, 02 Jun 2024 20:04:39 +0000 Received: by outflank-mailman (input) for mailman id 734559; Sun, 02 Jun 2024 20:04:38 +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 1sDrRW-0007mz-F1 for xen-devel@lists.xenproject.org; Sun, 02 Jun 2024 20:04:38 +0000 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [2a00:1450:4864:20::435]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 567688e2-211b-11ef-90a1-e314d9c70b13; Sun, 02 Jun 2024 22:04:37 +0200 (CEST) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-354cd8da8b9so3476656f8f.0 for ; Sun, 02 Jun 2024 13:04:37 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:04:35 -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: 567688e2-211b-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717358676; x=1717963476; 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=DGLeqc9nd3kadS5/DKrJoeONfRKHhkFkkBxhvVJOirc=; b=GhgmK7CuZN2hw4/lDt7H0jQ6aoSKY0BpaAMv4FRuNgRGe2ttx246ENfqe9ZGj5xNB0 SDZUwlzrczAmaJFMKDvy3jQz0Yln4CorK7E931bIxdmNXTkN2cRW2tnX0Ty6Y9KSyrXJ XEeNaB9eDTUVuwNRd7pTG3UjcT5987KimH+Hv02IRK79qYJBqEA/1U/lXDhzrwoyTMHB R8npw6eflvzSQKjdhF/x1nYnNGopNN4wIZUzjf4k/Kt4j7gvupvhMwszOtMubSDjdjW+ EtFW9QuIxmTOTFKWXy5dSGDCl+vI94s8EOUGtafdCfi97Xch780LydQz46xouIDu7YP2 y9NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717358676; x=1717963476; 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=DGLeqc9nd3kadS5/DKrJoeONfRKHhkFkkBxhvVJOirc=; b=XHx0cz9t4ueZXR7TOEoXbW4IAaFjBnw0DhlAbZKdrapucJeS3bjbEsqX0wNKfBwnxp 8YsS7QnLSWceLu6Jh71kf/8mTGzydbFZxBwPvyiFY4trNZb9s0Z0H7EKqLKJj26I5FWc JykLR79751OGJa88xbOUnucM6+7DvdB+5DQjHaex1Z4lmmeehkCUdBTscNVAFymbEygE kV4nsdE/tr2i6E5JsPNWeIC6Kt6yGtA53Byv4d7ZTuuVN6AMkY6p426pj5BCznErZWEB Jq11r5Bz7/soEpdxDzXHKcKFAImyK2nscLGQ63zAfFsdyQUCVdbQ1ujrJOsC3KlWYvDq X+jA== X-Gm-Message-State: AOJu0YwPLmZl1CpPq0H5Oz/L9kMp3agn/kR+pxOMkO56g7Ko3/7GIEur vsHDVLm/z5i5RujvR/o8mRID6KOwlMmJjcRKoZJBdEu5xSjv/SyyTcu/RQf8 X-Google-Smtp-Source: AGHT+IEORE2b4SaQdkTR0pXCC6XV8zO8DY7VkZoXdbf4u7ErtCbWMsWhiSLCOTi1fq/GRpWayS+IXQ== X-Received: by 2002:a5d:4f8f:0:b0:356:50e7:e948 with SMTP id ffacd0b85a97d-35e0f32e295mr5789389f8f.67.1717358675755; Sun, 02 Jun 2024 13:04:35 -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?= , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , George Dunlap , Tamas K Lengyel , Alexandru Isaila , Petre Pircalabu Subject: [PATCH for-4.19? v5 06/10] x86/altp2m: Introduce accessor functions for safer array indexing Date: Sun, 2 Jun 2024 20:04:19 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Petr Beneš This patch introduces a set of accessor functions for altp2m array operations, and refactoring direct array accesses with them. This approach aims on improving the code clarity and also future-proofing the codebase against potential speculative execution attacks. Signed-off-by: Petr Beneš --- xen/arch/x86/hvm/vmx/vmx.c | 4 +-- xen/arch/x86/include/asm/altp2m.h | 32 +++++++++++++++++ xen/arch/x86/include/asm/p2m.h | 7 ++-- xen/arch/x86/mm/altp2m.c | 60 +++++++++++++------------------ xen/arch/x86/mm/hap/hap.c | 8 ++--- xen/arch/x86/mm/mem_access.c | 17 ++++----- xen/arch/x86/mm/mem_sharing.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 14 ++++---- xen/arch/x86/mm/p2m.c | 16 ++++----- 9 files changed, 91 insertions(+), 69 deletions(-) -- 2.34.1 diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index f16faa6a61..a420d452b3 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -4887,10 +4887,10 @@ bool asmlinkage vmx_vmenter_helper(const struct cpu_user_regs *regs) for ( i = 0; i < MAX_ALTP2M; ++i ) { - if ( currd->arch.altp2m_eptp[i] == mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(currd, i) == mfn_x(INVALID_MFN) ) continue; - ept = &currd->arch.altp2m_p2m[i]->ept; + ept = &altp2m_get_p2m(currd, i)->ept; if ( cpumask_test_cpu(cpu, ept->invalidate) ) { cpumask_clear_cpu(cpu, ept->invalidate); diff --git a/xen/arch/x86/include/asm/altp2m.h b/xen/arch/x86/include/asm/altp2m.h index e5e59cbd68..2f064c61a2 100644 --- a/xen/arch/x86/include/asm/altp2m.h +++ b/xen/arch/x86/include/asm/altp2m.h @@ -19,6 +19,38 @@ static inline bool altp2m_active(const struct domain *d) return d->arch.altp2m_active; } +static inline struct p2m_domain *altp2m_get_p2m(const struct domain* d, + unsigned int idx) +{ + return d->arch.altp2m_p2m[array_index_nospec(idx, MAX_ALTP2M)]; +} + +static inline uint64_t altp2m_get_eptp(const struct domain* d, + unsigned int idx) +{ + return d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)]; +} + +static inline void altp2m_set_eptp(const struct domain* d, + unsigned int idx, + uint64_t eptp) +{ + d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] = eptp; +} + +static inline uint64_t altp2m_get_visible_eptp(const struct domain* d, + unsigned int idx) +{ + return d->arch.altp2m_visible_eptp[array_index_nospec(idx, MAX_EPTP)]; +} + +static inline void altp2m_set_visible_eptp(const struct domain* d, + unsigned int idx, + uint64_t eptp) +{ + d->arch.altp2m_visible_eptp[array_index_nospec(idx, MAX_EPTP)] = eptp; +} + /* Alternate p2m VCPU */ void altp2m_vcpu_initialise(struct vcpu *v); void altp2m_vcpu_destroy(struct vcpu *v); diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h index c1478ffc36..e6f7764f9f 100644 --- a/xen/arch/x86/include/asm/p2m.h +++ b/xen/arch/x86/include/asm/p2m.h @@ -18,6 +18,7 @@ #include #include #include /* for pagetable_t */ +#include /* Debugging and auditing of the P2M code? */ #if !defined(NDEBUG) && defined(CONFIG_HVM) @@ -888,13 +889,14 @@ static inline struct p2m_domain *p2m_get_altp2m(struct vcpu *v) BUG_ON(index >= MAX_ALTP2M); - return v->domain->arch.altp2m_p2m[index]; + return altp2m_get_p2m(v->domain, index); } /* set current alternate p2m table */ static inline bool p2m_set_altp2m(struct vcpu *v, unsigned int idx) { struct p2m_domain *orig; + struct p2m_domain *ap2m; BUG_ON(idx >= MAX_ALTP2M); @@ -906,7 +908,8 @@ static inline bool p2m_set_altp2m(struct vcpu *v, unsigned int idx) atomic_dec(&orig->active_vcpus); vcpu_altp2m(v).p2midx = idx; - atomic_inc(&v->domain->arch.altp2m_p2m[idx]->active_vcpus); + ap2m = altp2m_get_p2m(v->domain, idx); + atomic_inc(&ap2m->active_vcpus); return true; } diff --git a/xen/arch/x86/mm/altp2m.c b/xen/arch/x86/mm/altp2m.c index 6fe1e9ed6b..7fb1738376 100644 --- a/xen/arch/x86/mm/altp2m.c +++ b/xen/arch/x86/mm/altp2m.c @@ -205,7 +205,7 @@ bool p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx) altp2m_list_lock(d); - if ( d->arch.altp2m_eptp[idx] != mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, idx) != mfn_x(INVALID_MFN) ) { if ( p2m_set_altp2m(v, idx) ) altp2m_vcpu_update_p2m(v); @@ -307,7 +307,7 @@ static void p2m_reset_altp2m(struct domain *d, unsigned int idx, struct p2m_domain *p2m; ASSERT(idx < MAX_ALTP2M); - p2m = array_access_nospec(d->arch.altp2m_p2m, idx); + p2m = altp2m_get_p2m(d, idx); p2m_lock(p2m); @@ -335,8 +335,8 @@ void p2m_flush_altp2m(struct domain *d) for ( i = 0; i < MAX_ALTP2M; i++ ) { p2m_reset_altp2m(d, i, ALTP2M_DEACTIVATE); - d->arch.altp2m_eptp[i] = mfn_x(INVALID_MFN); - d->arch.altp2m_visible_eptp[i] = mfn_x(INVALID_MFN); + altp2m_set_eptp(d, i, mfn_x(INVALID_MFN)); + altp2m_set_visible_eptp(d, i, mfn_x(INVALID_MFN)); } altp2m_list_unlock(d); @@ -350,7 +350,7 @@ static int p2m_activate_altp2m(struct domain *d, unsigned int idx, ASSERT(idx < MAX_ALTP2M); - p2m = array_access_nospec(d->arch.altp2m_p2m, idx); + p2m = altp2m_get_p2m(d, idx); hostp2m = p2m_get_hostp2m(d); p2m_lock(p2m); @@ -393,8 +393,7 @@ int p2m_init_altp2m_by_id(struct domain *d, unsigned int idx) altp2m_list_lock(d); - if ( d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] == - mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, idx) == mfn_x(INVALID_MFN) ) rc = p2m_activate_altp2m(d, idx, hostp2m->default_access); altp2m_list_unlock(d); @@ -417,7 +416,7 @@ int p2m_init_next_altp2m(struct domain *d, uint16_t *idx, for ( i = 0; i < MAX_ALTP2M; i++ ) { - if ( d->arch.altp2m_eptp[i] != mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, i) != mfn_x(INVALID_MFN) ) continue; rc = p2m_activate_altp2m(d, i, a); @@ -447,18 +446,15 @@ int p2m_destroy_altp2m_by_id(struct domain *d, unsigned int idx) rc = -EBUSY; altp2m_list_lock(d); - if ( d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] != - mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, idx) != mfn_x(INVALID_MFN) ) { - p2m = array_access_nospec(d->arch.altp2m_p2m, idx); + p2m = altp2m_get_p2m(d, idx); if ( !_atomic_read(p2m->active_vcpus) ) { p2m_reset_altp2m(d, idx, ALTP2M_DEACTIVATE); - d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] = - mfn_x(INVALID_MFN); - d->arch.altp2m_visible_eptp[array_index_nospec(idx, MAX_EPTP)] = - mfn_x(INVALID_MFN); + altp2m_set_eptp(d, idx, mfn_x(INVALID_MFN)); + altp2m_set_visible_eptp(d, idx, mfn_x(INVALID_MFN)); rc = 0; } } @@ -485,7 +481,7 @@ int p2m_switch_domain_altp2m_by_id(struct domain *d, unsigned int idx) rc = -EINVAL; altp2m_list_lock(d); - if ( d->arch.altp2m_visible_eptp[idx] != mfn_x(INVALID_MFN) ) + if ( altp2m_get_visible_eptp(d, idx) != mfn_x(INVALID_MFN) ) { for_each_vcpu( d, v ) if ( p2m_set_altp2m(v, idx) ) @@ -510,13 +506,12 @@ int p2m_change_altp2m_gfn(struct domain *d, unsigned int idx, mfn_t mfn; int rc = -EINVAL; - if ( idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] == - mfn_x(INVALID_MFN) ) + if ( idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || + altp2m_get_eptp(d, idx) == mfn_x(INVALID_MFN) ) return rc; hp2m = p2m_get_hostp2m(d); - ap2m = array_access_nospec(d->arch.altp2m_p2m, idx); + ap2m = altp2m_get_p2m(d, idx); p2m_lock(hp2m); p2m_lock(ap2m); @@ -577,10 +572,10 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t gfn, p2m_type_t t; p2m_access_t a; - if ( d->arch.altp2m_eptp[i] == mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, i) == mfn_x(INVALID_MFN) ) continue; - p2m = d->arch.altp2m_p2m[i]; + p2m = altp2m_get_p2m(d, i); /* Check for a dropped page that may impact this altp2m */ if ( mfn_eq(mfn, INVALID_MFN) && @@ -598,7 +593,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t gfn, for ( i = 0; i < MAX_ALTP2M; i++ ) { if ( i == last_reset_idx || - d->arch.altp2m_eptp[i] == mfn_x(INVALID_MFN) ) + altp2m_get_eptp(d, i) == mfn_x(INVALID_MFN) ) continue; p2m_reset_altp2m(d, i, ALTP2M_RESET); @@ -660,11 +655,10 @@ int p2m_set_suppress_ve_multi(struct domain *d, if ( sve->view > 0 ) { if ( sve->view >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(sve->view, MAX_EPTP)] == - mfn_x(INVALID_MFN) ) + altp2m_get_eptp(d, sve->view) == mfn_x(INVALID_MFN) ) return -EINVAL; - p2m = ap2m = array_access_nospec(d->arch.altp2m_p2m, sve->view); + p2m = ap2m = altp2m_get_p2m(d, sve->view); } p2m_lock(host_p2m); @@ -728,11 +722,10 @@ int p2m_get_suppress_ve(struct domain *d, gfn_t gfn, bool *suppress_ve, if ( altp2m_idx > 0 ) { if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] == - mfn_x(INVALID_MFN) ) + altp2m_get_eptp(d, altp2m_idx) == mfn_x(INVALID_MFN) ) return -EINVAL; - p2m = ap2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + p2m = ap2m = altp2m_get_p2m(d, altp2m_idx); } else p2m = host_p2m; @@ -766,15 +759,12 @@ int p2m_set_altp2m_view_visibility(struct domain *d, unsigned int altp2m_idx, * min(MAX_ALTP2M, MAX_EPTP). */ if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] == - mfn_x(INVALID_MFN) ) + altp2m_get_eptp(d, altp2m_idx) == mfn_x(INVALID_MFN) ) rc = -EINVAL; else if ( visible ) - d->arch.altp2m_visible_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] = - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]; + altp2m_set_visible_eptp(d, altp2m_idx, altp2m_get_eptp(d, altp2m_idx)); else - d->arch.altp2m_visible_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] = - mfn_x(INVALID_MFN); + altp2m_set_visible_eptp(d, altp2m_idx, mfn_x(INVALID_MFN)); altp2m_list_unlock(d); diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index d2011fde24..8fc8348152 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -511,13 +511,13 @@ int hap_enable(struct domain *d, u32 mode) for ( i = 0; i < MAX_EPTP; i++ ) { - d->arch.altp2m_eptp[i] = mfn_x(INVALID_MFN); - d->arch.altp2m_visible_eptp[i] = mfn_x(INVALID_MFN); + altp2m_set_eptp(d, i, mfn_x(INVALID_MFN)); + altp2m_set_visible_eptp(d, i, mfn_x(INVALID_MFN)); } for ( i = 0; i < MAX_ALTP2M; i++ ) { - rv = p2m_alloc_table(d->arch.altp2m_p2m[i]); + rv = p2m_alloc_table(altp2m_get_p2m(d, i)); if ( rv != 0 ) goto out; } @@ -592,7 +592,7 @@ void hap_teardown(struct domain *d, bool *preempted) for ( i = 0; i < MAX_ALTP2M; i++ ) { - p2m_teardown(d->arch.altp2m_p2m[i], false, preempted); + p2m_teardown(altp2m_get_p2m(d, i), false, preempted); if ( preempted && *preempted ) return; } diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c index 60a0cce68a..43f3a8c2aa 100644 --- a/xen/arch/x86/mm/mem_access.c +++ b/xen/arch/x86/mm/mem_access.c @@ -348,11 +348,10 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, if ( altp2m_idx ) { if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] == - mfn_x(INVALID_MFN) ) + altp2m_get_eptp(d, altp2m_idx) == mfn_x(INVALID_MFN) ) return -EINVAL; - ap2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + ap2m = altp2m_get_p2m(d, altp2m_idx); } if ( !xenmem_access_to_p2m_access(p2m, access, &a) ) @@ -404,11 +403,10 @@ long p2m_set_mem_access_multi(struct domain *d, if ( altp2m_idx ) { if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] == - mfn_x(INVALID_MFN) ) + altp2m_get_eptp(d, altp2m_idx) == mfn_x(INVALID_MFN) ) return -EINVAL; - ap2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + ap2m = altp2m_get_p2m(d, altp2m_idx); } p2m_lock(p2m); @@ -467,11 +465,10 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn, xenmem_access_t *access, else if ( altp2m_idx ) /* altp2m view 0 is treated as the hostp2m */ { if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] == - mfn_x(INVALID_MFN) ) + altp2m_get_eptp(d, altp2m_idx) == mfn_x(INVALID_MFN) ) return -EINVAL; - p2m = array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + p2m = altp2m_get_p2m(d, altp2m_idx); } return _p2m_get_mem_access(p2m, gfn, access); @@ -488,7 +485,7 @@ void arch_p2m_set_access_required(struct domain *d, bool access_required) unsigned int i; for ( i = 0; i < MAX_ALTP2M; i++ ) { - struct p2m_domain *p2m = d->arch.altp2m_p2m[i]; + struct p2m_domain *p2m = altp2m_get_p2m(d, i); if ( p2m ) p2m->access_required = access_required; diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index da28266ef0..21ac361111 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -914,7 +914,7 @@ static int nominate_page(struct domain *d, gfn_t gfn, for ( i = 0; i < MAX_ALTP2M; i++ ) { - ap2m = d->arch.altp2m_p2m[i]; + ap2m = altp2m_get_p2m(d, i); if ( !ap2m ) continue; diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index f83610cb8c..ed4252822e 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -1297,10 +1297,10 @@ static void ept_set_ad_sync(struct domain *d, bool value) { struct p2m_domain *p2m; - if ( d->arch.altp2m_eptp[i] == mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, i) == mfn_x(INVALID_MFN) ) continue; - p2m = d->arch.altp2m_p2m[i]; + p2m = altp2m_get_p2m(d, i); p2m_lock(p2m); p2m->ept.ad = value; @@ -1500,15 +1500,15 @@ void setup_ept_dump(void) void p2m_init_altp2m_ept(struct domain *d, unsigned int i) { - struct p2m_domain *p2m = array_access_nospec(d->arch.altp2m_p2m, i); + struct p2m_domain *p2m = altp2m_get_p2m(d, i); struct p2m_domain *hostp2m = p2m_get_hostp2m(d); struct ept_data *ept; p2m->ept.ad = hostp2m->ept.ad; ept = &p2m->ept; ept->mfn = pagetable_get_pfn(p2m_get_pagetable(p2m)); - d->arch.altp2m_eptp[array_index_nospec(i, MAX_EPTP)] = ept->eptp; - d->arch.altp2m_visible_eptp[array_index_nospec(i, MAX_EPTP)] = ept->eptp; + altp2m_set_eptp(d, i, ept->eptp); + altp2m_set_visible_eptp(d, i, ept->eptp); } unsigned int p2m_find_altp2m_by_eptp(struct domain *d, uint64_t eptp) @@ -1521,10 +1521,10 @@ unsigned int p2m_find_altp2m_by_eptp(struct domain *d, uint64_t eptp) for ( i = 0; i < MAX_ALTP2M; i++ ) { - if ( d->arch.altp2m_eptp[i] == mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, i) == mfn_x(INVALID_MFN) ) continue; - p2m = d->arch.altp2m_p2m[i]; + p2m = altp2m_get_p2m(d, i); ept = &p2m->ept; if ( eptp == ept->eptp ) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index e7e327d6a6..30a44441ba 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -107,9 +107,9 @@ void p2m_change_entry_type_global(struct domain *d, for ( i = 0; i < MAX_ALTP2M; i++ ) { - if ( d->arch.altp2m_eptp[i] != mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, i) != mfn_x(INVALID_MFN) ) { - struct p2m_domain *altp2m = d->arch.altp2m_p2m[i]; + struct p2m_domain *altp2m = altp2m_get_p2m(d, i); p2m_lock(altp2m); change_entry_type_global(altp2m, ot, nt); @@ -142,9 +142,9 @@ void p2m_memory_type_changed(struct domain *d) for ( i = 0; i < MAX_ALTP2M; i++ ) { - if ( d->arch.altp2m_eptp[i] != mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, i) != mfn_x(INVALID_MFN) ) { - struct p2m_domain *altp2m = d->arch.altp2m_p2m[i]; + struct p2m_domain *altp2m = altp2m_get_p2m(d, i); p2m_lock(altp2m); _memory_type_changed(altp2m); @@ -915,9 +915,9 @@ void p2m_change_type_range(struct domain *d, for ( i = 0; i < MAX_ALTP2M; i++ ) { - if ( d->arch.altp2m_eptp[i] != mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, i) != mfn_x(INVALID_MFN) ) { - struct p2m_domain *altp2m = d->arch.altp2m_p2m[i]; + struct p2m_domain *altp2m = altp2m_get_p2m(d, i); p2m_lock(altp2m); change_type_range(altp2m, start, end, ot, nt); @@ -988,9 +988,9 @@ int p2m_finish_type_change(struct domain *d, for ( i = 0; i < MAX_ALTP2M; i++ ) { - if ( d->arch.altp2m_eptp[i] != mfn_x(INVALID_MFN) ) + if ( altp2m_get_eptp(d, i) != mfn_x(INVALID_MFN) ) { - struct p2m_domain *altp2m = d->arch.altp2m_p2m[i]; + struct p2m_domain *altp2m = altp2m_get_p2m(d, i); p2m_lock(altp2m); rc = finish_type_change(altp2m, first_gfn, max_nr); From patchwork Sun Jun 2 20:04:20 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: 13682996 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 AB94AC27C53 for ; Sun, 2 Jun 2024 20:04:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.734560.1140703 (Exim 4.92) (envelope-from ) id 1sDrRY-0000wv-Q9; Sun, 02 Jun 2024 20:04:40 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 734560.1140703; Sun, 02 Jun 2024 20:04:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sDrRY-0000wE-KC; Sun, 02 Jun 2024 20:04:40 +0000 Received: by outflank-mailman (input) for mailman id 734560; Sun, 02 Jun 2024 20:04:40 +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 1sDrRX-0007mz-Ue for xen-devel@lists.xenproject.org; Sun, 02 Jun 2024 20:04:40 +0000 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [2a00:1450:4864:20::42a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5727d16e-211b-11ef-90a1-e314d9c70b13; Sun, 02 Jun 2024 22:04:38 +0200 (CEST) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-35dcd34a69bso2430744f8f.3 for ; Sun, 02 Jun 2024 13:04:38 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:04:36 -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: 5727d16e-211b-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717358677; x=1717963477; 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=IVTFox30KwHLP/OtWq0mLQ/t5mCblNfzOg7TaHqw2bw=; b=emz1xUD/5PnrdKZBt+GsbD23012FWwlFwlUFBfTsYIT0m43F5+s4yTGhjKLZLr9psC UyzN8JZyciT/rEX0EOgxLABrSXQgliPtIWe4sV/nRPOdIbn93dUAsmHZ6X0e//ugUa31 fZRs/4X2rJxUOY6M6sl93LaLgKS5W0fD5bxDBsHDyaVbuwGq41NK128wcL4jmYbFoDsC UeYdKss8zASwmSsxEcK8OPKq9ePUApe8ed7pjixoaPiwpuAZoigEJ1wxEULkFlQlkqHQ e2a+J75Y7zw83rmqSVZGx88fsdVC5jj1lvgk3Zcs4MflOVbl9+pTozIouIwvvdQ69oda e2ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717358677; x=1717963477; 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=IVTFox30KwHLP/OtWq0mLQ/t5mCblNfzOg7TaHqw2bw=; b=KFO6R2wQuBtCvveC9mwgOOWaaFkZqh8+PIRbgivi09686ZWgEhVafWKmb9HheoWtOi qMLb5R18K0eJ+xwGZNdNMbbn5e20mChz1kQb8lc4oR4rHmLdnMRw6F5iEtrog2XZ8jF6 ar9T/iFDSMrRw2wsfXKENEIhAupF7gyHGdwU7CX+znCjm9G/yn2wt5PHjlZFSJ9qO1no FxPCNUQm2uGE12JCHr2bBFyk8qMlQ2jsAJOBm1MwS+qD1Hj3iCd6uJeMtZW7EfvU9bSl x84HEuTHxDCQn5s44bc0kDD6Qh/1SCEpHRQ5gtaLh+vg8qqQ4DdOsPKFi9YsU3nHxp6Q VXAA== X-Gm-Message-State: AOJu0Yz3qFx2vch5aRno918jLH8Z6T6KBz9nsPjEwmlqyIUdty+s6W/S QMSIvGMDvW1RDNDZ0GK9pwURXDWQMnudOy/cLMlQYvyHSn3agwY9Cp75DXTr X-Google-Smtp-Source: AGHT+IFfWW1mzFYkEfS5aJQ0OAMKzDVsGxqM2GlbwhRTwd4ipwqab+yoixf+R+8smKTOTCLHm5k4JA== X-Received: by 2002:a5d:6e5e:0:b0:354:faf4:fa87 with SMTP id ffacd0b85a97d-35e0f2590e5mr4052405f8f.3.1717358677173; Sun, 02 Jun 2024 13:04:37 -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?= , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , George Dunlap , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Tamas K Lengyel , Alexandru Isaila , Petre Pircalabu Subject: [PATCH for-4.19? v5 07/10] xen: Make the maximum number of altp2m views configurable for x86 Date: Sun, 2 Jun 2024 20:04:20 +0000 Message-Id: <84794f97bc738add96a66790425a3aa5f5084a25.1717356829.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Petr Beneš x86: Make the maximum number of altp2m views configurable This commit introduces the ability to configure the maximum number of altp2m views for the domain during its creation. Previously, the limits were hardcoded to a maximum of 10. This change allows for greater flexibility in environments that require more or fewer altp2m views. The maximum configurable limit for nr_altp2m on x86 is now set to MAX_NR_ALTP2M (which currently holds the MAX_EPTP value - 512). This cap is linked to the architectural limit of the EPTP-switching VMFUNC, which supports up to 512 entries. Despite there being no inherent need for limiting nr_altp2m in scenarios not utilizing VMFUNC, decoupling these components would necessitate substantial code changes. xen_domctl_createdomain::altp2m is extended for a new field `nr`, that will configure this limit for a domain. Additionally, previous altp2m.opts value has been reduced from uint32_t to uint16_t so that both of these fields occupy as little space as possible. altp2m_get_p2m() function is modified to respect the new nr_altp2m value. Accessor functions that operate on EPT arrays are unmodified, since these arrays always have fixed size of MAX_EPTP. A dummy hvm_altp2m_supported() function is introduced for non-HVM builds, so that the compilation won't fail for them. Additional sanitization is introduced in the x86/arch_sanitise_domain_config to fix the altp2m.nr value to 10 if it is previously set to 0. This behavior is only temporary and immediately removed in the upcoming commit (which will disallow creating a domain with enabled altp2m with zero nr_altp2m). The reason for this temporary workaround is to retain the legacy behavior until the feature is fully activated in libxl. Also, arm/arch_sanitise_domain_config is extended to not allow requesting non-zero altp2ms. Signed-off-by: Petr Beneš Acked-by: Julien Grall # arm --- xen/arch/arm/domain.c | 2 +- xen/arch/x86/domain.c | 40 ++++++++++++++++++---- xen/arch/x86/hvm/hvm.c | 8 ++++- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/include/asm/altp2m.h | 2 +- xen/arch/x86/include/asm/domain.h | 9 ++--- xen/arch/x86/include/asm/hvm/hvm.h | 5 +++ xen/arch/x86/include/asm/p2m.h | 4 +-- xen/arch/x86/mm/altp2m.c | 54 ++++++++++++++++++++---------- xen/arch/x86/mm/hap/hap.c | 8 ++--- xen/arch/x86/mm/mem_access.c | 8 ++--- xen/arch/x86/mm/mem_sharing.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 4 +-- xen/arch/x86/mm/p2m.c | 8 ++--- xen/common/domain.c | 1 + xen/include/public/domctl.h | 5 ++- xen/include/xen/sched.h | 2 ++ 17 files changed, 113 insertions(+), 51 deletions(-) -- 2.34.1 diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 5234b627d0..e5785d2d96 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -688,7 +688,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config) return -EINVAL; } - if ( config->altp2m.opts ) + if ( config->altp2m.opts || config->altp2m.nr ) { dprintk(XENLOG_INFO, "Altp2m not supported\n"); return -EINVAL; diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index bb5ba8fc1e..011cffb07e 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -724,16 +724,42 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config) return -EINVAL; } - if ( altp2m_mode && nested_virt ) + if ( altp2m_mode ) { - dprintk(XENLOG_INFO, - "Nested virt and altp2m are not supported together\n"); - return -EINVAL; - } + if ( nested_virt ) + { + dprintk(XENLOG_INFO, + "Nested virt and altp2m are not supported together\n"); + return -EINVAL; + } + + if ( !hap ) + { + dprintk(XENLOG_INFO, "altp2m is only supported with HAP\n"); + return -EINVAL; + } + + if ( !hvm_altp2m_supported() ) + { + dprintk(XENLOG_INFO, "altp2m is not supported\n"); + return -EINVAL; + } + + if ( !config->altp2m.nr ) + { + /* Fix the value to the legacy default */ + config->altp2m.nr = 10; + } - if ( altp2m_mode && !hap ) + if ( config->altp2m.nr > MAX_NR_ALTP2M ) + { + dprintk(XENLOG_INFO, "altp2m.nr must be <= %lu\n", MAX_NR_ALTP2M); + return -EINVAL; + } + } + else if ( config->altp2m.nr ) { - dprintk(XENLOG_INFO, "altp2m is only supported with HAP\n"); + dprintk(XENLOG_INFO, "altp2m.nr must be zero when altp2m is off\n"); return -EINVAL; } diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index a66ebaaceb..3d0357a0f8 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4657,6 +4657,12 @@ static int do_altp2m_op( goto out; } + if ( d->nr_altp2m == 0 ) + { + rc = -EINVAL; + goto out; + } + if ( (rc = xsm_hvm_altp2mhvm_op(XSM_OTHER, d, mode, a.cmd)) ) goto out; @@ -5245,7 +5251,7 @@ void hvm_fast_singlestep(struct vcpu *v, uint16_t p2midx) if ( !hvm_is_singlestep_supported() ) return; - if ( p2midx >= MAX_ALTP2M ) + if ( p2midx >= v->domain->nr_altp2m ) return; v->arch.hvm.single_step = true; diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index a420d452b3..9292a2c8d8 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -4885,7 +4885,7 @@ bool asmlinkage vmx_vmenter_helper(const struct cpu_user_regs *regs) { unsigned int i; - for ( i = 0; i < MAX_ALTP2M; ++i ) + for ( i = 0; i < currd->nr_altp2m; ++i ) { if ( altp2m_get_eptp(currd, i) == mfn_x(INVALID_MFN) ) continue; diff --git a/xen/arch/x86/include/asm/altp2m.h b/xen/arch/x86/include/asm/altp2m.h index 2f064c61a2..a4cc3d3ffc 100644 --- a/xen/arch/x86/include/asm/altp2m.h +++ b/xen/arch/x86/include/asm/altp2m.h @@ -22,7 +22,7 @@ static inline bool altp2m_active(const struct domain *d) static inline struct p2m_domain *altp2m_get_p2m(const struct domain* d, unsigned int idx) { - return d->arch.altp2m_p2m[array_index_nospec(idx, MAX_ALTP2M)]; + return d->arch.altp2m_p2m[array_index_nospec(idx, d->nr_altp2m)]; } static inline uint64_t altp2m_get_eptp(const struct domain* d, diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h index f5daeb182b..855e844bed 100644 --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -258,11 +258,12 @@ struct paging_vcpu { struct shadow_vcpu shadow; }; -#define MAX_NESTEDP2M 10 +#define MAX_EPTP (PAGE_SIZE / sizeof(uint64_t)) +#define MAX_NR_ALTP2M MAX_EPTP +#define MAX_NESTEDP2M 10 -#define MAX_ALTP2M 10 /* arbitrary */ #define INVALID_ALTP2M 0xffff -#define MAX_EPTP (PAGE_SIZE / sizeof(uint64_t)) + struct p2m_domain; struct time_scale { int shift; @@ -353,7 +354,7 @@ struct arch_domain /* altp2m: allow multiple copies of host p2m */ bool altp2m_active; - struct p2m_domain *altp2m_p2m[MAX_ALTP2M]; + struct p2m_domain **altp2m_p2m; mm_lock_t altp2m_list_lock; uint64_t *altp2m_eptp; uint64_t *altp2m_visible_eptp; diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h index 1c01e22c8e..277648dd18 100644 --- a/xen/arch/x86/include/asm/hvm/hvm.h +++ b/xen/arch/x86/include/asm/hvm/hvm.h @@ -828,6 +828,11 @@ static inline bool hvm_hap_supported(void) return false; } +static inline bool hvm_altp2m_supported(void) +{ + return false; +} + static inline bool hvm_nested_virt_supported(void) { return false; diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h index e6f7764f9f..a1094fc7b3 100644 --- a/xen/arch/x86/include/asm/p2m.h +++ b/xen/arch/x86/include/asm/p2m.h @@ -887,7 +887,7 @@ static inline struct p2m_domain *p2m_get_altp2m(struct vcpu *v) if ( index == INVALID_ALTP2M ) return NULL; - BUG_ON(index >= MAX_ALTP2M); + BUG_ON(index >= v->domain->nr_altp2m); return altp2m_get_p2m(v->domain, index); } @@ -898,7 +898,7 @@ static inline bool p2m_set_altp2m(struct vcpu *v, unsigned int idx) struct p2m_domain *orig; struct p2m_domain *ap2m; - BUG_ON(idx >= MAX_ALTP2M); + BUG_ON(idx >= v->domain->nr_altp2m); if ( idx == vcpu_altp2m(v).p2midx ) return false; diff --git a/xen/arch/x86/mm/altp2m.c b/xen/arch/x86/mm/altp2m.c index 7fb1738376..d47277e5e5 100644 --- a/xen/arch/x86/mm/altp2m.c +++ b/xen/arch/x86/mm/altp2m.c @@ -15,6 +15,11 @@ void altp2m_vcpu_initialise(struct vcpu *v) { + struct domain *d = v->domain; + + if ( d->nr_altp2m == 0 ) + return; + if ( v != current ) vcpu_pause(v); @@ -30,8 +35,12 @@ altp2m_vcpu_initialise(struct vcpu *v) void altp2m_vcpu_destroy(struct vcpu *v) { + struct domain *d = v->domain; struct p2m_domain *p2m; + if ( d->nr_altp2m == 0 ) + return; + if ( v != current ) vcpu_pause(v); @@ -122,7 +131,12 @@ int p2m_init_altp2m(struct domain *d) struct p2m_domain *hostp2m = p2m_get_hostp2m(d); mm_lock_init(&d->arch.altp2m_list_lock); - for ( i = 0; i < MAX_ALTP2M; i++ ) + d->arch.altp2m_p2m = xzalloc_array(struct p2m_domain *, d->nr_altp2m); + + if ( !d->arch.altp2m_p2m ) + return -ENOMEM; + + for ( i = 0; i < d->nr_altp2m; i++ ) { d->arch.altp2m_p2m[i] = p2m = p2m_init_one(d); if ( p2m == NULL ) @@ -143,7 +157,10 @@ void p2m_teardown_altp2m(struct domain *d) unsigned int i; struct p2m_domain *p2m; - for ( i = 0; i < MAX_ALTP2M; i++ ) + if ( !d->arch.altp2m_p2m ) + return; + + for ( i = 0; i < d->nr_altp2m; i++ ) { if ( !d->arch.altp2m_p2m[i] ) continue; @@ -151,6 +168,8 @@ void p2m_teardown_altp2m(struct domain *d) d->arch.altp2m_p2m[i] = NULL; p2m_free_one(p2m); } + + XFREE(d->arch.altp2m_p2m); } int altp2m_get_effective_entry(struct p2m_domain *ap2m, gfn_t gfn, mfn_t *mfn, @@ -200,7 +219,7 @@ bool p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx) struct domain *d = v->domain; bool rc = false; - if ( idx >= MAX_ALTP2M ) + if ( idx >= d->nr_altp2m ) return rc; altp2m_list_lock(d); @@ -306,7 +325,7 @@ static void p2m_reset_altp2m(struct domain *d, unsigned int idx, { struct p2m_domain *p2m; - ASSERT(idx < MAX_ALTP2M); + ASSERT(idx < d->nr_altp2m); p2m = altp2m_get_p2m(d, idx); p2m_lock(p2m); @@ -332,7 +351,7 @@ void p2m_flush_altp2m(struct domain *d) altp2m_list_lock(d); - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { p2m_reset_altp2m(d, i, ALTP2M_DEACTIVATE); altp2m_set_eptp(d, i, mfn_x(INVALID_MFN)); @@ -348,7 +367,7 @@ static int p2m_activate_altp2m(struct domain *d, unsigned int idx, struct p2m_domain *hostp2m, *p2m; int rc; - ASSERT(idx < MAX_ALTP2M); + ASSERT(idx < d->nr_altp2m); p2m = altp2m_get_p2m(d, idx); hostp2m = p2m_get_hostp2m(d); @@ -388,7 +407,7 @@ int p2m_init_altp2m_by_id(struct domain *d, unsigned int idx) int rc = -EINVAL; struct p2m_domain *hostp2m = p2m_get_hostp2m(d); - if ( idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ) + if ( idx >= d->nr_altp2m ) return rc; altp2m_list_lock(d); @@ -414,7 +433,7 @@ int p2m_init_next_altp2m(struct domain *d, uint16_t *idx, altp2m_list_lock(d); - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { if ( altp2m_get_eptp(d, i) != mfn_x(INVALID_MFN) ) continue; @@ -436,7 +455,7 @@ int p2m_destroy_altp2m_by_id(struct domain *d, unsigned int idx) struct p2m_domain *p2m; int rc = -EBUSY; - if ( !idx || idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ) + if ( !idx || idx >= d->nr_altp2m ) return rc; rc = domain_pause_except_self(d); @@ -471,7 +490,7 @@ int p2m_switch_domain_altp2m_by_id(struct domain *d, unsigned int idx) struct vcpu *v; int rc = -EINVAL; - if ( idx >= MAX_ALTP2M ) + if ( idx >= d->nr_altp2m ) return rc; rc = domain_pause_except_self(d); @@ -506,8 +525,7 @@ int p2m_change_altp2m_gfn(struct domain *d, unsigned int idx, mfn_t mfn; int rc = -EINVAL; - if ( idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - altp2m_get_eptp(d, idx) == mfn_x(INVALID_MFN) ) + if ( idx >= d->nr_altp2m || altp2m_get_eptp(d, idx) == mfn_x(INVALID_MFN) ) return rc; hp2m = p2m_get_hostp2m(d); @@ -567,7 +585,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t gfn, altp2m_list_lock(d); - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { p2m_type_t t; p2m_access_t a; @@ -590,7 +608,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t gfn, else { /* At least 2 altp2m's impacted, so reset everything */ - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { if ( i == last_reset_idx || altp2m_get_eptp(d, i) == mfn_x(INVALID_MFN) ) @@ -654,7 +672,7 @@ int p2m_set_suppress_ve_multi(struct domain *d, if ( sve->view > 0 ) { - if ( sve->view >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || + if ( sve->view >= d->nr_altp2m || altp2m_get_eptp(d, sve->view) == mfn_x(INVALID_MFN) ) return -EINVAL; @@ -721,7 +739,7 @@ int p2m_get_suppress_ve(struct domain *d, gfn_t gfn, bool *suppress_ve, if ( altp2m_idx > 0 ) { - if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || + if ( altp2m_idx >= d->nr_altp2m || altp2m_get_eptp(d, altp2m_idx) == mfn_x(INVALID_MFN) ) return -EINVAL; @@ -756,9 +774,9 @@ int p2m_set_altp2m_view_visibility(struct domain *d, unsigned int altp2m_idx, /* * Eptp index is correlated with altp2m index and should not exceed - * min(MAX_ALTP2M, MAX_EPTP). + * d->nr_altp2m. */ - if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || + if ( altp2m_idx >= d->nr_altp2m || altp2m_get_eptp(d, altp2m_idx) == mfn_x(INVALID_MFN) ) rc = -EINVAL; else if ( visible ) diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index 8fc8348152..8b23792a0d 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -515,7 +515,7 @@ int hap_enable(struct domain *d, u32 mode) altp2m_set_visible_eptp(d, i, mfn_x(INVALID_MFN)); } - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { rv = p2m_alloc_table(altp2m_get_p2m(d, i)); if ( rv != 0 ) @@ -538,8 +538,8 @@ void hap_final_teardown(struct domain *d) unsigned int i; if ( hvm_altp2m_supported() ) - for ( i = 0; i < MAX_ALTP2M; i++ ) - p2m_teardown(d->arch.altp2m_p2m[i], true, NULL); + for ( i = 0; i < d->nr_altp2m; i++ ) + p2m_teardown(altp2m_get_p2m(d, i), true, NULL); /* Destroy nestedp2m's first */ for (i = 0; i < MAX_NESTEDP2M; i++) { @@ -590,7 +590,7 @@ void hap_teardown(struct domain *d, bool *preempted) FREE_XENHEAP_PAGE(d->arch.altp2m_eptp); FREE_XENHEAP_PAGE(d->arch.altp2m_visible_eptp); - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { p2m_teardown(altp2m_get_p2m(d, i), false, preempted); if ( preempted && *preempted ) diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c index 43f3a8c2aa..669a0d0a54 100644 --- a/xen/arch/x86/mm/mem_access.c +++ b/xen/arch/x86/mm/mem_access.c @@ -347,7 +347,7 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, uint32_t nr, /* altp2m view 0 is treated as the hostp2m */ if ( altp2m_idx ) { - if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || + if ( altp2m_idx >= d->nr_altp2m || altp2m_get_eptp(d, altp2m_idx) == mfn_x(INVALID_MFN) ) return -EINVAL; @@ -402,7 +402,7 @@ long p2m_set_mem_access_multi(struct domain *d, /* altp2m view 0 is treated as the hostp2m */ if ( altp2m_idx ) { - if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || + if ( altp2m_idx >= d->nr_altp2m || altp2m_get_eptp(d, altp2m_idx) == mfn_x(INVALID_MFN) ) return -EINVAL; @@ -464,7 +464,7 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn, xenmem_access_t *access, } else if ( altp2m_idx ) /* altp2m view 0 is treated as the hostp2m */ { - if ( altp2m_idx >= min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || + if ( altp2m_idx >= d->nr_altp2m || altp2m_get_eptp(d, altp2m_idx) == mfn_x(INVALID_MFN) ) return -EINVAL; @@ -483,7 +483,7 @@ void arch_p2m_set_access_required(struct domain *d, bool access_required) if ( altp2m_active(d) ) { unsigned int i; - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { struct p2m_domain *p2m = altp2m_get_p2m(d, i); diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index 21ac361111..2139d13009 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -912,7 +912,7 @@ static int nominate_page(struct domain *d, gfn_t gfn, altp2m_list_lock(d); - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { ap2m = altp2m_get_p2m(d, i); if ( !ap2m ) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index ed4252822e..f90c82f89b 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -1293,7 +1293,7 @@ static void ept_set_ad_sync(struct domain *d, bool value) { unsigned int i; - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { struct p2m_domain *p2m; @@ -1519,7 +1519,7 @@ unsigned int p2m_find_altp2m_by_eptp(struct domain *d, uint64_t eptp) altp2m_list_lock(d); - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { if ( altp2m_get_eptp(d, i) == mfn_x(INVALID_MFN) ) continue; diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 30a44441ba..380b7ece9c 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -105,7 +105,7 @@ void p2m_change_entry_type_global(struct domain *d, { unsigned int i; - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { if ( altp2m_get_eptp(d, i) != mfn_x(INVALID_MFN) ) { @@ -140,7 +140,7 @@ void p2m_memory_type_changed(struct domain *d) { unsigned int i; - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { if ( altp2m_get_eptp(d, i) != mfn_x(INVALID_MFN) ) { @@ -913,7 +913,7 @@ void p2m_change_type_range(struct domain *d, { unsigned int i; - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { if ( altp2m_get_eptp(d, i) != mfn_x(INVALID_MFN) ) { @@ -986,7 +986,7 @@ int p2m_finish_type_change(struct domain *d, { unsigned int i; - for ( i = 0; i < MAX_ALTP2M; i++ ) + for ( i = 0; i < d->nr_altp2m; i++ ) { if ( altp2m_get_eptp(d, i) != mfn_x(INVALID_MFN) ) { diff --git a/xen/common/domain.c b/xen/common/domain.c index 67cadb7c3f..776442cec0 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -610,6 +610,7 @@ struct domain *domain_create(domid_t domid, if ( config ) { d->options = config->flags; + d->nr_altp2m = config->altp2m.nr; d->vmtrace_size = config->vmtrace_size; } diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index dea399aa8e..056bbc82a2 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -103,7 +103,10 @@ struct xen_domctl_createdomain { /* Altp2m mode signaling uses bits [0, 1]. */ #define XEN_DOMCTL_ALTP2M_mode_mask (0x3U) #define XEN_DOMCTL_ALTP2M_mode(m) ((m) & XEN_DOMCTL_ALTP2M_mode_mask) - uint32_t opts; + uint16_t opts; + + /* Number of altp2ms to allocate. */ + uint16_t nr; } altp2m; /* Per-vCPU buffer size in bytes. 0 to disable. */ diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 2dcd1d1a4f..7119f3c44f 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -610,6 +610,8 @@ struct domain unsigned int guest_request_sync : 1; } monitor; + unsigned int nr_altp2m; /* Number of altp2m tables */ + unsigned int vmtrace_size; /* Buffer size in bytes, or 0 to disable. */ #ifdef CONFIG_ARGO From patchwork Sun Jun 2 20:04:21 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: 13682991 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 75E20C41513 for ; Sun, 2 Jun 2024 20:04:55 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.734562.1140722 (Exim 4.92) (envelope-from ) id 1sDrRa-0001Nb-Hl; Sun, 02 Jun 2024 20:04:42 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 734562.1140722; Sun, 02 Jun 2024 20:04:42 +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-0001MG-6Y; Sun, 02 Jun 2024 20:04:42 +0000 Received: by outflank-mailman (input) for mailman id 734562; Sun, 02 Jun 2024 20:04:41 +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 1sDrRY-00084Y-Ty for xen-devel@lists.xenproject.org; Sun, 02 Jun 2024 20:04:40 +0000 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [2a00:1450:4864:20::32d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 57aa46a1-211b-11ef-b4bb-af5377834399; Sun, 02 Jun 2024 22:04:39 +0200 (CEST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-421338c4c3bso15296275e9.1 for ; Sun, 02 Jun 2024 13:04:39 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:04:37 -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: 57aa46a1-211b-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717358678; x=1717963478; 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=nyVxB8SzIq3ix8NG+232jLUPvfNmU9Jk5I/4qPsfmIc=; b=LaGqPt/FCXizFXiToBbVw60xjCEWY5BxEOq2nas5cf7TyTy5jaML1HIyqZATCq1/rd HD7qVDO7i/n2ZU7tODZMZiLiN6rcHenUaksp1gbqqgfEP91stAx/ncsiH4msms14ysus oTKjvoHOasLELpNNo2uUAzkWrT0NXXvlhiWsipH8NuFFvTj13vkVVz7Z9GJp4ZlGaITb YaqcSU065fwYu1236yFNoGybGqyYWCBmeassQe0Ze6eGMiLetXH0tLk8psib/oT21KVr bzluTrW6J9XA0e8HC0PfWvKX1uKtRm0G5e4QNDRyt7QB6Eu0Cz0xwGz3wH73Si0PfaR2 MZ8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717358678; x=1717963478; 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=nyVxB8SzIq3ix8NG+232jLUPvfNmU9Jk5I/4qPsfmIc=; b=nADz7E28FOKzGoj+uov5OqRCxIwiGrciGDMj7MPCL24wz5ruCwTNeyH3UlpKS1ldmj +hTWLauOnNI2eMQUeCeYlAWph5zLrv8Wn2jDNQB4vpmuNeNyvHrdv2EtV+43g0l3ptxq vOr5O2y8F1Y1mT81jMVdhPF56Nr7B8wiGP2aoZbJOpAVzj5KHz3rZiuARBnzsLlBiqdg FP9Us1mD++AARQ6p2N6xt+uJijsnwSDfWQhPcg4Y4u/36MwfIEfXs2xtWib2oENVLt97 MAGsSCBd/1dzBfY7UO/AIt6quSkvmJ+IFaPfHJAuvTXEwWvR1r6n6w+l8mY5EPX1SLix xL3A== X-Gm-Message-State: AOJu0YzhJrNIAi0eBcJ7xydpfkZ6TqNeLy6MV8V5alQTdHI+80nw77Rz anqa8FCBIz+fety0JyGigoNXoYD7fClTAUOB2XbS7fu0/isaR+j24OsLng== X-Google-Smtp-Source: AGHT+IGVr5Ym4zdRhYa0+9XmV8eM6V0ASINffhd7dARFKkDZCPZn6fIveD60a1vitG9ViPB4KVzJ2w== X-Received: by 2002:adf:f3c6:0:b0:354:f2a7:97d6 with SMTP id ffacd0b85a97d-35e0f285b04mr5191591f8f.30.1717358678069; Sun, 02 Jun 2024 13:04:38 -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?= , Anthony PERARD , Juergen Gross Subject: [PATCH for-4.19? v5 08/10] tools/libxl: Activate the altp2m_count feature Date: Sun, 2 Jun 2024 20:04:21 +0000 Message-Id: <9f0f897ea677aa80da2465f1a713d409950d33dd.1717356829.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Petr Beneš This commit activates the previously introduced altp2m_count parameter, establishing the connection between libxl and Xen. Signed-off-by: Petr Beneš --- tools/libs/light/libxl_create.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.34.1 diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c index 11d2f282f5..5ad552c4ec 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -656,6 +656,10 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, .max_grant_frames = b_info->max_grant_frames, .max_maptrack_frames = b_info->max_maptrack_frames, .grant_opts = XEN_DOMCTL_GRANT_version(b_info->max_grant_version), + .altp2m = { + .opts = 0, /* .opts will be set below */ + .nr = b_info->altp2m_count, + }, .vmtrace_size = ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAGE_SHIFT), .cpupool_id = info->poolid, }; From patchwork Sun Jun 2 20:04:22 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: 13682998 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 3E793C27C5F for ; Sun, 2 Jun 2024 20:04:57 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.734561.1140715 (Exim 4.92) (envelope-from ) id 1sDrRa-0001JS-1a; Sun, 02 Jun 2024 20:04:42 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 734561.1140715; Sun, 02 Jun 2024 20:04:41 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sDrRZ-0001Ij-SQ; Sun, 02 Jun 2024 20:04:41 +0000 Received: by outflank-mailman (input) for mailman id 734561; Sun, 02 Jun 2024 20:04:40 +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 1sDrRY-0007mz-9Z for xen-devel@lists.xenproject.org; Sun, 02 Jun 2024 20:04:40 +0000 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [2a00:1450:4864:20::32f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 580ba425-211b-11ef-90a1-e314d9c70b13; Sun, 02 Jun 2024 22:04:39 +0200 (CEST) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-42133f8432aso10412765e9.3 for ; Sun, 02 Jun 2024 13:04:39 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 13:04:38 -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: 580ba425-211b-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717358679; x=1717963479; 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=4tWBEUL49TAySW16gIvLPk/vey32SSkMkPdHxsZn7CQ=; b=d536lnBfkYCeDZ8tKQ1RKRoa+gTQ9riLbc7ml3J2qmS7e66F97Nt8z3CE4O2ykWR5N VpWTfgwGWMJnXKIgqpvWfVNoqLUVVrglBaCMQ035MvDL/zFcf3VBRGw2AdI11rVVHLRf WDd3R9U/DYCBi+rlNrxfTxnUPcptKq65DenK8ZGzI+aKesRm0SLe4v5Qv1J7Wa0KuWPx Ysx+5SSQtWRokxg3Fx13Gb489x4tv8Dsx3kGzHviLcPjCPdUG/FgATsdAhhWXfcEeVC7 SPia4M3+RHxFDt5eSlPuxnEJ3+aYDPpGwmpnGCMvL3BBrfcqFHwula+DLblMZZIfM/Vm aVQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717358679; x=1717963479; 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=4tWBEUL49TAySW16gIvLPk/vey32SSkMkPdHxsZn7CQ=; b=HAldCsgSOweObLxXKHiVOi1YpYtnlPQ6iXz4vkXyn1wTBD6TPC51muSgDlcs2otzfj BJjtcZNed/l4QZYZwxZFE70wgPc3EPRRwTdKuUl3Ub9uenccWm9VKvbJrek7gygvrR5U BETnixlO5WRWBciA2qRyMe9W7BXM44OlnTHpthzuAoXIBQ+NWTjqDG4AnwOv/kiOVAIb afjvExObJoDUqUiWI3+k35KO2X3uX9eWHwk0BlcpzafOzyjI37e/Pp28ivFLmXcdVSHg Vn0MAKdiNfwYAbjajwC545ZEBlI9jv2GcK+dbTgUhJgxN5yuLJn+GdjDrWeWQjNHrDiM 3R2Q== X-Gm-Message-State: AOJu0YyI1evj8U3RDa3mR0TOVUGu6o/Mw/0vWRlSnFWV9pCKIzH+gVIq 8OmxNEca7pVIrHzE+uAYXDCjKBqRyQGJ90bmeolpu7/WJ0ieznmVsgPY4g== X-Google-Smtp-Source: AGHT+IEcZugb1HchUGNH0n8OmUpHLBaLxbPi8w5G8EFFJnI6zPxZpMm0Djp1QyiCnXUS+IGb/ZHrtA== X-Received: by 2002:a05:600c:1c19:b0:421:2adb:dd4c with SMTP id 5b1f17b1804b1-4212e07009amr63464015e9.22.1717358678880; Sun, 02 Jun 2024 13:04:38 -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?= , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Subject: [PATCH for-4.19? v5 09/10] xen/x86: Disallow creating domains with altp2m enabled and altp2m.nr == 0 Date: Sun, 2 Jun 2024 20:04:22 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Petr Beneš Since libxl finally sends the altp2m.nr value, we can remove the previously introduced temporary workaround. Creating domain with enabled altp2m while setting altp2m.nr == 0 doesn't make sense and it's probably not what user wants. Signed-off-by: Petr Beneš Acked-by: Jan Beulich --- xen/arch/x86/domain.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.34.1 diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 011cffb07e..52bfeafe3f 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -747,8 +747,9 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config) if ( !config->altp2m.nr ) { - /* Fix the value to the legacy default */ - config->altp2m.nr = 10; + dprintk(XENLOG_INFO, + "altp2m must be requested with altp2m.nr > 0\n"); + return -EINVAL; } if ( config->altp2m.nr > MAX_NR_ALTP2M ) 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