diff mbox

[v2,18/25] libnvdimm, pmem: switch from ioremap_cache to memremap

Message ID 20150725023940.8664.2784.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Williams July 25, 2015, 2:39 a.m. UTC
In preparation for deprecating ioremap_cache() convert its usage in
libnvdimm and the PMEM API to memremap.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 arch/x86/include/asm/io.h         |    7 +------
 arch/x86/mm/ioremap.c             |    6 ++++++
 tools/testing/nvdimm/Kbuild       |    2 +-
 tools/testing/nvdimm/test/iomap.c |    6 +++---
 4 files changed, 11 insertions(+), 10 deletions(-)

Comments

Ross Zwisler July 28, 2015, 10:51 p.m. UTC | #1
On Fri, 2015-07-24 at 22:39 -0400, Dan Williams wrote:
> In preparation for deprecating ioremap_cache() convert its usage in
> libnvdimm and the PMEM API to memremap.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  arch/x86/include/asm/io.h         |    7 +------
>  arch/x86/mm/ioremap.c             |    6 ++++++
>  tools/testing/nvdimm/Kbuild       |    2 +-
>  tools/testing/nvdimm/test/iomap.c |    6 +++---
>  4 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
> index cc9c61bc1abe..8aeb6456188a 100644
> --- a/arch/x86/include/asm/io.h
> +++ b/arch/x86/include/asm/io.h
> @@ -248,12 +248,7 @@ static inline void flush_write_buffers(void)
>  #endif
>  }
>  
> -static inline void __pmem *arch_memremap_pmem(resource_size_t offset,
> -	unsigned long size)
> -{
> -	return (void __force __pmem *) ioremap_cache(offset, size);
> -}
> -
> +void __pmem *arch_memremap_pmem(resource_size_t offset, size_t size);
>  #endif /* __KERNEL__ */
>  
>  extern void native_io_delay(void);
> diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> index 6f759c7c2ab7..7b422e7574b1 100644
> --- a/arch/x86/mm/ioremap.c
> +++ b/arch/x86/mm/ioremap.c
> @@ -317,6 +317,12 @@ void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
>  }
>  EXPORT_SYMBOL(ioremap_cache);
>  
> +void __pmem *arch_memremap_pmem(resource_size_t offset, size_t size)
> +{
> +	return (void __force __pmem *) ioremap_cache(offset, size);

Did you mean for this to be a call to memremap() instead of ioremap_cache()?
Dan Williams July 28, 2015, 11:06 p.m. UTC | #2
On Tue, Jul 28, 2015 at 3:51 PM, Ross Zwisler
<ross.zwisler@linux.intel.com> wrote:
> On Fri, 2015-07-24 at 22:39 -0400, Dan Williams wrote:
>> In preparation for deprecating ioremap_cache() convert its usage in
>> libnvdimm and the PMEM API to memremap.
>>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> ---
>>  arch/x86/include/asm/io.h         |    7 +------
>>  arch/x86/mm/ioremap.c             |    6 ++++++
>>  tools/testing/nvdimm/Kbuild       |    2 +-
>>  tools/testing/nvdimm/test/iomap.c |    6 +++---
>>  4 files changed, 11 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
>> index cc9c61bc1abe..8aeb6456188a 100644
>> --- a/arch/x86/include/asm/io.h
>> +++ b/arch/x86/include/asm/io.h
>> @@ -248,12 +248,7 @@ static inline void flush_write_buffers(void)
>>  #endif
>>  }
>>
>> -static inline void __pmem *arch_memremap_pmem(resource_size_t offset,
>> -     unsigned long size)
>> -{
>> -     return (void __force __pmem *) ioremap_cache(offset, size);
>> -}
>> -
>> +void __pmem *arch_memremap_pmem(resource_size_t offset, size_t size);
>>  #endif /* __KERNEL__ */
>>
>>  extern void native_io_delay(void);
>> diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
>> index 6f759c7c2ab7..7b422e7574b1 100644
>> --- a/arch/x86/mm/ioremap.c
>> +++ b/arch/x86/mm/ioremap.c
>> @@ -317,6 +317,12 @@ void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
>>  }
>>  EXPORT_SYMBOL(ioremap_cache);
>>
>> +void __pmem *arch_memremap_pmem(resource_size_t offset, size_t size)
>> +{
>> +     return (void __force __pmem *) ioremap_cache(offset, size);
>
> Did you mean for this to be a call to memremap() instead of ioremap_cache()?

The ioremap_cache elimination comes in "[PATCH v2 25/25] pmem: convert
to generic memremap", but yeah I should update the changelog to
reflect this is more about pushing the calls to ioremap_cache() out of
line.  It would be circular at this point in the series to call back
out to memremap to have it turn around and call ioremap_cache again.
diff mbox

Patch

diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index cc9c61bc1abe..8aeb6456188a 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -248,12 +248,7 @@  static inline void flush_write_buffers(void)
 #endif
 }
 
-static inline void __pmem *arch_memremap_pmem(resource_size_t offset,
-	unsigned long size)
-{
-	return (void __force __pmem *) ioremap_cache(offset, size);
-}
-
+void __pmem *arch_memremap_pmem(resource_size_t offset, size_t size);
 #endif /* __KERNEL__ */
 
 extern void native_io_delay(void);
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 6f759c7c2ab7..7b422e7574b1 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -317,6 +317,12 @@  void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
 }
 EXPORT_SYMBOL(ioremap_cache);
 
+void __pmem *arch_memremap_pmem(resource_size_t offset, size_t size)
+{
+	return (void __force __pmem *) ioremap_cache(offset, size);
+}
+EXPORT_SYMBOL(arch_memremap_pmem);
+
 void __iomem *ioremap_prot(resource_size_t phys_addr, unsigned long size,
 				unsigned long prot_val)
 {
diff --git a/tools/testing/nvdimm/Kbuild b/tools/testing/nvdimm/Kbuild
index f56914c7929b..de2912ea78e8 100644
--- a/tools/testing/nvdimm/Kbuild
+++ b/tools/testing/nvdimm/Kbuild
@@ -1,7 +1,7 @@ 
 ldflags-y += --wrap=ioremap_wt
 ldflags-y += --wrap=ioremap_wc
 ldflags-y += --wrap=devm_ioremap_nocache
-ldflags-y += --wrap=ioremap_cache
+ldflags-y += --wrap=arch_memremap_pmem
 ldflags-y += --wrap=ioremap_nocache
 ldflags-y += --wrap=iounmap
 ldflags-y += --wrap=__request_region
diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/iomap.c
index 64bfaa50831c..f8486f98f860 100644
--- a/tools/testing/nvdimm/test/iomap.c
+++ b/tools/testing/nvdimm/test/iomap.c
@@ -80,11 +80,11 @@  void __iomem *__wrap_devm_ioremap_nocache(struct device *dev,
 }
 EXPORT_SYMBOL(__wrap_devm_ioremap_nocache);
 
-void __iomem *__wrap_ioremap_cache(resource_size_t offset, unsigned long size)
+void *__wrap_arch_memremap_pmem(resource_size_t offset, size_t size)
 {
-	return __nfit_test_ioremap(offset, size, ioremap_cache);
+	return __nfit_test_ioremap(offset, size, arch_memremap_pmem);
 }
-EXPORT_SYMBOL(__wrap_ioremap_cache);
+EXPORT_SYMBOL(__wrap_arch_memremap_pmem);
 
 void __iomem *__wrap_ioremap_nocache(resource_size_t offset, unsigned long size)
 {