Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp489594imm; Fri, 11 May 2018 01:23:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpPUk53VO6W7dckt+9WaGcANGpHhg2vNXbLDpUNN31k/gNKkzXmT/olZvYbrWBS5POUIgzi X-Received: by 2002:a62:a315:: with SMTP id s21-v6mr4585852pfe.168.1526026995018; Fri, 11 May 2018 01:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526026994; cv=none; d=google.com; s=arc-20160816; b=B0KzWkEq82ExoysfH6/I/DqMwSs10jIP3fruuL1Thcufu6idItuoyEDBUs124/tv4Y Z7azs7M5kliaCcEWtVrmRVZ384rFoF8uOy6EfYHevBuWGBh9/nhhuUo1Tv5T4EcrbbH9 gmq3zJUII8TX0m6vWWC44SMQNcoSKgUUoSQ7yWCPPBwt4txBqCZaY12Wh2p8uhql84XK T7/cdnhIoXCmOOsg3afvhOJFT0suIByNMmiGViNVNWZ/PVFt5fxfQ+lrpWD0vAHbaZkm 1aI0nlNRkEHUOzqeCgMJY2wU0S26pqqiwvfIAad5HamEJ7iVJHgNyPenNvLVMvjRC90u aNSg== 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=0vNz7OF0pH3bB3HD4GH+ESE6FNz7V1XjNNbUqRcbb2k=; b=qAHLQOrRR08btbnYIAf6AZTK25iGMG2qbjXCeeZgx/CxX0yHC0n6ruuAcUjdfRmqHZ TD7SB33nCV9j0aYLgQmuWqHz3EKXQHlCSYzAl88q5KRDn7Z/iE9tZeG51NuD95NclADs 4SxwmgXwkSVrT4WDEFRcyoZZ6JOdC2b0OzciTlh+nE4MRi+fnaGFoCPPnMcW2wBbDDN3 +DGNQySROCR/NAPKeRcm3jSoqrt8ICa3jQCuo9kg1R+XgUILc95jPZ7IMJ4P8sE1k2mH 3WFRHR+w/1TkpWWSPzBElaNcAAOlZwFLTAm5LoDWVu6F02cGYUx7w/TU2eTYKBCivi41 BORw== 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 r14-v6si2682558pfa.296.2018.05.11.01.22.38; Fri, 11 May 2018 01:23:14 -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 S1752677AbeEKIUT (ORCPT + 99 others); Fri, 11 May 2018 04:20:19 -0400 Received: from mga09.intel.com ([134.134.136.24]:8561 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750852AbeEKIUN (ORCPT ); Fri, 11 May 2018 04:20:13 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 May 2018 01:20:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,387,1520924400"; d="scan'208";a="55002595" Received: from gvt-dell.bj.intel.com (HELO gvt-dell-host.bj.intel.com) ([10.238.154.65]) by orsmga001.jf.intel.com with ESMTP; 11 May 2018 01:20:10 -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 v5 1/4] x86/mm: surround level4_kernel_pgt with #ifdef CONFIG_X86_5LEVEL...#endif Date: Fri, 11 May 2018 16:09:44 +0800 Message-Id: <1526026187-11782-2-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526026187-11782-1-git-send-email-changbin.du@intel.com> References: <1526026187-11782-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 Acked-by: Steven Rostedt (VMware) --- 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