Message ID | 1436488096-3165-1-git-send-email-mcgrof@do-not-panic.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Jul 9, 2015 at 7:28 PM, Luis R. Rodriguez <mcgrof@do-not-panic.com> wrote: > +/** > + * DOC: ioremap() and ioremap_*() variants > + * > + * If you have an IOMMU your architecture is expected to have both ioremap() > + * and iounmap() implemented otherwise the asm-generic helpers will provide a > + * direct mapping. > + * > + * There are ioremap_*() call variants, if you have no IOMMU we naturally will > + * default to direct mapping for all of them, you can override these defaults. > + * If you have an IOMMU you are highly encouraged to provide your own > + * ioremap variant implementation as there currently is no safe architecture > + * agnostic default. To avoid possible improper behaviour default asm-generic > + * ioremap_*() variants all return NULL when an IOMMU is available. If you've > + * defined your own ioremap_*() variant you must then declare your own > + * ioremap_*() variant as defined to itself to avoid the default NULL return. Are the references above to "IOMMU" typos? Should they say "MMU" instead, so they match the #ifdef below? > + */ > + > +#ifdef CONFIG_MMU > + > +#ifndef ioremap_uc > +#define ioremap_uc ioremap_uc > +static inline void __iomem *ioremap_uc(phys_addr_t offset, size_t size) > +{ > + return NULL; > +} > +#endif > + > +#else /* !CONFIG_MMU */ > + > /* > * Change "struct page" to physical address. > * > @@ -743,7 +772,6 @@ static inline void *phys_to_virt(unsigned long address) > * you'll need to provide your own definitions. > */ > > -#ifndef CONFIG_MMU > #ifndef ioremap > #define ioremap ioremap > static inline void __iomem *ioremap(phys_addr_t offset, size_t size) > -- > 2.3.2.209.gd67f9d5.dirty > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Mar 16, 2017 at 03:46:51PM -0500, Bjorn Helgaas wrote: > On Thu, Jul 9, 2015 at 7:28 PM, Luis R. Rodriguez > <mcgrof@do-not-panic.com> wrote: > > > +/** > > + * DOC: ioremap() and ioremap_*() variants > > + * > > + * If you have an IOMMU your architecture is expected to have both ioremap() > > + * and iounmap() implemented otherwise the asm-generic helpers will provide a > > + * direct mapping. > > + * > > + * There are ioremap_*() call variants, if you have no IOMMU we naturally will > > + * default to direct mapping for all of them, you can override these defaults. > > + * If you have an IOMMU you are highly encouraged to provide your own > > + * ioremap variant implementation as there currently is no safe architecture > > + * agnostic default. To avoid possible improper behaviour default asm-generic > > + * ioremap_*() variants all return NULL when an IOMMU is available. If you've > > + * defined your own ioremap_*() variant you must then declare your own > > + * ioremap_*() variant as defined to itself to avoid the default NULL return. > > Are the references above to "IOMMU" typos? Should they say "MMU" > instead, so they match the #ifdef below? Yes. Patch welcomed. Luis -- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index cc9c61bc1abe..7cfc085b6879 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -180,6 +180,8 @@ static inline unsigned int isa_virt_to_bus(volatile void *address) */ extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size); extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size); +#define ioremap_uc ioremap_uc + extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size); extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size, unsigned long prot_val); diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index f56094cfdeff..eed3bbe88c8a 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -736,6 +736,35 @@ static inline void *phys_to_virt(unsigned long address) } #endif +/** + * DOC: ioremap() and ioremap_*() variants + * + * If you have an IOMMU your architecture is expected to have both ioremap() + * and iounmap() implemented otherwise the asm-generic helpers will provide a + * direct mapping. + * + * There are ioremap_*() call variants, if you have no IOMMU we naturally will + * default to direct mapping for all of them, you can override these defaults. + * If you have an IOMMU you are highly encouraged to provide your own + * ioremap variant implementation as there currently is no safe architecture + * agnostic default. To avoid possible improper behaviour default asm-generic + * ioremap_*() variants all return NULL when an IOMMU is available. If you've + * defined your own ioremap_*() variant you must then declare your own + * ioremap_*() variant as defined to itself to avoid the default NULL return. + */ + +#ifdef CONFIG_MMU + +#ifndef ioremap_uc +#define ioremap_uc ioremap_uc +static inline void __iomem *ioremap_uc(phys_addr_t offset, size_t size) +{ + return NULL; +} +#endif + +#else /* !CONFIG_MMU */ + /* * Change "struct page" to physical address. * @@ -743,7 +772,6 @@ static inline void *phys_to_virt(unsigned long address) * you'll need to provide your own definitions. */ -#ifndef CONFIG_MMU #ifndef ioremap #define ioremap ioremap static inline void __iomem *ioremap(phys_addr_t offset, size_t size)