[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH for-4.16 1/4] domctl: introduce a macro to set the grant table max version


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Mon, 15 Nov 2021 13:17:38 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J7YKl3TZjUGOEVn92cpS9NgBaIkzP5wzuawrDSqqVDk=; b=C4f+1dBGO/n3j7UyhTt9Sze3sccsoJYBM+4ySPhdsmwsT17dirdghXEiwFLLdQ7h6jVYAOhFO+nC+oxIICls1PcXeM/iJIOnoKv+LR1updWTK8Jgn4EGvGPPMpsuEviW/2kqFDy+dC/rjxx4BxS2qEO2w/Svr0g6evwhKJb8u8QEL7kJ2MzZSeDYuyhf22XP/d5OWPLVggFhnE19Ap2A27r7aUEgpD4p/Gm7PoluIX/VnbEwb5MtLQh8O+7Zb9ae71Cjl0gOZw/6FGuoKOZ6UPYGzH8eltL6NHaduhyXxUv6m3+WKWW72SCIRhi62kV99YD/JbgUIcWwRMOLH5qNuA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cuFMl7v1hjy4JgWw4X7OP7QEmNw7+FmBeKSOvBWMBsg9H3dh9cMYpxqcht6al44q8bUU2KSsZXImGJOPimlDEGNwvY8fO8is23ROQmiBvD4q0ldSBcS0CTZ1onCod7/v/Z9XaoHA5FJ2IHh0giFTLXYBupmgxw4oqYSCux7qZpLbdXr76LtjS+4V0LBLDs8O4K9ztyYjgjp26zWKWc+/+/bi1kF9dVLcJNhNWit9Yo1JkABMgSXBrww70mPsCEFb8/5vGIZuG3KJ9Eq2zhVmnqVSMbin7lDnMt10kSvdZDXSVTiMXHf1xgCBer16RzjVrhGDGcoAJFk/1LxOXswcWw==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "Christian Lindig" <christian.lindig@xxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 15 Nov 2021 12:18:13 +0000
  • Ironport-data: A9a23:ZbBERKpQ/h6qxQmEEAbHcwiE5OFeBmJ1YxIvgKrLsJaIsI4StFCzt garIBnXMqqJYzD1ed1+aYS28UwPuZ7UyYdhHQU/+3s2HyJD8JuZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlZT4vE2xbuKU5NTsY0idfic5Dnd+4f5fs7Rh2Ncx2IHkW1rlV e7a+KUzBnf0g1aYDUpMg06zgEsHUCPa4W5wUvQWPJinjXeG/5UnJMt3yZKZdhMUdrJ8DO+iL 9sv+Znilo/vE7XBPfv++lrzWhVirrc/pmFigFIOM0SpqkAqSiDfTs/XnRfTAKtao2zhojx/9 DlCnZOiEFszJPbFoekMSwhpDS1AZf0f5JaSdBBTseTLp6HHW37lwvEoB0AqJ4wIvO1wBAm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L/FUEbvM7ztkiqMDuQuiHdsdz+12MegUM RydlWB6p5qnaArWyKYTiEDN5whSGu1HfszUXboRRAl6fQIGs0g5o97e8BfRhrjgtwpG5BA5KIR 9bJJCd0M9SAbaQ8H05x5jQ/TPL7HgtcLOVf1wh+JJ3cjk6EvKmTy0nv4ljV+oOOHTUNONVS8eb 43loXXxWunzWjLt8fJcd6lJ/
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Such macro just clamps the passed version to fit in the designated
bits of the domctl field. The main purpose is to make it clearer in
the code when max grant version is being set in the grant_opts field.

Existing users that where setting the version in the grant_opts field
are switched to use the macro.

No functional change intended.

Requested-by: Jan Beulich <jbeulich@xxxxxxxx>
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>

