From patchwork Thu Jan 2 08:45:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tu Dinh X-Patchwork-Id: 13924336 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6FAFEE77194 for ; Thu, 2 Jan 2025 08:46:10 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.863737.1275165 (Exim 4.92) (envelope-from ) id 1tTGpz-0006X4-5D; Thu, 02 Jan 2025 08:45:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 863737.1275165; Thu, 02 Jan 2025 08:45:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tTGpy-0006W9-Sk; Thu, 02 Jan 2025 08:45:50 +0000 Received: by outflank-mailman (input) for mailman id 863737; Thu, 02 Jan 2025 08:45:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tTGpx-0004rS-UK for xen-devel@lists.xenproject.org; Thu, 02 Jan 2025 08:45:49 +0000 Received: from mail180-50.suw31.mandrillapp.com (mail180-50.suw31.mandrillapp.com [198.2.180.50]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f5908fed-c8e5-11ef-99a4-01e77a169b0f; Thu, 02 Jan 2025 09:45:46 +0100 (CET) Received: from pmta11.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail180-50.suw31.mandrillapp.com (Mailchimp) with ESMTP id 4YP0fD5n5HzCf9M37 for ; Thu, 2 Jan 2025 08:45:40 +0000 (GMT) Received: from [37.26.189.201] by mandrillapp.com id 18bc4adf6c0c4943a835c5bc80ce84cb; Thu, 02 Jan 2025 08:45:40 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f5908fed-c8e5-11ef-99a4-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1735807540; x=1736068040; bh=mzhXuh0ndyjVjpzrrKA3CLzzrom7CZG1ilSX478/eBg=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=oDCE65nLyW+4kZGft2uh059FpwIwEueCaNkKPOqR4qKgZ9asIUVyLSu9WliVX/lFt HjW7vUdQvjKPQ+Z5vsIT+NDkW3B5f4NuFGyaZn7ebPHat+5nJY9k3j4OcCDBeT8Hf5 SuzhFE6e0ZBcTcjCt6nvUoSIRhlKXHU/gBLgd69GiYaQTg7DdMk0rjrtn9mhNww5J/ i8T6DkNcuzuie6/zz8hj0LRvcf+SurMdLTj7slyVyXsZeGFyRJnYDJi4Svu0qy8ekQ HCztn4N6idpPsqlKxpb34fOVZAZN9aWPKRf1nbBNNt4IPi8joto40BELFQ3eNQjxw+ HrWVGMELfkFzQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1735807540; x=1736068040; i=ngoc-tu.dinh@vates.tech; bh=mzhXuh0ndyjVjpzrrKA3CLzzrom7CZG1ilSX478/eBg=; h=From:Subject:To:Cc:Message-Id:In-Reply-To:References:Feedback-ID: Date:MIME-Version:Content-Type:Content-Transfer-Encoding:CC:Date: Subject:From; b=O+r6NcYohpfHx1h+H0YjkdzcWSY9atwvPggh+iuatsHlmcnivPBokfNhI88D02J7C avhzxVYyQM7mFbxrG1Tax4w2HEdM63sEWtui4MOwGev9O2POXZFC0gzfG1vevkNgI4 D5odIRyCKRLqNb8ZHiCkzr6UFykXnhdo7mlog4CJgBXGBB1GbaCWuHCGEGw/Z9FlwC o8+gAo9DIHkq1QDWKRwJH1tbkKTwRY9Ef0IRs8fbg8RPuA78jTIRH83e6dlm9W4Sz4 ZVgScCgL+8YNyam/yi7Bslp9G4jjgjym9OWSpUWh/8Cdr0pq9Wsf+hgnMzt5Jcr947 91P/BmnQ1CICA== From: "Tu Dinh" Subject: =?utf-8?q?=5BRFC_PATCH_v2_05/10=5D_x86=3A_Keep_a_copy_of_XSAVE_area?= =?utf-8?q?_size?= X-Mailer: git-send-email 2.43.0 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1735807539875 To: xen-devel@lists.xenproject.org Cc: "Tu Dinh" , "Anthony PERARD" , "Juergen Gross" , "Jan Beulich" , "Andrew Cooper" , " =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= " Message-Id: <20250102084413.102-6-ngoc-tu.dinh@vates.tech> In-Reply-To: <20250102084413.102-1-ngoc-tu.dinh@vates.tech> References: <20250102084413.102-1-ngoc-tu.dinh@vates.tech> X-Native-Encoded: 1 X-Report-Abuse: =?utf-8?q?Please_forward_a_copy_of_this_message=2C_including?= =?utf-8?q?_all_headers=2C_to_abuse=40mandrill=2Ecom=2E_You_can_also_report_?= =?utf-8?q?abuse_here=3A_https=3A//mandrillapp=2Ecom/contact/abuse=3Fid=3D30?= =?utf-8?q?504962=2E18bc4adf6c0c4943a835c5bc80ce84cb?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20250102:md Date: Thu, 02 Jan 2025 08:45:40 +0000 MIME-Version: 1.0 Signed-off-by: Tu Dinh --- xen/arch/x86/include/asm/domain.h | 1 + xen/arch/x86/xstate.c | 1 + 2 files changed, 2 insertions(+) diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h index b79d6badd7..d3f2695c20 100644 --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -638,6 +638,7 @@ struct arch_vcpu * #NM handler, we XRSTOR the states we XSAVE-ed; */ struct xsave_struct *xsave_area; + unsigned int xsave_area_size; uint64_t xcr0; /* Accumulated eXtended features mask for using XSAVE/XRESTORE by Xen * itself, as we can never know whether guest OS depends on content diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index af9e345a7a..baae8e1a13 100644 --- a/xen/arch/x86/xstate.c +++ b/xen/arch/x86/xstate.c @@ -550,6 +550,7 @@ int xstate_alloc_save_area(struct vcpu *v) save_area->fpu_sse.mxcsr = MXCSR_DEFAULT; v->arch.xsave_area = save_area; + v->arch.xsave_area_size = size; v->arch.xcr0 = 0; v->arch.xcr0_accum = 0;