Commit 1b4013b9 authored by Vineet Gupta's avatar Vineet Gupta

ARC: mm: Enable STRICT_MM_TYPECHECKS

In the past I've refrained from doing this (at least 2 times) due to the
slight code bloat due to ABI implications of pte_t etc becoming struct

Per ARC ABI, functions return struct via memory and not through register
r0, even if the struct would fit in register(s)

 - caller allocates space on stack and passes the address as first arg
   (r0), shifting rest of args by one

 - callee creates return struct in memory (referenced via r0)

This time around the code actually shrunk slightly (due to subtle
inlining heuristic effects), but still slightly inefficient due to
return values passed through memory. That however seems like a small
cost compared to maintenance burden given the impending new mmu support
for page walk etc
Signed-off-by: default avatarVineet Gupta <vgupta@kernel.org>
parent 366440ee
...@@ -34,12 +34,6 @@ void copy_user_highpage(struct page *to, struct page *from, ...@@ -34,12 +34,6 @@ void copy_user_highpage(struct page *to, struct page *from,
unsigned long u_vaddr, struct vm_area_struct *vma); unsigned long u_vaddr, struct vm_area_struct *vma);
void clear_user_page(void *to, unsigned long u_vaddr, struct page *page); void clear_user_page(void *to, unsigned long u_vaddr, struct page *page);
#undef STRICT_MM_TYPECHECKS
#ifdef STRICT_MM_TYPECHECKS
/*
* These are used to make use of C type-checking..
*/
typedef struct { typedef struct {
#ifdef CONFIG_ARC_HAS_PAE40 #ifdef CONFIG_ARC_HAS_PAE40
unsigned long long pte; unsigned long long pte;
...@@ -64,26 +58,6 @@ typedef struct { ...@@ -64,26 +58,6 @@ typedef struct {
#define pte_pgprot(x) __pgprot(pte_val(x)) #define pte_pgprot(x) __pgprot(pte_val(x))
#else /* !STRICT_MM_TYPECHECKS */
#ifdef CONFIG_ARC_HAS_PAE40
typedef unsigned long long pte_t;
#else
typedef unsigned long pte_t;
#endif
typedef unsigned long pgd_t;
typedef unsigned long pgprot_t;
#define pte_val(x) (x)
#define pgd_val(x) (x)
#define pgprot_val(x) (x)
#define __pte(x) (x)
#define __pgd(x) (x)
#define __pgprot(x) (x)
#define pte_pgprot(x) (x)
#endif
typedef pte_t * pgtable_t; typedef pte_t * pgtable_t;
/* /*
......
...@@ -39,7 +39,7 @@ void __iomem *ioremap(phys_addr_t paddr, unsigned long size) ...@@ -39,7 +39,7 @@ void __iomem *ioremap(phys_addr_t paddr, unsigned long size)
if (arc_uncached_addr_space(paddr)) if (arc_uncached_addr_space(paddr))
return (void __iomem *)(u32)paddr; return (void __iomem *)(u32)paddr;
return ioremap_prot(paddr, size, PAGE_KERNEL_NO_CACHE); return ioremap_prot(paddr, size, pgprot_val(PAGE_KERNEL_NO_CACHE));
} }
EXPORT_SYMBOL(ioremap); EXPORT_SYMBOL(ioremap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment