* [PATCH] powerpc: Record vma->phys_addr in ioremap()
@ 2010-11-29 4:26 Michael Ellerman
2010-11-29 4:56 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2010-11-29 4:26 UTC (permalink / raw)
To: linuxppc-dev
The vmalloc code can track the physical address of a vma, when the
vma is used for ioremap, if set it is displayed in /proc/vmallocinfo.
Because get_vm_area_caller() doesn't know it's being called for
ioremap() it's up to the arch code to set the phys_addr. A bunch
of other arch's do this, I'm not sure why powerpc doesn't?
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/mm/pgtable_32.c | 1 +
arch/powerpc/mm/pgtable_64.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index a87ead0..71932d0 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -230,6 +230,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
area = get_vm_area_caller(size, VM_IOREMAP, caller);
if (area == 0)
return NULL;
+ area->phys_addr = p;
v = (unsigned long) area->addr;
} else {
v = (ioremap_bot -= size);
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 21d6dfa..88927a0 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -223,6 +223,8 @@ void __iomem * __ioremap_caller(phys_addr_t addr, unsigned long size,
caller);
if (area == NULL)
return NULL;
+
+ area->phys_addr = paligned;
ret = __ioremap_at(paligned, area->addr, size, flags);
if (!ret)
vunmap(area->addr);
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Record vma->phys_addr in ioremap()
2010-11-29 4:26 [PATCH] powerpc: Record vma->phys_addr in ioremap() Michael Ellerman
@ 2010-11-29 4:56 ` Benjamin Herrenschmidt
2010-11-29 5:04 ` Michael Ellerman
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2010-11-29 4:56 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
On Mon, 2010-11-29 at 15:26 +1100, Michael Ellerman wrote:
> The vmalloc code can track the physical address of a vma, when the
> vma is used for ioremap, if set it is displayed in /proc/vmallocinfo.
>
> Because get_vm_area_caller() doesn't know it's being called for
> ioremap() it's up to the arch code to set the phys_addr. A bunch
> of other arch's do this, I'm not sure why powerpc doesn't?
Because I never noticed ? :-)
Cheers,
Ben.
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> ---
> arch/powerpc/mm/pgtable_32.c | 1 +
> arch/powerpc/mm/pgtable_64.c | 2 ++
> 2 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
> index a87ead0..71932d0 100644
> --- a/arch/powerpc/mm/pgtable_32.c
> +++ b/arch/powerpc/mm/pgtable_32.c
> @@ -230,6 +230,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
> area = get_vm_area_caller(size, VM_IOREMAP, caller);
> if (area == 0)
> return NULL;
> + area->phys_addr = p;
> v = (unsigned long) area->addr;
> } else {
> v = (ioremap_bot -= size);
> diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
> index 21d6dfa..88927a0 100644
> --- a/arch/powerpc/mm/pgtable_64.c
> +++ b/arch/powerpc/mm/pgtable_64.c
> @@ -223,6 +223,8 @@ void __iomem * __ioremap_caller(phys_addr_t addr, unsigned long size,
> caller);
> if (area == NULL)
> return NULL;
> +
> + area->phys_addr = paligned;
> ret = __ioremap_at(paligned, area->addr, size, flags);
> if (!ret)
> vunmap(area->addr);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Record vma->phys_addr in ioremap()
2010-11-29 4:56 ` Benjamin Herrenschmidt
@ 2010-11-29 5:04 ` Michael Ellerman
0 siblings, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2010-11-29 5:04 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 635 bytes --]
On Mon, 2010-11-29 at 15:56 +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2010-11-29 at 15:26 +1100, Michael Ellerman wrote:
> > The vmalloc code can track the physical address of a vma, when the
> > vma is used for ioremap, if set it is displayed in /proc/vmallocinfo.
> >
> > Because get_vm_area_caller() doesn't know it's being called for
> > ioremap() it's up to the arch code to set the phys_addr. A bunch
> > of other arch's do this, I'm not sure why powerpc doesn't?
>
> Because I never noticed ? :-)
Yeah I figured. It seems to go back past 2.6.12 so who knows when it
went in, anyway it's useful.
cheers
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-29 5:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-29 4:26 [PATCH] powerpc: Record vma->phys_addr in ioremap() Michael Ellerman
2010-11-29 4:56 ` Benjamin Herrenschmidt
2010-11-29 5:04 ` Michael Ellerman
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).