From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCHv1 3/5] x86/fpu: Add a per-domain field to set the width of FIP/FDP Date: Thu, 18 Feb 2016 19:13:51 +0000 Message-ID: <56C617EF.6090808@citrix.com> References: <1455821530-4263-1-git-send-email-david.vrabel@citrix.com> <1455821530-4263-4-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWU1T-0004aT-UI for xen-devel@lists.xenproject.org; Thu, 18 Feb 2016 19:13:56 +0000 In-Reply-To: <1455821530-4263-4-git-send-email-david.vrabel@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel , xen-devel@lists.xenproject.org Cc: Jan Beulich List-Id: xen-devel@lists.xenproject.org On 18/02/16 18:52, David Vrabel wrote: > The x86 architecture allows either: a) the 64-bit FIP/FDP registers to be > restored (clearing FCS and FDS); or b) the 32-bit FIP/FDP and FCS/FDS > registers to be restored (clearing the upper 32-bits). ^ of FIP/FDP > diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h > index 4fad638..362fd8f 100644 > --- a/xen/include/asm-x86/domain.h > +++ b/xen/include/asm-x86/domain.h > @@ -394,6 +394,21 @@ struct arch_domain > > /* Emulated devices enabled bitmap. */ > uint32_t emulation_flags; > + > + /* > + * The width of the FIP/FDP register in the FPU that needs to be > + * saved/restored during a context switch. This is needed because > + * the FPU can either: a) restore the 64-bit FIP/FDP and clear FCS > + * and FDS; or b) retstore the 32-bit FIP/FDP (clearing the upper > + * 32-bits) and restore FCS/FDS. > + * > + * Which one is needed depends on the guest. > + * > + * This can be either: 8, 4 or 0. 0 means auto-detect the size > + * based on the width of FIP/FDP values that are written by by the > + * guest. > + */ > + uint8_t x87_fip_width; Can we get away with always using fpu_sse.x[FPU_WORD_SIZE_OFFSET], instead if duplicating the information in arch_domain and risking them getting out of sync? VMs which have migrated in will already have some policy latched, and we should preserve their old behaviour if possible. ~Andrew