x86/domctl: generalize the restore of vMCE parameters
authorHaozhong Zhang <haozhong.zhang@intel.com>
Fri, 14 Jul 2017 10:42:35 +0000 (12:42 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 14 Jul 2017 10:42:35 +0000 (12:42 +0200)
commit862c83e90e80c1da126990a9e749338f1ee56bca
treec374805c3f0dcfd740adb7772fc878231c52a536
parent614a14736e33fb84872eb00f08799ebbc73a96c6
x86/domctl: generalize the restore of vMCE parameters

vMCE parameters in struct xen_domctl_ext_vcpucontext were extended in
the past, and is likely to be extended in the future. When migrating a
PV domain from old Xen, XEN_DOMCTL_set_ext_vcpucontext should handle
the differences.

Instead of adding ad-hoc handling code at each extension, we introduce
an array to record sizes of the current and all past versions of vMCE
parameters, and search for the largest one that does not expire the
size of passed-in parameters to determine vMCE parameters that will be
restored. If vMCE parameters are extended in the future, we only need
to adapt the array to reflect the extension.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domctl.c