From nobody Fri Oct 31 03:47:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1751399694; cv=none; d=zohomail.com; s=zohoarc; b=QJPD/I5GDj/TLVL3lkTGI+Mi+q3SYWsmOzYldHnSKzDF2VtrKHDaNrDvCVwvze0Vk/ejUhZMCsQu/93UFTAqsSOgyaQ5eKie6ylhJqvJKKoZvppWYQTzE2rmR49aO/bn9thDKQH90uW8SDlfyeyLkTQwPa8IrupWyhpuFXHgaI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751399694; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=h7PeFG4j0+6wg/8x4w0BGJXrwiGp05DFafVuw1va9HQ=; b=HuUNYg5qWcVtvecoDD8eQdxWkfPdo373ctg3z3hGkOHhtfGtOsVg2syCQIbomA5S10tXRK+6P/GnAKyg7KHQ2RJLUEsG0JD10wx+qqZMoMMAjwVpxpmA4DlwkK5vyLreSOxn67Av3CRp2sj7+8xrvuclCkm1gnjZn4FxzxFUm+o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751399694546673.3225723934152; Tue, 1 Jul 2025 12:54:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1029943.1403652 (Exim 4.92) (envelope-from ) id 1uWh3x-0000Dd-Va; Tue, 01 Jul 2025 19:54:41 +0000 Received: by outflank-mailman (output) from mailman id 1029943.1403652; Tue, 01 Jul 2025 19:54: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 1uWh3x-0000DV-Sq; Tue, 01 Jul 2025 19:54:41 +0000 Received: by outflank-mailman (input) for mailman id 1029943; Tue, 01 Jul 2025 19:54: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 1uWh3x-0000D0-79 for xen-devel@lists.xenproject.org; Tue, 01 Jul 2025 19:54:41 +0000 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [2a00:1450:4864:20::333]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 38d8a3f5-56b5-11f0-b894-0df219b8e170; Tue, 01 Jul 2025 21:54:39 +0200 (CEST) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-45362642f3bso8203555e9.2 for ; Tue, 01 Jul 2025 12:54: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-3a88c7e9d1csm14291644f8f.13.2025.07.01.12.54.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jul 2025 12:54:37 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 38d8a3f5-56b5-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751399678; x=1752004478; 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=h7PeFG4j0+6wg/8x4w0BGJXrwiGp05DFafVuw1va9HQ=; b=ECeRJY62+x9nWP83c41llj4YFl4IM4+WFXr3X2Dd+8EdjSFM1Kqexascw13qJMWrV3 +I/dZdxUanmuRMvVNJ/K6spMiodOxRGGkildHNfk7FHjA5XKhq6N9GehyS9saz0XNKRD zgMRZpo7yY2Gb8+/O6B/nhKaCpiOJcmx8xOSd10j2eKCbvCRCkDC9/L/41GlzFt068FQ cV9nl0x5cB9FPRNVeoesO+EoSpD71vY5IqsGyQmCxfSstxUWlgVAj8J/a8zzMNPekk6J QtZFyRsY9L2Ct8go0Qbx2zcQrcIECOaJ27F11c6s4qdnw+4UvYkAeORhXP4VsJETKk+0 Ub4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751399678; x=1752004478; 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=h7PeFG4j0+6wg/8x4w0BGJXrwiGp05DFafVuw1va9HQ=; b=gwMfQQFjET/GtX2Cf1A1psx7Ie3fJE64KypQVAiF4w04GXHzlrzwhWn1tdJ+A8ahUt uZjb5XFj4nV9B6+ZpFkBOkZ+o22KntInmHpaQnfwuWokaLY90z4mUYUkInHaw6wOOoHg 6W7+LTER9Ua9iHOZo5+hADxRXaTS4wz3iXeXf4/Zpu3vVLUl8hiRh3Brg3fFoT4E1ZIy ccKk5b33FJ6d1Y2/7MJkKX513bSbZ8cTohI9pVu+CeJwFaqE2oN40O3WQmVF24U/LNqa iNiLHrfkA+/eZrOfgSUZXHSLI9h2VEp+pE2cpfQYO70N7mdxaewMipf0cip+CSQcRV5m H69g== X-Gm-Message-State: AOJu0YwHvkkizHHGLa8wabOKNlLnDMKxbLjQEC2odyPOE8t3fpABEVIP +0k50R8P05Bxf98AZG+CcajwMwDpyBPHJ1CnUr18lF7pbay0C4/Pb/SZD6RG0A== X-Gm-Gg: ASbGnctyQXQhEuKEj39cM1lNWo3+4u4kw3ZrV94c+4O0ra0Oj893qU2dRHsbuEjdh8E g60nn8iNEKaCJ1D+Ptx10XRo4a2wpp1MZQLdAIz30txuDGEzyHcvlBYSet7j/jSs40m+Ho+7/KY rzEGNq53Tdqt7QfEMcHzd0pjZlwbK3vpmdJyVv+mVbQFrZiZ35folRfzv8Y+/aD7yPA41IK5F4Y vm+i6o1WA/i624qqD3633ciiJNEWogjn6XI7uDrlT3PvgIGKmYu3GnI/tD9qT8gnV0y/ABboc/J 48qEyi0SSvVxj3I83onMyInfIoJqpFHKy8+7cAeOjFOsqxfp/LCttq3dt5N8IHK6n8l3zXsRq26 styWDYMTympeBrRCso2FWdQoRHQ93iEH8o8/sJTRSeNq3zk3cxhQC0rIjPb8jqQ== X-Google-Smtp-Source: AGHT+IFmZWVWUaqiRen1DgrZdhU0MlS1yST6+M+EjNqhMxIAw+nMfyfVsHuzAkH1f5VXRnCrd7HKrg== X-Received: by 2002:a05:6000:18a9:b0:3a5:3399:51b1 with SMTP id ffacd0b85a97d-3af24e18458mr1776818f8f.6.1751399678131; Tue, 01 Jul 2025 12:54:38 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Anthony PERARD , Juergen Gross , Andrew Cooper , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Christian Lindig , David Scott , Bertrand Marquis , Volodymyr Babchuk , Christian Lindig , Julien Grall Subject: [PATCH v7 1/7] xen: Refactor altp2m options into a structured format Date: Tue, 1 Jul 2025 19:54:23 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1751399696398116600 From: Petr Bene=C5=A1 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=C5=A1 Acked-by: Christian Lindig Acked-by: Anthony PERARD Acked-by: Julien Grall # arm Reviewed-by: Jan Beulich # hypervisor --- 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(-) diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_creat= e.c index 9525d22312..8a85fba1cf 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -622,17 +622,17 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_co= nfig *d_config, LOG(DETAIL, "altp2m: %s", libxl_altp2m_mode_to_string(b_info->altp= 2m)); switch(b_info->altp2m) { case LIBXL_ALTP2M_MODE_MIXED: - create.altp2m_opts |=3D + create.altp2m.opts |=3D XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_mixed); break; =20 case LIBXL_ALTP2M_MODE_EXTERNAL: - create.altp2m_opts |=3D + create.altp2m.opts |=3D XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_external); break; =20 case LIBXL_ALTP2M_MODE_LIMITED: - create.altp2m_opts |=3D + create.altp2m.opts |=3D XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_limited); break; =20 diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index 863ab3c778..b51fd66788 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -225,7 +225,9 @@ CAMLprim value stub_xc_domain_create(value xch_val, val= ue wanted_domid, value co .max_maptrack_frames =3D Int_val(VAL_MAX_MAPTRACK_FRAMES), .grant_opts =3D XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)), - .altp2m_opts =3D Int32_val(VAL_ALTP2M_OPTS), + .altp2m =3D { + .opts =3D Int32_val(VAL_ALTP2M_OPTS), + }, .vmtrace_size =3D vmtrace_size, .cpupool_id =3D Int32_val(VAL_CPUPOOL_ID), }; diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index be58a23dd7..79a144e61b 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -693,7 +693,7 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config) return -EINVAL; } =20 - 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 b67342797f..56c3816187 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -622,7 +622,7 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config) bool hap =3D config->flags & XEN_DOMCTL_CDF_hap; bool nested_virt =3D config->flags & XEN_DOMCTL_CDF_nested_virt; unsigned int max_vcpus; - unsigned int altp2m_mode =3D MASK_EXTR(config->altp2m_opts, + unsigned int altp2m_mode =3D MASK_EXTR(config->altp2m.opts, XEN_DOMCTL_ALTP2M_mode_mask); =20 if ( hvm ? !hvm_enabled : !IS_ENABLED(CONFIG_PV) ) @@ -709,7 +709,7 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config) return -EINVAL; } =20 - 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 056360d5fe..56c7de3977 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -665,7 +665,7 @@ int hvm_domain_initialise(struct domain *d, d->arch.hvm.params[HVM_PARAM_TRIPLE_FAULT_REASON] =3D SHUTDOWN_reboot; =20 /* 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] =3D XEN_ALTP2M_mixed; diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index be19ab5e26..a69dd96084 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -99,6 +99,7 @@ struct xen_domctl_createdomain { =20 uint32_t grant_opts; =20 + struct { /* * Enable altp2m mixed mode. * @@ -115,7 +116,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; =20 /* Per-vCPU buffer size in bytes. 0 to disable. */ uint32_t vmtrace_size; --=20 2.34.1 From nobody Fri Oct 31 03:47:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1751399698; cv=none; d=zohomail.com; s=zohoarc; b=kYjDVL5bJFvQacMm22PPcr0qe/btUvVf8szjqIPoSTiFJhkgpn/uUpSbH2m+VkzvV3sViKmORp87HbRnlv4dNQyG76XvZAwHgTiCqhOwQJFVKQl9PATIxCbyOwBDromwRgggeos98ePQSKVnyKZjDMh+KM37BqO92ETg2iepkzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751399698; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hCdCFUU01yaVxgQDnPyQnDx1XPvODNjjRXJBKjo5xuA=; b=nsw+Uez5jDxqB4us5yipkoTLk7Rhd9RKwEWLa/EMPcNvn8QwyQy9I/F7n1k+KGtyQgUqBH7thAmNGA9rc2/Gc5hMlLUZExkSitgA25Zs2BEfCm70Ftq6l+NhIerOa6x6LOg57dXXbaac6HRnB5mGjUE6DrIp6i+dWI9FzMWAG5I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751399698839887.4645014339212; Tue, 1 Jul 2025 12:54:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1029944.1403662 (Exim 4.92) (envelope-from ) id 1uWh3z-0000SP-7y; Tue, 01 Jul 2025 19:54:43 +0000 Received: by outflank-mailman (output) from mailman id 1029944.1403662; Tue, 01 Jul 2025 19:54: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 1uWh3z-0000SI-3y; Tue, 01 Jul 2025 19:54:43 +0000 Received: by outflank-mailman (input) for mailman id 1029944; Tue, 01 Jul 2025 19:54: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 1uWh3x-0000D0-TE for xen-devel@lists.xenproject.org; Tue, 01 Jul 2025 19:54:41 +0000 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [2a00:1450:4864:20::42e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3958c4d4-56b5-11f0-b894-0df219b8e170; Tue, 01 Jul 2025 21:54:40 +0200 (CEST) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3a4eed70f24so821012f8f.0 for ; Tue, 01 Jul 2025 12:54: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-3a88c7e9d1csm14291644f8f.13.2025.07.01.12.54.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jul 2025 12:54:38 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3958c4d4-56b5-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751399679; x=1752004479; 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=hCdCFUU01yaVxgQDnPyQnDx1XPvODNjjRXJBKjo5xuA=; b=Txw33WL1Il2ssqtj0mX/lGxwnnThK6h2dCal0vg0B7C7gFjocxTH9JhdsBsqb4hB0O P+Ib7fGAVAy/AddmYmZesPQu4dgKl7Ejo+AMwwlfPMLKkcHnTDZJiF8W+ZRrgM010awC XtSuFC79ZGcbGYHK8cTty1/jjCGkAZVcsIkdyp43LGAlsgPAmpN+PQHfpvSBwxpi+FPM jO4qRHrDo+amVEWp4reO1OzlPq8f+mVHTZ6gwlz28GpZqrv7uvngkv456T+W2JvyydQg fXhceC5S8/r9+x0uZnnsENip36IgxRTYyJw1aCj0wavjD/XGcD9idzcHpPosQuk/egLe GHEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751399679; x=1752004479; 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=hCdCFUU01yaVxgQDnPyQnDx1XPvODNjjRXJBKjo5xuA=; b=BQZiANnWSp6y1Psfd9Ih7QlNqbscJPmEBuCFU0C7tNwZDc4MoSdtmFJfY3cphHcHyv MMn1QXyxLa2LuAhzTUWoMTv13SN42+rFYOwHlnuhKZS4+2g2uvZH05LUq7xcwwHXFBAZ EdEM1Rsx0tLmOrTeRJ2B3KToHWNS7Btj8OFcERAcbYstEJ7TbZarggvzhmgdSJ2K2Fnb h8/v4L5+gvI4854JisCTZ5jDzdc8JmWsvFwKlBtQnQbuqU5SdoImt4OhIud17Iqq+/kj Dj7SCdLnmA3QW2iUXpJqsWpKFvspCfr+5rssh5grSc/U6AUlaFRoxn7n0a3HZLGe5MW7 jc3g== X-Gm-Message-State: AOJu0YxBS6tqu0dxftnRnxeSBBvmJlIruuZJQQK5drn5GNyHmh06XlBx SLFuyAa5N2YpR8OH91uHghvPezXyAAtQnHiT7orBzkgyxsdQfcsaNcqz2wmXCg== X-Gm-Gg: ASbGnctmch2h4Scv0yhevUMteEh5X60PhfbIJuXPnTky1XBeRIFmqJflVG4iN4+onSf Qk/aHsVHYF1Nm48TRG4pNYAKPpFnFFF5TmQQ6pM8xiclcD1RdeUXtgmlsd202r/bNiqX0QrM2DY BJbc0EQldXCEmSFn92mGWaRLU0yKOezl8ldNLz92xx+USguMUthTJ1MhDlYU+J8GC62c46UiPuz sUwv/N5HjFACWJ+4qY+CFHtLeeArOe9MJvYtPYxJMraJTrWay4rUjNUoTAcjIv3aTlOEY6fa8PC Hxj2Nu69v5XyvJAoODIpk3LSfvX1xxbp5EL8WcmmN0khsu4TyDVaJZM6XO/v6YJoTCiqJVmKsLU siruhxLl14yE+WL0CRXcZ/ciuFDFX7xm9sYoZGjgu3WomAUglHPbNRozTZ67+wwlFHfvLGgBI X-Google-Smtp-Source: AGHT+IGqy9WvmFoV4PCqeXPzzqJMJQX/mH9EUd2EwPVh3v1Bx49gZZ64DKvi6qWmziv3UlU1jzFqTw== X-Received: by 2002:a05:6000:2082:b0:3a5:3369:391c with SMTP id ffacd0b85a97d-3af23ad0719mr1593821f8f.1.1751399678973; Tue, 01 Jul 2025 12:54:38 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Nick Rosbrook , George Dunlap , Anthony PERARD , Juergen Gross Subject: [PATCH v7 2/7] tools/xl: Add altp2m_count parameter Date: Tue, 1 Jul 2025 19:54:24 +0000 Message-Id: <090b27895506d78055d1bab9c2b3617e85f389c6.1751397919.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1751399700611116600 From: Petr Bene=C5=A1 Introduce a new altp2m_count parameter to control the maximum number of alt= p2m views a domain can use. By default, if altp2m_count is unspecified and altp= 2m is enabled, the value is set to 10, reflecting the legacy behavior. This change is preparatory; it establishes the groundwork for the feature b= ut does not activate it. Signed-off-by: Petr Bene=C5=A1 Reviewed-by: Anthony PERARD Acked-by: Nick Rosbrook --- tools/golang/xenlight/helpers.gen.go | 2 ++ tools/golang/xenlight/types.gen.go | 1 + tools/include/libxl.h | 7 +++++++ tools/libs/light/libxl_create.c | 9 +++++++++ tools/libs/light/libxl_internal.h | 1 + tools/libs/light/libxl_types.idl | 1 + tools/xl/xl_parse.c | 9 +++++++++ 7 files changed, 30 insertions(+) diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/h= elpers.gen.go index 191be87297..515a6ef10a 100644 --- a/tools/golang/xenlight/helpers.gen.go +++ b/tools/golang/xenlight/helpers.gen.go @@ -1167,6 +1167,7 @@ if err :=3D x.ArchX86.MsrRelaxed.fromC(&xc.arch_x86.m= sr_relaxed);err !=3D nil { return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err) } x.Altp2M =3D Altp2MMode(xc.altp2m) +x.Altp2MCount =3D uint32(xc.altp2m_count) x.VmtraceBufKb =3D int(xc.vmtrace_buf_kb) if err :=3D x.Vpmu.fromC(&xc.vpmu);err !=3D nil { return fmt.Errorf("converting field Vpmu: %v", err) @@ -1695,6 +1696,7 @@ if err :=3D x.ArchX86.MsrRelaxed.toC(&xc.arch_x86.msr= _relaxed); err !=3D nil { return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err) } xc.altp2m =3D C.libxl_altp2m_mode(x.Altp2M) +xc.altp2m_count =3D C.uint32_t(x.Altp2MCount) xc.vmtrace_buf_kb =3D C.int(x.VmtraceBufKb) if err :=3D x.Vpmu.toC(&xc.vpmu); err !=3D nil { return fmt.Errorf("converting field Vpmu: %v", err) diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/typ= es.gen.go index 656933c6c9..1a4f076bd2 100644 --- a/tools/golang/xenlight/types.gen.go +++ b/tools/golang/xenlight/types.gen.go @@ -604,6 +604,7 @@ ArchX86 struct { MsrRelaxed Defbool } Altp2M Altp2MMode +Altp2MCount uint32 VmtraceBufKb int Vpmu Defbool TrapUnmappedAccesses Defbool diff --git a/tools/include/libxl.h b/tools/include/libxl.h index a8704e0268..d6b6e5d2dd 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -1257,6 +1257,13 @@ typedef struct libxl__ctx libxl_ctx; */ #define LIBXL_HAVE_ALTP2M 1 =20 +/* + * 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 + /* * 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_creat= e.c index 8a85fba1cf..acf7fd9837 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -421,6 +421,15 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, return -ERROR_INVAL; } =20 + if (b_info->altp2m_count =3D=3D LIBXL_ALTP2M_COUNT_DEFAULT) { + if ((libxl_defbool_val(b_info->u.hvm.altp2m) || + b_info->altp2m !=3D LIBXL_ALTP2M_MODE_DISABLED)) + /* Reflect the default legacy count */ + b_info->altp2m_count =3D 10; + else + b_info->altp2m_count =3D 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_internal.h b/tools/libs/light/libxl_int= ernal.h index 75bb0b94cf..2a5b233caa 100644 --- a/tools/libs/light/libxl_internal.h +++ b/tools/libs/light/libxl_internal.h @@ -111,6 +111,7 @@ #define LIBXL_MIN_DOM0_MEM (128*1024) #define LIBXL_INVALID_GFN (~(uint64_t)0) #define LIBXL_VGA_HOLE_SIZE 0x20 +#define LIBXL_ALTP2M_COUNT_DEFAULT (~(uint32_t)0) /* use 0 as the domid of the toolstack domain for now */ #define LIBXL_TOOLSTACK_DOMID 0 #define QEMU_SIGNATURE "DeviceModelRecord0002" diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_type= s.idl index a3a79d12b2..fe251649f3 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -731,6 +731,7 @@ libxl_domain_build_info =3D 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'}), =20 # 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 7e11c62ba0..28cdbf07c2 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -2099,6 +2099,15 @@ void parse_config_data(const char *config_source, } } =20 + if (!xlu_cfg_get_long(config, "altp2m_count", &l, 1)) { + if (l !=3D (uint16_t)l) { + fprintf(stderr, "ERROR: invalid value %ld for \"altp2m_count\"= \n", l); + exit (1); + } + + b_info->altp2m_count =3D l; + } + if (!xlu_cfg_get_long(config, "vmtrace_buf_kb", &l, 1) && l) { b_info->vmtrace_buf_kb =3D l; } --=20 2.34.1 From nobody Fri Oct 31 03:47:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1751399698; cv=none; d=zohomail.com; s=zohoarc; b=NRxzzgxs/INGJgLCORoA5ZlyFupQJo97q2xWp5fp6czGwnm/bRfSRukDL6763JI24AnT0wbX9ECbdAF8oUxdcOuY+e+/s8nmcRFZwHtVZg6LhkT3gPkRAIgSsmD0G97JNANg8IHiwL1OKPKHfkD4KJl/kFNk3mJ68Z6SSD7Femg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751399698; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vr3HAWcy3iR7RnCWpXjXk9ptcqN2sMtjI1FfiwT4ilQ=; b=WNVXjn/kucEIxqLieP2bayDWFR1XbD637ivOTiJFDoennw/Y+MBxjs7Szyx7Aco2e68jHOu4S1QUxwd0+cFV6mSFR/K434TcG7fMw+X/rfrr55Zat3Op8PakdZhUnLhNGilSPjf1b9dWl7eAQfcuqGKuclbeHcHOkn1b9CBzNtU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751399698095970.9570073807791; Tue, 1 Jul 2025 12:54:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1029945.1403672 (Exim 4.92) (envelope-from ) id 1uWh40-0000hj-I8; Tue, 01 Jul 2025 19:54:44 +0000 Received: by outflank-mailman (output) from mailman id 1029945.1403672; Tue, 01 Jul 2025 19:54:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWh40-0000hZ-Ey; Tue, 01 Jul 2025 19:54:44 +0000 Received: by outflank-mailman (input) for mailman id 1029945; Tue, 01 Jul 2025 19:54:42 +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 1uWh3y-0000D0-TH for xen-devel@lists.xenproject.org; Tue, 01 Jul 2025 19:54:42 +0000 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [2a00:1450:4864:20::429]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 39c67f59-56b5-11f0-b894-0df219b8e170; Tue, 01 Jul 2025 21:54:40 +0200 (CEST) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3a5828d26e4so877671f8f.0 for ; Tue, 01 Jul 2025 12:54: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-3a88c7e9d1csm14291644f8f.13.2025.07.01.12.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jul 2025 12:54:39 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 39c67f59-56b5-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751399680; x=1752004480; 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=vr3HAWcy3iR7RnCWpXjXk9ptcqN2sMtjI1FfiwT4ilQ=; b=jeHmPVAT9BaZNCp8sRjRX7034bVdSX7j4Baav3m17c3drX/8gVVpYFCSeQxTf3CwNd 6Cf8Q2hja8Ynyxoi+/V5hIipjMyxORVJcW5yNSd4iKPxySHm2tqcK/r+sH6VPqVgfPOb qXjfZd2/o5mHFpr0jrrP6PUXVpdNN//42dRU+piVJgOdcSORaLNfJEGqKspnqKihJaGP 2HogeIWYaULCHqliWjcsHby0AYMoANdzgkoXRoUPBDlvzsdGpSdqdMCjOXK29BhssT/x Ftz8nDPwolY3uhKwvnatN3VdifphTGAct9bXzohTPNdsqwsXiC5D8BtV0vWfOJCfWaCF ZVHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751399680; x=1752004480; 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=vr3HAWcy3iR7RnCWpXjXk9ptcqN2sMtjI1FfiwT4ilQ=; b=bTCEkZch+CLt3fvjgWTLOfBkpKCIamgzmtpkzP+ogEX4aMDp9mTM5R3RsAt7BVo/E2 pKaCczrPXdaVdXtvnuu8aa3CEyJcDqNKyF49CRsK1Gj0exyz516o69rgyaCzpErfi/Ze bqEJ+1crVcAtLXEttf0U5Do+jPcR+OjmBqVjGSOVH6hbPl9hqaofmp9yxIcX6y0cwf7y a4QmALfshfa4CHS4+DA6SO+sOdVBM5UunwYuw49TSVzO5UZX6cJv2AVzxQJKJWaJ86lD eaah+m0Vmg86Uey42emYLfVukb2CMnsUjXWOyZt06R4asI4nS4p1Ctt+je4QsXD3m7HM zPow== X-Gm-Message-State: AOJu0YybOabzM/y2EwNQnb9j0JrzUGlSpQKY6vHMI7X2hTuUY5Y18DYe ltw57vikUAxp7weFqVOp1EchmvtWF5ZBRSZxd970m0QPIXKPIlHMurV6aUXt5A== X-Gm-Gg: ASbGncvZUJSN298OvH4fHT6LOlE4en/KqecWKHi6WmT9fnxGk0WvhewJ3A0riozktQS euo71ZFtY9PNRkMxzuV3AWZNLiRCP/L+DbYP7AHvdbFxYTuBkTI6rqRtbd7wXRTxFrp47zorDdR Y5yWMmcoPfXJ9LYJpKRdsOhkKdRMW3pKrrqIpTpAq6TCP6EWvWa1ep4NRE/64eeOXaz4AF3rRVZ P+K2o0SQRc7x9O66tCR/gv8z69xiCjOP4wtfjvkKyOARTW9wLZXUq//Bd054FxsQkF9BFwNwshn nY5CmOxPWVKfjhXYPdIvgyOCWzkc1b8bH+gXfuAvA4yYeXC6GNDohF87l/GOsCkYguPwvj1sGa3 oII4gANh487kGpil2RRU3EDBRDUtGGLkaDlxIdsN33sdrKy+m/YPDRZtE1KK5Hg== X-Google-Smtp-Source: AGHT+IE5MNyFWK/lLO1mAH7M1ZWZyzxLMqdKG4H+fdSXrnqN+L9LfTwuzNba/O0IRkDdrkgLzG65Cw== X-Received: by 2002:a05:6000:4408:b0:3a4:f744:e019 with SMTP id ffacd0b85a97d-3af26beee03mr963549f8f.16.1751399679699; Tue, 01 Jul 2025 12:54:39 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Anthony PERARD Subject: [PATCH v7 3/7] docs/man: Add altp2m_count parameter to the xl.cfg manual Date: Tue, 1 Jul 2025 19:54:25 +0000 Message-Id: <862974b84f405ba81b801ec8613c3b05f87fc75d.1751397919.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1751399698449116600 From: Petr Bene=C5=A1 Update manual pages to include detailed information about the altp2m_count configuration parameter. Signed-off-by: Petr Bene=C5=A1 Acked-by: Anthony PERARD --- docs/man/xl.cfg.5.pod.in | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index 1d122982c6..5362fb0e9a 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -2023,6 +2023,20 @@ a single guest HVM domain. B: While the option "altp2mhvm" is deprecated, legacy applications f= or x86 systems will continue to work using it. =20 +=3Ditem 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. + =3Ditem B =20 Enable or disables guest access to hardware virtualisation features, --=20 2.34.1 From nobody Fri Oct 31 03:47:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1751399706; cv=none; d=zohomail.com; s=zohoarc; b=nqINJTdoIQzk60NeLaU9BM6EZujq2d7Hpd4l+V7DR/uG0Rd4UwS1GW4y6xFIyLO2P0GVqMh+ALex+Luv5qNyIZxUpAtEGXIdeHP3bK8eRlErDnHLKGm/K8NwYtucK1B9/Vekejyxf3K4+uk9IWEBAA94ZF8klDA4nWSXbUyhVE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751399706; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L2cnHrrzD+wqGofUm4sfDRu9d8822/NadKBk0KDrtvY=; b=fUFZ/fhSJZMvto1MTB+LaLh83s+vQjIEKbUgVRh+YBPt8EBLBj6vaTtwmNHdTGM65x2S77/318jROWF9Xu7S/chGt5JTv1h9uQgqDXOh2+eu8muWoPph+aw+BND2xxuycHQUqpxmPKkyj7OdrDQgZTDiJjuYlwKsr5tlML6+Tjs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751399706297699.0252138595059; Tue, 1 Jul 2025 12:55:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1029946.1403682 (Exim 4.92) (envelope-from ) id 1uWh41-0000xJ-RF; Tue, 01 Jul 2025 19:54:45 +0000 Received: by outflank-mailman (output) from mailman id 1029946.1403682; Tue, 01 Jul 2025 19:54:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWh41-0000wu-NF; Tue, 01 Jul 2025 19:54:45 +0000 Received: by outflank-mailman (input) for mailman id 1029946; Tue, 01 Jul 2025 19:54:44 +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 1uWh40-0000D0-6e for xen-devel@lists.xenproject.org; Tue, 01 Jul 2025 19:54:44 +0000 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [2a00:1450:4864:20::435]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3aacf556-56b5-11f0-b894-0df219b8e170; Tue, 01 Jul 2025 21:54:42 +0200 (CEST) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3a4eb4dfd8eso925777f8f.2 for ; Tue, 01 Jul 2025 12:54:42 -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-3a88c7e9d1csm14291644f8f.13.2025.07.01.12.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jul 2025 12:54:40 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3aacf556-56b5-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751399681; x=1752004481; 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=L2cnHrrzD+wqGofUm4sfDRu9d8822/NadKBk0KDrtvY=; b=dqZGPmOxak7f6Og69vf7vb92JBg+9ql6bOA8i21uaT0Lv8xGVgQWlBHjsdHByXR6oR LFP1S026adRybEUENGG7U1hcRZw8+2EGfWRAs9NX3dGYw0fGPEJEaPgXxeZkkaCV/iHR k7G4zWZzyq9n/gWSMN+aRJC/OrzT0xRqLGN04vSXuOH1UeSTrm60BhwYl4ilpNyYedTG wV3P6nwsYo65WEYSZccMUl3oBkQE8z7YYzqwy+K+iMYR8fcSC/piZDQZpXlupvZViqYX zsh/4VX5WAmJjZyCDJ2nhnCL70uUzXE+OXgnZ//qS9JhErwH43fI6wZtskWqUgmRc+KT Isxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751399681; x=1752004481; 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=L2cnHrrzD+wqGofUm4sfDRu9d8822/NadKBk0KDrtvY=; b=AS9WikTq1w+unzDwkpoM4QhEhd/zY9LsXBTsqwHJ+acWb4xCXNUAPZ3HCPB0SN6+a7 INcl0DdGVVm9rUAsUqYwODmfQCt2jK3TJyWCqNMoBgD6ccPRe9joRb1p61ZZrPJyuHqr 2NmUxiLVUfhjoOwbqRvtbqUh17nvmhszGnQSl9HNvYe7P5bKMSFsHXPR3984O6X3OeLK 5HIgL4dJhr3Lx21pXu3mhopXDpFF5Pr7+maXOa0gOhdxtmGm+L7dO3xWFJuY0j8qjmMM iPdUbAwvquO/KzTMy8THBg/L6y4BLWxKVYyuUq2llJfcwggApUbBJkYtpguuQdcj/cqU iaJw== X-Gm-Message-State: AOJu0YyX/Fftf60IBpInNupKsAFG4yhmceB+IIZuKNUk6LNkN5fYGHZX 3foOm9Ckt6DX4fZmR+hvW13s0/YlLJlZvcvDkh4MZj96L/JjpJq3ADU213jq2g== X-Gm-Gg: ASbGncvJFGC5vx1GmmcVHcQ9n5gbWhK558UqaHURqRMJRbXdRHAHSPtFvSHo99Mys6C XYkoSoKf3bQl9g0fLfE2e0bz+csxkMekxR4LKBa2RKcCjtufddnwqgU1XbjtlbS//sWa0UfT8Kt l14OcK5jjCJE29fulOddIE1P7o9UZE/ICxkqLG0uKkTUXAOxyC0MWVxyD2JzbcedFCkW33uGs7j +n95ISirSTHVdlm7EPYaPWy/z+ylOiP5ozwZFO1N7UdYKMhQItmYUslLNXOHXVXWyQHNHuEjamN S+uAKr4UvasmKKjYH/s7u6Q/eFI0V9CmL4+C3nKoX8KB67Di5bmPLXUMiAzGVDzbH+tMsXZV4EC 1OneCWtrJokLK2hr/sNJf2vgjn4J0SJaDe+rP0+Y1+PRF8f3QQ7Yt2ySfHxKeZQ== X-Google-Smtp-Source: AGHT+IFcBIX+sX5UmOzW9aZyGvPE+iEHcIpKkjaUil7iRuHC2/Cy2eTaQa6mOa7WbuwaXiJWi4Faew== X-Received: by 2002:a05:6000:3103:b0:3a4:f8a9:a03e with SMTP id ffacd0b85a97d-3af23ad0767mr1323866f8f.3.1751399680871; Tue, 01 Jul 2025 12:54:40 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , Anthony PERARD , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Tamas K Lengyel , Alexandru Isaila , Petre Pircalabu Subject: [PATCH v7 4/7] xen: Make the maximum number of altp2m views configurable for x86 Date: Tue, 1 Jul 2025 19:54:26 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1751399709113116600 From: Petr Bene=C5=A1 This commit introduces the ability to configure the maximum number of altp2m views for the domain during its creation. Previously, the limits were hardc= oded to a maximum of 10. This change allows for greater flexibility in environme= nts 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 suppo= rts up to 512 entries. Despite there being no inherent need for limiting nr_alt= p2m in scenarios not utilizing VMFUNC, decoupling these components would necess= itate 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 occ= upy as little space as possible. Accesses to the altp2m_p2m array are modified to respect the new nr_altp2m value. Accesses to the altp2m_(visible_)eptp 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=C5=A1 --- 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 | 28 ++++++++++-- xen/arch/x86/include/asm/domain.h | 9 ++-- xen/arch/x86/include/asm/p2m.h | 4 +- xen/arch/x86/mm/altp2m.c | 74 +++++++++++++++++-------------- xen/arch/x86/mm/hap/hap.c | 6 +-- xen/arch/x86/mm/mem_access.c | 20 +++------ xen/arch/x86/mm/mem_sharing.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 7 +-- xen/arch/x86/mm/p2m.c | 8 ++-- xen/common/domain.c | 1 + xen/include/public/domctl.h | 5 ++- xen/include/xen/sched.h | 2 + 16 files changed, 140 insertions(+), 78 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 79a144e61b..9a4f72c62b 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -693,7 +693,7 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config) return -EINVAL; } =20 - 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 56c3816187..155ea1f79f 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -716,16 +716,42 @@ int arch_sanitise_domain_config(struct xen_domctl_cre= atedomain *config) return -EINVAL; } =20 - if ( altp2m_mode && nested_virt ) + if ( altp2m_mode ) { - dprintk(XENLOG_INFO, - "Nested virt and altp2m are not supported together\n"); - return -EINVAL; - } + if ( !hvm_altp2m_supported() ) + { + dprintk(XENLOG_INFO, "altp2m is not supported\n"); + return -EINVAL; + } + + if ( !hap ) + { + dprintk(XENLOG_INFO, "altp2m is only supported with HAP\n"); + return -EINVAL; + } + + if ( nested_virt ) + { + dprintk(XENLOG_INFO, + "Nested virt and altp2m are not supported together\n"); + return -EINVAL; + } + + if ( !config->altp2m.nr ) + { + /* Fix the value to the legacy default */ + config->altp2m.nr =3D 10; + } =20 - if ( altp2m_mode && !hap ) + if ( config->altp2m.nr > MAX_NR_ALTP2M ) + { + dprintk(XENLOG_INFO, "altp2m.nr must be <=3D %lu\n", MAX_NR_AL= TP2M); + 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; } =20 diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 56c7de3977..f4bf0c8374 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4674,6 +4674,12 @@ static int do_altp2m_op( goto out; } =20 + if ( d->nr_altp2m =3D=3D 0 ) + { + rc =3D -EINVAL; + goto out; + } + if ( (rc =3D xsm_hvm_altp2mhvm_op(XSM_OTHER, d, mode, a.cmd)) ) goto out; =20 @@ -5266,7 +5272,7 @@ void hvm_fast_singlestep(struct vcpu *v, uint16_t p2m= idx) if ( !hvm_is_singlestep_supported() ) return; =20 - if ( p2midx >=3D MAX_ALTP2M ) + if ( p2midx >=3D v->domain->nr_altp2m ) return; =20 v->arch.hvm.single_step =3D true; diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 218cb2c1af..3b63ac8b54 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -4967,7 +4967,7 @@ bool asmlinkage vmx_vmenter_helper(const struct cpu_u= ser_regs *regs) { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; ++i ) + for ( i =3D 0; i < currd->nr_altp2m; ++i ) { if ( currd->arch.altp2m_eptp[i] =3D=3D mfn_x(INVALID_MFN) ) continue; diff --git a/xen/arch/x86/include/asm/altp2m.h b/xen/arch/x86/include/asm/a= ltp2m.h index c57a8c5588..2882b3e7f0 100644 --- a/xen/arch/x86/include/asm/altp2m.h +++ b/xen/arch/x86/include/asm/altp2m.h @@ -13,12 +13,32 @@ #include /* for struct vcpu, struct domain */ #include /* for vcpu_altp2m */ =20 +static inline bool altp2m_is_eptp_valid(const struct domain *d, + unsigned int idx) +{ + ASSERT(d->nr_altp2m <=3D MAX_EPTP); + + /* + * EPTP index is correlated with altp2m index and should not exceed + * d->nr_altp2m. + */ + + return idx < d->nr_altp2m && + d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] !=3D + mfn_x(INVALID_MFN); +} + /* Alternate p2m HVM on/off per domain */ static inline bool altp2m_active(const struct domain *d) { return d->arch.altp2m_active; } =20 +static inline uint16_t altp2m_vcpu_idx(const struct vcpu *v) +{ + return vcpu_altp2m(v).p2midx; +} + /* Alternate p2m VCPU */ void altp2m_vcpu_initialise(struct vcpu *v); void altp2m_vcpu_destroy(struct vcpu *v); @@ -26,11 +46,13 @@ void altp2m_vcpu_destroy(struct vcpu *v); int altp2m_vcpu_enable_ve(struct vcpu *v, gfn_t gfn); void altp2m_vcpu_disable_ve(struct vcpu *v); =20 -static inline uint16_t altp2m_vcpu_idx(const struct vcpu *v) +#else + +static inline bool altp2m_is_eptp_valid(const struct domain *d, + unsigned int idx) { - return vcpu_altp2m(v).p2midx; + return false; } -#else =20 static inline bool altp2m_active(const struct domain *d) { diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/d= omain.h index 8c0dea12a5..deb247480e 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; }; =20 -#define MAX_NESTEDP2M 10 +#define MAX_EPTP (PAGE_SIZE / sizeof(uint64_t)) +#define MAX_NR_ALTP2M MAX_EPTP +#define MAX_NESTEDP2M 10 =20 -#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 =20 /* 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/p2m.h b/xen/arch/x86/include/asm/p2m.h index 4358cc15a2..a2d7483602 100644 --- a/xen/arch/x86/include/asm/p2m.h +++ b/xen/arch/x86/include/asm/p2m.h @@ -901,7 +901,7 @@ static inline struct p2m_domain *p2m_get_altp2m(struct = vcpu *v) if ( index =3D=3D INVALID_ALTP2M ) return NULL; =20 - BUG_ON(index >=3D MAX_ALTP2M); + BUG_ON(index >=3D v->domain->nr_altp2m); =20 return v->domain->arch.altp2m_p2m[index]; } @@ -911,7 +911,7 @@ static inline bool p2m_set_altp2m(struct vcpu *v, unsig= ned int idx) { struct p2m_domain *orig; =20 - BUG_ON(idx >=3D MAX_ALTP2M); + BUG_ON(idx >=3D v->domain->nr_altp2m); =20 if ( idx =3D=3D vcpu_altp2m(v).p2midx ) return false; diff --git a/xen/arch/x86/mm/altp2m.c b/xen/arch/x86/mm/altp2m.c index 6fe1e9ed6b..2b1a05fc0d 100644 --- a/xen/arch/x86/mm/altp2m.c +++ b/xen/arch/x86/mm/altp2m.c @@ -15,6 +15,9 @@ void altp2m_vcpu_initialise(struct vcpu *v) { + if ( v->domain->nr_altp2m =3D=3D 0 ) + return; + if ( v !=3D current ) vcpu_pause(v); =20 @@ -32,6 +35,9 @@ altp2m_vcpu_destroy(struct vcpu *v) { struct p2m_domain *p2m; =20 + if ( v->domain->nr_altp2m =3D=3D 0 ) + return; + if ( v !=3D current ) vcpu_pause(v); =20 @@ -122,7 +128,12 @@ int p2m_init_altp2m(struct domain *d) struct p2m_domain *hostp2m =3D p2m_get_hostp2m(d); =20 mm_lock_init(&d->arch.altp2m_list_lock); - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + d->arch.altp2m_p2m =3D xzalloc_array(struct p2m_domain *, d->nr_altp2m= ); + + if ( !d->arch.altp2m_p2m ) + return -ENOMEM; + + for ( i =3D 0; i < d->nr_altp2m; i++ ) { d->arch.altp2m_p2m[i] =3D p2m =3D p2m_init_one(d); if ( p2m =3D=3D NULL ) @@ -143,7 +154,10 @@ void p2m_teardown_altp2m(struct domain *d) unsigned int i; struct p2m_domain *p2m; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + if ( !d->arch.altp2m_p2m ) + return; + + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( !d->arch.altp2m_p2m[i] ) continue; @@ -151,6 +165,8 @@ void p2m_teardown_altp2m(struct domain *d) d->arch.altp2m_p2m[i] =3D NULL; p2m_free_one(p2m); } + + XFREE(d->arch.altp2m_p2m); } =20 int altp2m_get_effective_entry(struct p2m_domain *ap2m, gfn_t gfn, mfn_t *= mfn, @@ -200,7 +216,7 @@ bool p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsig= ned int idx) struct domain *d =3D v->domain; bool rc =3D false; =20 - if ( idx >=3D MAX_ALTP2M ) + if ( idx >=3D d->nr_altp2m ) return rc; =20 altp2m_list_lock(d); @@ -306,8 +322,8 @@ static void p2m_reset_altp2m(struct domain *d, unsigned= int idx, { struct p2m_domain *p2m; =20 - ASSERT(idx < MAX_ALTP2M); - p2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + ASSERT(idx < d->nr_altp2m); + p2m =3D d->arch.altp2m_p2m[array_index_nospec(idx, d->nr_altp2m)]; =20 p2m_lock(p2m); =20 @@ -332,7 +348,7 @@ void p2m_flush_altp2m(struct domain *d) =20 altp2m_list_lock(d); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { p2m_reset_altp2m(d, i, ALTP2M_DEACTIVATE); d->arch.altp2m_eptp[i] =3D mfn_x(INVALID_MFN); @@ -348,9 +364,9 @@ static int p2m_activate_altp2m(struct domain *d, unsign= ed int idx, struct p2m_domain *hostp2m, *p2m; int rc; =20 - ASSERT(idx < MAX_ALTP2M); + ASSERT(idx < d->nr_altp2m); =20 - p2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + p2m =3D d->arch.altp2m_p2m[array_index_nospec(idx, d->nr_altp2m)]; hostp2m =3D p2m_get_hostp2m(d); =20 p2m_lock(p2m); @@ -388,7 +404,7 @@ int p2m_init_altp2m_by_id(struct domain *d, unsigned in= t idx) int rc =3D -EINVAL; struct p2m_domain *hostp2m =3D p2m_get_hostp2m(d); =20 - if ( idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ) + if ( idx >=3D d->nr_altp2m ) return rc; =20 altp2m_list_lock(d); @@ -415,7 +431,7 @@ int p2m_init_next_altp2m(struct domain *d, uint16_t *id= x, =20 altp2m_list_lock(d); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) continue; @@ -437,7 +453,7 @@ int p2m_destroy_altp2m_by_id(struct domain *d, unsigned= int idx) struct p2m_domain *p2m; int rc =3D -EBUSY; =20 - if ( !idx || idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ) + if ( !idx || idx >=3D d->nr_altp2m ) return rc; =20 rc =3D domain_pause_except_self(d); @@ -450,7 +466,7 @@ int p2m_destroy_altp2m_by_id(struct domain *d, unsigned= int idx) if ( d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] !=3D mfn_x(INVALID_MFN) ) { - p2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + p2m =3D d->arch.altp2m_p2m[array_index_nospec(idx, d->nr_altp2m)]; =20 if ( !_atomic_read(p2m->active_vcpus) ) { @@ -475,7 +491,7 @@ int p2m_switch_domain_altp2m_by_id(struct domain *d, un= signed int idx) struct vcpu *v; int rc =3D -EINVAL; =20 - if ( idx >=3D MAX_ALTP2M ) + if ( idx >=3D d->nr_altp2m ) return rc; =20 rc =3D domain_pause_except_self(d); @@ -510,13 +526,11 @@ int p2m_change_altp2m_gfn(struct domain *d, unsigned = int idx, mfn_t mfn; int rc =3D -EINVAL; =20 - if ( idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] =3D=3D - mfn_x(INVALID_MFN) ) + if ( !altp2m_is_eptp_valid(d, idx) ) return rc; =20 hp2m =3D p2m_get_hostp2m(d); - ap2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + ap2m =3D d->arch.altp2m_p2m[array_index_nospec(idx, d->nr_altp2m)]; =20 p2m_lock(hp2m); p2m_lock(ap2m); @@ -572,7 +586,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t= gfn, =20 altp2m_list_lock(d); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { p2m_type_t t; p2m_access_t a; @@ -595,7 +609,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn_t= gfn, else { /* At least 2 altp2m's impacted, so reset everything */ - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( i =3D=3D last_reset_idx || d->arch.altp2m_eptp[i] =3D=3D mfn_x(INVALID_MFN) ) @@ -659,12 +673,11 @@ int p2m_set_suppress_ve_multi(struct domain *d, =20 if ( sve->view > 0 ) { - if ( sve->view >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) = || - d->arch.altp2m_eptp[array_index_nospec(sve->view, MAX_EPTP)] = =3D=3D - mfn_x(INVALID_MFN) ) + if ( !altp2m_is_eptp_valid(d, sve->view) ) return -EINVAL; =20 - p2m =3D ap2m =3D array_access_nospec(d->arch.altp2m_p2m, sve->view= ); + p2m =3D ap2m =3D + d->arch.altp2m_p2m[array_index_nospec(sve->view, d->nr_altp2m)= ]; } =20 p2m_lock(host_p2m); @@ -727,12 +740,11 @@ int p2m_get_suppress_ve(struct domain *d, gfn_t gfn, = bool *suppress_ve, =20 if ( altp2m_idx > 0 ) { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D - mfn_x(INVALID_MFN) ) + if ( !altp2m_is_eptp_valid(d, altp2m_idx) ) return -EINVAL; =20 - p2m =3D ap2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_id= x); + p2m =3D ap2m =3D + d->arch.altp2m_p2m[array_index_nospec(altp2m_idx, d->nr_altp2m= )]; } else p2m =3D host_p2m; @@ -761,13 +773,7 @@ int p2m_set_altp2m_view_visibility(struct domain *d, u= nsigned int altp2m_idx, =20 altp2m_list_lock(d); =20 - /* - * Eptp index is correlated with altp2m index and should not exceed - * min(MAX_ALTP2M, MAX_EPTP). - */ - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] =3D= =3D - mfn_x(INVALID_MFN) ) + if ( !altp2m_is_eptp_valid(d, altp2m_idx) ) rc =3D -EINVAL; else if ( visible ) d->arch.altp2m_visible_eptp[array_index_nospec(altp2m_idx, MAX_EPT= P)] =3D diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index ec5043a8aa..dcc15d6f1a 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) d->arch.altp2m_visible_eptp[i] =3D mfn_x(INVALID_MFN); } =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { rv =3D p2m_alloc_table(d->arch.altp2m_p2m[i]); if ( rv !=3D 0 ) @@ -538,7 +538,7 @@ void hap_final_teardown(struct domain *d) unsigned int i; =20 if ( hvm_altp2m_supported() ) - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) p2m_teardown(d->arch.altp2m_p2m[i], true, NULL); =20 /* Destroy nestedp2m's first */ @@ -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); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { p2m_teardown(d->arch.altp2m_p2m[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 21b5b7ecda..3208b34925 100644 --- a/xen/arch/x86/mm/mem_access.c +++ b/xen/arch/x86/mm/mem_access.c @@ -350,12 +350,10 @@ 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 >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D - mfn_x(INVALID_MFN) ) + if ( !altp2m_is_eptp_valid(d, altp2m_idx) ) return -EINVAL; =20 - ap2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + ap2m =3D d->arch.altp2m_p2m[array_index_nospec(altp2m_idx, d->nr_a= ltp2m)]; } =20 if ( !xenmem_access_to_p2m_access(p2m, access, &a) ) @@ -406,12 +404,10 @@ long p2m_set_mem_access_multi(struct domain *d, /* altp2m view 0 is treated as the hostp2m */ if ( altp2m_idx ) { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D - mfn_x(INVALID_MFN) ) + if ( !altp2m_is_eptp_valid(d, altp2m_idx) ) return -EINVAL; =20 - ap2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + ap2m =3D d->arch.altp2m_p2m[array_index_nospec(altp2m_idx, d->nr_a= ltp2m)]; } =20 p2m_lock(p2m); @@ -469,12 +465,10 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn, x= enmem_access_t *access, } else if ( altp2m_idx ) /* altp2m view 0 is treated as the hostp2m */ { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D - mfn_x(INVALID_MFN) ) + if ( !altp2m_is_eptp_valid(d, altp2m_idx) ) return -EINVAL; =20 - p2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + p2m =3D d->arch.altp2m_p2m[array_index_nospec(altp2m_idx, d->nr_al= tp2m)]; } =20 return _p2m_get_mem_access(p2m, gfn, access); @@ -489,7 +483,7 @@ void arch_p2m_set_access_required(struct domain *d, boo= l access_required) if ( altp2m_active(d) ) { unsigned int i; - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { struct p2m_domain *p2m =3D d->arch.altp2m_p2m[i]; =20 diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index da28266ef0..83bb9dd5df 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, =20 altp2m_list_lock(d); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { ap2m =3D d->arch.altp2m_p2m[i]; if ( !ap2m ) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index 0cf6818c13..305404f392 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -1301,7 +1301,7 @@ static void ept_set_ad_sync(struct domain *d, bool va= lue) { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { struct p2m_domain *p2m; =20 @@ -1508,7 +1508,8 @@ void __init setup_ept_dump(void) =20 void p2m_init_altp2m_ept(struct domain *d, unsigned int i) { - struct p2m_domain *p2m =3D array_access_nospec(d->arch.altp2m_p2m, i); + struct p2m_domain *p2m =3D + d->arch.altp2m_p2m[array_index_nospec(i, d->nr_altp2m)]; struct p2m_domain *hostp2m =3D p2m_get_hostp2m(d); struct ept_data *ept; =20 @@ -1527,7 +1528,7 @@ unsigned int p2m_find_altp2m_by_eptp(struct domain *d= , uint64_t eptp) =20 altp2m_list_lock(d); =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] =3D=3D mfn_x(INVALID_MFN) ) continue; diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index b9a7c2dc53..b4dd12433e 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; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -149,7 +149,7 @@ bool p2m_memory_type_changed(struct domain *d) { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -934,7 +934,7 @@ void p2m_change_type_range(struct domain *d, { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -1007,7 +1007,7 @@ int p2m_finish_type_change(struct domain *d, { unsigned int i; =20 - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { diff --git a/xen/common/domain.c b/xen/common/domain.c index 303c338ef2..77c3486065 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -811,6 +811,7 @@ struct domain *domain_create(domid_t domid, if ( config ) { d->options =3D config->flags; + d->nr_altp2m =3D config->altp2m.nr; d->vmtrace_size =3D config->vmtrace_size; } =20 diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index a69dd96084..573d34f239 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -116,7 +116,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 permit. */ + uint16_t nr; } altp2m; =20 /* Per-vCPU buffer size in bytes. 0 to disable. */ diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index fe53d4fab7..f8be4ea1d9 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -619,6 +619,8 @@ struct domain unsigned int guest_request_sync : 1; } monitor; =20 + unsigned int nr_altp2m; /* Number of altp2m tables. */ + unsigned int vmtrace_size; /* Buffer size in bytes, or 0 to disable. */ =20 #ifdef CONFIG_ARGO --=20 2.34.1 From nobody Fri Oct 31 03:47:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1751399698; cv=none; d=zohomail.com; s=zohoarc; b=Pvn765j9uF37NISgRYk6hpUQ8QiFUREsmog4TKjF+q0XKu1rvRr4nufC6YO6CwiKbR2UqkP3CC4jJzAYk+fNr/FXrEi+YVjc6c0EXtPIFyQq7WsBfQUsC9c0kbZZcIDnm5EMfI6PxXuMSITbRd34YkAQ47cNnOLEme35Hn8D6L4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751399698; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=f6AiubYcFN2sCZHsUEd0HCaMavYugrJHT3OnsCW0tjY=; b=VzzzyeDS73ahQq7vgExsIP/R1inBsN4vr3A3kn1fmX1jk4pp7+HhMjoVfPkULFWVTc0S6W7Fm8RnZftQDLmCCzQDtDbovbEIWTkkMGMc6lwKyzBXNmr3aHfkqI0qdGycTLQe0I4mRutt24UevN/IhkzlFKdR3ViGpxer7IbYME8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751399698211851.0753716410985; Tue, 1 Jul 2025 12:54:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1029947.1403686 (Exim 4.92) (envelope-from ) id 1uWh42-00010n-7u; Tue, 01 Jul 2025 19:54:46 +0000 Received: by outflank-mailman (output) from mailman id 1029947.1403686; Tue, 01 Jul 2025 19:54:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWh42-0000zv-23; Tue, 01 Jul 2025 19:54:46 +0000 Received: by outflank-mailman (input) for mailman id 1029947; Tue, 01 Jul 2025 19:54:44 +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 1uWh40-0000D0-TH for xen-devel@lists.xenproject.org; Tue, 01 Jul 2025 19:54:44 +0000 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [2a00:1450:4864:20::331]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3b15acf0-56b5-11f0-b894-0df219b8e170; Tue, 01 Jul 2025 21:54:43 +0200 (CEST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4531898b208so2133445e9.3 for ; Tue, 01 Jul 2025 12:54:43 -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-3a88c7e9d1csm14291644f8f.13.2025.07.01.12.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jul 2025 12:54:41 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3b15acf0-56b5-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751399682; x=1752004482; 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=f6AiubYcFN2sCZHsUEd0HCaMavYugrJHT3OnsCW0tjY=; b=bH2JHAmT/WqXOxohJuPIrqBPa02Qv0X21W9Q70XmRz9fK2/ZO65SWpPSFj+KBolcCB NmdezqGCe2LWdrJUQyows1xaoJkLtfF9aY0qkrsJiBmviKkTjp8c6ZNF3t8o86+u2yVQ u38SXIXD9spdUQaqA/B+idu1+fhFwgVwXfxc9/cpD0lkkr62Aqr7KTsnAeszh+2aRJzH 3b73Z4n2wsj3Io84KoPZR5fEdjnD+vaAMrMa8MN7dMXRbdnrDfrL/5Cen9mUfH0lRNT+ V9pl5MsMcQYIpKEHo4nPhwuM7CLYCdk+atRhbcnihmDHHDtcCI7Bx4+xJffAK05+yi+1 Fa/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751399682; x=1752004482; 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=f6AiubYcFN2sCZHsUEd0HCaMavYugrJHT3OnsCW0tjY=; b=aH9W8bGM9owiu1bIUBgEBuW5Ztnkz4GJdpSjDe0ThkBoXDLp5jEA0EpQa3Ia1fJOSx BxIfpuibs30o0N0TROGLoAUtjWeiluiX+xA1ASRUEOEvjWLNb4C4cyznAVt78U9klTJ7 2Pg+tl398wZsGyJ+OL/8jSO74wQ4M6dQLx4G+LWfm3shzwToOmF+HqwHIjkC+MUq8CcD 0zTqJejsMbB2lMKSsbSFpGAAAKubtMsXs4/f2A+KVHZTceZ7ZFACYI2rIU5FfDs3NyT3 Fftbt0H4RhzHTGTSFmPWUVmbv6+Zf1U9Z2Aptq7LUmpZp7m3PGSD492JSEVr7I2USYtT feSw== X-Gm-Message-State: AOJu0YxXQ7HFSUGyjq6eWAINXkw/Eml7MjYnyt4ThYf3kbjo+tCX0MPs WhKgMwPEl99ORRHB6cbc3J7OyfabNUEmzICdS14IZXnHDC2VO+IwQQ4b80Qy3A== X-Gm-Gg: ASbGncseZv/XJhnEZVaLhMsWUW/Gdfgfbd2KO8S3zUYX7mHhNgFTjlThUwLHE5Dm3qX AEYfi/c6vJNrUXQbiDnf1faKEmjnxqr5TkINGMZosPqATWKW8nm8cmASKInO7vxMgc58Q5gpfRp CVYXTQ5XZFJS9LXl716gyYLxVPigYyB1TVfEhc5pfqW0UUn5tH/5JH5QgibLhJA5jGia4uC2s3W 9XfuuKykNFs12bO8cs2UtSQBGArcKWy/FWjEFuMYA/+Ejeqmcyf3M/5rMYqmFQGyA17dNTuwsWj GWzMa6WLi2IER/6qBfnKyoWe778PUaVkhEmYiJH5SRgy2b6gap2V7d9UWR/kG72W9syNU3aEnOJ b3XgGJuCapRozW7x6SeD2tB6TheUFU3ExnyJkcwprf72WtHhxpiTgLcCJ+0fH+w== X-Google-Smtp-Source: AGHT+IEegKfuB4Xj0TRqvJCfwBJncc6e4FIwc5OZu1nEyaT3hrTI/JjsOpNSM8DPIMue3C0e8imwpQ== X-Received: by 2002:a05:600c:4e91:b0:453:78fd:1769 with SMTP id 5b1f17b1804b1-454a370c4e2mr1385555e9.4.1751399681824; Tue, 01 Jul 2025 12:54:41 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Anthony PERARD , Juergen Gross Subject: [PATCH v7 5/7] tools/libxl: Activate the altp2m_count feature Date: Tue, 1 Jul 2025 19:54:27 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1751399698440116600 From: Petr Bene=C5=A1 This commit activates the previously introduced altp2m_count parameter, establishing the connection between libxl and Xen. Signed-off-by: Petr Bene=C5=A1 Acked-by: Anthony PERARD --- tools/libs/light/libxl_create.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_creat= e.c index acf7fd9837..75f0d47f97 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -595,6 +595,10 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_con= fig *d_config, .max_grant_frames =3D b_info->max_grant_frames, .max_maptrack_frames =3D b_info->max_maptrack_frames, .grant_opts =3D XEN_DOMCTL_GRANT_version(b_info->max_grant_ver= sion), + .altp2m =3D { + .opts =3D 0, /* .opts will be set below */ + .nr =3D b_info->altp2m_count, + }, .vmtrace_size =3D ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAG= E_SHIFT), .cpupool_id =3D info->poolid, }; --=20 2.34.1 From nobody Fri Oct 31 03:47:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1751399706; cv=none; d=zohomail.com; s=zohoarc; b=TkeZ+xKhAX3mr4nD3IvqziPl5YVtba9hUXpMXdCzF/dxFZvNI60msVn6bsxyfhdt5BurdpMmznlAgsyi9sVZxqroMiKON6sJCf8uBMYFDDVlvwCp7xrBmpjNQui0ouWLd3s2CfASATKJDIwFriP6HI6rMivL0tfivDmPkANlFK0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751399706; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PYagUw7+nV4AIrSjbYjtskD6tyaobfXIr4xaV+yxYuw=; b=hcsecEvNNAjgCrwvnvbq/ZjIvVkCVWk5OZCGFJHJdUUFlNEtt+RcC1L3j2jvYRt/9UswyCnFnYYvPlZPQVwEvIIaeNJtHHOuztF79okInfulfxm6KbuUyvuCauQfl3vYZXns8V8IqIEu3N8liLMs0SMLjxV/TriIUDtrbavrSqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 175139970610612.241121174738396; Tue, 1 Jul 2025 12:55:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1029948.1403701 (Exim 4.92) (envelope-from ) id 1uWh43-0001Qh-Pa; Tue, 01 Jul 2025 19:54:47 +0000 Received: by outflank-mailman (output) from mailman id 1029948.1403701; Tue, 01 Jul 2025 19:54:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWh43-0001P7-Jd; Tue, 01 Jul 2025 19:54:47 +0000 Received: by outflank-mailman (input) for mailman id 1029948; Tue, 01 Jul 2025 19:54:45 +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 1uWh41-0000D0-TQ for xen-devel@lists.xenproject.org; Tue, 01 Jul 2025 19:54:45 +0000 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [2a00:1450:4864:20::429]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3b8e77c4-56b5-11f0-b894-0df219b8e170; Tue, 01 Jul 2025 21:54:43 +0200 (CEST) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-3a4e749d7b2so1029516f8f.0 for ; Tue, 01 Jul 2025 12:54:43 -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-3a88c7e9d1csm14291644f8f.13.2025.07.01.12.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jul 2025 12:54:42 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3b8e77c4-56b5-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751399683; x=1752004483; 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=PYagUw7+nV4AIrSjbYjtskD6tyaobfXIr4xaV+yxYuw=; b=Di3xDQEKfDyU7yBCcvW7aAj2PGSFVVzQQwN1VPejqsnsAUO472bU38df8ZInR9KTD4 2sp0iBEeHF9AI8UxPb6ZokYYbF8GHI6thVhKqdOq1QoYbUImL9fwMXbRM5R7bC+57Upm x2mHMtyO76e5sKXg6yUR33xSwXQtRzAsPWTVPT60ocvPXJ8FU+P5nkh0j8eoPkvJCMNn NOdV+XlJOERvf2p1yyW06Gs2U5AxijWdOfIIdUKwwM4Zcb9f7hD1z+v9ez9JWJOoUzzd J8InY0jwAz3Uy0dLBv9hGNFnRFUeZRzbXt7gHace4cpk7ujap50OscJ6CT2b+a3MqOiH spkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751399683; x=1752004483; 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=PYagUw7+nV4AIrSjbYjtskD6tyaobfXIr4xaV+yxYuw=; b=WgACGQKvSSV9HwOR8ftHypwH75AR7dutHFrpZAkYI8Yil8tNoPeoOhmc+EC+lS5DqZ i94SYbGKlWBboreCtqi1ymWlK2nR9fAD4fAp0DPCDcJPfiN2wOWAzCXX0wMHOfsUu22T gx4HsLNb3/aR6Th0MyDsAtW/q0usxj8/k0Nj/ejzQgti/eRZCXJ/UDPXUYUChtwI/3Jq Gz1Uhgmuv9VaoLOoYyimQuJv0nLsgvNmG3dkJ6bINyQj7ig408JVdFFFBTWqqayvxq+w eaVghJDBYkwPQwvzoUvkTmmAEyYf/U+df+C5KRmy97a1UA+M0CwQc6X05bWj8887W3kh DH4Q== X-Gm-Message-State: AOJu0YyWakvvO0zJ4/Bp9qeecV04b1IQtMrP/vwWiTVbPCNNB+tlA4di x9Y4GdcsG8HzDBs2cmN6vgjKDsFcTQNEslrqaiwKZ9HrQhRUQqGWQ7mlc3bTKg== X-Gm-Gg: ASbGnct6PCktHTa6DAQuWkrkcilA8Vk5eISZNPi9ftiF1XbSN9kBJs+0pcti7dBJn78 trcpYfIb1JlmBaqqi64V4VjiKhHH/lZ2jx1DpjUEWy4hO2aaNHlBCtMTUFiKxt4TQW5Z7AvgzCS HcJU1Ol+qPR+xbqjZD8d13NiEeBhc7OT0a32Jqanekk3AJKZ9EQbjQABv68f5gSPxNmilm/hPD+ jx1Y2gvAr6o/Gt0UahITEe6cKHvTsggu+m+COXkRfc+vV66sTstFiJByLklIg6FsdXIHb2rlS9b 9JetNqvNSodqWwVse7aDOuo03BWiv2cfMpPUAHhMurbmO8xtHt9RDhsSbn5rUfu3tp3jVJLoJzJ t4edGwXXSg2RVPVy6FfgmkBiT13HWjCZfLwBcVwEtMpKxlvjicUye1XL/v/vGqA== X-Google-Smtp-Source: AGHT+IE/KB/pxZ3KsLfyOzOBxluoYg0uOA1iBcipA1IAJq6s4BCrryXlA7GMb3XV63jEVfYXkY5AUw== X-Received: by 2002:a05:6000:4282:b0:3a5:1306:3c30 with SMTP id ffacd0b85a97d-3af459656bfmr1410089f8f.0.1751399682732; Tue, 01 Jul 2025 12:54:42 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v7 6/7] xen/x86: Disallow creating domains with altp2m enabled and altp2m.nr == 0 Date: Tue, 1 Jul 2025 19:54:28 +0000 Message-Id: <6875a5f659a9a48e2beb49e3c5ff8a2720ff882e.1751397919.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1751399706511116600 From: Petr Bene=C5=A1 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 =3D=3D 0 doesn't make sense and it's probably not what user wants. Signed-off-by: Petr Bene=C5=A1 Acked-by: Jan Beulich --- xen/arch/x86/domain.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 155ea1f79f..872e97999c 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -739,8 +739,9 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config) =20 if ( !config->altp2m.nr ) { - /* Fix the value to the legacy default */ - config->altp2m.nr =3D 10; + dprintk(XENLOG_INFO, + "altp2m must be requested with altp2m.nr > 0\n"); + return -EINVAL; } =20 if ( config->altp2m.nr > MAX_NR_ALTP2M ) --=20 2.34.1 From nobody Fri Oct 31 03:47:35 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1751399703; cv=none; d=zohomail.com; s=zohoarc; b=GnmuTeYmSyygb4a2uN4WzarFKuwXNlpgsahG+G6zg7jY7WiLzIQXG0UH8WnAwlgJgzEw1HdoDj3Q50BOWh54DIAIRPLD4BQ8nGRfyT2YBLkbFbq4184kJVKg7gEtalpvwLobK4z4NjH7hBe90f6TcusoL8Oym75igBRg/hwUsRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751399703; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=m6MHrYUDy32kDYPpsu7hQKmN53Ci3Cb0G+3ghuqtWGg=; b=KdsPHySKtxUQQ7hLjn66r+jRnVadTBjjxT+WS4P6aVzGBD/1u/f2cnB+jonQQuYdXMvfqUVEFMz1lX7wmgKmHpr4aWwQGkatYRDv1GYcBQGSND3oqzlCBu6d8KktcT8620O6KicMQXFmmFal59BLGIHPbZXOWkmMKO/gENuDGuk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1751399703236374.0194357807238; Tue, 1 Jul 2025 12:55:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1029949.1403712 (Exim 4.92) (envelope-from ) id 1uWh45-0001it-6b; Tue, 01 Jul 2025 19:54:49 +0000 Received: by outflank-mailman (output) from mailman id 1029949.1403712; Tue, 01 Jul 2025 19:54:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uWh45-0001i9-0Q; Tue, 01 Jul 2025 19:54:49 +0000 Received: by outflank-mailman (input) for mailman id 1029949; Tue, 01 Jul 2025 19:54:47 +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 1uWh42-0000D0-Tj for xen-devel@lists.xenproject.org; Tue, 01 Jul 2025 19:54:46 +0000 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [2a00:1450:4864:20::334]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3c29b215-56b5-11f0-b894-0df219b8e170; Tue, 01 Jul 2025 21:54:44 +0200 (CEST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-450ddb35583so7750875e9.1 for ; Tue, 01 Jul 2025 12:54:44 -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-3a88c7e9d1csm14291644f8f.13.2025.07.01.12.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jul 2025 12:54:43 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3c29b215-56b5-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751399684; x=1752004484; 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=m6MHrYUDy32kDYPpsu7hQKmN53Ci3Cb0G+3ghuqtWGg=; b=WXsb3JkxKh1iranZ8bRReHLUmtLSE5qnZRxWhKvD+0cJqWxLZhSjrxhcrCa/pwRkWl GhTgtmwqvHlzoH8ngGQjbbhcblkxYAp0r38bI1i6j/aHjr582QiHu2N97BVyp+IKGn9O Ecm4COXZCMhr3BJNQieyw+z0S95rU6mU5bFsEiKQyP8ji1rM/ezte2aN55AnRVtPuTRO bJ9/QcrbUo2svlhe3wR3tFfoR4Bdaj6uXKtEG2loEiIZxHIpeLkoSHpp8nVanpNgooCp S4sEWuzgIHb3auqAc2WQQQkwV5WLEshXIaxKVd5RQH8ZljIZ5MEpM6iiIJM146tnnBQo a+Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751399684; x=1752004484; 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=m6MHrYUDy32kDYPpsu7hQKmN53Ci3Cb0G+3ghuqtWGg=; b=eGyQyQabRuUzIn24O1O9dBz0bMNOHJb439CYDRwucgtgvEQ8cvRE9gdLMcb4cUihFA JM8ezDAdmAXMlrvqkIbgF1IbPZSyxMGK8HUCm1YzE9aN+EnI4nAbNkbkMnlidHcJcqxp umGl6Blz7lscBQR8GlMXZ5wSB0f2+zzMMvwunYSBu5prJ9Rmv7qj9U4h9xha6xdR7HVf SCllzs0HI9iQbLSeu4wl7fv2ygOcBauNN1HZQ3mQ01jp0pDoyKbzcDEnqj3xiOL/VQHD +QvoI3x1DChjqLMNAaFskpIXGqSyBJJYZTQdZjIb+lrPmXxS9ZadhHoMA3ifpNKuONWL AquA== X-Gm-Message-State: AOJu0YzZzchQk9ULqExfLtIk4rabC+X/vE8pwpr3il7aLE1D8qsGkvOw UXVaW/es98atSEotf5FqSAWzXeHlVG4Cr8dvHZI8wwx+MOWPMGPFpzX5Tqq/Gw== X-Gm-Gg: ASbGnct3+ZXN6Kk6LB4iIJba0Ai5l+40M9CHQbyvFDpMJiFtv5ynrMINnRlB9RiMUJs uqcQ5NYVxtWA4jv6g2lTZhIUW5BucVN2V+OJuh/dVMZpPRlwailSjznL7keSbLgSyuw0oG6o9t6 w20IVJzBBBUNOs338qnohTclcSU5Kh+Ss5UZyp1gdvz0xmNpzVbkj8m4K+dvzw9JkccvnolcGw3 rFTy2/oxUNjPOjnYk4EAHRFJ0+HPw4Neh87nD+JoOh6dUu5F+ACV3IZwIuKfEvh/bKASVJ7t2ZS J3WSZEkx/0kgX1Vkz0y3q2mIWJylNlv8jM4C7FZCJ2h2RQrXKS3AleN1Bq0aZRQExAH2XivbuaE mxm7co5t0GzkwoJ1IMl6anR8/vtLoz+ZhLm+S7uROvyGo02pSfnhR4pK0mzlv0w== X-Google-Smtp-Source: AGHT+IElo4rx5fETCCYMKriRcSRwJ8MBAScTFnecMLMIF3afaDKYQV5Sx781IyEjT92/D+2lnI0VRA== X-Received: by 2002:a05:6000:2406:b0:3a5:7991:fee with SMTP id ffacd0b85a97d-3af26ddfda7mr1832481f8f.14.1751399683711; Tue, 01 Jul 2025 12:54:43 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Christian Lindig , David Scott , Anthony PERARD , Christian Lindig Subject: [PATCH v7 7/7] tools/ocaml: Add altp2m_count parameter Date: Tue, 1 Jul 2025 19:54:29 +0000 Message-Id: <0a386a56ff67d854d827cbb672ecd54f703632b3.1751397919.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1751399704444116600 From: Petr Bene=C5=A1 Allow developers using the OCaml bindings to set the altp2m_count parameter. Signed-off-by: Petr Bene=C5=A1 Acked-by: Christian Lindig --- tools/ocaml/libs/xc/xenctrl.ml | 1 + tools/ocaml/libs/xc/xenctrl.mli | 1 + tools/ocaml/libs/xc/xenctrl_stubs.c | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 7e1aabad6c..97108b9d86 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -87,6 +87,7 @@ type domctl_create_config =3D 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 f44dba61ae..9fccb2c2c2 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -79,6 +79,7 @@ type domctl_create_config =3D { 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/xenc= trl_stubs.c index b51fd66788..ac2a7537d6 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -205,13 +205,22 @@ CAMLprim value stub_xc_domain_create(value xch_val, v= alue 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) =20 uint32_t domid =3D Int_val(wanted_domid); + uint32_t altp2m_opts =3D Int32_val(VAL_ALTP2M_OPTS); + uint32_t altp2m_nr =3D Int32_val(VAL_ALTP2M_COUNT); uint64_t vmtrace_size =3D Int32_val(VAL_VMTRACE_BUF_KB); =20 + if ( altp2m_opts !=3D (uint16_t)altp2m_opts ) + caml_invalid_argument("altp2m_opts"); + + if ( altp2m_nr !=3D (uint16_t)altp2m_nr ) + caml_invalid_argument("altp2m_count"); + vmtrace_size =3D ROUNDUP(vmtrace_size << 10, XC_PAGE_SHIFT); if ( vmtrace_size !=3D (uint32_t)vmtrace_size ) caml_invalid_argument("vmtrace_buf_kb"); @@ -226,7 +235,8 @@ CAMLprim value stub_xc_domain_create(value xch_val, val= ue wanted_domid, value co .grant_opts =3D XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)), .altp2m =3D { - .opts =3D Int32_val(VAL_ALTP2M_OPTS), + .opts =3D altp2m_opts, + .nr =3D altp2m_nr, }, .vmtrace_size =3D vmtrace_size, .cpupool_id =3D Int32_val(VAL_CPUPOOL_ID), @@ -286,6 +296,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, val= ue 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 --=20 2.34.1