Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753137AbcLFUmg (ORCPT ); Tue, 6 Dec 2016 15:42:36 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36252 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751726AbcLFUmd (ORCPT ); Tue, 6 Dec 2016 15:42:33 -0500 Subject: Re: [PATCH 3/3] ARM: Add support for CONFIG_DEBUG_VIRTUAL To: linux-arm-kernel@lists.infradead.org References: <1480445729-27130-1-git-send-email-labbott@redhat.com> <20161206195312.22354-1-f.fainelli@gmail.com> <20161206195312.22354-4-f.fainelli@gmail.com> Cc: linux@armlinux.org.uk, nicolas.pitre@linaro.org, panand@redhat.com, chris.brandt@renesas.com, arnd@arndb.de, jonathan.austin@arm.com, pawel.moll@arm.com, vladimir.murzin@arm.com, mark.rutland@arm.com, ard.biesheuvel@linaro.org, keescook@chromium.org, matt@codeblueprint.co.uk, labbott@fedoraproject.org, kirill.shutemov@linux.intel.com, ben@decadent.org.uk, js07.lee@samsung.com, stefan@agner.ch, linux-kernel@vger.kernel.org From: Florian Fainelli Message-ID: <2c5c5fe5-ad79-35f8-95b4-32c5653ddd5c@gmail.com> Date: Tue, 6 Dec 2016 12:42:10 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161206195312.22354-4-f.fainelli@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 849 Lines: 21 On 12/06/2016 11:53 AM, Florian Fainelli wrote: > x86 has an option: CONFIG_DEBUG_VIRTUAL to do additional checks on > virt_to_phys calls. The goal is to catch users who are calling > virt_to_phys on non-linear addresses immediately. This includes caller > using __virt_to_phys() on image addresses instead of __pa_symbol(). This > is a generally useful debug feature to spot bad code (particulary in > drivers). > > Signed-off-by: Florian Fainelli > --- > @@ -261,6 +261,16 @@ static inline unsigned long __phys_to_virt(phys_addr_t x) > ((((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT) + \ > PHYS_PFN_OFFSET) > > +#define __pa_symbol_nodebug(x) ((x) - (unsigned long)KERNEL_START) I don't think I got this one quite right, but I also assume that won't be the only problem with this patch series. -- Florian