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

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


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Mon, 15 Nov 2021 13:23:24 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=rtTxbtnCB2KB/902wzp+iv0ZDTex8678qXIJkh4APrw=; b=Hyu9Pu0IwbdfcYM08ozGlY6YeNpopESh5SREzm70YoEps/Yoys+NUJPz5I3rWe8+fXa1we6/AfkjaO+YttFhZHRdLGPRP8XkgCXqKthL5BbO0d2CCOQoQyKTFfC5NP6jsmaWAF/W7y3BRhkJdPI3xh2jGuHxJdtsQSv1eE0vqDTMMyDjpT4DEj1/60aIhPa1qinPCqiSzcRcVJ1HVQooizizper1Q14gLY5pWM9tug/B6SPmdrj0oBHBTwOlaxerTp9RDLYhF1hR4rfusQdQX4KZtnKqiXy0DrOmLHPzWSjoqT0IWYzqoNHALS8BMYO+g6w8sCq2y/ftO1QhF6f5Tw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fbQkG965492pcFqUvt1aTc9v5hI2D60PfDRuozTYl7BfcqUU1g3pNrIgub02yyhfXguSlcZnBIJPMX6MjuCGuJ7kl0sj8VY2tkupYRHhaGSn/HFO1YZfviqpkdkdny3lVLyeGZB5izqAH3lFptWzerrPONixgauwpIeEE9Q6b0IClkPdzIZcJb9vZSXcd45nO8hnDGos48e508OHoG159awlZ6J8lx4AvXlCoOyAud1NhWFhW9GUCOZfpI/RyiJj7dwWyRwWgG0RytTjRAw/orUji4PTDAYYTn1eLVzgw5sBgvPBhNc0MCQ1Etd9IHn80gP6jyaSb7muom9e+avdgA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, 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>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 15 Nov 2021 13:24:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHX2hrekOwfuxb0lUKAubErloiStawEk7kA
  • Thread-topic: [PATCH for-4.16 1/4] domctl: introduce a macro to set the grant table max version

Hi Roger,

> On 15 Nov 2021, at 12:17, Roger Pau Monne <roger.pau@xxxxxxxxxx> wrote:
> 
> 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>

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> 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®.