From: Richard Lee <superlibj8301@gmail.com>
To: linux-mm@kvack.org, linux@arm.linux.org.uk,
linux-arm-kernel@lists.infradead.org, arnd@arndb.de,
robherring2@gmail.com
Cc: lauraa@codeaurora.org, akpm@linux-foundation.org,
d.hatayama@jp.fujitsu.com, zhangyanfei@cn.fujitsu.com,
liwanp@linux.vnet.ibm.com, iamjoonsoo.kim@lge.com,
hannes@cmpxchg.org, linux-kernel@vger.kernel.org,
Richard Lee <superlibj8301@gmail.com>
Subject: [PATCHv2 2/2] ARM: ioremap: Add IO mapping space reused support.
Date: Wed, 14 May 2014 16:18:52 +0800 [thread overview]
Message-ID: <1400055532-13134-3-git-send-email-superlibj8301@gmail.com> (raw)
In-Reply-To: <1400055532-13134-1-git-send-email-superlibj8301@gmail.com>
For the IO mapping, the same physical address space maybe
mapped more than one time, for example, in some SoCs:
- 0x20001000 ~ 0x20001400 --> 1KB for Dev1
- 0x20001400 ~ 0x20001800 --> 1KB for Dev2
and the page size is 4KB.
Then both Dev1 and Dev2 will do ioremap operations, and the IO
vmalloc area's virtual address will be aligned down to 4KB, and
the size will be aligned up to 4KB. That's to say, only one
4KB size's vmalloc area could contain Dev1 and Dev2 IO mapping area
at the same time.
For this case, we can ioremap only one time, and the later ioremap
operation will just return the exist vmalloc area.
This patch add IO mapping space reused support.
Signed-off-by: Richard Lee <superlibj8301@gmail.com>
---
arch/arm/mm/ioremap.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index f9c32ba..be69333 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -301,6 +301,12 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
if (WARN_ON(pfn_valid(pfn)))
return NULL;
+ area = find_vm_area_paddr(paddr, size, &offset, VM_IOREMAP);
+ if (area) {
+ addr = (unsigned long)area->addr;
+ return (void __iomem *)(offset + addr);
+ }
+
area = get_vm_area_caller(size, VM_IOREMAP, caller);
if (!area)
return NULL;
--
1.8.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2014-05-14 9:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 8:18 [PATCHv2 0/2] Add IO mapping space reused support Richard Lee
2014-05-14 8:18 ` [PATCHv2 1/2] mm/vmalloc: Add IO mapping space reused interface support Richard Lee
2014-05-14 16:06 ` Rob Herring
2014-05-15 3:46 ` Richard Lee
2014-05-14 22:56 ` Andrew Morton
2014-05-15 7:55 ` Richard Lee
2014-05-14 8:18 ` Richard Lee [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400055532-13134-3-git-send-email-superlibj8301@gmail.com \
--to=superlibj8301@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=d.hatayama@jp.fujitsu.com \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=lauraa@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@arm.linux.org.uk \
--cc=liwanp@linux.vnet.ibm.com \
--cc=robherring2@gmail.com \
--cc=zhangyanfei@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).