Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp270799imm; Thu, 20 Sep 2018 23:21:26 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYPdIaXDk8vQwgYcw7r+6FJFN2Him2xVm3MgKXiR62EXUbLc8BLutR4Iyw0Q9LfEYJmUbhw X-Received: by 2002:a17:902:ac86:: with SMTP id h6-v6mr5488402plr.103.1537510886854; Thu, 20 Sep 2018 23:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537510886; cv=none; d=google.com; s=arc-20160816; b=MkaaZUD6KLjgE0FKk4d2ZRrdBxkLfq9r/xGG4yJDKd1thbHPA3JCL7JtVXt0dJfaT1 RRBuJz/19/+5N8EhTOXIulMzWnaS0/756hWM6LhXBdf+3uwVtP7+B5j13pcqvsTmDWKh kThd5+IYkzNurBPAIbiRfo/fem9zsqEFZdO3rk4L57OWjbgcj80BOmwNCY5d6UOb2PrC 9RtEiLEkbCrhQzSJNr/CMK+EpdSMZ+C4aLX3oNTfvmvdkRY0kTOUOsN/53qpxOgKMiIx AGuwq8rRuKrS7lqZs3MOJU6bXhUaBW4Hn2/HA+1hBx9PPw1WUVqgf88+kFLiblJGhI82 KPwg== 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=vtEJoeg+Ie+hwB0cD9CXI1+AE2YOo3sXPMszMABZPOE=; b=s9rW04xKZm8nJcKoC4kPWab/LlzCxyhktRIic+BXirFfb8k7esRvctBxfcbeW8TMOy J+mYzuqQX5aWlKnsk/CbsC6lGE5NajjGI07HdgOZFXNhbLnfQdJuHJp/lZzoC1amQdeA 62lRQjwRXx8AVwhTQSPKAiiI69VuZU4wCtAgp+bK5JS5FNJSsRg+eiUSmAYzjWzG8Np0 H72E2zetLcuU1CBvHisDeVDXsdZcv18n24sVs3ANnyEBR6RD+BkZcERnEhJpMNFMfBxw 5BOUVe3+FgF2i7LcWmrt2soLyU+gU/HVqgiPFYVeKGBEV0833Ax7tfkx5MUIr0wGudRX 1z/g== 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 b137-v6si7592006pga.90.2018.09.20.23.21.11; Thu, 20 Sep 2018 23:21:26 -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 S2389371AbeIUMII (ORCPT + 99 others); Fri, 21 Sep 2018 08:08:08 -0400 Received: from mga12.intel.com ([192.55.52.136]:5596 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbeIUMIH (ORCPT ); Fri, 21 Sep 2018 08:08:07 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2018 23:20:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,283,1534834800"; d="scan'208";a="74798909" Received: from chenyu-desktop.sh.intel.com ([10.239.160.116]) by orsmga007.jf.intel.com with ESMTP; 20 Sep 2018 23:20:43 -0700 From: Chen Yu To: Thomas Gleixner , "Rafael J. Wysocki" Cc: Pavel Machek , Len Brown , Zhimin Gu , Chen Yu , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" Subject: [PATCH 05/12][v4] x86-32, hibernate: Enable CONFIG_ARCH_HIBERNATION_HEADER on 32bit system Date: Fri, 21 Sep 2018 14:27:29 +0800 Message-Id: <93afbc94001d7aa85d2cabdf2f80ce72ca80168d.1537448058.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 Enable CONFIG_ARCH_HIBERNATION_HEADER for 32bit system so that 1. arch_hibernation_header_save/restore() are invoked across hibernation on 32bit system. 2. The checksum handling as well as 'magic' number checking for 32bit system are enabled. Controlled by CONFIG_X86_64 in hibernate.c Cc: "Rafael J. Wysocki" Signed-off-by: Zhimin Gu Signed-off-by: Chen Yu --- arch/x86/Kconfig | 2 +- arch/x86/power/hibernate.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1a0be022f91d..e8de5de1057f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2422,7 +2422,7 @@ menu "Power management and ACPI options" config ARCH_HIBERNATION_HEADER def_bool y - depends on X86_64 && HIBERNATION + depends on HIBERNATION source "kernel/power/Kconfig" diff --git a/arch/x86/power/hibernate.c b/arch/x86/power/hibernate.c index f63793b8de3f..a04ca13bf592 100644 --- a/arch/x86/power/hibernate.c +++ b/arch/x86/power/hibernate.c @@ -53,7 +53,6 @@ int pfn_is_nosave(unsigned long pfn) return pfn >= nosave_begin_pfn && pfn < nosave_end_pfn; } -#ifdef CONFIG_X86_64 #define MD5_DIGEST_SIZE 16 @@ -140,7 +139,11 @@ static bool hibernation_e820_mismatch(void *buf) } #endif +#ifdef CONFIG_X86_64 #define RESTORE_MAGIC 0x23456789ABCDEF01UL +#else +#define RESTORE_MAGIC 0x12345678UL +#endif /** * arch_hibernation_header_save - populate the architecture specific part @@ -154,6 +157,7 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size) if (max_size < sizeof(struct restore_data_record)) return -EOVERFLOW; rdr->magic = RESTORE_MAGIC; +#ifdef CONFIG_X86_64 rdr->jump_address = (unsigned long)restore_registers; rdr->jump_address_phys = __pa_symbol(restore_registers); @@ -175,6 +179,7 @@ int arch_hibernation_header_save(void *addr, unsigned int max_size) * have any of the PCID bits set. */ rdr->cr3 = restore_cr3 & ~CR3_PCID_MASK; +#endif return hibernation_e820_save(rdr->e820_digest); } @@ -193,9 +198,11 @@ int arch_hibernation_header_restore(void *addr) return -EINVAL; } +#ifdef CONFIG_X86_64 restore_jump_address = rdr->jump_address; jump_address_phys = rdr->jump_address_phys; restore_cr3 = rdr->cr3; +#endif if (hibernation_e820_mismatch(rdr->e820_digest)) { pr_crit("Hibernate inconsistent memory map detected!\n"); @@ -205,6 +212,7 @@ int arch_hibernation_header_restore(void *addr) return 0; } +#ifdef CONFIG_X86_64 int relocate_restore_code(void) { pgd_t *pgd; -- 2.17.1