]>
Commit | Line | Data |
---|---|---|
5a5e98ca GKH |
1 | From 1c3c909303924d30145601f47b6c058fdd2cbc2e Mon Sep 17 00:00:00 2001 |
2 | From: Vineet Gupta <vgupta@synopsys.com> | |
3 | Date: Tue, 16 Aug 2016 18:27:07 -0700 | |
4 | Subject: ARC: mm: fix build breakage with STRICT_MM_TYPECHECKS | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | From: Vineet Gupta <vgupta@synopsys.com> | |
10 | ||
11 | commit 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 | ||
19 | With STRICT_MM_TYPECHECKS pte_t is a struct and the offending code | |
20 | forces a cast which ends up shifting a struct and hence the gcc warning. | |
21 | ||
22 | Note that in recent past some of the arches (aarch64, s390) made | |
23 | STRICT_MM_TYPECHECKS default, but we don't for ARC as this leads to slightly | |
24 | worse generated code, given ARC ABI definition of returning structs | |
25 | (which pte_t would become) | |
26 | ||
27 | Quoting 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 | ||
34 | So | |
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 | ||
40 | Hence STRICT_MM_TYPECHECKS is not enabled by default for ARC | |
41 | ||
42 | Signed-off-by: Vineet Gupta <vgupta@synopsys.com> | |
43 | Signed-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) |