Received: by 10.192.165.148 with SMTP id m20csp1625176imm; Sat, 5 May 2018 17:32:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr+FoohxhSx1IlUDhR34DetOWgV2WTwRuDUHweykoQxDd8D5L05qv4gtKMfHWQP5K5l7i3r X-Received: by 2002:a65:6250:: with SMTP id q16-v6mr10981961pgv.113.1525566778480; Sat, 05 May 2018 17:32:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525566778; cv=none; d=google.com; s=arc-20160816; b=Zr3SSUrCLDvCVAiNRoi40aiywDbf0HcxdsBlOq1RjP+PfDzt+Cep+4kNGdtrxF3MKA 48mkHqkvSS/9Zi+oApbTwHrbEIYFqX6XKlX9U8uPO4j4+b/Ve+/byxw8dPGHKuRndfij H9JelIHgpv1zmN157AzdfiwdWhMdTmplWZMNtPOu2rb6y5lbry/C7+6rtq8lHDvxzy5W GEMDGSkJvUAKeQDLHwMt/SKsAKgU1lOmKBk3xdw30V86LZDEp6Ds/jA3W1MkgS9/D6nr Dbl9c7in9OFgQeyaN03656AjGFxOfwMxzPGZ7M5pS/fuOLtkbjlt122PDILNI1FN13s1 EvKw== 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=jwDIGGHPCD5yg+fI12+xDwHcybc5p71me2xkQsAXUEFlbDVwY4v1nRMQQQSZNL+SQZ 6lCib4288mGrNrpQgVAtZ3tyHUUAlW4b+8sZ/y8uJgqOBqGXmn9wC6jGEZ1qG2korA17 yMjhIU+iyfLmuFyi0AvIsUNYzPl89mlXl13zU9RC9uW+Le3iwBX8PktUWGpzC5SyRZEm v7Jwr29J8CtlGRt5/sFe0Wlh5vC2B3fh5l+YOc/4Z2N0GJ578OatY6DN8fipZ5FUHd2u t95J5rt0Hc+1vZzO7r1d/0FULfoEK5qlQ5Q2mszwngrn4iQWUnSUz82Yo2lEwLTO+nLD wuDQ== 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 y21-v6si18901644pll.353.2018.05.05.17.32.44; Sat, 05 May 2018 17:32:58 -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 S1751941AbeEFAam (ORCPT + 99 others); Sat, 5 May 2018 20:30:42 -0400 Received: from mga02.intel.com ([134.134.136.20]:58221 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751775AbeEFAak (ORCPT ); Sat, 5 May 2018 20:30:40 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 May 2018 17:30:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,367,1520924400"; d="scan'208";a="226149309" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.59]) by fmsmga006.fm.intel.com with ESMTP; 05 May 2018 17:30:36 -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: rostedt@goodmis.org, rdunlap@infradead.org, 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 v3 1/5] x86/mm: surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif Date: Sun, 6 May 2018 08:20:12 +0800 Message-Id: <1525566016-30172-2-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525566016-30172-1-git-send-email-changbin.du@intel.com> References: <1525566016-30172-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