From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 1/2] arm: introduce arch_ioremap and arch_iounmap function pointer
Date: Sun, 22 May 2011 11:03:42 +0100 [thread overview]
Message-ID: <20110522100342.GD17672@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1306055080-30420-1-git-send-email-plagnioj@jcrosoft.com>
On Sun, May 22, 2011 at 11:04:39AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> today we define it at runtime via __arch_ioremap and __arch_iounmap
>
> this PATH will allow to overwrite the default ioremap at runtime
> to be able to compile multiple soc in the same kernel
This is buggy.
> diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
> index ab50627..40ef390 100644
> --- a/arch/arm/mm/ioremap.c
> +++ b/arch/arm/mm/ioremap.c
> @@ -281,9 +281,15 @@ __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
> }
> EXPORT_SYMBOL(__arm_ioremap_pfn);
>
> +void __iomem* (*arch_ioremap)(unsigned long p, size_t size, unsigned int type);
> +void (*arch_iounmap)(volatile void __iomem *addr);
> +
> void __iomem *
> __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
> {
> + if (arch_ioremap)
> + return arch_ioremap(phys_addr, size, mtype);
> +
Some SoCs call __arm_ioremap() from their ioremap() implementation, so
making this hook results in infinite function recursion if you try to
set this to their ioremap() implementation.
> void __iounmap(volatile void __iomem *io_addr)
> {
> - void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
> + void *addr;
> #ifndef CONFIG_SMP
> struct vm_struct **p, *tmp;
> +#endif
>
> + if (arch_iounmap) {
> + arch_iounmap(io_addr);
> + return;
> + }
And on OMAP, for similar reasons, this will also be infinite function
recursion:
void omap_iounmap(volatile void __iomem *addr)
{
unsigned long virt = (unsigned long)addr;
if (virt >= VMALLOC_START && virt < VMALLOC_END)
__iounmap(addr);
}
So you'll end up with a call to iounmap() calling __iounmap() which then
calls omap_iounmap(), which then calls __iounmap()...
next prev parent reply other threads:[~2011-05-22 10:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-22 9:04 [RFC PATCH 1/2] arm: introduce arch_ioremap and arch_iounmap function pointer Jean-Christophe PLAGNIOL-VILLARD
2011-05-22 9:04 ` [RFC PATCH 2/2] omap: switch to ioremap " Jean-Christophe PLAGNIOL-VILLARD
2011-05-22 9:54 ` Arnd Bergmann
2011-05-22 11:13 ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-22 11:20 ` Santosh Shilimkar
2011-05-22 11:17 ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-22 11:35 ` Arnd Bergmann
2011-05-22 11:46 ` Santosh Shilimkar
2011-05-22 12:56 ` Arnd Bergmann
2011-05-22 13:20 ` Santosh Shilimkar
2011-05-22 13:09 ` Russell King - ARM Linux
2011-05-22 13:23 ` Santosh Shilimkar
2011-05-22 16:40 ` Arnd Bergmann
2011-05-22 10:03 ` Russell King - ARM Linux [this message]
2011-05-22 11:05 ` [RFC PATCH 1/2] arm: introduce arch_ioremap and arch_iounmap " Jean-Christophe PLAGNIOL-VILLARD
2011-05-22 13:19 ` Russell King - ARM Linux
2011-05-22 14:58 ` Jean-Christophe PLAGNIOL-VILLARD
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=20110522100342.GD17672@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/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).