From nobody Mon Feb 9 14:33:27 2026 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 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