]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.7.3/arc-mm-fix-build-breakage-with-strict_mm_typechecks.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.7.3 / arc-mm-fix-build-breakage-with-strict_mm_typechecks.patch
CommitLineData
5a5e98ca
GKH
1From 1c3c909303924d30145601f47b6c058fdd2cbc2e Mon Sep 17 00:00:00 2001
2From: Vineet Gupta <vgupta@synopsys.com>
3Date: Tue, 16 Aug 2016 18:27:07 -0700
4Subject: ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9From: Vineet Gupta <vgupta@synopsys.com>
10
11commit 1c3c909303924d30145601f47b6c058fdd2cbc2e upstream.
12
13| CC mm/memory.o
14| In file included from ../mm/memory.c:53:0:
15| ../include/linux/pfn_t.h: In function ‘pfn_t_pte’:
16| ../include/linux/pfn_t.h:78:2: error: conversion to non-scalar type requested
17| return pfn_pte(pfn_t_to_pfn(pfn), pgprot);
18
19With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code
20forces a cast which ends up shifting a struct and hence the gcc warning.
21
22Note that in recent past some of the arches (aarch64, s390) made
23STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly
24worse generated code, given ARC ABI definition of returning structs
25(which pte_t would become)
26
27Quoting from ARC ABI...
28
29 "Results of type struct are returned in a caller-supplied temporary
30 variable whose address is passed in r0.
31 For such functions, the arguments are shifted so that they are
32 passed in r1 and up."
33
34So
35 - struct to be returned would be allocated on stack requiring extra
36 code at call sites
37 - callee updates stack memory to facilitate the return (vs. simple
38 MOV into return reg r0)
39
40Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC
41
42Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
43Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
44
45---
46 arch/arc/include/asm/pgtable.h | 2 +-
47 1 file changed, 1 insertion(+), 1 deletion(-)
48
49--- a/arch/arc/include/asm/pgtable.h
50+++ b/arch/arc/include/asm/pgtable.h
51@@ -280,7 +280,7 @@ static inline void pmd_set(pmd_t *pmdp,
52
53 #define pte_page(pte) pfn_to_page(pte_pfn(pte))
54 #define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
55-#define pfn_pte(pfn, prot) (__pte(((pte_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot)))
56+#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
57
58 /* Don't use virt_to_pfn for macros below: could cause truncations for PAE40*/
59 #define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)