Received: by 10.192.165.148 with SMTP id m20csp4915773imm; Tue, 1 May 2018 06:12:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZruPZlR84Qt4VQpJk+drVLsdxBYz70jtBvvMYshI2h5BQK9N9/hkCl4Zzv1/HTagD49SIQa X-Received: by 2002:a17:902:5914:: with SMTP id o20-v6mr16342667pli.40.1525180357209; Tue, 01 May 2018 06:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525180357; cv=none; d=google.com; s=arc-20160816; b=MyJeDxl2kKFqApRFdJ55D+7Gnmg2OguDr9DJ8RKfyHaZ18mHCCRuogGKOs1uWQdoqd +kGdy+bYxbJTWoWhv9mHpkp+UfpmuCAawD+gCOX8cQffwQeZpP5qXrRoq8ntAOn21TIA 8pQA0rGnunpjcg+x6tm9IZ8D722xfTSV3vIVzP2GfJfzv1VdfFRKH9Fr41gPAVH/6GLi JYWjwRlwmyCimcZty3QzhHCC8vlZAQDlewa2ijE2E6XhBI6JM8Ia9B0wKbz9hwYC4uCE pCli3XBptdQ0VzA00SzFYVuV3s/pbjrqUykZ/3FIoZ/gxR0PHYX9P2ktL48WkC5yHl+S IufA== 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:arc-authentication-results; bh=W7OOz2fsIRaWJ+IWindiGcuM058Hg6UGO1XPJF+mHxg=; b=fIvG0lr1Qam+J9rV3TlDaJzUuMCMZ7oVBo1Z+QtxH8RJB98rUzUzfKazgjWhJcvVTC 1TjUC2yWt7UpTsDi31F8+n27BXm4EV3DgExato7R5l/wFMD5SVq3humSjf52qKzzDbdt oMltOCUjZCqRpL1JsyMCqykNRG8+RZG5JS+DQVWxOCzXAPGd1HZPbH2AmNQg7X9tWJdf BZduLaBaQDqjBH/WGyhDU7srYl15lNb+atRbw40C83EzfsF1IYT9ldv3TQEY4B/+XxWm pphi210r3yeatBagHgJYAPqZsAQZrDB3qqwsYcEakasaUUGmQOMn8bClYgoCLFoUzPMy 6m4w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si9469003ply.464.2018.05.01.06.12.22; Tue, 01 May 2018 06:12:37 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755284AbeEANKx (ORCPT + 99 others); Tue, 1 May 2018 09:10:53 -0400 Received: from mga06.intel.com ([134.134.136.31]:65261 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754805AbeEANKt (ORCPT ); Tue, 1 May 2018 09:10:49 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 May 2018 06:10:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,351,1520924400"; d="scan'208";a="38382523" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.59]) by orsmga006.jf.intel.com with ESMTP; 01 May 2018 06:10:45 -0700 From: changbin.du@intel.com To: yamada.masahiro@socionext.com, michal.lkml@markovi.net, tglx@linutronix.de, mingo@redhat.com, akpm@linux-foundation.org Cc: x86@kernel.org, lgirdwood@gmail.com, broonie@kernel.org, arnd@arndb.de, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Changbin Du Subject: [PATCH 1/5] x86/mm: surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif Date: Tue, 1 May 2018 21:00:10 +0800 Message-Id: <1525179614-14571-2-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525179614-14571-1-git-send-email-changbin.du@intel.com> References: <1525179614-14571-1-git-send-email-changbin.du@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Changbin Du The level4_kernel_pgt is only defined when X86_5LEVEL is enabled. So surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif to make code correct. Signed-off-by: Changbin Du --- arch/x86/include/asm/pgtable_64.h | 2 ++ arch/x86/kernel/head64.c | 13 ++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h index 877bc27..9e7f667 100644 --- a/arch/x86/include/asm/pgtable_64.h +++ b/arch/x86/include/asm/pgtable_64.h @@ -15,7 +15,9 @@ #include #include +#ifdef CONFIG_X86_5LEVEL extern p4d_t level4_kernel_pgt[512]; +#endif extern p4d_t level4_ident_pgt[512]; extern pud_t level3_kernel_pgt[512]; extern pud_t level3_ident_pgt[512]; diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 0c408f8..775d7a6 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -143,16 +143,15 @@ unsigned long __head __startup_64(unsigned long physaddr, pgd = fixup_pointer(&early_top_pgt, physaddr); p = pgd + pgd_index(__START_KERNEL_map); - if (la57) - *p = (unsigned long)level4_kernel_pgt; - else - *p = (unsigned long)level3_kernel_pgt; - *p += _PAGE_TABLE_NOENC - __START_KERNEL_map + load_delta; - +#ifdef CONFIG_X86_5LEVEL if (la57) { + *p = (unsigned long)level4_kernel_pgt; p4d = fixup_pointer(&level4_kernel_pgt, physaddr); p4d[511] += load_delta; - } + } else +#endif + *p = (unsigned long)level3_kernel_pgt; + *p += _PAGE_TABLE_NOENC - __START_KERNEL_map + load_delta; pud = fixup_pointer(&level3_kernel_pgt, physaddr); pud[510] += load_delta; -- 2.7.4