Re: [PATCH] sparc64: Fix the generic IO helpers

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

 



Hi--

On 8/23/22 01:50, Linus Walleij wrote:
> This enables the Sparc to use <asm-generic/io.h> to fill in the
> missing (undefined) [read|write]sq I/O accessor functions.
> 
> This is needed if Sparc[64] ever wants to uses CONFIG_REGMAP_MMIO
> which has been patches to use accelerated _noinc accessors
> such as readsq/writesq that Sparc64, while being a 64bit platform,
> as of now not yet provide.
> 
> This comes with the requirement that everything the architecture
> already provides needs to be defined, rather than just being,
> say, static inline functions.
> 
> Bite the bullet and just provide the definitions and make it work.
> Compile-tested on sparc64.
> 
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Link: https://lore.kernel.org/linux-arm-kernel/202208201639.HXye3ke4-lkp@xxxxxxxxx/
> Cc: David S. Miller <davem@xxxxxxxxxxxxx>
> Cc: sparclinux@xxxxxxxxxxxxxxx
> Cc: linux-arch@xxxxxxxxxxxxxxx
> Cc: Mark Brown <broonie@xxxxxxxxxx>
> Cc: Arnd Bergmann <arnd@xxxxxxxx>
> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Both alpha & parisc (32 and 64 bits) need this fix also.

Is it always safe to do this?

> ---
>  arch/sparc/include/asm/io.h | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/arch/sparc/include/asm/io.h b/arch/sparc/include/asm/io.h
> index 2eefa526b38f..88da27165c01 100644
> --- a/arch/sparc/include/asm/io.h
> +++ b/arch/sparc/include/asm/io.h
> @@ -19,4 +19,35 @@
>  #define writel_be(__w, __addr)	__raw_writel(__w, __addr)
>  #define writew_be(__l, __addr)	__raw_writew(__l, __addr)
>  
> +/*
> + * These defines are necessary to use the generic io.h for filling in
> + * the missing parts of the API contract. This is because the platform
> + * uses (inline) functions rather than defines and the generic helper
> + * fills in the undefined.
> + */
> +/* These are static inlines on 64BIT only */
> +#if defined(__sparc__) && defined(__arch64__)
> +#define memset_io memset_io
> +#define memcpy_fromio memcpy_fromio
> +#define memcpy_toio memcpy_toio
> +#endif
> +#define pci_iomap pci_iomap
> +#define pci_iounmap pci_iounmap
> +#define ioremap_np ioremap_np
> +#define ioport_map ioport_map
> +#define ioport_unmap ioport_unmap
> +#define readsb readsb
> +#define readsw readsw
> +#define readsl readsl
> +#define writesb writesb
> +#define writesw writesw
> +#define writesl writesl
> +#define insb insb
> +#define insw insw
> +#define insl insl
> +#define outsb outsb
> +#define outsw outsw
> +#define outsl outsl
> +#include <asm-generic/io.h>
> +
>  #endif

-- 
~Randy



[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux