Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp408530imm; Wed, 19 Sep 2018 00:32:32 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaauL22n6cvNELlGQRtXuCTR33TXLWrkGP4u/Vjpfw/j7u12nurFbl1MB8M7MT1NRDeParq X-Received: by 2002:a17:902:b70f:: with SMTP id d15-v6mr33863676pls.53.1537342352524; Wed, 19 Sep 2018 00:32:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537342352; cv=none; d=google.com; s=arc-20160816; b=v3MtJ+yagBVuj9lqaZDHoyiobAeJI3bBRR6LQeATN5CjhvDV61U+PGSyBnl1rT2Oyu h4R5nUi21l55nAl3rxZEPinyVK+KL71hgGB6KsfvCOKTcCzp+TQGettOGVcWRK+GkAtS YUgiZ+6FbZ8a+UdRwjnhro3saMFzEYcnbn6izC+ASkPYKL1fkIYJysJ0D3G/Vs1nMkd5 x2kfn+zLir1RzQIdM27pPo1kknoO9OD6iX+8nGXPO8HH1nOYUgrNqW1BJrQ9e9qTC6zq jOvymvxcO3a+vxxLEMsoJ1Txv3yAYpHBTNAcgpELGVWiZvro9o8sp8S0hxOaMybilUZ1 Ctkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=rTx+Ij6ienDmTb9BJRDEQ3gWWOWccMzZwPQfJcTsGpw=; b=YHx5o8DmjpISc/rHkwkCOrwtMhSE1Y2DZBCFQrQMjRhWcsB9UPcasAIeirc0pRdJmE g0i7kEzzOA+ONc9zokqVPKgl228jf69GUBws5O0htPnOLIWrxw9ZhZ//UT74xXJF9/V4 I2BA0uNTM2d3Cas7DRr2wSS/62m9bJHxYrjocTV2MJKlO2GJpdqBRpS1zRTq63VPkh0Q 8L4Gx0wzJL4IQD5d010cDNybimd/cnH7SmCuBCU77cdoo68JwuEMZiJII3GTkASNUP4x nOs9Jt6kDU2MBZ6o0Su3YBsC1I35ayv/NXKkVOGMhOwHtrGLLoxd4MXl8GAFX4BBAcrs 0CpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2-v6si21495835pfd.76.2018.09.19.00.32.16; Wed, 19 Sep 2018 00:32:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731030AbeISNIW (ORCPT + 99 others); Wed, 19 Sep 2018 09:08:22 -0400 Received: from mga18.intel.com ([134.134.136.126]:8163 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbeISNIW (ORCPT ); Wed, 19 Sep 2018 09:08:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2018 00:31:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,393,1531810800"; d="scan'208";a="91367381" Received: from chenyu-desktop.sh.intel.com ([10.239.160.116]) by fmsmga001.fm.intel.com with ESMTP; 19 Sep 2018 00:31:41 -0700 From: Chen Yu To: Thomas Gleixner , "Rafael J. Wysocki" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Pavel Machek , Len Brown , Zhimin Gu , Yu Chen Subject: [PATCH 03/12][RFC v3] x86-32/asm/power: Create stack frames in hibernate_asm_32.S Date: Wed, 19 Sep 2018 15:38:25 +0800 Message-Id: <19aed6bb376b47f672800b4c59da07efca0f9e5a.1537275915.git.yu.c.chen@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhimin Gu Backport Commit ef0f3ed5a4ac (x86/asm/power: Create stack frames in hibernate_asm_64.S) and Commit 4ce827b4cc58 (x86/power/64: Fix hibernation return address corruption) And also prepare for relocated code and jump address mapping. Cc: "Rafael J. Wysocki" Signed-off-by: Zhimin Gu Signed-off-by: Chen Yu --- arch/x86/include/asm/suspend_32.h | 4 ++++ arch/x86/power/hibernate_asm_32.S | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/arch/x86/include/asm/suspend_32.h b/arch/x86/include/asm/suspend_32.h index 8be6afb58471..fdbd9d7b7bca 100644 --- a/arch/x86/include/asm/suspend_32.h +++ b/arch/x86/include/asm/suspend_32.h @@ -32,4 +32,8 @@ struct saved_context { unsigned long return_address; } __attribute__((packed)); +/* routines for saving/restoring kernel state */ +extern char core_restore_code[]; +extern char restore_registers[]; + #endif /* _ASM_X86_SUSPEND_32_H */ diff --git a/arch/x86/power/hibernate_asm_32.S b/arch/x86/power/hibernate_asm_32.S index 6e56815e13a0..671d38d0d931 100644 --- a/arch/x86/power/hibernate_asm_32.S +++ b/arch/x86/power/hibernate_asm_32.S @@ -12,6 +12,7 @@ #include #include #include +#include .text @@ -24,8 +25,11 @@ ENTRY(swsusp_arch_suspend) pushfl popl saved_context_eflags + FRAME_BEGIN call swsusp_save + FRAME_END ret +ENDPROC(swsusp_arch_suspend) ENTRY(restore_image) movl mmu_cr4_features, %ecx @@ -58,6 +62,10 @@ copy_loop: .p2align 4,,7 done: + + /* code below belongs to the image kernel */ + .align PAGE_SIZE +ENTRY(restore_registers) /* go back to the original page tables */ movl $swapper_pg_dir, %eax subl $__PAGE_OFFSET, %eax @@ -83,3 +91,4 @@ done: xorl %eax, %eax ret +ENDPROC(restore_registers) -- 2.17.1