From patchwork Sun Aug 30 06:19:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yalin wang X-Patchwork-Id: 7096591 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7068CBEEC1 for ; Sun, 30 Aug 2015 06:24:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F2D020690 for ; Sun, 30 Aug 2015 06:24:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B7782068F for ; Sun, 30 Aug 2015 06:24:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZVvym-0000lb-7c; Sun, 30 Aug 2015 06:20:36 +0000 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZVvyk-0000kf-4d for linux-arm-kernel@lists.infradead.org; Sun, 30 Aug 2015 06:20:34 +0000 Received: by pacdd16 with SMTP id dd16so104441010pac.2 for ; Sat, 29 Aug 2015 23:20:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=UaJRYiv+pnhhIRBrHhv+XejaDRYNETscQwBR+rIDTbQ=; b=pn6cjc+hWAJga5wzxIgeDWnjmFyAxzoofoUWBWJJjbNFEbEDpeGagwtA8oZ4M3JCur QITtc7GZBG2YgJpPR7Ynjh5cEJ0OrEQ0UkarXXA9MeL0PkznP02nN+QHRIgP5p45ZQsh wk+XqQPaUqHkNZ+q/n+NQybC8cvXZse1WDaDX1Bv0lgYq5rmeadIjYIiUwWlsomSH9yy SDjRoe+qes5ohyWjiDkNV0WCm9jQVG2sEEJc2lvNEKJ0Mm3m19ctIGwchmc68GUGTuen emAI6bEue8CppUFmIJxcF25NfNc930UvRHJ+Ezo4nQesoZWUk4sYczE1Gn6R87mJRSVG UT3A== X-Received: by 10.68.233.5 with SMTP id ts5mr27913790pbc.58.1440915612866; Sat, 29 Aug 2015 23:20:12 -0700 (PDT) Received: from ubuntu.localdomain ([17.87.20.100]) by smtp.googlemail.com with ESMTPSA id pt3sm10353235pbb.38.2015.08.29.23.20.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 29 Aug 2015 23:20:12 -0700 (PDT) From: yalin wang To: catalin.marinas@arm.com, will.deacon@arm.com, 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: [PATCH] arm64: add kc_offset_to_vaddr and kc_vaddr_to_offset macro Date: Sun, 30 Aug 2015 14:19:59 +0800 Message-Id: <1440915599-18485-1-git-send-email-yalin.wang2010@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150829_232034_221727_74FD05C8 X-CRM114-Status: UNSURE ( 9.35 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yalin wang MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)) #endif /* !__ASSEMBLY__ */ #endif /* __ASM_PGTABLE_H */