Re: [PATCH v5 01/17] asm-generic/iomap.h: remove ARCH_HAS_IOREMAP_xx macros

From: Edward Cree
Date: Tue Feb 28 2023 - 23:38:34 EST


On 01/03/2023 03:42, Baoquan He wrote:
> diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/io.h
> index 30439cc83a89..07f99ad14bf3 100644
> --- a/drivers/net/ethernet/sfc/io.h
> +++ b/drivers/net/ethernet/sfc/io.h
> @@ -70,7 +70,7 @@
> */
> #ifdef CONFIG_X86_64
> /* PIO is a win only if write-combining is possible */
> -#ifdef ARCH_HAS_IOREMAP_WC
> +#ifdef ioremap_wc
> #define EFX_USE_PIO 1
> #endif
> #endif

So I don't know how valid what we're doing here is...

> diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
> index 08237ae8b840..196087a8126e 100644
> --- a/include/asm-generic/iomap.h
> +++ b/include/asm-generic/iomap.h
> @@ -93,15 +93,15 @@ extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
> extern void ioport_unmap(void __iomem *);
> #endif
>
> -#ifndef ARCH_HAS_IOREMAP_WC
> +#ifndef ioremap_wc
> #define ioremap_wc ioremap
> #endif

... but it looks like this will break it, since in sfc/io.h
`#ifdef ioremap_wc` will always be true (if I'm correctly
understanding what we get via #include <linux/io.h>, which I'm
probably not because asm includes always confuse me).
I.e. we're not just interested in "can code that calls ioremap_wc
compile?", we care about whether we actually get WC, because
we're making an optimisation decision based on it.