Re: [RFC PATCH v3 28/37] kvx: Add misc common routines

Arnd Bergmann
2024-07-23T09:58:29Z

On Mon, Jul 22, 2024, at 09:41, ysionneau@kalrayinc.com wrote:

> +#define memset_io(c, v, l) __memset_io((c), (v), (l))
> +#define memcpy_fromio(a, c, l) __memcpy_fromio((a), (c), (l))
> +#define memcpy_toio(c, a, l) __memcpy_toio((c), (a), (l))
> +
> +#include <asm-generic/io.h>

You generally want to define __raw_{read,write}{b,w,l,q}
functions using inline asm here in order to guarantee
that they are done with atomic load/store instructions of
the correct size.

Does the PCI controller support IORESOURCE_IO accesses?
It looks like you get the default PCI_IOBASE, which turns
into a NULL pointer and is not a good idea for accessing
fixed port numbers. This should hopefully get resolved
soon once turning off CONFIG_HAS_IOPORT means you don't
need to define inb()/outb() or special ioread()/iowrite()
functions at all.

Arnd