[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] domctl: introduce a macro to set the grant table max version
commit 2abeaf319c59d3446e03264e25987200eb4217ca Author: Roger Pau Monné <roger.pau@xxxxxxxxxx> AuthorDate: Wed Nov 17 08:12:00 2021 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Nov 17 08:12:00 2021 +0100 domctl: introduce a macro to set the grant table max version 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: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx> Acked-by: Julien Grall <jgrall@xxxxxxxxxx> Reviewed-by: Ian Jackson <iwj@xxxxxxxxxxxxxx> Release-Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx> --- 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; -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |