Received: by 10.192.165.148 with SMTP id m20csp666829imm; Wed, 2 May 2018 06:58:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoLlsf/y0UiAFqdW/ZJgoo7L6+7x88E4ldwLgxeaL06/e+TWae9BjoHh57o7A7V0bvaCu5Q X-Received: by 10.167.133.131 with SMTP id w3mr19342321pfn.197.1525269481550; Wed, 02 May 2018 06:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525269481; cv=none; d=google.com; s=arc-20160816; b=eSzsGQM/jFRZbf+4CY4iQMzC17iExguF/06nTG9ANgQMgeJYqCQ/OKz3QwhXk/f+ol GDZudulm//bPj3ifXzf2/qjLLWPNzEUFBdldV7MLsI2lXQWhvcZs83y4cx9tY9sYNKRW LPbknE/lXJ/lEvw9O7sNXbt2C+j8yA097iL65eDHR3cY0XJ6nGfOEWEv1AiYBYzSQPq+ ZjAW0dTwvguJs79B04tD7Mxc5u6YbUymnHgLm3hZrMfdxemqVxxloeDxOeupAcyPzc5B /ptcHbD3queJknS952wQ/BdlxaVLnQHVu2IZ3IKE5Mqhd9vKgAaAYMfc8+vhi/jr8pE9 B9jQ== 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=DomL6LbHJPh0fhTAmZllWcbwNQMJvJdi9XYVjALtuoGJwl5YuEAzwfsFr+KTfc9G1d dRdFHuRZ9YWr/f99inJDlkHyuMOxj2NSYpQNNIh0e/63Tvly3ARUNg+0E/8c0EjiGdQg E6Zn8kEjm9L24m259K1VJisAM8MmaFN2elRSSPMQMMYun6+PuTViSxSKeZVL4cWwUAlB KLwA61kwrd033upGw9qjkx9RynE3Pzp5kAy4gXYfCfY2jayBf7q7fldBPLo947fzopq5 YlHl1mPOFaPTir8sAtVG/k00lP8RIps+zt2yn59TgTDSp2yqOhIOXp90p6QJ2HJGhk5G YBqw== 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 w24-v6si3649901plq.254.2018.05.02.06.57.47; Wed, 02 May 2018 06:58:01 -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 S1751761AbeEBN5C (ORCPT + 99 others); Wed, 2 May 2018 09:57:02 -0400 Received: from mga01.intel.com ([192.55.52.88]:58147 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751271AbeEBNzc (ORCPT ); Wed, 2 May 2018 09:55:32 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 May 2018 06:55:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,354,1520924400"; d="scan'208";a="225150729" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.59]) by fmsmga005.fm.intel.com with ESMTP; 02 May 2018 06:55:29 -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 v2 1/5] x86/mm: surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif Date: Wed, 2 May 2018 21:44:56 +0800 Message-Id: <1525268700-10631-2-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525268700-10631-1-git-send-email-changbin.du@intel.com> References: <1525268700-10631-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