mips: mm: Create UCA-based ioremap_wc() method
Subsystems (2)
PATCH 1/2 mips: mm: Create UCA-based ioremap_wc() method
Modern MIPS cores (like P5600/6600, M5150/6520, end so on) which got L2-cache on chip also can enable a special type Cache-Coherency attribute (CCA) named UnCached Accelerated attribute (UCA). In this way uncached accelerated accesses are treated the same way as non-accelerated uncached accesses, but uncached stores are gathered together for more efficient bus utilization. So to speak this CCA enables uncached transactions to better utilize bus bandwidth via burst transactions.
This is exactly why ioremap_wc() method has been introduced in linux. Alas MIPS-platform code hasn't implemented it so far, instead default one has been used which was an alias to ioremap_nocache. In order to fix this we added MIPS-specific ioremap_wc() macro substituted by generic __ioremap_mode() method call with writecombine CPU-info field passed. It shall create real ioremap_wc() method if CPU-cache supports UCA feature and fall-back to _CACHE_UNCACHED attribute if one doesn't. Additionally platform-specific io.h shall declare ARCH_HAS_IOREMAP_WC macro as indication of architectural definition of ioremap_wc() (similar to x86/powerpc).
--- arch/mips/include/asm/io.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
arch/mips/include/asm/io.h +23 -0
@@ -12,6 +12,8 @@#ifndef _ASM_IO_H#define _ASM_IO_H +#define ARCH_HAS_IOREMAP_WC +#include <linux/compiler.h> #include <linux/kernel.h> #include <linux/types.h>
@@ -278,6 +280,27 @@ static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long si#define ioremap_cache ioremap_cachable/* +* ioremap_wc - map bus memory into CPU space +* @offset: bus address of the memory +* @size: size of the resource to map +* +* ioremap_wc performs a platform specific sequence of operations to +* make bus memory CPU accessible via the readb/readw/readl/writeb/ +* writew/writel functions and the other mmio helpers. The returned +* address is not guaranteed to be usable directly as a virtual +* address. +* +* This version of ioremap ensures that the memory is marked uncachable +* but accelerated by means of write-combining feature. It is specifically +* useful for PCIe prefetchable windows, which may vastly improve a +* communications performance. If it was determined on boot stage, what +* CPU CCA doesn't support UCA, the method shall fall-back to the +* _CACHE_UNCACHED option (see cpu_probe() method). +*/ +#define ioremap_wc (offset, size) \ + __ioremap_mode((offset), (size), boot_cpu_data.writecombine) + +/* * These two are MIPS specific ioremap variant. ioremap_cacheable_cow * requests a cachable mapping, ioremap_uncached_accelerated requests a * mapping using the uncached accelerated mode which isn't supported on
Signature · 1 line
2.12.0
PATCH 2/2 mips: mm: Discard ioremap_uncached_accelerated() method
Adaptive ioremap_wc() method is now available (see "mips: mm:
Create UCA-based ioremap_wc() method" commit). We can use it for UCA-featured MMIO transactions in the kernel, so we don't need it platform clone ioremap_uncached_accelerated() being declard. Seeing it is also unused anywhere in the kernel code, lets remove it from io.h arch-specific header then.
--- arch/mips/include/asm/io.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
arch/mips/include/asm/io.h +2 -6
@@ -301,15 +301,11 @@ static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long si__ioremap_mode ((offset), (size), boot_cpu_data.writecombine)/* -* These two are MIPS specific ioremap variant. ioremap_cacheable_cow -* requests a cachable mapping, ioremap_uncached_accelerated requests a -* mapping using the uncached accelerated mode which isn't supported on -* all processors. +* This is a MIPS specific ioremap variant. ioremap_cacheable_cow +* requests a cachable mapping with CWB attribute enabled. */#define ioremap_cacheable_cow (offset, size) \ __ioremap_mode((offset), (size), _CACHE_CACHABLE_COW) -#define ioremap_uncached_accelerated (offset, size) \ - __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED)static inline void iounmap (const volatile void __iomem *addr) {
Signature · 1 line
2.12.0
Re: [PATCH 2/2] mips: mm: Discard ioremap_uncached_accelerated() method
'
Quoted 10 lines · Serge Semin
Adaptive
ioremap_wc()method is now available (see "mips: mm:
Create UCA-basedioremap_wc()method" commit). We can use it for UCA-featured MMIO transactions in the kernel, so we don't need it platform cloneioremap_uncached_accelerated()being declard. Seeing it is also unused anywhere in the kernel code, lets remove it fromio.harch-specific header then.Signed-off-by Serge Semin <[email protected]>Singed-off-by Paul Burton <[email protected]>
nit: 'Signed' (on both patches)
Quoted 34 lines
Cc James Hogan <[email protected]>Cc Ralf Baechle <[email protected]>--- arch/mips/include/asm/io.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)arch/mips/include/asm/io.h +2
-7@@ -301,15 +301,11 @@ static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long si__ioremap_mode ((offset), (size), boot_cpu_data.writecombine)/* -* These two are MIPS specific ioremap variant. ioremap_cacheable_cow -* requests a cachable mapping, ioremap_uncached_accelerated requests a -* mapping using the uncached accelerated mode which isn't supported on -* all processors. +* This is a MIPS specific ioremap variant. ioremap_cacheable_cow +* requests a cachable mapping with CWB attribute enabled. */#define ioremap_cacheable_cow (offset, size) \ __ioremap_mode((offset), (size), _CACHE_CACHABLE_COW) -#define ioremap_uncached_accelerated (offset, size) \ - __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED)static inline void iounmap (const volatile void __iomem *addr) { --2.12.0
Re: [PATCH 2/2] mips: mm: Discard ioremap_uncached_accelerated() method
Quoted 10 lines · Mathieu Malaterre
'
Quoted 8 lines · Serge Semin
Adaptive
ioremap_wc()method is now available (see "mips: mm:
Create UCA-basedioremap_wc()method" commit). We can use it for UCA-featured MMIO transactions in the kernel, so we don't need it platform cloneioremap_uncached_accelerated()being declard. Seeing it is also unused anywhere in the kernel code, lets remove it fromio.harch-specific header then.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Serge Semin <[email protected]>Singed-off-by Paul Burton <[email protected]>nit: 'Signed' (on both patches)
Good catch! Thanks. Didn't notice the typo. Should have copy-pasted both the signature and the e-mail from another letter.
I'll fix it if there will be a second version of the patchset. Otherwise I suppose it would be easier for the integrator to do this.
Regards,
-Sergey
Quoted 34 lines
Quoted 34 lines
Cc James Hogan <[email protected]>Cc Ralf Baechle <[email protected]>--- arch/mips/include/asm/io.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)arch/mips/include/asm/io.h +2
-7@@ -301,15 +301,11 @@ static inline void __iomem * __ioremap_mode(phys_addr_t offset, unsigned long si__ioremap_mode ((offset), (size), boot_cpu_data.writecombine)/* -* These two are MIPS specific ioremap variant. ioremap_cacheable_cow -* requests a cachable mapping, ioremap_uncached_accelerated requests a -* mapping using the uncached accelerated mode which isn't supported on -* all processors. +* This is a MIPS specific ioremap variant. ioremap_cacheable_cow +* requests a cachable mapping with CWB attribute enabled. */#define ioremap_cacheable_cow (offset, size) \ __ioremap_mode((offset), (size), _CACHE_CACHABLE_COW) -#define ioremap_uncached_accelerated (offset, size) \ - __ioremap_mode((offset), (size), _CACHE_UNCACHED_ACCELERATED)static inline void iounmap (const volatile void __iomem *addr) { --2.12.0
Re: [PATCH 2/2] mips: mm: Discard ioremap_uncached_accelerated() method
Hi Sergey,
Quoted 12 lines · Serge Semin
Quoted 11 lines · Mathieu Malaterre
Quoted 9 lines · Serge Semin
Adaptive
ioremap_wc()method is now available (see "mips: mm:
Create UCA-basedioremap_wc()method" commit). We can use it for UCA-featured MMIO transactions in the kernel, so we don't need it platform cloneioremap_uncached_accelerated()being declard. Seeing it is also unused anywhere in the kernel code, lets remove it fromio.harch-specific header then.Signed-off-by Serge Semin <[email protected]>Singed-off-by Paul Burton <[email protected]>
Quoted 7 lines
Quoted 1 line
nit: 'Signed' (on both patches)
Good catch! Thanks. Didn't notice the typo. Should have copy-pasted both the signature and the e-mail from another letter.
I'll fix it if there will be a second version of the patchset. Otherwise I suppose it would be easier for the integrator to do this.
I've fixed this up & applied these 2 patches with minor tweaks to mips-next for 4.19.
However FYI for next time - you shouldn't really add someone else's Signed-off-by tag anyway. The tag effectively states that a person can agree to the Developer's Certificate of Origin for this patch (see Documentation/process/submitting-patches.rst), and you can't agree that on behalf of someone else. Generally a maintainer should add this tag for themselves when they apply a patch.
Anyway, I think we should reserve the Singed-off-by tag for patches that quell fires. ;)
Thanks,
Paul
Re: [PATCH 2/2] mips: mm: Discard ioremap_uncached_accelerated() method
On Tue, Jul 10, 2018 at 10:59:40AM -0700, Paul Burton <[email protected]> wrote:
Hello Paul,
Quoted 17 lines
Hi Sergey,
Quoted 14 lines · Serge Semin
Quoted 12 lines · Mathieu Malaterre
Quoted 9 lines · Serge Semin
Adaptive
ioremap_wc()method is now available (see "mips: mm:
Create UCA-basedioremap_wc()method" commit). We can use it for UCA-featured MMIO transactions in the kernel, so we don't need it platform cloneioremap_uncached_accelerated()being declard. Seeing it is also unused anywhere in the kernel code, lets remove it fromio.harch-specific header then.Signed-off-by Serge Semin <[email protected]>Singed-off-by Paul Burton <[email protected]>nit: 'Signed' (on both patches)
Quoted 9 lines
Quoted 5 lines
Good catch! Thanks. Didn't notice the typo. Should have copy-pasted both the signature and the e-mail from another letter.
I'll fix it if there will be a second version of the patchset. Otherwise I suppose it would be easier for the integrator to do this.
I've fixed this up & applied these 2 patches with minor tweaks to mips-next for 4.19.
Great! Thanks.
Quoted 7 lines
However FYI for next time - you shouldn't really add someone else's Signed-off-by tag anyway. The tag effectively states that a person can agree to the Developer's Certificate of Origin for this patch (see
Documentation/process/submitting-patches.rst), and you can't agree that on behalf of someone else. Generally a maintainer should add this tag for themselves when they apply a patch.
I'm sorry if it seemed like I added Signed-off on your behalf. I thought the Signed-off also concerns the ones, who participated in the patch preparation. Since you suggested the design of the change, I've decided to put your name in the Signed-off tag. What shall I use in this way then?
Quoted 5 lines
Anyway, I think we should reserve the Singed-off-by tag for patches that quell fires. ;)
Thanks,
Paul
Regards,
-Sergey
Re: [PATCH 2/2] mips: mm: Discard ioremap_uncached_accelerated() method
Hi Serge,
Quoted 9 lines · Serge Semin
Quoted 6 lines · Paul Burton
However FYI for next time - you shouldn't really add someone else's Signed-off-by tag anyway. The tag effectively states that a person can agree to the Developer's Certificate of Origin for this patch (see
Documentation/process/submitting-patches.rst), and you can't agree that on behalf of someone else. Generally a maintainer should add this tag for themselves when they apply a patch.I'm sorry if it seemed like I added Signed-off on your behalf.
That's OK, I didn't think you did it maliciously :)
Quoted 4 lines
I thought the Signed-off also concerns the ones, who participated in the patch preparation. Since you suggested the design of the change, I've decided to put your name in the Signed-off tag. What shall I use in this way then?
In this case Suggested-by might have been a good choice. Reported-by is also commonly used if someone reported a problem which you created a fix for.
Section 13 of Documentation/process/submitting-patches.rst describes these tags along with a couple others.
Thanks,
Paul
Re: [PATCH 2/2] mips: mm: Discard ioremap_uncached_accelerated() method
Paul,
Quoted 20 lines · Paul Burton
Hi Serge,
Quoted 9 lines · Serge Semin
Quoted 6 lines · Paul Burton
However FYI for next time - you shouldn't really add someone else's Signed-off-by tag anyway. The tag effectively states that a person can agree to the Developer's Certificate of Origin for this patch (see
Documentation/process/submitting-patches.rst), and you can't agree that on behalf of someone else. Generally a maintainer should add this tag for themselves when they apply a patch.I'm sorry if it seemed like I added Signed-off on your behalf.
That's OK, I didn't think you did it maliciously :)
Quoted 4 lines
I thought the Signed-off also concerns the ones, who participated in the patch preparation. Since you suggested the design of the change, I've decided to put your name in the Signed-off tag. What shall I use in this way then?
Quoted 6 lines
In this case Suggested-by might have been a good choice. Reported-by is also commonly used if someone reported a problem which you created a fix for.
Section 13 of
Documentation/process/submitting-patches.rstdescribes these tags along with a couple others.
I always thought of these tags as something more like a formality. In fact this hasn't been my first patchset sent to the kernel e-mailing list. Although all of the previous ones didn't involve someone else participating in the changes development, except the reviewers of course. So I do aware of all the tags mentioned in the doc. But as it turns out I didn't fully understand their meaning. Main rule: most of the tags should not be added without the permission, except more or less formal CC and Fixes ones. Anyway thanks for the advice. Next time I'll be more careful with it.
Regards,
-Sergey
Quoted 3 lines
Thanks,
Paul
Re: [PATCH 2/2] mips: mm: Discard ioremap_uncached_accelerated() method
In reply to Serge SeminQuoted 5 lines
+ * This is a MIPS specific ioremap variant.
ioremap_cacheable_cow
+ * requests a cachable mapping with CWB attribute enabled. */
#defineioremap_cacheable_cow(offset, size)\
__ioremap_mode((offset), (size), _CACHE_CACHABLE_COW)
This isn't actually used anywhere in the kernel tree. Please remove it as well.
Re: [PATCH 2/2] mips: mm: Discard ioremap_uncached_accelerated() method
Hello Christoph,
Quoted 8 lines · Christoph Hellwig
Quoted 5 lines
+ * This is a MIPS specific ioremap variant.
ioremap_cacheable_cow
+ * requests a cachable mapping with CWB attribute enabled. */
#defineioremap_cacheable_cow(offset, size)\
__ioremap_mode((offset), (size), _CACHE_CACHABLE_COW)This isn't actually used anywhere in the kernel tree. Please remove it as well.
I don't really know whether it is necessary at this point. We discarded the ioremap_uncached_accelerated() method, since the obvious alternative is now
available: ioremap_wc(). While ioremap_cacheable_cow() hasn't got one. So if it was up to me, I'd leave it here. Anyway if the subsystem maintainers think otherwise, I won't refuse to submit a patch with this method removal.
Regards,
-Sergey
Re: [PATCH 2/2] mips: mm: Discard ioremap_uncached_accelerated() method
Quoted 9 lines · Serge Semin
Hello Christoph,
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines
+ * This is a MIPS specific ioremap variant.
ioremap_cacheable_cow
+ * requests a cachable mapping with CWB attribute enabled. */
#defineioremap_cacheable_cow(offset, size)\
__ioremap_mode((offset), (size), _CACHE_CACHABLE_COW)
Quoted 8 lines
Quoted 2 lines
This isn't actually used anywhere in the kernel tree. Please remove it as well.
I don't really know whether it is necessary at this point. We discarded the
ioremap_uncached_accelerated()method, since the obvious alternative is now
available:ioremap_wc(). Whileioremap_cacheable_cow()hasn't got one. So if it was up to me, I'd leave it here. Anyway if the subsystem maintainers think otherwise, I won't refuse to submit a patch with this method removal.
The function is entirely unused in the kernel tree, please remove it.