Re: [PATCH v2 3/4] arch: introduce memremap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Saturday 30 May 2015, Dan Williams wrote:
> 
> +/*
> + * memremap() is "ioremap" for cases where it is known that the resource
> + * being mapped does not have i/o side effects and the __iomem
> + * annotation is not applicable.
> + */
> +
> +static inline void *memremap(resource_size_t offset, size_t size)
> +{
> +       return (void __force *) ioremap(offset, size);
> +}
> +
> +static inline void *memremap_nocache(resource_size_t offset, size_t size)
> +{
> +       return (void __force *) ioremap_nocache(offset, size);
> +}
> +
> +static inline void *memremap_cache(resource_size_t offset, size_t size)
> +{
> +       return (void __force *) ioremap_cache(offset, size);
> +}
> +

There are architectures on which the result of ioremap is not necessarily
a pointer, but instead indicates that the access is to be done through
some other indirect access, or require special instructions. I think implementing
the memremap() interfaces is generally helpful, but don't rely on the
ioremap implementation.

Adding both cached an uncached versions is also dangerous, because you
typically get either undefined behavior or a system checkstop when a
single page is mapped both cached and uncached at the same time. This
means that doing memremap() or memremap_nocache() on something that
may be part of the linear kernel mapping is a bug, and we should probably
check for that here.

We can probably avoid having both memremap() and memremap_nocache(),
as all architectures define ioremap() and ioremap_nocache() to be the
same thing.
	
	Arnd

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]