From patchwork Thu Mar 16 13:29:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jon Medhurst (Tixy)" X-Patchwork-Id: 9628183 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CB1F76048C for ; Thu, 16 Mar 2017 13:30:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC707285EB for ; Thu, 16 Mar 2017 13:30:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFD8828643; Thu, 16 Mar 2017 13:30:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD8F62864B for ; Thu, 16 Mar 2017 13:30:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=uga+czZpR12ZyHL8pmlVSJxVjx04wOdzgIe72dFAM4w=; b=MBz8EliRTH5I+zYvrWnPLQ5Uh9 XnlxBrVDHdxGEEV2r7ulSwY5Fo2Sa6UjaB/SmyKUI0bDys6cMCxBNPSq3AiULyJrF41D83kimTaDc ykmlLuxc9XnpKcp6Hi7QP9xmr5bEf5ik4YUvtErEuMAsdg/ZCu6wOKMAOACSrqM+GTU0vfZW+7994 eGxQ3j0l3nhi3d5XVWQ83XQ1i/Qas3Er9wlLHfv7WYwRwe5vUjI4/0/fQ2Es3e6CE+5YBui8hqE0u 8gTYyFTzqb/K1tvwrwft4mH5EByvY2dsZVF4XWX6hfkOEaAQVfAfCyKVfSXmNzqlulb3VA5471o2r dra+k55A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1coVU4-0000Ls-Ov; Thu, 16 Mar 2017 13:30:28 +0000 Received: from smarthost03b.mail.zen.net.uk ([212.23.1.21]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1coVU1-0007q8-7I for linux-arm-kernel@lists.infradead.org; Thu, 16 Mar 2017 13:30:27 +0000 Received: from [82.69.122.217] (helo=plug1) by smarthost03b.mail.zen.net.uk with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1coVTc-0002kB-7Q; Thu, 16 Mar 2017 13:30:00 +0000 Received: from linaro1 ([192.168.2.110] helo=linaro2.home) by plug1 with esmtp (Exim 4.80) (envelope-from ) id 1coVTa-0000y9-76; Thu, 16 Mar 2017 13:29:58 +0000 Received: from tixy by linaro2.home with local (Exim 4.88) (envelope-from ) id 1coVTa-0005ov-5N; Thu, 16 Mar 2017 13:29:58 +0000 From: Jon Medhurst To: Russell King Subject: [PATCH 2/2] arm: Make fixmap memory type defines work with STRICT_MM_TYPECHECKS Date: Thu, 16 Mar 2017 13:29:58 +0000 Message-Id: <20170316132958.22227-2-tixy@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170316132958.22227-1-tixy@linaro.org> References: <20170316132958.22227-1-tixy@linaro.org> X-Originating-smarthost03b-IP: [82.69.122.217] Feedback-ID: 82.69.122.217 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170316_063025_413923_AD43C86C X-CRM114-Status: UNSURE ( 9.93 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Agner , linux-arm-kernel@lists.infradead.org, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Change fixmap's defines for memory types to make use of the same constructs as in pgtable.h. This results in the code compiling when STRICT_MM_TYPECHECKS is defined and enables us to directly use the PAGE_KERNEL define rather than open coding a separate equivalent. Whilst changing these defines, also rename FIXMAP_PAGE_COMMON to have a double underscore prefix as this is an internal implementation factor and not a memory type definition to be used with fixmap the APIs. Reviewed-by: Stefan Agner Reviewed-by: Ard Biesheuvel Signed-off-by: Jon Medhurst --- arch/arm/include/asm/fixmap.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/fixmap.h b/arch/arm/include/asm/fixmap.h index 4e6784dc5668..c376dd9ac1ae 100644 --- a/arch/arm/include/asm/fixmap.h +++ b/arch/arm/include/asm/fixmap.h @@ -39,14 +39,15 @@ static const enum fixed_addresses __end_of_fixed_addresses = __end_of_fixmap_region > __end_of_early_ioremap_region ? __end_of_fixmap_region : __end_of_early_ioremap_region; -#define FIXMAP_PAGE_COMMON (L_PTE_YOUNG | L_PTE_PRESENT | L_PTE_XN | L_PTE_DIRTY) +#define __FIXMAP_PAGE_COMMON (L_PTE_YOUNG | L_PTE_PRESENT | L_PTE_XN | L_PTE_DIRTY) -#define FIXMAP_PAGE_NORMAL (pgprot_kernel ? pgprot_kernel | L_PTE_XN : \ - FIXMAP_PAGE_COMMON | L_PTE_MT_WRITEBACK) -#define FIXMAP_PAGE_RO (FIXMAP_PAGE_NORMAL | L_PTE_RDONLY) +#define FIXMAP_PAGE_NORMAL (pgprot_val(pgprot_kernel) ? PAGE_KERNEL : \ + __pgprot(__FIXMAP_PAGE_COMMON | L_PTE_MT_WRITEBACK)) +#define FIXMAP_PAGE_RO _MOD_PROT(FIXMAP_PAGE_NORMAL, L_PTE_RDONLY) /* Used by set_fixmap_(io|nocache), both meant for mapping a device */ -#define FIXMAP_PAGE_IO (FIXMAP_PAGE_COMMON | L_PTE_MT_DEV_SHARED | L_PTE_SHARED) +#define FIXMAP_PAGE_IO __pgprot(__FIXMAP_PAGE_COMMON | L_PTE_MT_DEV_SHARED | \ + L_PTE_SHARED) #define FIXMAP_PAGE_NOCACHE FIXMAP_PAGE_IO #define __early_set_fixmap __set_fixmap