Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756901Ab2HXX4W (ORCPT ); Fri, 24 Aug 2012 19:56:22 -0400 Received: from co1ehsobe003.messaging.microsoft.com ([216.32.180.186]:50342 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756734Ab2HXX4S (ORCPT ); Fri, 24 Aug 2012 19:56:18 -0400 X-Forefront-Antispam-Report: CIP:163.181.249.108;KIP:(null);UIP:(null);IPV:NLI;H:ausb3twp01.amd.com;RD:none;EFVD:NLI X-SpamScore: 0 X-BigFish: VPS0(zzzz1202hzz8275bhz2dh668h839hd24he5bhf0ah107ah1155h) X-WSS-ID: 0M9AAHQ-01-KWO-02 X-M-MSG: From: Jacob Shin To: X86-ML CC: LKML , "H. Peter Anvin" , Yinghai Lu , Tejun Heo , Dave Young , Chao Wang , Vivek Goyal , Andreas Herrmann , Borislav Petkov , Jacob Shin Subject: [PATCH 1/5] x86: Move enabling of PSE and PGE out of init_memory_mapping Date: Fri, 24 Aug 2012 18:55:12 -0500 Message-ID: <1345852516-3125-2-git-send-email-jacob.shin@amd.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1345852516-3125-1-git-send-email-jacob.shin@amd.com> References: <1345852516-3125-1-git-send-email-jacob.shin@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-OriginatorOrg: amd.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1738 Lines: 60 Depending on the platform, init_memory_mapping() may be called multiple times. Move it out to setup_arch() to avoid writing to cr4 on every call. Signed-off-by: Jacob Shin --- arch/x86/kernel/setup.c | 10 ++++++++++ arch/x86/mm/init.c | 10 ---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index f4b9b80..751e020 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -913,6 +913,16 @@ void __init setup_arch(char **cmdline_p) init_gbpages(); + /* Enable PSE if available */ + if (cpu_has_pse) + set_in_cr4(X86_CR4_PSE); + + /* Enable PGE if available */ + if (cpu_has_pge) { + set_in_cr4(X86_CR4_PGE); + __supported_pte_mask |= _PAGE_GLOBAL; + } + /* max_pfn_mapped is updated here */ max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<