diff mbox

[2/3] ARM: Exynos4: Add ioremap interceptor for statically remapped regions

Message ID 1318234289-22041-3-git-send-email-thomas.abraham@linaro.org
State New
Headers show

Commit Message

thomas.abraham@linaro.org Oct. 10, 2011, 8:11 a.m. UTC
ioremap() request for statically remapped regions are intercepted and the
statically assigned virtual address is returned. For requests for which
there are no statically remapped regions, the requests are let through.

Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
---
 arch/arm/mach-exynos4/cpu.c             |   16 ++++++++++++++++
 arch/arm/mach-exynos4/include/mach/io.h |    4 ++++
 2 files changed, 20 insertions(+), 0 deletions(-)

Comments

Rob Herring Oct. 12, 2011, 4:13 p.m. UTC | #1
On 10/10/2011 03:11 AM, Thomas Abraham wrote:
> ioremap() request for statically remapped regions are intercepted and the
> statically assigned virtual address is returned. For requests for which
> there are no statically remapped regions, the requests are let through.
> 
> Cc: Kukjin Kim <kgene.kim@samsung.com>
> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
> ---
>  arch/arm/mach-exynos4/cpu.c             |   16 ++++++++++++++++
>  arch/arm/mach-exynos4/include/mach/io.h |    4 ++++
>  2 files changed, 20 insertions(+), 0 deletions(-)
> 

You won't need this with Nico's vmalloc.h clean-up series. It does
exactly this but generically for all platforms.

Rob
thomas.abraham@linaro.org Oct. 12, 2011, 4:30 p.m. UTC | #2
On 12 October 2011 21:43, Rob Herring <robherring2@gmail.com> wrote:
> On 10/10/2011 03:11 AM, Thomas Abraham wrote:
>> ioremap() request for statically remapped regions are intercepted and the
>> statically assigned virtual address is returned. For requests for which
>> there are no statically remapped regions, the requests are let through.
>>
>> Cc: Kukjin Kim <kgene.kim@samsung.com>
>> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
>> ---
>>  arch/arm/mach-exynos4/cpu.c             |   16 ++++++++++++++++
>>  arch/arm/mach-exynos4/include/mach/io.h |    4 ++++
>>  2 files changed, 20 insertions(+), 0 deletions(-)
>>
>
> You won't need this with Nico's vmalloc.h clean-up series. It does
> exactly this but generically for all platforms.

Ok. Thanks for your suggestion. I will move to using Nico's patches.

Regards,
Thomas.

>
> Rob
>
thomas.abraham@linaro.org Oct. 13, 2011, 3:28 a.m. UTC | #3
On 12 October 2011 22:00, Thomas Abraham <thomas.abraham@linaro.org> wrote:
> On 12 October 2011 21:43, Rob Herring <robherring2@gmail.com> wrote:
>> On 10/10/2011 03:11 AM, Thomas Abraham wrote:
>>> ioremap() request for statically remapped regions are intercepted and the
>>> statically assigned virtual address is returned. For requests for which
>>> there are no statically remapped regions, the requests are let through.
>>>
>>> Cc: Kukjin Kim <kgene.kim@samsung.com>
>>> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
>>> ---
>>>  arch/arm/mach-exynos4/cpu.c             |   16 ++++++++++++++++
>>>  arch/arm/mach-exynos4/include/mach/io.h |    4 ++++
>>>  2 files changed, 20 insertions(+), 0 deletions(-)
>>>
>>
>> You won't need this with Nico's vmalloc.h clean-up series. It does
>> exactly this but generically for all platforms.
>
> Ok. Thanks for your suggestion. I will move to using Nico's patches.

From Nico's reply to his pull request of vmalloc cleanup series, it
looks like that pull request has been withdrawn (hope I am not missing
anything here). Without Nico's series, and gic dt support for exynos4
support requiring this patch, all other workarounds to replace this
patch does not seem be correct.

So is it acceptable to retain this patch and later rework/drop the
exynos4 specific ioremap along with Nico's vmalloc patch series when
it is merged.

Thanks,
Thomas.

