From nobody Thu Sep 19 01:29:21 2024 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=1718039490; cv=none; d=zohomail.com; s=zohoarc; b=DDo8HRlr7fPiKwg2Uw6Fd1F2Wr22m/YocEhtMJ5kZD0+ssQ/Ivwe1PSziPQBlOYlGoffDoPjMwmMIe4oEHI8zNQliz5Zf8fMUgJM1DGLkuxTkeXrPL+PG7HcJ+pz6KuxHB8+m91dMyeMmbQ1gp+ny+gE2bBjEe4FWpTMhQHAWU0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718039490; 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=Q0bBFO5q1RXhnEhFZi3YywzgmIW8ZFC/EvRHCN4/klw=; b=iw8D7Cn8OthdEL/Dt4liu77YClANf8Fc5ObQJvpfW356YS4TDPzuwUkK5RYZNi8dyFc0F46owNpObQ+IQ3pWxaWFdv6PJayrMWSQl5RMGjXsUwt6W/PeEheQJivIfv9CGlbhq5v8Tlk+MPUDxSeoYkxpIFcZ+Qm9hZanGIAh37E= 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 171803949027357.44041770469062; Mon, 10 Jun 2024 10:11:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.737468.1143799 (Exim 4.92) (envelope-from ) id 1sGiXq-0000ze-MK; Mon, 10 Jun 2024 17:10:58 +0000 Received: by outflank-mailman (output) from mailman id 737468.1143799; Mon, 10 Jun 2024 17:10:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sGiXq-0000zX-JV; Mon, 10 Jun 2024 17:10:58 +0000 Received: by outflank-mailman (input) for mailman id 737468; Mon, 10 Jun 2024 17:10:56 +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 1sGiXo-0000kp-H8 for xen-devel@lists.xenproject.org; Mon, 10 Jun 2024 17:10:56 +0000 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [2a00:1450:4864:20::533]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 66438e4c-274c-11ef-90a2-e314d9c70b13; Mon, 10 Jun 2024 19:10:56 +0200 (CEST) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-57a1fe63a96so6034347a12.0 for ; Mon, 10 Jun 2024 10:10:56 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57c76740d6asm3233169a12.7.2024.06.10.10.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 10:10:54 -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: 66438e4c-274c-11ef-90a2-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718039455; x=1718644255; 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=Q0bBFO5q1RXhnEhFZi3YywzgmIW8ZFC/EvRHCN4/klw=; b=iwt/fm6Er4vVeB3dnZnO2tWRoaadhMQzz6Gz87MFKKWzdjDnNCyetdkzR87aEC80It wUK9/wq/ywqhK8GP3njxkwOPKhfe6m5kWKtD2HlVgkPdPWObnP4IxW6896T6ancIYmxh UT6CzAzE36sizTBOU/f95sMHmo1ge1oIZjz6JtTBbHE/HjZs6KaU2FzD30xaSlXvQnBy LvrLFyBORnWfrWlMSgZedFWBSmWAQc18G1N8ChqiWvyV4y7WV7LCbY2hG4oUJofhUMgI 8rp0iBgqSoVMoMIqZNKkIfeeV7UbTqQHil2ZpMzJ9rDwS+nPax2FQL2ZGTh6Trbp68um AgPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718039455; x=1718644255; 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=Q0bBFO5q1RXhnEhFZi3YywzgmIW8ZFC/EvRHCN4/klw=; b=BUFlvLaegYdtMG1ul3dDblKQGnQpl3lLaZBBoNouNQ2bFoae2UAG/UwzV9HRBIpVZo pTfhsixjqwi8tD+k0ZLSJ+jmchf9lWIaa8qLuv42kZu5r6P3weNMp038tqtiqdHoCCge XJ4zO4Nj82xtFwP2PNsibnQ0ts1bXO4ZLNEAnLGxTVI0h9P/jQH8AIREe8awQkrqMhwA 3MmYKo1ZKyA+GtdRxsd/9grPoBWWlPvy4eNZEZAijod2U/wohD6oEaWDRzRT82S7a39v RWK2WpgfPHk8fq2mJm/7yHYMtJB7ywwnISbbDi7Z2YlxehcqB4Ue/TvrAlQbXh/l5p1S Az8A== X-Gm-Message-State: AOJu0YzY02By7zneSErMFCHHD1dSVkrQ2dw+6AepWAR+v5y01/30qglL NEoIfnM7ZCOrYPJtqbTM0HFRKn0vrV/jFXpLpyqSdNHQRlSG0vz4tXQvAIx4 X-Google-Smtp-Source: AGHT+IHfPN5/U6D0d1riqJfkCo9zHTyJhnBxn6b4dy6ex7KulMrSOCKuuET5dGM//7BuI5dw3Ls7cA== X-Received: by 2002:a50:ab04:0:b0:57c:6248:62b7 with SMTP id 4fb4d7f45d1cf-57c62486320mr4930825a12.13.1718039454906; Mon, 10 Jun 2024 10:10:54 -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 , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Christian Lindig , David Scott , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Julien Grall Subject: [PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format Date: Mon, 10 Jun 2024 17:10:41 +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: 1718039491199100014 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: Julien Grall # arm Reviewed-by: Jan Beulich # hypervisor Acked-by: Anthony PERARD --- 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 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_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; case LIBXL_ALTP2M_MODE_EXTERNAL: - create.altp2m_opts |=3D + create.altp2m.opts |=3D XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_external); break; case LIBXL_ALTP2M_MODE_LIMITED: - create.altp2m_opts |=3D + create.altp2m.opts |=3D XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_limited); break; diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_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, 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 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_creat= edomain *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 ccadfe0c9e..a4f2e7bad1 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_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); if ( hvm ? !hvm_enabled : !IS_ENABLED(CONFIG_PV) ) @@ -717,7 +717,7 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *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] =3D 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] =3D 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; -- 2.34.1