Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6303309ybh; Wed, 7 Aug 2019 21:31:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqznW+SN57U5C/iWBmGvLhZ+tmX11x5ekkwNQIxNY+EiM2cnIVA1sn0Ln/bxOddlFzv9mqO4 X-Received: by 2002:a17:90a:2228:: with SMTP id c37mr1964601pje.9.1565238684597; Wed, 07 Aug 2019 21:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565238684; cv=none; d=google.com; s=arc-20160816; b=fwHsR3OFUPVzm8VRrzS+4APAgcV6dT7VJ6aIePsXhtk2SnNX0acz84FrLAE9VdKdRB Pg6LypN7qgjh+GJD/FDZHar6p2hF7HtrzY7/i951bFYQTTn4ToLp713vJpH6dbKh5+qn QCx72zqm+zsiRkRvbyOUJJ9/ks2m2INKmFzJwxDCG0+75CKZD3KKMosw+e6UUwOUoRzu TDeGkTz9amHerGUHqtOIKc5I8XlCNTiymF4YWE8Ka3Kystzu7kahOuNUuoSJPdcNuiKm NLDPccfOj3nYsRGgRiq+9lFcywsJK7xKglsk/b4bZ5EUE3H4RXlWA5JWQxFX86EyLoOP j8qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=3zf4hcOlJFfFmx5iHaNhP4lNIr2ltkJQoeJgi53xTqQ=; b=UFvzLzlLjlJ8cLtFT+i6IfCQ2wOsz/FZr+dwg7Y4lEmYq7doi6Bdr19iyAfjUYJtdc JQtI5VQ27vWDtaYikBOXvOsu9vxuP12BJElEQxPpvfhelYDUfuLt1+V919zttS4aKyKV HQ2KswpEpzVrvgPXzVvMqUD+DH3gIi81sjDtrfun40yQRKojLBgHYxapGqVp2Ldm1MCS DckBjBaQgleIwY+Z2luMLV0V2enfEFhAjZGeFVecBeM0YfkhvSS0Vldz3eug3gSsgn7+ +7f+CvSeFjDlevdTtjcrNAT4oNp4dyrX1f/YuKKDxSxmIKjnwelOlYZ+FctM3nL0y8HT 0Qig== 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 i68si52539195pfc.153.2019.08.07.21.31.08; Wed, 07 Aug 2019 21:31:24 -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 S1726156AbfHHE3U (ORCPT + 99 others); Thu, 8 Aug 2019 00:29:20 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3780 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725446AbfHHE3U (ORCPT ); Thu, 8 Aug 2019 00:29:20 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 43D6FA41CF4B4EF45A55; Thu, 8 Aug 2019 12:29:18 +0800 (CST) Received: from [127.0.0.1] (10.177.96.203) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Thu, 8 Aug 2019 12:29:10 +0800 Subject: Re: [PATCH v5 03/10] powerpc: introduce kimage_vaddr to store the kernel base To: Michael Ellerman , , , , , , , , CC: , , , , , , References: <20190807065706.11411-1-yanaijie@huawei.com> <20190807065706.11411-4-yanaijie@huawei.com> <8736idunz8.fsf@concordia.ellerman.id.au> From: Jason Yan Message-ID: Date: Thu, 8 Aug 2019 12:29:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <8736idunz8.fsf@concordia.ellerman.id.au> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.96.203] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/8/7 21:03, Michael Ellerman wrote: > Jason Yan writes: >> Now the kernel base is a fixed value - KERNELBASE. To support KASLR, we >> need a variable to store the kernel base. >> >> Signed-off-by: Jason Yan >> Cc: Diana Craciun >> Cc: Michael Ellerman >> Cc: Christophe Leroy >> Cc: Benjamin Herrenschmidt >> Cc: Paul Mackerras >> Cc: Nicholas Piggin >> Cc: Kees Cook >> Reviewed-by: Christophe Leroy >> Reviewed-by: Diana Craciun >> Tested-by: Diana Craciun >> --- >> arch/powerpc/include/asm/page.h | 2 ++ >> arch/powerpc/mm/init-common.c | 2 ++ >> 2 files changed, 4 insertions(+) >> >> diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h >> index 0d52f57fca04..60a68d3a54b1 100644 >> --- a/arch/powerpc/include/asm/page.h >> +++ b/arch/powerpc/include/asm/page.h >> @@ -315,6 +315,8 @@ void arch_free_page(struct page *page, int order); >> >> struct vm_area_struct; >> >> +extern unsigned long kimage_vaddr; >> + >> #include >> #endif /* __ASSEMBLY__ */ >> #include >> diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c >> index 152ae0d21435..d4801ce48dc5 100644 >> --- a/arch/powerpc/mm/init-common.c >> +++ b/arch/powerpc/mm/init-common.c >> @@ -25,6 +25,8 @@ phys_addr_t memstart_addr = (phys_addr_t)~0ull; >> EXPORT_SYMBOL_GPL(memstart_addr); >> phys_addr_t kernstart_addr; >> EXPORT_SYMBOL_GPL(kernstart_addr); >> +unsigned long kimage_vaddr = KERNELBASE; >> +EXPORT_SYMBOL_GPL(kimage_vaddr); > > The names of the #defines and variables we use for these values are not > very consistent already, but using kimage_vaddr makes it worse I think. > > Isn't this going to have the same value as kernstart_addr, but the > virtual rather than physical address? > Yes, that's true. > If so kernstart_virt_addr would seem better. > OK, I will take kernstart_virt_addr if no better name appears. > cheers > > . >