From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753846AbbIBKZA (ORCPT ); Wed, 2 Sep 2015 06:25:00 -0400 Received: from foss.arm.com ([217.140.101.70]:35878 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751589AbbIBKY7 (ORCPT ); Wed, 2 Sep 2015 06:24:59 -0400 Date: Wed, 2 Sep 2015 11:24:54 +0100 From: Will Deacon To: yalin wang Cc: Catalin Marinas , "akpm@linux-foundation.org" , "kirill.shutemov@linux.intel.com" , "ard.biesheuvel@linaro.org" , "minchan@kernel.org" , "fkan@apm.com" , "steve.capper@linaro.org" , "lauraa@codeaurora.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] arm64: add kc_offset_to_vaddr and kc_vaddr_to_offset macro Message-ID: <20150902102454.GG25720@arm.com> References: <1440915599-18485-1-git-send-email-yalin.wang2010@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1440915599-18485-1-git-send-email-yalin.wang2010@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 30, 2015 at 07:19:59AM +0100, yalin wang wrote: > This patch add kc_offset_to_vaddr() and kc_vaddr_to_offset(), > the default version doesn't work on arm64, because arm64 kernel address > is below the PAGE_OFFSET, like module address and vmemmap address are > all below PAGE_OFFSET address. > > Signed-off-by: yalin wang > --- > arch/arm64/include/asm/pgtable.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h > index d374191..ef1ed5c 100644 > --- a/arch/arm64/include/asm/pgtable.h > +++ b/arch/arm64/include/asm/pgtable.h > @@ -660,6 +660,8 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, > > #define update_mmu_cache_pmd(vma, address, pmd) do { } while (0) > > +#define kc_vaddr_to_offset(v) ((v) & ((1UL << VA_BITS) - 1)) > +#define kc_offset_to_vaddr(o) ((o) | ~((1UL << VA_BITS) - 1)) I think it would be cleaner to define something like VIRTUAL_BASE, and then define the vmalloc area in terms of that as well as these kcore macros. Will