* [PATCH] MIPS: Enable IOREMAP_PROT config option for MIPS cpus
@ 2018-10-30 1:27 ` Hassan Naveed
0 siblings, 0 replies; 4+ messages in thread
From: Hassan Naveed @ 2018-10-30 1:27 UTC (permalink / raw)
To: linux-mips; +Cc: Hassan Naveed
From: Hassan Naveed <hnaveed@wavecomp.com>
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>
---
.../features/vm/ioremap_prot/arch-support.txt | 2 +-
arch/mips/Kconfig | 1 +
arch/mips/include/asm/io.h | 12 ++++++++++++
arch/mips/include/asm/page.h | 1 +
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/Documentation/features/vm/ioremap_prot/arch-support.txt b/Documentation/features/vm/ioremap_prot/arch-support.txt
index 8527601a3739..326e4797bc65 100644
--- a/Documentation/features/vm/ioremap_prot/arch-support.txt
+++ b/Documentation/features/vm/ioremap_prot/arch-support.txt
@@ -16,7 +16,7 @@
| ia64: | TODO |
| m68k: | TODO |
| microblaze: | TODO |
- | mips: | TODO |
+ | mips: | ok |
| nds32: | TODO |
| nios2: | TODO |
| openrisc: | TODO |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 35511999156a..630a4d694b02 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -56,6 +56,7 @@ config MIPS
select HAVE_FUNCTION_TRACER
select HAVE_GENERIC_DMA_COHERENT
select HAVE_IDE
+ select HAVE_IOREMAP_PROT
select HAVE_IRQ_EXIT_ON_IRQ_STACK
select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_KPROBES
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 54c730aed327..61eca84d8b82 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -223,6 +223,18 @@ static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long si
#undef __IS_LOW512
}
+/*
+ * ioremap_prot - map bus memory into CPU space
+ * @offset: bus address of the memory
+ * @size: size of the resource to map
+
+ * ioremap_prot gives the caller control over cache coherency attributes (CCA)
+ */
+static inline void __iomem *ioremap_prot(phys_addr_t offset,
+ unsigned long size, unsigned long prot_val) {
+ return __ioremap_mode(offset, size, prot_val & _CACHE_MASK);
+}
+
/*
* ioremap - map bus memory into CPU space
* @offset: bus address of the memory
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index e8cc328fce2d..6b31c93b5eaa 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -154,6 +154,7 @@ typedef struct { unsigned long pgd; } pgd_t;
typedef struct { unsigned long pgprot; } pgprot_t;
#define pgprot_val(x) ((x).pgprot)
#define __pgprot(x) ((pgprot_t) { (x) } )
+#define pte_pgprot(x) __pgprot(pte_val(x) & ~_PFN_MASK)
/*
* On R4000-style MMUs where a TLB entry is mapping a adjacent even / odd
--
2.19.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] MIPS: Enable IOREMAP_PROT config option for MIPS cpus
@ 2018-10-30 1:27 ` Hassan Naveed
0 siblings, 0 replies; 4+ messages in thread
From: Hassan Naveed @ 2018-10-30 1:27 UTC (permalink / raw)
To: linux-mips; +Cc: Hassan Naveed
From: Hassan Naveed <hnaveed@wavecomp.com>
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>
---
.../features/vm/ioremap_prot/arch-support.txt | 2 +-
arch/mips/Kconfig | 1 +
arch/mips/include/asm/io.h | 12 ++++++++++++
arch/mips/include/asm/page.h | 1 +
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/Documentation/features/vm/ioremap_prot/arch-support.txt b/Documentation/features/vm/ioremap_prot/arch-support.txt
index 8527601a3739..326e4797bc65 100644
--- a/Documentation/features/vm/ioremap_prot/arch-support.txt
+++ b/Documentation/features/vm/ioremap_prot/arch-support.txt
@@ -16,7 +16,7 @@
| ia64: | TODO |
| m68k: | TODO |
| microblaze: | TODO |
- | mips: | TODO |
+ | mips: | ok |
| nds32: | TODO |
| nios2: | TODO |
| openrisc: | TODO |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 35511999156a..630a4d694b02 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -56,6 +56,7 @@ config MIPS
select HAVE_FUNCTION_TRACER
select HAVE_GENERIC_DMA_COHERENT
select HAVE_IDE
+ select HAVE_IOREMAP_PROT
select HAVE_IRQ_EXIT_ON_IRQ_STACK
select HAVE_IRQ_TIME_ACCOUNTING
select HAVE_KPROBES
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 54c730aed327..61eca84d8b82 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -223,6 +223,18 @@ static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long si
#undef __IS_LOW512
}
+/*
+ * ioremap_prot - map bus memory into CPU space
+ * @offset: bus address of the memory
+ * @size: size of the resource to map
+
+ * ioremap_prot gives the caller control over cache coherency attributes (CCA)
+ */
+static inline void __iomem *ioremap_prot(phys_addr_t offset,
+ unsigned long size, unsigned long prot_val) {
+ return __ioremap_mode(offset, size, prot_val & _CACHE_MASK);
+}
+
/*
* ioremap - map bus memory into CPU space
* @offset: bus address of the memory
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
index e8cc328fce2d..6b31c93b5eaa 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -154,6 +154,7 @@ typedef struct { unsigned long pgd; } pgd_t;
typedef struct { unsigned long pgprot; } pgprot_t;
#define pgprot_val(x) ((x).pgprot)
#define __pgprot(x) ((pgprot_t) { (x) } )
+#define pte_pgprot(x) __pgprot(pte_val(x) & ~_PFN_MASK)
/*
* On R4000-style MMUs where a TLB entry is mapping a adjacent even / odd
--
2.19.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Enable IOREMAP_PROT config option for MIPS cpus
@ 2018-11-05 18:31 ` Paul Burton
0 siblings, 0 replies; 4+ messages in thread
From: Paul Burton @ 2018-11-05 18:31 UTC (permalink / raw)
To: Hassan Naveed; +Cc: linux-mips, Hassan Naveed
Hi Hassan,
On Mon, Oct 29, 2018 at 06:27:41PM -0700, Hassan Naveed wrote:
> From: Hassan Naveed <hnaveed@wavecomp.com>
>
> 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>
> ---
> .../features/vm/ioremap_prot/arch-support.txt | 2 +-
> arch/mips/Kconfig | 1 +
> arch/mips/include/asm/io.h | 12 ++++++++++++
> arch/mips/include/asm/page.h | 1 +
> 4 files changed, 15 insertions(+), 1 deletion(-)
Thanks - applied to mips-next for v4.21.
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] MIPS: Enable IOREMAP_PROT config option for MIPS cpus
@ 2018-11-05 18:31 ` Paul Burton
0 siblings, 0 replies; 4+ messages in thread
From: Paul Burton @ 2018-11-05 18:31 UTC (permalink / raw)
To: Hassan Naveed; +Cc: linux-mips
Hi Hassan,
On Mon, Oct 29, 2018 at 06:27:41PM -0700, Hassan Naveed wrote:
> From: Hassan Naveed <hnaveed@wavecomp.com>
>
> 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>
> ---
> .../features/vm/ioremap_prot/arch-support.txt | 2 +-
> arch/mips/Kconfig | 1 +
> arch/mips/include/asm/io.h | 12 ++++++++++++
> arch/mips/include/asm/page.h | 1 +
> 4 files changed, 15 insertions(+), 1 deletion(-)
Thanks - applied to mips-next for v4.21.
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-05 18:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30 1:27 [PATCH] MIPS: Enable IOREMAP_PROT config option for MIPS cpus Hassan Naveed
2018-10-30 1:27 ` Hassan Naveed
2018-11-05 18:31 ` Paul Burton
2018-11-05 18:31 ` Paul Burton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.