From nobody Tue May 7 11:29:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576263942; cv=none; d=zohomail.com; s=zohoarc; b=OOI9Pnu7cqLaAQY9IIZO8hSPFo3+8R90K0kzSupmpSf7gcYewef1vkUusC39t178Ez3Brpohsodduh42AOsRTTbw+2T6HNL/B2LsSsrrVuUaB9dk0JlgofQ0eIuMrFmc0orCmCczstQLhByqgRfzMIvfOV5N1QFrsBlPgpFTRuE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576263942; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TIfvLxLAVPB8EPNaMTaQGgiHXjxiIODqG749RPmlksE=; b=LpT57cbcCWMTFwnt6OwCoO9VEcuhM3qqPj+uM9HaHyuoTVp8ty1WZyF2FnzugRytb7NSN14hUHdG88n9jaLVEj5DM4pkChRs1wFOcUvtiRpbuXc4iJLP6BFfkvI12RNJ8lyEFzoFv3nmvRIuytCh3F3vAHarbIFi2IMiJu7vAM0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576263942103918.1324583471826; Fri, 13 Dec 2019 11:05:42 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqF9-000071-Q6; Fri, 13 Dec 2019 19:04:51 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqF8-00006w-RJ for xen-devel@lists.xenproject.org; Fri, 13 Dec 2019 19:04:50 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 6abe8292-1ddb-11ea-a914-bc764e2007e4; Fri, 13 Dec 2019 19:04:41 +0000 (UTC) X-Inumbo-ID: 6abe8292-1ddb-11ea-a914-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576263881; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xkbOJP6fAuyas6j302ok5QU8W4tIruFk69fgVV3kLDw=; b=OYA9CtOtVm97FL8VAXu/Klk7iNP8tDkeMsEH/XQucmDug76W3NgvtUFJ +xvScMqMRPn3bgqxnpizdF8pc6+kytI+Iys0ZrnNxjXYB6+0bu2cm+sAN D4ABHMefiKZsaiEGGWo231242Ap+LXuTy1p7OlRMtNKoKx78Yi8J4HWoU 0=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: B6sdGRnwAWvSkpzytoORndvvoqDgrCCPK4jjVEgpwx7Ql9O6iNme2dax8INcy2+Ij4bM42Vja8 gRPLQ6b2h9bjeclAITS+ansqNAQc0uWFhwT9YYTNn4mq5XfqT3gK60y/TsYO6lV2VpAUgR3Wou th1myvYL1AN5TQtkfRD0DLpGLdA0RAFpqfVyKqwkq5meKNoYSXJFNHuXsFpyh0dxqFaYaafBC4 9GTaeVDspDGC9ajq7FXrY4PPMnCgoHIA60dS2hk+a0mvFUlphrlI3+yW2s8tU7ofr8c+ylQX6F jmI= X-SBRS: 2.7 X-MesageID: 10018946 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,309,1571716800"; d="scan'208";a="10018946" From: Andrew Cooper To: Xen-devel Date: Fri, 13 Dec 2019 19:04:31 +0000 Message-ID: <20191213190436.24475-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191213190436.24475-1-andrew.cooper3@citrix.com> References: <20191213190436.24475-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/6] x86/suspend: Clarify and improve the behaviour of do_suspend_lowlevel() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) do_suspend_lowlevel() behaves as a function call, even when the trampoline jumps back into the middle of it. Discuss this property, while renaming the far-too-generic __ret_point to s3_resume. Optimise the calling logic for acpi_enter_sleep_state(). $3 doesn't requir= e a 64bit write, and the function isn't variadic so doesn't need to specify zero FPU registers in use. In the case of an acpi_enter_sleep_state() error, we didn't actually lose state so don't need to restore it. Jump straight to the end. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/acpi/wakeup_prot.S | 23 ++++++++++++++++------- xen/arch/x86/boot/wakeup.S | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_pro= t.S index 74261cb4f1..8c525a802b 100644 --- a/xen/arch/x86/acpi/wakeup_prot.S +++ b/xen/arch/x86/acpi/wakeup_prot.S @@ -42,15 +42,23 @@ ENTRY(do_suspend_lowlevel) =20 call save_rest_processor_state =20 - mov $3, %rdi - xor %eax, %eax - /* enter sleep state physically */ + mov $3, %edi call acpi_enter_sleep_state - jmp __ret_point - =20 -ENTRY(__ret_point) + /* It seems we didn't suspend. Get out of here. */ + jmp .Lsuspend_err + + /* + * do_suspend_lowlevel() is arranged to behave as a regular functi= on + * call, even if hardware actually goes to sleep in the middle. + * + * The trampoline re-intercepts here. State is: + * - 64bit mode + * + * Everything else, including the stack, needs restoring. + */ +ENTRY(s3_resume) lgdt boot_gdtr(%rip) =20 /* mmu_cr4_features contains latest cr4 setting */ @@ -92,7 +100,8 @@ ENTRY(__ret_point) LOAD_GREG(13) LOAD_GREG(14) LOAD_GREG(15) - ret=20 +.Lsuspend_err: + ret =20 .data .align 16 diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S index fc47721f43..c17d613b61 100644 --- a/xen/arch/x86/boot/wakeup.S +++ b/xen/arch/x86/boot/wakeup.S @@ -151,7 +151,7 @@ wakeup_32: .code64 wakeup_64: /* Jump to high mappings and the higher-level wakeup code. */ - movabs $__ret_point, %rbx + movabs $s3_resume, %rbx jmp *%rbx =20 bogus_saved_magic: --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue May 7 11:29:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576263940; cv=none; d=zohomail.com; s=zohoarc; b=IUPOkVH1FOoQdZQN2OZtgKYHaskaiY+CPrOJL1VlM8NegH6MUir+Rju5CEJDM8QAYBenE20byRZBPrjmKb+dbFHzSSRCKL5Rfi8Yxx2QK8bqCVG//XjVK3hgTSTCXB6IExSRD/S2T0i8R9iZGZF3GCEWJOOVKszBk9jUrC47v+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576263940; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=f0cOlD+EffMNLuqOq/UI9pCnxzQlSfjEZJ6mKQlJBNI=; b=MBdwWXLPs0loAwubVGXxzK9R9YysffH3rdZ2V92zGy2nQbq16+uGJaW1I9I06ob8ViAG6Slgup3hUyJDdw4R9Mk9x5q8QA0wtvrxnH5Gb1IDkh623z9hUjGicMX78MZ8hp4pSGY9qWF2js4BPAvJ7sQdHeAo6qDasu2XsI1UcT4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576263940696508.7546057002412; Fri, 13 Dec 2019 11:05:40 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqFB-00007W-6a; Fri, 13 Dec 2019 19:04:53 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqFA-00007J-Cz for xen-devel@lists.xenproject.org; Fri, 13 Dec 2019 19:04:52 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6a36db64-1ddb-11ea-8fd3-12813bfff9fa; Fri, 13 Dec 2019 19:04:42 +0000 (UTC) X-Inumbo-ID: 6a36db64-1ddb-11ea-8fd3-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576263882; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zuRI4c3DTD+Wc+o6lyKaviisE7PPCLcipPLcD1CIIHU=; b=PpKivg1svAcxyr/9PGNJqALhiHUoyAa7Ip3hTWuPE1A88XFeqiy8+R+x FhBgaBUsTcXh0RN2d9tcaP5Znxc7Ylft2q4Z+2EjYm4nffCGfKg1pJt8o OAf0ZBRReDDutrB/8mbgVwS92NbJIyXjo8dxjwScAAZD3vjbpQfOMmsw5 A=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: G0QFSutTcdlsNjc6xySx5My5Dk5FXqvtJDJfz7Io1ls2Mgkv8PTAnbl75bH8j0wqsm0L0rx20i V0ZwF+PMf5y+Rt7tvuKAIImbiE0Tve2R17gd1uq+WmP/GcQKLGKU2WFzF4P5aG0LqxmxMdjyAt g8eXh5eL/CAyuwE2x9w5KfEIj2a6ckby/2FTF3H9QaHKb/tCk/0NF5djY1d7YkfigcoaKo2bzl VGP5vxXNVfS8ltkJBiPf3tpkE4QOJ9y933JEz9fsQhmO2cUXr9tFmZTUBDNv5tjL+L/+3iNoKk zP0= X-SBRS: 2.7 X-MesageID: 9669005 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,309,1571716800"; d="scan'208";a="9669005" From: Andrew Cooper To: Xen-devel Date: Fri, 13 Dec 2019 19:04:32 +0000 Message-ID: <20191213190436.24475-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191213190436.24475-1-andrew.cooper3@citrix.com> References: <20191213190436.24475-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/6] x86/suspend: Don't bother saving %cr3, %ss or flags X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The trampoline has already set up the idle pagetables (which are the correct ones to use), and sanitised the flags state. For %ss, __HYPERVISOR_DS64 is the correct descriptor to restore. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/acpi/wakeup_prot.S | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_pro= t.S index 8c525a802b..35fd7a5e9f 100644 --- a/xen/arch/x86/acpi/wakeup_prot.S +++ b/xen/arch/x86/acpi/wakeup_prot.S @@ -29,17 +29,10 @@ ENTRY(do_suspend_lowlevel) SAVE_GREG(13) SAVE_GREG(14) SAVE_GREG(15) - pushfq; - popq SAVED_GREG(flags) - - mov %ss, REF(saved_ss) =20 mov %cr0, GREG(ax) mov GREG(ax), REF(saved_cr0) =20 - mov %cr3, GREG(ax) - mov GREG(ax), REF(saved_cr3) - call save_rest_processor_state =20 /* enter sleep state physically */ @@ -55,6 +48,7 @@ ENTRY(do_suspend_lowlevel) * * The trampoline re-intercepts here. State is: * - 64bit mode + * - %cr3 =3D> idle_pg_table[] * * Everything else, including the stack, needs restoring. */ @@ -65,13 +59,11 @@ ENTRY(s3_resume) mov REF(mmu_cr4_features), GREG(ax) mov GREG(ax), %cr4 =20 - mov REF(saved_cr3), GREG(ax) - mov GREG(ax), %cr3 - mov REF(saved_cr0), GREG(ax) mov GREG(ax), %cr0 =20 - mov REF(saved_ss), %ss + mov $__HYPERVISOR_DS64, %eax + mov %eax, %ss LOAD_GREG(sp) =20 /* Reload code selector */ @@ -80,8 +72,6 @@ ENTRY(s3_resume) pushq %rax lretq 1: - pushq SAVED_GREG(flags) - popfq =20 call restore_rest_processor_state =20 @@ -109,8 +99,6 @@ ENTRY(s3_resume) GLOBAL(saved_magic) .long 0x9abcdef0 =20 -saved_ss: .word 0 - .align 8 DECLARE_GREG(sp) DECLARE_GREG(bp) @@ -120,7 +108,6 @@ DECLARE_GREG(cx) DECLARE_GREG(dx) DECLARE_GREG(si) DECLARE_GREG(di) -DECLARE_GREG(flags) =20 DECLARE_GREG(8) DECLARE_GREG(9) @@ -132,4 +119,3 @@ DECLARE_GREG(14) DECLARE_GREG(15) =20 saved_cr0: .quad 0 -saved_cr3: .quad 0 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue May 7 11:29:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576263947; cv=none; d=zohomail.com; s=zohoarc; b=PrPqo7wYmrMGEvWdQ4RlzoTOr05p9KnSr922AvRxVNrS5NHg/RkMq7ZZzUDc4VwUS+SbW9cA6V6gEuB5xzTfP2i0SptHpLOe6DKEkD0lgywIbZpTU/GpLSuxmflLepb5Bzux2MsK/khjjVASECJnedIj+S/DjI9zOtbIkGAXmUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576263947; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XAKhYT+/B9tAf1vqw/PYAWbn/AyChG8OzVAk0REPNFo=; b=lh63n014BMnV7nxUBTVa3U2YIL4K2lTInu2YdlJ6coj0bB2ew9ShRqNHZRXHt+JRX+pRpWoYo7+48EzsRR1C0jAilG/bEh+oSsUQu42ZMvQsB/k2VNQztqF62Ib7I35wrTgZzJPlAPVcWfHhppIxwqA4OTCinXebd05kyiF1SA8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576263947245615.1621036945281; Fri, 13 Dec 2019 11:05:47 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqFG-000096-Nq; Fri, 13 Dec 2019 19:04:58 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqFF-00008b-Cm for xen-devel@lists.xenproject.org; Fri, 13 Dec 2019 19:04:57 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6b450204-1ddb-11ea-8fd3-12813bfff9fa; Fri, 13 Dec 2019 19:04:42 +0000 (UTC) X-Inumbo-ID: 6b450204-1ddb-11ea-8fd3-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576263883; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EJgMFJt/RS3x/ZD3KvpyYE+R3JWErTfXnkRvySsPS6s=; b=FWUCyF3UrO1BHozHiin4pKOTHM3IUl1cyE84AUWDPxOneP9552hxA9Sr iYe2c/h3JlFJs/XLYmj5TGTU4xwMs6k6J7d4bqKDezc/pGkg6N7fVezK9 e8Tk2bEkck7e0AD7ElnPwZFgzXHAiQXbJuFmK+/BWqs4keCETqt68qHAS E=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 8k5xsDKfWOc+feNupSDJ+qIb8M+r/lkd0jA/ySDSYCOJ6QVzpLj3xxEtPY240VYnrZ4ptNONtx sACk54q3vFGUnViGGUUoNoBVyEN4ZtwMO/NeBpNwXUmHCCItWBctBxV01miwhMTLJmRIGiyYDJ eqbacnD2FB2qEHxfez9yQl8aQ4Nmr/SdJf/fUfAJ1jLFn13otiapH3uFLrYXYbaRC4VuZ/XZnQ 3WvQFsmSm5DeCOlF/3C/rlmZyJpIDX0hYIS4VCWJFAsalfgOo+E0VSG1CyINqd3CwgZPF27wVW BMo= X-SBRS: 2.7 X-MesageID: 9794915 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,309,1571716800"; d="scan'208";a="9794915" From: Andrew Cooper To: Xen-devel Date: Fri, 13 Dec 2019 19:04:33 +0000 Message-ID: <20191213190436.24475-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191213190436.24475-1-andrew.cooper3@citrix.com> References: <20191213190436.24475-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 3/6] x86/suspend: Don't save unnecessary GPRs X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Only the callee-preserved registers need saving/restoring. Spill them to t= he stack like regular functions do. %rsp is now the only GPR which gets stash= ed in .data Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/acpi/wakeup_prot.S | 59 +++++++++----------------------------= ---- 1 file changed, 12 insertions(+), 47 deletions(-) diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_pro= t.S index 35fd7a5e9f..2f6c8e18ef 100644 --- a/xen/arch/x86/acpi/wakeup_prot.S +++ b/xen/arch/x86/acpi/wakeup_prot.S @@ -11,24 +11,14 @@ #define REF(x) x(%rip) =20 ENTRY(do_suspend_lowlevel) + push %rbp + push %rbx + push %r12 + push %r13 + push %r14 + push %r15 =20 SAVE_GREG(sp) - SAVE_GREG(ax) - SAVE_GREG(bx) - SAVE_GREG(cx) - SAVE_GREG(dx) - SAVE_GREG(bp) - SAVE_GREG(si) - SAVE_GREG(di) - - SAVE_GREG(8) # save r8...r15 - SAVE_GREG(9) - SAVE_GREG(10) - SAVE_GREG(11) - SAVE_GREG(12) - SAVE_GREG(13) - SAVE_GREG(14) - SAVE_GREG(15) =20 mov %cr0, GREG(ax) mov GREG(ax), REF(saved_cr0) @@ -75,22 +65,13 @@ ENTRY(s3_resume) =20 call restore_rest_processor_state =20 - LOAD_GREG(bp) - LOAD_GREG(ax) - LOAD_GREG(bx) - LOAD_GREG(cx) - LOAD_GREG(dx) - LOAD_GREG(si) - LOAD_GREG(di) - LOAD_GREG(8) # save r8...r15 - LOAD_GREG(9) - LOAD_GREG(10) - LOAD_GREG(11) - LOAD_GREG(12) - LOAD_GREG(13) - LOAD_GREG(14) - LOAD_GREG(15) .Lsuspend_err: + pop %r15 + pop %r14 + pop %r13 + pop %r12 + pop %rbx + pop %rbp ret =20 .data @@ -101,21 +82,5 @@ GLOBAL(saved_magic) =20 .align 8 DECLARE_GREG(sp) -DECLARE_GREG(bp) -DECLARE_GREG(ax) -DECLARE_GREG(bx) -DECLARE_GREG(cx) -DECLARE_GREG(dx) -DECLARE_GREG(si) -DECLARE_GREG(di) - -DECLARE_GREG(8) -DECLARE_GREG(9) -DECLARE_GREG(10) -DECLARE_GREG(11) -DECLARE_GREG(12) -DECLARE_GREG(13) -DECLARE_GREG(14) -DECLARE_GREG(15) =20 saved_cr0: .quad 0 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue May 7 11:29:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576263950; cv=none; d=zohomail.com; s=zohoarc; b=IU4RjncCqsxidisGAmWUW+WwHYziQfBbLNoPXr4Yqu+PCy8OyYt+mNZRLsZAFkwAuycNV3cFhT4G4JEGimzXmtr+PXWpcPaOAN37Ew9FsKCdwFsU5dhlMyXbeSTInXW/uPc84jDWbiNS1AYlxqfsxCiBeJdjqylQpW/wLsVWE60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576263950; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cJ9o4RE8dn5fONQ3D03jyoaP6l03OBTrNqchC+8DvXc=; b=AaXdhjdJvttLbiSL1V1/eoxQjcDQfA0Xgi/TZ3sIF/TbJKWb4kluqtVpvV6MB9JeS/0RAlYmGJB3UYseAMzgE2fzEoeVtok3am2yhMWOhWS9Ws3Gp1SEWPGzPskQ7/PNkQUVcxUpYlJ4qt/rSvwIMLj+RB7K95X78qsgM24dvZE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576263950801274.80860662250905; Fri, 13 Dec 2019 11:05:50 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqF6-00006i-HP; Fri, 13 Dec 2019 19:04:48 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqF5-00006c-Cs for xen-devel@lists.xenproject.org; Fri, 13 Dec 2019 19:04:47 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6b1a1ac7-1ddb-11ea-8fd3-12813bfff9fa; Fri, 13 Dec 2019 19:04:42 +0000 (UTC) X-Inumbo-ID: 6b1a1ac7-1ddb-11ea-8fd3-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576263882; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3ze14VkftPAGShn8HBpi741Od6YeSkC3h65W60m19Tw=; b=PAQrzddX9/FnnIP1LFgM3ZaHxtiBv6VIC7mUfRqeu8scUxp3CvwdtiC0 VofKYl932m4NC7f6TvJgsWdazToY3yfrLv0z07io6Zb1a56ckxDGQi3Pd Y+3JfpF2Ox5VOVfMfmUrrErk2G2qYjwDBnSfPKxmc+LAT39LHXlsn6Reh g=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: BNLlEGqlK86X2/egcZBZ2xtitSl6jeaLfkDAp6Wb0d8L+DR0vkqpUGzyGLTvdDz9uxkwmOMX30 sP+rSLqEmGQLQ92tdD73UWqqii509tRKQvOPo/iH7Vx331CDaBBXWs2Fz2TfyRPI9dHSlZG/bS WHQuLEYybBTJ9R470KoOagsfA61ByTWxOoZs6/4TKuSSbAeAGMjW5DEuAyoZxdExd6d8txcJtV hYjg56YVrJB/akb2kMTT0tb6uJgDBu8fb6874EGmEZZ8FO74nxd6W/bP7A3ib9VsbVV4PyKEY/ lcY= X-SBRS: 2.7 X-MesageID: 10233140 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,309,1571716800"; d="scan'208";a="10233140" From: Andrew Cooper To: Xen-devel Date: Fri, 13 Dec 2019 19:04:34 +0000 Message-ID: <20191213190436.24475-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191213190436.24475-1-andrew.cooper3@citrix.com> References: <20191213190436.24475-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 4/6] x86/suspend: Restore cr4 later during resume X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Just like the BSP/AP paths, %cr4 is loaded with only PAE. Defer restoring = all of %cr4 (MCE in particular) until all the system structures (IDT/TSS in particular) have been loaded. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/acpi/suspend.c | 3 +++ xen/arch/x86/acpi/wakeup_prot.S | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/acpi/suspend.c b/xen/arch/x86/acpi/suspend.c index c9dea67bf3..32d0f71ffd 100644 --- a/xen/arch/x86/acpi/suspend.c +++ b/xen/arch/x86/acpi/suspend.c @@ -43,6 +43,9 @@ void restore_rest_processor_state(void) { load_system_tables(); =20 + /* Restore full CR4 (inc MCE) now that the IDT is in place. */ + write_cr4(mmu_cr4_features); + /* Recover syscall MSRs */ wrmsrl(MSR_LSTAR, saved_lstar); wrmsrl(MSR_CSTAR, saved_cstar); diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_pro= t.S index 2f6c8e18ef..a81849fd2b 100644 --- a/xen/arch/x86/acpi/wakeup_prot.S +++ b/xen/arch/x86/acpi/wakeup_prot.S @@ -45,10 +45,6 @@ ENTRY(do_suspend_lowlevel) ENTRY(s3_resume) lgdt boot_gdtr(%rip) =20 - /* mmu_cr4_features contains latest cr4 setting */ - mov REF(mmu_cr4_features), GREG(ax) - mov GREG(ax), %cr4 - mov REF(saved_cr0), GREG(ax) mov GREG(ax), %cr0 =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue May 7 11:29:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576263939; cv=none; d=zohomail.com; s=zohoarc; b=admc7I/jISF1xRzEhdQgUXwN1ZPrxR7QcjblM2k9jsR9O4UqjjmYJIxlCQsSHdbx3jgaXxLVAD7ym8Tckj9WJTaPZszD+KSl4L5vHz/dv1fuzDR152jIHaqmxfMI3ka2C/q9IxHpZTWTEjftGEz0E31bqIg0BiTufu1RfMI6SzA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576263939; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9WxdzgDcTIKQCkQwhsaa2lXjLlfZcbYBT4vZ3ydbufA=; b=g+Bj0GLBWnEMP18THSuSozm7TdwleOCFLMdocQ6+9rPD9BzyybNbuZ2Rn1A3swW8s5B6O/XHJPnpDlQ3vjoOku4k8s69IYQbPgozyUJMm20HQfLVWz4LLvxUhhUql8w8rEve8LaToIORh4eKGgA6AcHTWyUJslwENPky4qRVeyo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 157626393901392.00045936498805; Fri, 13 Dec 2019 11:05:39 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqFF-00008g-Fb; Fri, 13 Dec 2019 19:04:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqFD-000087-N7 for xen-devel@lists.xenproject.org; Fri, 13 Dec 2019 19:04:55 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 6bd56556-1ddb-11ea-b6f1-bc764e2007e4; Fri, 13 Dec 2019 19:04:43 +0000 (UTC) X-Inumbo-ID: 6bd56556-1ddb-11ea-b6f1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576263883; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v0wSirtyLeQ7dUEvDbrV4J90EInwLyDV68v47iceJpM=; b=Lg6mNc8+tgh2Z50ZVYfrudA45SFMeEyLsuuTttbCFp5zUNTIfZPWqcN7 +E94aYXEhNEUczexY1AWu4cA7iLJ8/xIDprrInwCSm9fzG7313+/TvZi/ p5MJf12z10IQh1dqVC4wkXDeIASGpcIPpG9gkFEye8dEeLQIGizuD7TG3 w=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: svensZ28/3DG1yttqvNRZuTwMrAB7vu9mGqJHOfbYN1rbURFOvCnhPX4Rpr6djt0q4EU8uDrTD ZgwspXmx2rsVFc1YSExL3PGtmswP2VxNIHEvzwpTPyzeEWRDdNsEg6DMUUTQyY+6A7PppeQhwC CdD7nk47zbbA2+w6sACT5L9vAIXlAjLDp2kc1XFM0CqRnnucsj3v21uMYk03HBKjjif4qIdLeC jUN/kZ5BSigDffFu009cpfR2wGveYWZPcUQJegMwn9sfZlDcbG3twQPNvN8DRn8nBwy+xZfzsg qy0= X-SBRS: 2.7 X-MesageID: 10077314 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,309,1571716800"; d="scan'208";a="10077314" From: Andrew Cooper To: Xen-devel Date: Fri, 13 Dec 2019 19:04:35 +0000 Message-ID: <20191213190436.24475-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191213190436.24475-1-andrew.cooper3@citrix.com> References: <20191213190436.24475-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 5/6] x86/suspend: Expand macros in wakeup_prot.S X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Most users have been dropped, and they do nothing but obfuscate the assembl= y. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/acpi/wakeup_prot.S | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_pro= t.S index a81849fd2b..0ce96e26a9 100644 --- a/xen/arch/x86/acpi/wakeup_prot.S +++ b/xen/arch/x86/acpi/wakeup_prot.S @@ -2,14 +2,6 @@ .text .code64 =20 -#define GREG(x) %r##x -#define SAVED_GREG(x) saved_r##x(%rip) -#define DECLARE_GREG(x) saved_r##x: .quad 0 -#define SAVE_GREG(x) movq GREG(x), SAVED_GREG(x) -#define LOAD_GREG(x) movq SAVED_GREG(x), GREG(x) - -#define REF(x) x(%rip) - ENTRY(do_suspend_lowlevel) push %rbp push %rbx @@ -18,10 +10,10 @@ ENTRY(do_suspend_lowlevel) push %r14 push %r15 =20 - SAVE_GREG(sp) + mov %rsp, saved_rsp(%rip) =20 - mov %cr0, GREG(ax) - mov GREG(ax), REF(saved_cr0) + mov %cr0, %rax + mov %rax, saved_cr0(%rip) =20 call save_rest_processor_state =20 @@ -45,12 +37,12 @@ ENTRY(do_suspend_lowlevel) ENTRY(s3_resume) lgdt boot_gdtr(%rip) =20 - mov REF(saved_cr0), GREG(ax) - mov GREG(ax), %cr0 + mov saved_cr0(%rip), %rax + mov %rax, %cr0 =20 mov $__HYPERVISOR_DS64, %eax mov %eax, %ss - LOAD_GREG(sp) + mov saved_rsp(%rip), %rsp =20 /* Reload code selector */ pushq $__HYPERVISOR_CS @@ -73,10 +65,8 @@ ENTRY(s3_resume) .data .align 16 =20 +saved_rsp: .quad 0 +saved_cr0: .quad 0 + GLOBAL(saved_magic) .long 0x9abcdef0 - - .align 8 -DECLARE_GREG(sp) - -saved_cr0: .quad 0 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue May 7 11:29:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1576263943; cv=none; d=zohomail.com; s=zohoarc; b=LCaRjEm71jX4BB1KB+u/WrCNAIlytkE2C00YgYsM9oPNjRqaLndBP0LgVOcDB3Lt/008Tf8EF8PefWsySq/pVjpeOKcsssSaiHiOSrSfB90F5Quu8/5iNUrq9vJSjqjNrzujiK56bFCTIvN2nZM9pyCK9B70hQV3ga5QVm20cNc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576263943; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=juzvqAVX5TW2Ah11BFIhytaaW584LuXto9ooWVnUDkw=; b=maSNa/yic/1yb82aae2Z0XuA0eJTsW+2PMwZcbpKw1BizLXUok40XIjTBFOdwykcIMq/NSqHqEBF2QoCMv2w3JJvkf8uw3r/e4vUhxygvn7R1HFW+M98vBMO0zwiT1yXBRrlr6QKm/r8aB757UEgtikOETYgr2XWWKlYbXABdT8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1576263943626664.2203407520321; Fri, 13 Dec 2019 11:05:43 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqFK-0000Bi-1C; Fri, 13 Dec 2019 19:05:02 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ifqFI-0000Ar-Nz for xen-devel@lists.xenproject.org; Fri, 13 Dec 2019 19:05:00 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 6c308a44-1ddb-11ea-b6f1-bc764e2007e4; Fri, 13 Dec 2019 19:04:44 +0000 (UTC) X-Inumbo-ID: 6c308a44-1ddb-11ea-b6f1-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1576263885; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YjF02GlWPriQhahOg2egLA3ecSJkJckuzJldhgBpkqk=; b=AMbIulpfxAY/3nU0r5I6F991hJu/pUhu1DgAWnx0xfRBPOXMD6O+UvTG 8nzjmqXa/disnXp6JcOE7haC5J6Fx9qHoVfMzgVNFT3ItpAPla7DDYxSy H+raPKZcG3lui9AplYEKngwAjiJg5LNq5EnI0UJBi71Klluu7Ox7Ip1Cy o=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: sVC6s97+yMae/7I8P13eS0fk1llmRATX0vWljiMSUg3KEEA6Sp2dD/37HBnYPurVYS3CdfS5vu qJZ8FJq0XEob7Q5H568nPjAD/FZCIS0cmqTa3N5+yHH5NQT1cY3HgHg3uNlq6IOfBMCgFS4Jvp FjznNUuVAetEYLHfInICm199keV2uRhSQZRtid8pClYKO/MsnqTnGRHSl6pMJvMic3uP8rMu+p P7sG4uCc1Jnh9bKfY71tFZw404akL2/Qa9J0AFd/LbiEIHZQnSUakX4esyUFPIZJmfiSQl1bi9 LNU= X-SBRS: 2.7 X-MesageID: 9655076 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,309,1571716800"; d="scan'208";a="9655076" From: Andrew Cooper To: Xen-devel Date: Fri, 13 Dec 2019 19:04:36 +0000 Message-ID: <20191213190436.24475-7-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191213190436.24475-1-andrew.cooper3@citrix.com> References: <20191213190436.24475-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 6/6] x86/suspend: Drop save_rest_processor_state() completely X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Construct the system linkage MSRs using percpu_traps_init(), brining the S3 path in line with the BSP/AP path. Restore xcr0 from the per-cpu shadow co= py. The FS/GS base values are unused in Xen context, and will be loaded appropriately by the next vcpu context switch. Trim the include list substantially, as most are unused. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich Reviewed-by: Roger Pau Monn=C3=A9 --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/acpi/suspend.c | 54 +++----------------------------------= ---- xen/arch/x86/acpi/wakeup_prot.S | 2 -- 2 files changed, 3 insertions(+), 53 deletions(-) diff --git a/xen/arch/x86/acpi/suspend.c b/xen/arch/x86/acpi/suspend.c index 32d0f71ffd..629d117965 100644 --- a/xen/arch/x86/acpi/suspend.c +++ b/xen/arch/x86/acpi/suspend.c @@ -4,40 +4,8 @@ * Copyright (c) 2001 Patrick Mochel */ =20 -#include -#include -#include -#include -#include -#include -#include -#include +#include #include -#include - -static unsigned long saved_lstar, saved_cstar; -static unsigned long saved_sysenter_esp, saved_sysenter_eip; -static unsigned long saved_fs_base, saved_gs_base, saved_kernel_gs_base; -static uint64_t saved_xcr0; - -void save_rest_processor_state(void) -{ - saved_fs_base =3D rdfsbase(); - saved_gs_base =3D rdgsbase(); - rdmsrl(MSR_SHADOW_GS_BASE, saved_kernel_gs_base); - rdmsrl(MSR_CSTAR, saved_cstar); - rdmsrl(MSR_LSTAR, saved_lstar); - - if ( cpu_has_sep ) - { - rdmsrl(MSR_IA32_SYSENTER_ESP, saved_sysenter_esp); - rdmsrl(MSR_IA32_SYSENTER_EIP, saved_sysenter_eip); - } - - if ( cpu_has_xsave ) - saved_xcr0 =3D get_xcr0(); -} - =20 void restore_rest_processor_state(void) { @@ -46,25 +14,9 @@ void restore_rest_processor_state(void) /* Restore full CR4 (inc MCE) now that the IDT is in place. */ write_cr4(mmu_cr4_features); =20 - /* Recover syscall MSRs */ - wrmsrl(MSR_LSTAR, saved_lstar); - wrmsrl(MSR_CSTAR, saved_cstar); - wrmsrl(MSR_STAR, XEN_MSR_STAR); - wrmsrl(MSR_SYSCALL_MASK, XEN_SYSCALL_MASK); - - wrfsbase(saved_fs_base); - wrgsbase(saved_gs_base); - wrmsrl(MSR_SHADOW_GS_BASE, saved_kernel_gs_base); - - if ( cpu_has_sep ) - { - /* Recover sysenter MSRs */ - wrmsrl(MSR_IA32_SYSENTER_ESP, saved_sysenter_esp); - wrmsrl(MSR_IA32_SYSENTER_EIP, saved_sysenter_eip); - wrmsr(MSR_IA32_SYSENTER_CS, __HYPERVISOR_CS, 0); - } + percpu_traps_init(); =20 - if ( cpu_has_xsave && !set_xcr0(saved_xcr0) ) + if ( cpu_has_xsave && !set_xcr0(get_xcr0()) ) BUG(); =20 wrmsrl(MSR_IA32_CR_PAT, XEN_MSR_PAT); diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_pro= t.S index 0ce96e26a9..fed114c0b2 100644 --- a/xen/arch/x86/acpi/wakeup_prot.S +++ b/xen/arch/x86/acpi/wakeup_prot.S @@ -15,8 +15,6 @@ ENTRY(do_suspend_lowlevel) mov %cr0, %rax mov %rax, saved_cr0(%rip) =20 - call save_rest_processor_state - /* enter sleep state physically */ mov $3, %edi call acpi_enter_sleep_state --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel