From patchwork Mon Oct 12 06:52: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: 7372511 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 A5BF9BEEA4 for ; Mon, 12 Oct 2015 06:55:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF3B0206D8 for ; Mon, 12 Oct 2015 06:55:36 +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 D9ED1206D2 for ; Mon, 12 Oct 2015 06:55:35 +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 1ZlWzJ-0004Nf-GW; Mon, 12 Oct 2015 06:53:37 +0000 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZlWzH-0004M6-Dt for linux-arm-kernel@lists.infradead.org; Mon, 12 Oct 2015 06:53:35 +0000 Received: by pabve7 with SMTP id ve7so88036964pab.2 for ; Sun, 11 Oct 2015 23:53: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=A79FhLAmomcs6jAdIcAd9PYLJPrKsDXujuJEmzIWCtM=; b=lx7T6gUwp29HOOsXcDd5qKgwXoCHz8+Zjvv/ZNWcGspUmW7r5WBN/j1zY3fker3GXC 8E+xt1dbwFH9bVeOW2n1bv90ynQIzmQtR9dXsp1iX0wcsRg2Nphh3W2nmFUPYCmIN9cG Oiyhncqnvm/V97Gn6ZMohdtmA0QyVix3mF8I2BK1rshOAHLuxtAXcpSlWAObibaljZlR DbQkFZf1Y1GYELKsY9H+38EFXT6+2k7uFKj5weASFF4I2TtytsMkNq7mpZywR7Gu1Zcu 9mr4ER+b0kNXqQQGWbdxiqs2TSPwGnLbRDp9SIY6G+p0KijSnS99Un46Ypk0Mt8bNMtU P/xw== X-Received: by 10.66.216.1 with SMTP id om1mr32804848pac.51.1444632793427; Sun, 11 Oct 2015 23:53:13 -0700 (PDT) Received: from ubuntu.localdomain ([17.87.20.100]) by smtp.googlemail.com with ESMTPSA id iy1sm16153072pbb.85.2015.10.11.23.53.09 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 11 Oct 2015 23:53:12 -0700 (PDT) From: yalin wang To: catalin.marinas@arm.com, will.deacon@arm.com, akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RFC] arm64: add kc_offset_to_vaddr and kc_vaddr_to_offset macro Date: Mon, 12 Oct 2015 14:52:59 +0800 Message-Id: <1444632779-23369-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-20151011_235335_507428_DEA722E3 X-CRM114-Status: UNSURE ( 9.94 ) 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 4331d84..23070a8 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -658,6 +658,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) & ~VA_START) +#define kc_offset_to_vaddr(o) ((o) | VA_START) #endif /* !__ASSEMBLY__ */ #endif /* __ASM_PGTABLE_H */