Given it's a non functional change (or at least that's the intention)
it shouldn't have any impact on the release, it's just syntactic
sugar.
---
 tools/helpers/init-xenstore-domain.c | 2 +-
 tools/libs/light/libxl_create.c      | 2 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c  | 3 ++-
 xen/arch/arm/domain_build.c          | 4 ++--
 xen/arch/x86/setup.c                 | 2 +-
 xen/include/public/domctl.h          | 1 +
 6 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/helpers/init-xenstore-domain.c 
b/tools/helpers/init-xenstore-domain.c
index 60469161bd..b205a79ee6 100644
--- a/tools/helpers/init-xenstore-domain.c
+++ b/tools/helpers/init-xenstore-domain.c
@@ -89,7 +89,7 @@ static int build(xc_interface *xch)
          */
         .max_grant_frames = 4,
         .max_maptrack_frames = 128,
-        .grant_opts = 1,
+        .grant_opts = XEN_DOMCTL_GRANT_version(1),
     };
 
     xs_fd = open("/dev/xen/xenbus_backend", O_RDWR);
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index b6855c7b46..dcd09d32ba 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -629,7 +629,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config 
*d_config,
             .max_evtchn_port = b_info->event_channels,
             .max_grant_frames = b_info->max_grant_frames,
             .max_maptrack_frames = b_info->max_maptrack_frames,
-            .grant_opts = b_info->max_grant_version,
+            .grant_opts = XEN_DOMCTL_GRANT_version(b_info->max_grant_version),
             .vmtrace_size = ROUNDUP(b_info->vmtrace_buf_kb << 10, 
XC_PAGE_SHIFT),
         };
 
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
b/tools/ocaml/libs/xc/xenctrl_stubs.c
index eca0b8b334..5b4fe72c8d 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -199,7 +199,8 @@ CAMLprim value stub_xc_domain_create(value xch, value 
wanted_domid, value config
                .max_evtchn_port = Int_val(VAL_MAX_EVTCHN_PORT),
                .max_grant_frames = Int_val(VAL_MAX_GRANT_FRAMES),
                .max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
-               .grant_opts = Int_val(VAL_MAX_GRANT_VERSION),
+               .grant_opts =
+                   XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)),
        };
 
        domain_handle_of_uuid_string(cfg.handle, String_val(VAL_HANDLE));
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 19487c79da..d02bacbcd1 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -2986,7 +2986,7 @@ void __init create_domUs(void)
             .max_evtchn_port = -1,
             .max_grant_frames = -1,
             .max_maptrack_frames = -1,
-            .grant_opts = opt_gnttab_max_version,
+            .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
         };
 
         if ( !dt_device_is_compatible(node, "xen,domain") )
@@ -3094,7 +3094,7 @@ void __init create_dom0(void)
         .max_evtchn_port = -1,
         .max_grant_frames = gnttab_dom0_frames(),
         .max_maptrack_frames = -1,
-        .grant_opts = opt_gnttab_max_version,
+        .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
     };
 
     /* The vGIC for DOM0 is exactly emulating the hardware GIC */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ec6e686fac..da47cdea14 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -755,7 +755,7 @@ static struct domain *__init create_dom0(const module_t 
*image,
         .max_evtchn_port = -1,
         .max_grant_frames = -1,
         .max_maptrack_frames = -1,
-        .grant_opts = opt_gnttab_max_version,
+        .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
         .max_vcpus = dom0_max_vcpus(),
         .arch = {
             .misc_flags = opt_dom0_msr_relaxed ? XEN_X86_MSR_RELAXED : 0,
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 1c21d4dc75..b85e6170b0 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -99,6 +99,7 @@ struct xen_domctl_createdomain {
 
 /* Grant version, use low 4 bits. */
 #define XEN_DOMCTL_GRANT_version_mask    0xf
+#define XEN_DOMCTL_GRANT_version(v)      ((v) & XEN_DOMCTL_GRANT_version_mask)
 
     uint32_t grant_opts;
 
-- 
2.33.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.