>
> Regards,
> Thomas.
>
>>
>> Rob
>>
>
Grant Likely Oct. 13, 2011, 3:29 a.m. UTC | #4
On Wed, Oct 12, 2011 at 9:28 PM, Thomas Abraham
<thomas.abraham@linaro.org> wrote:
> On 12 October 2011 22:00, Thomas Abraham <thomas.abraham@linaro.org> wrote:
>> On 12 October 2011 21:43, Rob Herring <robherring2@gmail.com> wrote:
>>> On 10/10/2011 03:11 AM, Thomas Abraham wrote:
>>>> ioremap() request for statically remapped regions are intercepted and the
>>>> statically assigned virtual address is returned. For requests for which
>>>> there are no statically remapped regions, the requests are let through.
>>>>
>>>> Cc: Kukjin Kim <kgene.kim@samsung.com>
>>>> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
>>>> ---
>>>>  arch/arm/mach-exynos4/cpu.c             |   16 ++++++++++++++++
>>>>  arch/arm/mach-exynos4/include/mach/io.h |    4 ++++
>>>>  2 files changed, 20 insertions(+), 0 deletions(-)
>>>>
>>>
>>> You won't need this with Nico's vmalloc.h clean-up series. It does
>>> exactly this but generically for all platforms.
>>
>> Ok. Thanks for your suggestion. I will move to using Nico's patches.
>
> From Nico's reply to his pull request of vmalloc cleanup series, it
> looks like that pull request has been withdrawn (hope I am not missing
> anything here). Without Nico's series, and gic dt support for exynos4
> support requiring this patch, all other workarounds to replace this
> patch does not seem be correct.
>
> So is it acceptable to retain this patch and later rework/drop the
> exynos4 specific ioremap along with Nico's vmalloc patch series when
> it is merged.

I would say yes, but I don't get to make the decision here.

g.
Nicolas Pitre Oct. 13, 2011, 6:52 p.m. UTC | #5
On Thu, 13 Oct 2011, Thomas Abraham wrote:

> On 12 October 2011 22:00, Thomas Abraham <thomas.abraham@linaro.org> wrote:
> > On 12 October 2011 21:43, Rob Herring <robherring2@gmail.com> wrote:
> >> On 10/10/2011 03:11 AM, Thomas Abraham wrote:
> >>> ioremap() request for statically remapped regions are intercepted and the
> >>> statically assigned virtual address is returned. For requests for which
> >>> there are no statically remapped regions, the requests are let through.
> >>>
> >>> Cc: Kukjin Kim <kgene.kim@samsung.com>
> >>> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
> >>> ---
> >>>  arch/arm/mach-exynos4/cpu.c             |   16 ++++++++++++++++
> >>>  arch/arm/mach-exynos4/include/mach/io.h |    4 ++++
> >>>  2 files changed, 20 insertions(+), 0 deletions(-)
> >>>
> >>
> >> You won't need this with Nico's vmalloc.h clean-up series. It does
> >> exactly this but generically for all platforms.
> >
> > Ok. Thanks for your suggestion. I will move to using Nico's patches.
> 
> From Nico's reply to his pull request of vmalloc cleanup series, it
> looks like that pull request has been withdrawn (hope I am not missing
> anything here).

I'm just postponing it because this depends on a large cleanup in the 
OMAP code which is being pushed to mainline for the next merge window.

> Without Nico's series, and gic dt support for exynos4 support 
> requiring this patch, all other workarounds to replace this patch does 
> not seem be correct.
> 
> So is it acceptable to retain this patch and later rework/drop the
> exynos4 specific ioremap along with Nico's vmalloc patch series when
> it is merged.

I would guess so.  But please CC me on those patches so I know what to 
look for when rebasing my series.


Nicolas
diff mbox

Patch

diff --git a/arch/arm/mach-exynos4/cpu.c b/arch/arm/mach-exynos4/cpu.c
index 5b1765b..358624d 100644
--- a/arch/arm/mach-exynos4/cpu.c
+++ b/arch/arm/mach-exynos4/cpu.c
@@ -137,6 +137,22 @@  static struct map_desc exynos4_iodesc1[] __initdata = {
 	},
 };
 
+/*
+ * For all ioremap requests of statically mapped regions, intercept ioremap and
+ * return virtual address from the iodesc table.
+ */
+void __iomem *exynos4_ioremap(unsigned long phy, size_t size, unsigned int type)
+{
+	struct map_desc *desc = exynos4_iodesc;
+	unsigned int idx;
+
+	for (idx = 0; idx < ARRAY_SIZE(exynos4_iodesc); idx++, desc++)
+		if (desc->pfn == __phys_to_pfn(phy) && desc->type == type)
+			return (void __iomem *)desc->virtual;
+
+	return __arm_ioremap(phy, size, type);
+}
+
 static void exynos4_idle(void)
 {
 	if (!need_resched())
diff --git a/arch/arm/mach-exynos4/include/mach/io.h b/arch/arm/mach-exynos4/include/mach/io.h
index d5478d2..33c2890 100644
--- a/arch/arm/mach-exynos4/include/mach/io.h
+++ b/arch/arm/mach-exynos4/include/mach/io.h
@@ -22,5 +22,10 @@ 
 #define __mem_pci(a)	(a)
 
 #define IO_SPACE_LIMIT (0xFFFFFFFF)
+#define __arch_ioremap	exynos4_ioremap
+#define __arch_iounmap	__iounmap
+
+void __iomem *exynos4_ioremap(unsigned long phy, size_t size,
+					unsigned int type);
 
 #endif /* __ASM_ARM_ARCH_IO_H */