From patchwork Sun Sep 6 04:04:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yalin wang X-Patchwork-Id: 7130561 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 0DA00BEEC1 for ; Sun, 6 Sep 2015 04:07:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 19FE3207EB for ; Sun, 6 Sep 2015 04:07:45 +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 4CC33207E8 for ; Sun, 6 Sep 2015 04:07:44 +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 1ZYRCC-00044f-Jg; Sun, 06 Sep 2015 04:04:48 +0000 Received: from mail-pa0-x244.google.com ([2607:f8b0:400e:c03::244]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZYRC9-0003vI-F1 for linux-arm-kernel@lists.infradead.org; Sun, 06 Sep 2015 04:04:46 +0000 Received: by pactg12 with SMTP id tg12so6945084pac.2 for ; Sat, 05 Sep 2015 21:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=SaFHlP+lbNf5v+wYNPCkimFL3qwOO1sV3W3S5XYNqrQ=; b=iKHtfiLKr/B4Qlj7v2efDCCBJ1+poZGEOC/piYrT4LBGWS/8vtMG6tg0D21bnB2mXD 4vPbbaUgBvwB2Wp7ejPyaryAYxvItFOYuTxpfjiZZREwWhkyBCS73mFsOhGRPxpDAlcG zMgmAuSBpNBesFOH/y8YLA9ePtF5Qncf5+O5mbCYcwNWT9QKn8xuWWOtxB9PP8voLftq UBurWa+lkkWpUVvfdUgcAbT6hQaeXlhat4hQRWtD50gXolpoGhcyAHuY51ZLBPJe0FKE NqWSbHbKi8HaHXcXpfMWEvpMBQyJI4z9NW6eTUk1nJV2Jq+RSJVUy5LUSNrQGjmKwue9 nUUw== X-Received: by 10.66.102.71 with SMTP id fm7mr28467697pab.5.1441512263929; Sat, 05 Sep 2015 21:04:23 -0700 (PDT) Received: from ubuntu.localdomain ([17.87.20.100]) by smtp.googlemail.com with ESMTPSA id p3sm7394242pdf.3.2015.09.05.21.04.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 05 Sep 2015 21:04:23 -0700 (PDT) From: yalin wang To: catalin.marinas@arm.com, will.deacon@arm.com, yalin.wang2010@gmail.com, treding@nvidia.com, zhangwm@marvell.com, mark.rutland@arm.com, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, ard.biesheuvel@linaro.org, fkan@apm.com, jungseoklee85@gmail.com, steve.capper@linaro.org, lauraa@codeaurora.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2] arm64: add kc_offset_to_vaddr and kc_vaddr_to_offset macro Date: Sun, 6 Sep 2015 12:04:10 +0800 Message-Id: <1441512250-9667-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-20150905_210445_656730_8DD02C01 X-CRM114-Status: UNSURE ( 9.47 ) 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: , 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, RP_MATCHES_RCVD, T_DKIM_INVALID, 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/memory.h | 1 + arch/arm64/include/asm/pgtable.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index f800d45..2d09fe8 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -55,6 +55,7 @@ #define PCI_IO_START (PCI_IO_END - PCI_IO_SIZE) #define FIXADDR_TOP (PCI_IO_START - SZ_2M) #define TASK_SIZE_64 (UL(1) << VA_BITS) +#define __VIRTUAL_MASK ((1UL << VA_BITS) - 1) #ifdef CONFIG_COMPAT #define TASK_SIZE_32 UL(0x100000000) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index d374191..9da6681 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) & __VIRTUAL_MASK) +#define kc_offset_to_vaddr(o) ((o) | ~__VIRTUAL_MASK) #endif /* !__ASSEMBLY__ */ #endif /* __ASM_PGTABLE_H */