Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Enable IOREMAP_PROT config option for MIPS cpus

Allows the users of ptrace to access memory mapped by the ptraced process
using the same cache coherency attributes as the original process.
For example while using gdb with ioremap_prot() incorporated, both gdb and
the process being traced will have same cache coherency attributes.

Signed-off-by: Hassan Naveed <hnaveed@wavecomp.com>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/20955/
Cc: <linux-mips@linux-mips.org>

authored by

Hassan Naveed and committed by
Paul Burton
b3a428b4 67769857

+15 -1
+1 -1
Documentation/features/vm/ioremap_prot/arch-support.txt
··· 16 16 | ia64: | TODO | 17 17 | m68k: | TODO | 18 18 | microblaze: | TODO | 19 - | mips: | TODO | 19 + | mips: | ok | 20 20 | nds32: | TODO | 21 21 | nios2: | TODO | 22 22 | openrisc: | TODO |
+1
arch/mips/Kconfig
··· 56 56 select HAVE_FUNCTION_TRACER 57 57 select HAVE_GENERIC_DMA_COHERENT 58 58 select HAVE_IDE 59 + select HAVE_IOREMAP_PROT 59 60 select HAVE_IRQ_EXIT_ON_IRQ_STACK 60 61 select HAVE_IRQ_TIME_ACCOUNTING 61 62 select HAVE_KPROBES
+12
arch/mips/include/asm/io.h
··· 218 218 } 219 219 220 220 /* 221 + * ioremap_prot - map bus memory into CPU space 222 + * @offset: bus address of the memory 223 + * @size: size of the resource to map 224 + 225 + * ioremap_prot gives the caller control over cache coherency attributes (CCA) 226 + */ 227 + static inline void __iomem *ioremap_prot(phys_addr_t offset, 228 + unsigned long size, unsigned long prot_val) { 229 + return __ioremap_mode(offset, size, prot_val & _CACHE_MASK); 230 + } 231 + 232 + /* 221 233 * ioremap - map bus memory into CPU space 222 234 * @offset: bus address of the memory 223 235 * @size: size of the resource to map
+1
arch/mips/include/asm/page.h
··· 154 154 typedef struct { unsigned long pgprot; } pgprot_t; 155 155 #define pgprot_val(x) ((x).pgprot) 156 156 #define __pgprot(x) ((pgprot_t) { (x) } ) 157 + #define pte_pgprot(x) __pgprot(pte_val(x) & ~_PFN_MASK) 157 158 158 159 /* 159 160 * On R4000-style MMUs where a TLB entry is mapping a adjacent even / odd