From patchwork Mon Feb 22 20:54:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 62628 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1471128lbl; Mon, 22 Feb 2016 12:57:22 -0800 (PST) X-Received: by 10.98.33.199 with SMTP id o68mr40375625pfj.125.1456174642093; Mon, 22 Feb 2016 12:57:22 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id lp4si41901210pab.205.2016.02.22.12.57.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Feb 2016 12:57:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@linaro.org 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 1aXxW9-0004kT-9K; Mon, 22 Feb 2016 20:55:41 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aXxVi-0003FE-B1 for linux-arm-kernel@lists.infradead.org; Mon, 22 Feb 2016 20:55:15 +0000 Received: by mail-wm0-x230.google.com with SMTP id g62so182007354wme.0 for ; Mon, 22 Feb 2016 12:54:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X/dZLu7A5Cg+1eeiff5f3auk0DxGcy5biUUNEHmJ6Y8=; b=NNNdieoY3TE3qD5K1A4c1fUb7Kd6sFf6eKq4RtOap0PPoL0Prt37GXZx0yqJxfb7rt BF7cFRTkuVqY7BDm/6KzQ3RU7RBk8ftLP2EFOD2Hq5ucTE+kghw1yfChOplSBH2Df7Cq OOakz8tl4RKk5WJ6eYWZV/B4rdYnqadXjtQxM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X/dZLu7A5Cg+1eeiff5f3auk0DxGcy5biUUNEHmJ6Y8=; b=GmTsJPO+atgDa7Am3h/9Co3dGP0mCsUNg89oDnYbbHG4d93vG8Td8AMYfAaWcuuxIc pPAKeY+rPbzbkhTL462cxPd6UxwSnqX35zDfsSViU0FPjomqvth3/Y+WnFNx2cDgnAT4 TQ9dQp1fTZpyu1Vp8Na9q3TDv+wxuJykKXjvcEVbo5QlB2PtL8GAqARHqHihkmYeS4AS 90S4T9suPMgqQ7NYRV16stwn6o1uRSvQWrPVecUNzQpKjLyO6H9VU7HcqJgjmDUmli8W pOQMcP+iwjgP4z0sUQbZHwfsFBJlo/XSp7YG3B8pk3MWKD4SN68l33P/QjxJhwqEEqtS nUeA== X-Gm-Message-State: AG10YOQTaKLWnt4qZqQ/fVZgHC+tmXcAeabB5tEnFPelImrVRT0zqT51Jzn3KRUmd62prSpu X-Received: by 10.28.184.78 with SMTP id i75mr15063844wmf.22.1456174492707; Mon, 22 Feb 2016 12:54:52 -0800 (PST) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id k8sm15012530wjr.38.2016.02.22.12.54.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Feb 2016 12:54:52 -0800 (PST) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, catalin.marinas@arm.com, mark.rutland@arm.com Subject: [RFC PATCH 02/10] arm64: introduce __kimg_to_phys() and __pa_symbol() Date: Mon, 22 Feb 2016 21:54:24 +0100 Message-Id: <1456174472-30028-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456174472-30028-1-git-send-email-ard.biesheuvel@linaro.org> References: <1456174472-30028-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160222_125514_705433_5AF640DE X-CRM114-Status: GOOD ( 10.46 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:230 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Before restricting the domain of __pa()'s argument to the linear mapping, introduce alternatives __kimg_to_phys() and its alias __pa_symbol() [of which the latter exists on x86 as well] that can be used to obtain the physical address of a static object or function in the kernel text. Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/memory.h | 3 +++ 1 file changed, 3 insertions(+) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 2296b32130a1..56d6739430f3 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -92,7 +92,10 @@ (__x - kimage_voffset); }) #define __phys_to_virt(x) ((unsigned long)((x) - PHYS_OFFSET) | PAGE_OFFSET) + +#define __kimg_to_phys(x) ((phys_addr_t)(x) - kimage_voffset) #define __phys_to_kimg(x) ((unsigned long)((x) + kimage_voffset)) +#define __pa_symbol(x) __kimg_to_phys(x) /* * Convert a page to/from a physical address