From: Jan Beulich Date: Wed, 14 Aug 2024 13:38:14 +0000 (+0200) Subject: x86/xstate: use xvzalloc() for save area allocation X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b12da0cc86ce383a9d13b8117fb6a53e3e34dc25;p=people%2Fandrewcoop%2Fxen.git x86/xstate: use xvzalloc() for save area allocation This is in preparation for the area size exceeding a page's worth of space, as will happen with AMX as well as Architectural LBR. Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index 5c4144d55e..1e1abfc029 100644 --- a/xen/arch/x86/xstate.c +++ b/xen/arch/x86/xstate.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -530,7 +531,7 @@ int xstate_alloc_save_area(struct vcpu *v) /* XSAVE/XRSTOR requires the save area be 64-byte-boundary aligned. */ BUILD_BUG_ON(__alignof(*save_area) < 64); - save_area = _xzalloc(size, __alignof(*save_area)); + save_area = _xvzalloc(size, __alignof(*save_area)); if ( save_area == NULL ) return -ENOMEM; @@ -551,8 +552,7 @@ int xstate_alloc_save_area(struct vcpu *v) void xstate_free_save_area(struct vcpu *v) { - xfree(v->arch.xsave_area); - v->arch.xsave_area = NULL; + XVFREE(v->arch.xsave_area); } static bool valid_xcr0(uint64_t xcr0)