All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] alpha: Use generic <asm-generic/io.h>
@ 2022-08-18  9:20 Linus Walleij
  2022-08-18 10:28 ` Arnd Bergmann
  2022-10-02 22:45 ` Guenter Roeck
  0 siblings, 2 replies; 14+ messages in thread
From: Linus Walleij @ 2022-08-18  9:20 UTC (permalink / raw)
  To: Richard Henderson, Ivan Kokshaysky, Matt Turner, Arnd Bergmann
  Cc: linux-alpha, Linus Walleij, kernel test robot, Mark Brown, linux-arch

This enables the alpha to use <asm-generic/io.h> to fill in the
missing (undefined) I/O accessor functions.

This is needed if Alpha ever wants to uses CONFIG_REGMAP_MMIO
which has been patches to use accelerated _noinc accessors
such as readsq/writesq that Alpha, while being a 64bit platform,
as of now not yet provide. readq/writeq is however provided
so the machine can do 64bit I/O.

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.

Alternative approaches:

- Implement proper readsq/writesq inline accessors for alpha
- Rewrite the whole world of io.h to use something like __weak
  instead of relying on defines
- Leave regmap MMIO broken on Alpha because none of its drivers
  use it
- Make regmap MMIO depend of !ARCH_ALPHA

The latter seems a bit over the top. First option to implement
readsq/writesq seems possible but I cannot test it (no hardware)
so using the generic fallbacks seems like a better idea, also in
general that will provide future defaults for accelerated defines.

Leaving regmap MMIO broken or disabling it for Alpha feels bad
because it breaks compiler coverage.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/linux-mm/202208181447.G9FLcMkI-lkp@intel.com/
Cc: Mark Brown <broonie@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Richard Henderson <richard.henderson@linaro.org>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: linux-arch@vger.kernel.org
Cc: linux-alpha@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
I'd like this applied to the alpha tree if there is such a
thing otherwise maybe Arnd can apply it to the arch generic
tree?
---
 arch/alpha/include/asm/io.h | 76 ++++++++++++++++++++++++++++++++-----
 1 file changed, 66 insertions(+), 10 deletions(-)

diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index d277189b2677..53f1312d394e 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -586,22 +586,78 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
 #endif
 #define RTC_ALWAYS_BCD	0
 
-/*
- * Some mucking forons use if[n]def writeq to check if platform has it.
- * It's a bloody bad idea and we probably want ARCH_HAS_WRITEQ for them
- * to play with; for now just use cpp anti-recursion logics and make sure
- * that damn thing is defined and expands to itself.
- */
-
-#define writeq writeq
-#define readq readq
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
  */
 #define xlate_dev_mem_ptr(p)	__va(p)
 
+/*
+ * 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.
+ */
+#define virt_to_phys virt_to_phys
+#define phys_to_virt phys_to_virt
+#define memset_io memset_io
+#define memcpy_fromio memcpy_fromio
+#define memcpy_toio memcpy_toio
+#define __raw_readb __raw_readb
+#define __raw_readw __raw_readw
+#define __raw_readl __raw_readl
+#define __raw_readq __raw_readq
+#define __raw_writeb __raw_writeb
+#define __raw_writew __raw_writew
+#define __raw_writel __raw_writel
+#define __raw_writeq __raw_writeq
+#define readb readb
+#define readw readw
+#define readl readl
+#define readq readq
+#define writeb writeb
+#define writew writew
+#define writel writel
+#define writeq writeq
+#define readb_relaxed readb_relaxed
+#define readw_relaxed readw_relaxed
+#define readl_relaxed readl_relaxed
+#define readq_relaxed readq_relaxed
+/* Relaxed writes are already defines */
+#define ioport_map ioport_map
+#define ioport_unmap ioport_unmap
+#define inb inb
+#define inw inw
+#define inl inl
+#define outb outb
+#define outw outw
+#define outl outl
+#define insb insb
+#define insw insw
+#define insl insl
+#define outsb outsb
+#define outsw outsw
+#define outsl outsl
+#define ioread8 ioread8
+#define ioread16 ioread16
+#define ioread32 ioread32
+#define ioread64 ioread64
+#define iowrite8 iowrite8
+#define iowrite16 iowrite16
+#define iowrite32 iowrite32
+#define iowrite64 iowrite64
+#define ioread64be ioread64be
+#define iowrite64be iowrite64be
+#define ioread8_rep ioread8_rep
+#define ioread16_rep ioread16_rep
+#define ioread32_rep ioread32_rep
+#define iowrite8_rep iowrite8_rep
+#define iowrite16_rep iowrite16_rep
+#define iowrite32_rep iowrite32_rep
+#define pci_iounmap pci_iounmap
+
+#include <asm-generic/io.h>
+
 #endif /* __KERNEL__ */
 
 #endif /* __ALPHA_IO_H */
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-08-18  9:20 [PATCH] alpha: Use generic <asm-generic/io.h> Linus Walleij
@ 2022-08-18 10:28 ` Arnd Bergmann
  2022-09-05 19:30   ` Linus Walleij
  2022-10-02 22:45 ` Guenter Roeck
  1 sibling, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2022-08-18 10:28 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Arnd Bergmann,
	linux-alpha, kernel test robot, Mark Brown, linux-arch

On Thu, Aug 18, 2022 at 11:20 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> This enables the alpha to use <asm-generic/io.h> to fill in the
> missing (undefined) I/O accessor functions.
>
> This is needed if Alpha ever wants to uses CONFIG_REGMAP_MMIO
> which has been patches to use accelerated _noinc accessors
> such as readsq/writesq that Alpha, while being a 64bit platform,
> as of now not yet provide. readq/writeq is however provided
> so the machine can do 64bit I/O.
>
> 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.

I see the only other architectures that don't use asm-generic/io.h
yet are hexagon, mips, parisc, sh and sparc64. I wonder if it would
make sense to do this for all of them.

> Alternative approaches:
>
> - Implement proper readsq/writesq inline accessors for alpha

that would be ok with me

> - Rewrite the whole world of io.h to use something like __weak

>   instead of relying on defines
Nak to the use of __weak in anything I maintain, I find this to
be highly confusing whenever I try to find out what code is actually
getting called.

> - Leave regmap MMIO broken on Alpha because none of its drivers
>   use it

no problem for me

> - Make regmap MMIO depend of !ARCH_ALPHA

This doesn't work, because REGMAP_MMIO is selected by 150
drivers: unless you mark each of these individually as 'depends
on !ALPHA', you just get an addition warning from Kconfig
but it still fails to build.

> The latter seems a bit over the top. First option to implement
> readsq/writesq seems possible but I cannot test it (no hardware)
> so using the generic fallbacks seems like a better idea, also in
> general that will provide future defaults for accelerated defines.
>
> Leaving regmap MMIO broken or disabling it for Alpha feels bad
> because it breaks compiler coverage.

I'm not worried about compiler coverage on the less common
architectures, there is little hope of getting random configurations
to build because there are too many other problems.

> I'd like this applied to the alpha tree if there is such a
> thing otherwise maybe Arnd can apply it to the arch generic
> tree?

Sure, I can do that.

> +/*
> + * 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.
> + */
> +#define virt_to_phys virt_to_phys
> +#define phys_to_virt phys_to_virt
> +#define memset_io memset_io
> +#define memcpy_fromio memcpy_fromio

We tend to have these next to the function definition rather than
in a single place. Again, I'm not too worried here, just if you end
up reworking the patch in some form, or doing the same for the
other architectures that would be the way to do it.

      Arnd

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-08-18 10:28 ` Arnd Bergmann
@ 2022-09-05 19:30   ` Linus Walleij
  2022-09-05 20:52     ` Arnd Bergmann
  0 siblings, 1 reply; 14+ messages in thread
From: Linus Walleij @ 2022-09-05 19:30 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, linux-alpha,
	kernel test robot, Mark Brown, linux-arch

Hi Arnd,

On Thu, Aug 18, 2022 at 12:28 PM Arnd Bergmann <arnd@arndb.de> wrote:
> On Thu, Aug 18, 2022 at 11:20 AM Linus Walleij <linus.walleij@linaro.org> wrote:

> > I'd like this applied to the alpha tree if there is such a
> > thing otherwise maybe Arnd can apply it to the arch generic
> > tree?
>
> Sure, I can do that.

Could you apply this to the arch tree? I see no signs of life from
the alpha maintainers.

> > +/*
> > + * 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.
> > + */
> > +#define virt_to_phys virt_to_phys
> > +#define phys_to_virt phys_to_virt
> > +#define memset_io memset_io
> > +#define memcpy_fromio memcpy_fromio
>
> We tend to have these next to the function definition rather than
> in a single place. Again, I'm not too worried here, just if you end
> up reworking the patch in some form, or doing the same for the
> other architectures that would be the way to do it.

I looked into this, for parisc it was pretty straight forward. alpha has
a bunch of competing static inlines and externs and what not, I don't
see it helping to inline this, IMO it's actually better like this: "those
were defined somewhere in the birdnest of ifdefs above".

If it is a big issue I can start to pry into it.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-09-05 19:30   ` Linus Walleij
@ 2022-09-05 20:52     ` Arnd Bergmann
  2022-09-06 14:59       ` Matt Turner
  0 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2022-09-05 20:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, linux-alpha,
	kernel test robot, Mark Brown, Linux-Arch

On Mon, Sep 5, 2022, at 9:30 PM, Linus Walleij wrote:
> On Thu, Aug 18, 2022 at 12:28 PM Arnd Bergmann <arnd@arndb.de> wrote:
>> On Thu, Aug 18, 2022 at 11:20 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
>> > I'd like this applied to the alpha tree if there is such a
>> > thing otherwise maybe Arnd can apply it to the arch generic
>> > tree?
>>
>> Sure, I can do that.
>
> Could you apply this to the arch tree? I see no signs of life from
> the alpha maintainers.

Sure, I can do that. I also realized that we can actually fold
all of asm-generic/io.h into linux/io.h directly once this is
complete for all architectures. Probably better to leave that for
6.1 though.

I wonder if I should also add send a patch to mark Alpha as
'Orphaned' like we did for arch/ia64 a while ago.
It's already marked as 'Odd fixes', but the last pull request
from Matt was over a year ago now.

>> > +/*
>> > + * 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.
>> > + */
>> > +#define virt_to_phys virt_to_phys
>> > +#define phys_to_virt phys_to_virt
>> > +#define memset_io memset_io
>> > +#define memcpy_fromio memcpy_fromio
>>
>> We tend to have these next to the function definition rather than
>> in a single place. Again, I'm not too worried here, just if you end
>> up reworking the patch in some form, or doing the same for the
>> other architectures that would be the way to do it.
>
> I looked into this, for parisc it was pretty straight forward. alpha has
> a bunch of competing static inlines and externs and what not, I don't
> see it helping to inline this, IMO it's actually better like this: "those
> were defined somewhere in the birdnest of ifdefs above".
>
> If it is a big issue I can start to pry into it.

I would move the #defines specifically because the header is such a
mess, that way it should become clearer to anyone looking at the
file where the declaration is.

The header uses an unusual trick of declaring an extern
function first and then optionally overriding it with an
inline. I think it uses 'extern inline' in place of
'static inline' because older gcc versions would otherwise
reject this, not because it actually depends on the 'extern
inline' semantics.

It's probably not too hard to move the macros next to the
'extern' declaration for those functions that have both an
'extern' and an 'inline' version. Don't spend too much
time on getting it right if it doens't work right away though,
I don't think it matters all that much.

       Arnd

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-09-05 20:52     ` Arnd Bergmann
@ 2022-09-06 14:59       ` Matt Turner
  0 siblings, 0 replies; 14+ messages in thread
From: Matt Turner @ 2022-09-06 14:59 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, Richard Henderson, Ivan Kokshaysky, linux-alpha,
	kernel test robot, Mark Brown, Linux-Arch

On Mon, Sep 5, 2022 at 4:53 PM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Mon, Sep 5, 2022, at 9:30 PM, Linus Walleij wrote:
> > On Thu, Aug 18, 2022 at 12:28 PM Arnd Bergmann <arnd@arndb.de> wrote:
> >> On Thu, Aug 18, 2022 at 11:20 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> >> > I'd like this applied to the alpha tree if there is such a
> >> > thing otherwise maybe Arnd can apply it to the arch generic
> >> > tree?
> >>
> >> Sure, I can do that.
> >
> > Could you apply this to the arch tree? I see no signs of life from
> > the alpha maintainers.
>
> Sure, I can do that. I also realized that we can actually fold
> all of asm-generic/io.h into linux/io.h directly once this is
> complete for all architectures. Probably better to leave that for
> 6.1 though.
>
> I wonder if I should also add send a patch to mark Alpha as
> 'Orphaned' like we did for arch/ia64 a while ago.
> It's already marked as 'Odd fixes', but the last pull request
> from Matt was over a year ago now.

Sorry, I've just completed a cross-country move and have generally
been very busy with real life for the last year or so.

My alphas are being unpacked now, so I'll try to catch up on things.
Feel free to take any alpha patches through the arch tree. I feel
confident that you have more of a clue about what's going on in kernel
land than I do.

Thanks,
Matt

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-08-18  9:20 [PATCH] alpha: Use generic <asm-generic/io.h> Linus Walleij
  2022-08-18 10:28 ` Arnd Bergmann
@ 2022-10-02 22:45 ` Guenter Roeck
  2022-10-03 13:03   ` Arnd Bergmann
  1 sibling, 1 reply; 14+ messages in thread
From: Guenter Roeck @ 2022-10-02 22:45 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, Arnd Bergmann,
	linux-alpha, kernel test robot, Mark Brown, linux-arch

On Thu, Aug 18, 2022 at 11:20:59AM +0200, Linus Walleij wrote:
> This enables the alpha to use <asm-generic/io.h> to fill in the
> missing (undefined) I/O accessor functions.
> 
> This is needed if Alpha ever wants to uses CONFIG_REGMAP_MMIO
> which has been patches to use accelerated _noinc accessors
> such as readsq/writesq that Alpha, while being a 64bit platform,
> as of now not yet provide. readq/writeq is however provided
> so the machine can do 64bit I/O.
> 
> 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.
> 
> Alternative approaches:
> 
> - Implement proper readsq/writesq inline accessors for alpha
> - Rewrite the whole world of io.h to use something like __weak
>   instead of relying on defines
> - Leave regmap MMIO broken on Alpha because none of its drivers
>   use it
> - Make regmap MMIO depend of !ARCH_ALPHA
> 
> The latter seems a bit over the top. First option to implement
> readsq/writesq seems possible but I cannot test it (no hardware)
> so using the generic fallbacks seems like a better idea, also in
> general that will provide future defaults for accelerated defines.
> 
> Leaving regmap MMIO broken or disabling it for Alpha feels bad
> because it breaks compiler coverage.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/linux-mm/202208181447.G9FLcMkI-lkp@intel.com/
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Richard Henderson <richard.henderson@linaro.org>
> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> Cc: Matt Turner <mattst88@gmail.com>
> Cc: linux-arch@vger.kernel.org
> Cc: linux-alpha@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

This patch results in the following build errors when trying to build
alpha:allmodconfig.

ERROR: modpost: "ioread64" [drivers/pci/switch/switchtec.ko] undefined!
ERROR: modpost: "ioread64" [drivers/net/ethernet/freescale/enetc/fsl-enetc.ko] undefined!
ERROR: modpost: "ioread64" [drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko] undefined!
ERROR: modpost: "iowrite64" [drivers/net/ethernet/xilinx/xilinx_emac.ko] undefined!
ERROR: modpost: "iowrite64" [drivers/net/wwan/t7xx/mtk_t7xx.ko] undefined!
ERROR: modpost: "ioread64" [drivers/net/wwan/t7xx/mtk_t7xx.ko] undefined!
ERROR: modpost: "iowrite64" [drivers/firmware/arm_scmi/scmi-module.ko] undefined!
ERROR: modpost: "ioread64" [drivers/firmware/arm_scmi/scmi-module.ko] undefined!
ERROR: modpost: "iowrite64" [drivers/vfio/pci/vfio-pci-core.ko] undefined!
ERROR: modpost: "ioread64" [drivers/ntb/hw/mscc/ntb_hw_switchtec.ko] undefined!

Reverting it doesn't help because that just reintroduces the problem
that was supposed to be fixed by this patch.

Guenter

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-10-02 22:45 ` Guenter Roeck
@ 2022-10-03 13:03   ` Arnd Bergmann
  2022-10-03 15:07     ` Guenter Roeck
                       ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Arnd Bergmann @ 2022-10-03 13:03 UTC (permalink / raw)
  To: Guenter Roeck, Linus Walleij
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, linux-alpha,
	kernel test robot, Mark Brown, Linux-Arch

On Mon, Oct 3, 2022, at 12:45 AM, Guenter Roeck wrote:

>> 
>> Reported-by: kernel test robot <lkp@intel.com>
>> Link: https://lore.kernel.org/linux-mm/202208181447.G9FLcMkI-lkp@intel.com/
>> Cc: Mark Brown <broonie@kernel.org>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Richard Henderson <richard.henderson@linaro.org>
>> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
>> Cc: Matt Turner <mattst88@gmail.com>
>> Cc: linux-arch@vger.kernel.org
>> Cc: linux-alpha@vger.kernel.org
>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>
> This patch results in the following build errors when trying to build
> alpha:allmodconfig.
>
> ERROR: modpost: "ioread64" [drivers/pci/switch/switchtec.ko] undefined!
> ERROR: modpost: "ioread64" 
> [drivers/net/ethernet/freescale/enetc/fsl-enetc.ko] undefined!
> ERROR: modpost: "ioread64" 
> [drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko] undefined!
> ERROR: modpost: "iowrite64" 
> [drivers/net/ethernet/xilinx/xilinx_emac.ko] undefined!
> ERROR: modpost: "iowrite64" [drivers/net/wwan/t7xx/mtk_t7xx.ko] 
> undefined!
> ERROR: modpost: "ioread64" [drivers/net/wwan/t7xx/mtk_t7xx.ko] 
> undefined!
> ERROR: modpost: "iowrite64" [drivers/firmware/arm_scmi/scmi-module.ko] 
> undefined!
> ERROR: modpost: "ioread64" [drivers/firmware/arm_scmi/scmi-module.ko] 
> undefined!
> ERROR: modpost: "iowrite64" [drivers/vfio/pci/vfio-pci-core.ko] 
> undefined!
> ERROR: modpost: "ioread64" [drivers/ntb/hw/mscc/ntb_hw_switchtec.ko] 
> undefined!
>
> Reverting it doesn't help because that just reintroduces the problem
> that was supposed to be fixed by this patch.

Thanks for the report, I've now added this patch on top.

Matt, can you take a look if this look correct?

     Arnd

8<---
From 258382f3ca77b0e50501a0010d8c9abc2d4c51c8 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <arnd@arndb.de>
Date: Mon, 3 Oct 2022 13:12:54 +0200
Subject: [PATCH] alpha: add full ioread64/iowrite64 implementation

The previous patch introduced ioread64/iowrite64 declarations, but
this means we no longer get the io-64-nonatomic variant, and
run into a long error when someone actually wants to use these:

ERROR: modpost: "ioread64" [drivers/net/ethernet/freescale/enetc/fsl-enetc.ko] undefined!

Add the (hopefully) correct implementation for each machine type,
based on the 32-bit accessor. Since the 32-bit return type does
not work for ioread64(), change the internal implementation to use
the correct width consistently, but leave the external interface
to match the asm-generic/iomap.h header that uses 32-bit or 64-bit
return values.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: 7e772dad9913 ("alpha: Use generic <asm-generic/io.h>")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

diff --git a/arch/alpha/include/asm/core_apecs.h b/arch/alpha/include/asm/core_apecs.h
index 2d9726fc02ef..69a2fc62c9c3 100644
--- a/arch/alpha/include/asm/core_apecs.h
+++ b/arch/alpha/include/asm/core_apecs.h
@@ -384,7 +384,7 @@ struct el_apecs_procdata
 		}						\
 	} while (0)
 
-__EXTERN_INLINE unsigned int apecs_ioread8(const void __iomem *xaddr)
+__EXTERN_INLINE u8 apecs_ioread8(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long) xaddr;
 	unsigned long result, base_and_type;
@@ -420,7 +420,7 @@ __EXTERN_INLINE void apecs_iowrite8(u8 b, void __iomem *xaddr)
 	*(vuip) ((addr << 5) + base_and_type) = w;
 }
 
-__EXTERN_INLINE unsigned int apecs_ioread16(const void __iomem *xaddr)
+__EXTERN_INLINE u16 apecs_ioread16(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long) xaddr;
 	unsigned long result, base_and_type;
@@ -456,7 +456,7 @@ __EXTERN_INLINE void apecs_iowrite16(u16 b, void __iomem *xaddr)
 	*(vuip) ((addr << 5) + base_and_type) = w;
 }
 
-__EXTERN_INLINE unsigned int apecs_ioread32(const void __iomem *xaddr)
+__EXTERN_INLINE u32 apecs_ioread32(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long) xaddr;
 	if (addr < APECS_DENSE_MEM)
@@ -472,6 +472,22 @@ __EXTERN_INLINE void apecs_iowrite32(u32 b, void __iomem *xaddr)
 	*(vuip)addr = b;
 }
 
+__EXTERN_INLINE u64 apecs_ioread64(const void __iomem *xaddr)
+{
+	unsigned long addr = (unsigned long) xaddr;
+	if (addr < APECS_DENSE_MEM)
+		addr = ((addr - APECS_IO) << 5) + APECS_IO + 0x18;
+	return *(vulp)addr;
+}
+
+__EXTERN_INLINE void apecs_iowrite64(u64 b, void __iomem *xaddr)
+{
+	unsigned long addr = (unsigned long) xaddr;
+	if (addr < APECS_DENSE_MEM)
+		addr = ((addr - APECS_IO) << 5) + APECS_IO + 0x18;
+	*(vulp)addr = b;
+}
+
 __EXTERN_INLINE void __iomem *apecs_ioportmap(unsigned long addr)
 {
 	return (void __iomem *)(addr + APECS_IO);
diff --git a/arch/alpha/include/asm/core_cia.h b/arch/alpha/include/asm/core_cia.h
index cb22991f6761..d26bdfb7ca3b 100644
--- a/arch/alpha/include/asm/core_cia.h
+++ b/arch/alpha/include/asm/core_cia.h
@@ -342,7 +342,7 @@ struct el_CIA_sysdata_mcheck {
 #define vuip	volatile unsigned int __force *
 #define vulp	volatile unsigned long __force *
 
-__EXTERN_INLINE unsigned int cia_ioread8(const void __iomem *xaddr)
+__EXTERN_INLINE u8 cia_ioread8(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long) xaddr;
 	unsigned long result, base_and_type;
@@ -374,7 +374,7 @@ __EXTERN_INLINE void cia_iowrite8(u8 b, void __iomem *xaddr)
 	*(vuip) ((addr << 5) + base_and_type) = w;
 }
 
-__EXTERN_INLINE unsigned int cia_ioread16(const void __iomem *xaddr)
+__EXTERN_INLINE u16 cia_ioread16(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long) xaddr;
 	unsigned long result, base_and_type;
@@ -404,7 +404,7 @@ __EXTERN_INLINE void cia_iowrite16(u16 b, void __iomem *xaddr)
 	*(vuip) ((addr << 5) + base_and_type) = w;
 }
 
-__EXTERN_INLINE unsigned int cia_ioread32(const void __iomem *xaddr)
+__EXTERN_INLINE u32 cia_ioread32(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long) xaddr;
 	if (addr < CIA_DENSE_MEM)
@@ -420,6 +420,22 @@ __EXTERN_INLINE void cia_iowrite32(u32 b, void __iomem *xaddr)
 	*(vuip)addr = b;
 }
 
+__EXTERN_INLINE u64 cia_ioread64(const void __iomem *xaddr)
+{
+	unsigned long addr = (unsigned long) xaddr;
+	if (addr < CIA_DENSE_MEM)
+		addr = ((addr - CIA_IO) << 5) + CIA_IO + 0x18;
+	return *(vulp)addr;
+}
+
+__EXTERN_INLINE void cia_iowrite64(u64 b, void __iomem *xaddr)
+{
+	unsigned long addr = (unsigned long) xaddr;
+	if (addr < CIA_DENSE_MEM)
+		addr = ((addr - CIA_IO) << 5) + CIA_IO + 0x18;
+	*(vulp)addr = b;
+}
+
 __EXTERN_INLINE void __iomem *cia_ioportmap(unsigned long addr)
 {
 	return (void __iomem *)(addr + CIA_IO);
diff --git a/arch/alpha/include/asm/core_lca.h b/arch/alpha/include/asm/core_lca.h
index ec86314418cb..d8c3e72ef8f6 100644
--- a/arch/alpha/include/asm/core_lca.h
+++ b/arch/alpha/include/asm/core_lca.h
@@ -230,7 +230,7 @@ union el_lca {
 	} while (0)
 
 
-__EXTERN_INLINE unsigned int lca_ioread8(const void __iomem *xaddr)
+__EXTERN_INLINE u8 lca_ioread8(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long) xaddr;
 	unsigned long result, base_and_type;
@@ -266,7 +266,7 @@ __EXTERN_INLINE void lca_iowrite8(u8 b, void __iomem *xaddr)
 	*(vuip) ((addr << 5) + base_and_type) = w;
 }
 
-__EXTERN_INLINE unsigned int lca_ioread16(const void __iomem *xaddr)
+__EXTERN_INLINE u16 lca_ioread16(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long) xaddr;
 	unsigned long result, base_and_type;
@@ -302,7 +302,7 @@ __EXTERN_INLINE void lca_iowrite16(u16 b, void __iomem *xaddr)
 	*(vuip) ((addr << 5) + base_and_type) = w;
 }
 
-__EXTERN_INLINE unsigned int lca_ioread32(const void __iomem *xaddr)
+__EXTERN_INLINE u32 lca_ioread32(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long) xaddr;
 	if (addr < LCA_DENSE_MEM)
@@ -318,6 +318,22 @@ __EXTERN_INLINE void lca_iowrite32(u32 b, void __iomem *xaddr)
 	*(vuip)addr = b;
 }
 
+__EXTERN_INLINE u64 lca_ioread64(const void __iomem *xaddr)
+{
+	unsigned long addr = (unsigned long) xaddr;
+	if (addr < LCA_DENSE_MEM)
+		addr = ((addr - LCA_IO) << 5) + LCA_IO + 0x18;
+	return *(vulp)addr;
+}
+
+__EXTERN_INLINE void lca_iowrite64(u64 b, void __iomem *xaddr)
+{
+	unsigned long addr = (unsigned long) xaddr;
+	if (addr < LCA_DENSE_MEM)
+		addr = ((addr - LCA_IO) << 5) + LCA_IO + 0x18;
+	*(vulp)addr = b;
+}
+
 __EXTERN_INLINE void __iomem *lca_ioportmap(unsigned long addr)
 {
 	return (void __iomem *)(addr + LCA_IO);
diff --git a/arch/alpha/include/asm/core_marvel.h b/arch/alpha/include/asm/core_marvel.h
index b266e02e284b..d99f3a82e0e5 100644
--- a/arch/alpha/include/asm/core_marvel.h
+++ b/arch/alpha/include/asm/core_marvel.h
@@ -332,10 +332,10 @@ struct io7 {
 #define vucp	volatile unsigned char __force *
 #define vusp	volatile unsigned short __force *
 
-extern unsigned int marvel_ioread8(const void __iomem *);
+extern u8 marvel_ioread8(const void __iomem *);
 extern void marvel_iowrite8(u8 b, void __iomem *);
 
-__EXTERN_INLINE unsigned int marvel_ioread16(const void __iomem *addr)
+__EXTERN_INLINE u16 marvel_ioread16(const void __iomem *addr)
 {
 	return __kernel_ldwu(*(vusp)addr);
 }
diff --git a/arch/alpha/include/asm/core_mcpcia.h b/arch/alpha/include/asm/core_mcpcia.h
index cb24d1bd6141..ed2bf8ad40ed 100644
--- a/arch/alpha/include/asm/core_mcpcia.h
+++ b/arch/alpha/include/asm/core_mcpcia.h
@@ -248,6 +248,7 @@ struct el_MCPCIA_uncorrected_frame_mcheck {
 
 #define vip	volatile int __force *
 #define vuip	volatile unsigned int __force *
+#define vulp	volatile unsigned long __force *
 
 #ifndef MCPCIA_ONE_HAE_WINDOW
 #define MCPCIA_FROB_MMIO						\
@@ -267,7 +268,7 @@ extern inline int __mcpcia_is_mmio(unsigned long addr)
 	return (addr & 0x80000000UL) == 0;
 }
 
-__EXTERN_INLINE unsigned int mcpcia_ioread8(const void __iomem *xaddr)
+__EXTERN_INLINE u8 mcpcia_ioread8(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
 	unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
@@ -291,7 +292,7 @@ __EXTERN_INLINE void mcpcia_iowrite8(u8 b, void __iomem *xaddr)
 	*(vuip) ((addr << 5) + hose + 0x00) = w;
 }
 
-__EXTERN_INLINE unsigned int mcpcia_ioread16(const void __iomem *xaddr)
+__EXTERN_INLINE u16 mcpcia_ioread16(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
 	unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
@@ -315,7 +316,7 @@ __EXTERN_INLINE void mcpcia_iowrite16(u16 b, void __iomem *xaddr)
 	*(vuip) ((addr << 5) + hose + 0x08) = w;
 }
 
-__EXTERN_INLINE unsigned int mcpcia_ioread32(const void __iomem *xaddr)
+__EXTERN_INLINE u32 mcpcia_ioread32(const void __iomem *xaddr)
 {
 	unsigned long addr = (unsigned long)xaddr;
 
@@ -335,6 +336,26 @@ __EXTERN_INLINE void mcpcia_iowrite32(u32 b, void __iomem *xaddr)
 	*(vuip)addr = b;
 }
 
+__EXTERN_INLINE u64 mcpcia_ioread64(const void __iomem *xaddr)
+{
+	unsigned long addr = (unsigned long)xaddr;
+
+	if (!__mcpcia_is_mmio(addr))
+		addr = ((addr & 0xffff) << 5) + (addr & ~0xfffful) + 0x18;
+
+	return *(vulp)addr;
+}
+
+__EXTERN_INLINE void mcpcia_iowrite64(u64 b, void __iomem *xaddr)
+{
+	unsigned long addr = (unsigned long)xaddr;
+
+	if (!__mcpcia_is_mmio(addr))
+		addr = ((addr & 0xffff) << 5) + (addr & ~0xfffful) + 0x18;
+
+	*(vulp)addr = b;
+}
+
 
 __EXTERN_INLINE void __iomem *mcpcia_ioportmap(unsigned long addr)
 {
@@ -362,6 +383,7 @@ __EXTERN_INLINE int mcpcia_is_mmio(const volatile void __iomem *xaddr)
 
 #undef vip
 #undef vuip
+#undef vulp
 
 #undef __IO_PREFIX
 #define __IO_PREFIX		mcpcia
diff --git a/arch/alpha/include/asm/core_t2.h b/arch/alpha/include/asm/core_t2.h
index 12bb7addc789..ab956b1625b5 100644
--- a/arch/alpha/include/asm/core_t2.h
+++ b/arch/alpha/include/asm/core_t2.h
@@ -360,6 +360,7 @@ struct el_t2_frame_corrected {
 
 #define vip	volatile int *
 #define vuip	volatile unsigned int *
+#define vulp	volatile unsigned long *
 
 extern inline u8 t2_inb(unsigned long addr)
 {
@@ -402,6 +403,17 @@ extern inline void t2_outl(u32 b, unsigned long addr)
 	mb();
 }
 
+extern inline u64 t2_inq(unsigned long addr)
+{
+	return *(vulp) ((addr << 5) + T2_IO + 0x18);
+}
+
+extern inline void t2_outq(u64 b, unsigned long addr)
+{
+	*(vulp) ((addr << 5) + T2_IO + 0x18) = b;
+	mb();
+}
+
 
 /*
  * Memory functions.
@@ -572,7 +584,7 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)
    it doesn't make sense to merge the pio and mmio routines.  */
 
 #define IOPORT(OS, NS)							\
-__EXTERN_INLINE unsigned int t2_ioread##NS(const void __iomem *xaddr)		\
+__EXTERN_INLINE u##NS t2_ioread##NS(const void __iomem *xaddr)		\
 {									\
 	if (t2_is_mmio(xaddr))						\
 		return t2_read##OS(xaddr);				\
@@ -590,11 +602,13 @@ __EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr)	\
 IOPORT(b, 8)
 IOPORT(w, 16)
 IOPORT(l, 32)
+IOPORT(q, 64)
 
 #undef IOPORT
 
 #undef vip
 #undef vuip
+#undef vulp
 
 #undef __IO_PREFIX
 #define __IO_PREFIX		t2
diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index a887628f2ea6..1c3605d874e9 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -155,6 +155,7 @@ static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr)	\
 REMAP1(unsigned int, ioread8, const)
 REMAP1(unsigned int, ioread16, const)
 REMAP1(unsigned int, ioread32, const)
+REMAP1(u64, ioread64, const)
 REMAP1(u8, readb, const volatile)
 REMAP1(u16, readw, const volatile)
 REMAP1(u32, readl, const volatile)
@@ -163,6 +164,7 @@ REMAP1(u64, readq, const volatile)
 REMAP2(u8, iowrite8, /**/)
 REMAP2(u16, iowrite16, /**/)
 REMAP2(u32, iowrite32, /**/)
+REMAP2(u64, iowrite64, /**/)
 REMAP2(u8, writeb, volatile)
 REMAP2(u16, writew, volatile)
 REMAP2(u32, writel, volatile)
@@ -400,12 +402,27 @@ extern inline unsigned int ioread32(const void __iomem *addr)
 	return ret;
 }
 
+extern inline u64 ioread64(const void __iomem *addr)
+{
+	unsigned int ret;
+	mb();
+	ret = IO_CONCAT(__IO_PREFIX,ioread64)(addr);
+	mb();
+	return ret;
+}
+
 extern inline void iowrite32(u32 b, void __iomem *addr)
 {
 	mb();
 	IO_CONCAT(__IO_PREFIX, iowrite32)(b, addr);
 }
 
+extern inline void iowrite64(u64 b, void __iomem *addr)
+{
+	mb();
+	IO_CONCAT(__IO_PREFIX, iowrite64)(b, addr);
+}
+
 extern inline u32 inl(unsigned long port)
 {
 	return ioread32(ioport_map(port, 4));
@@ -418,7 +435,9 @@ extern inline void outl(u32 b, unsigned long port)
 #endif
 
 #define ioread32 ioread32
+#define ioread64 ioread64
 #define iowrite32 iowrite32
+#define iowrite64 iowrite64
 
 #if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1
 extern inline u8 __raw_readb(const volatile void __iomem *addr)
diff --git a/arch/alpha/include/asm/io_trivial.h b/arch/alpha/include/asm/io_trivial.h
index a1a29cbe02fa..00032093bcfc 100644
--- a/arch/alpha/include/asm/io_trivial.h
+++ b/arch/alpha/include/asm/io_trivial.h
@@ -6,13 +6,13 @@
 /* This file may be included multiple times.  */
 
 #if IO_CONCAT(__IO_PREFIX,trivial_io_bw)
-__EXTERN_INLINE unsigned int
+__EXTERN_INLINE u8
 IO_CONCAT(__IO_PREFIX,ioread8)(const void __iomem *a)
 {
 	return __kernel_ldbu(*(const volatile u8 __force *)a);
 }
 
-__EXTERN_INLINE unsigned int
+__EXTERN_INLINE u16
 IO_CONCAT(__IO_PREFIX,ioread16)(const void __iomem *a)
 {
 	return __kernel_ldwu(*(const volatile u16 __force *)a);
@@ -32,7 +32,7 @@ IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a)
 #endif
 
 #if IO_CONCAT(__IO_PREFIX,trivial_io_lq)
-__EXTERN_INLINE unsigned int
+__EXTERN_INLINE u32
 IO_CONCAT(__IO_PREFIX,ioread32)(const void __iomem *a)
 {
 	return *(const volatile u32 __force *)a;
@@ -43,6 +43,18 @@ IO_CONCAT(__IO_PREFIX,iowrite32)(u32 b, void __iomem *a)
 {
 	*(volatile u32 __force *)a = b;
 }
+
+__EXTERN_INLINE u64
+IO_CONCAT(__IO_PREFIX,ioread64)(const void __iomem *a)
+{
+	return *(const volatile u64 __force *)a;
+}
+
+__EXTERN_INLINE void
+IO_CONCAT(__IO_PREFIX,iowrite64)(u64 b, void __iomem *a)
+{
+	*(volatile u64 __force *)a = b;
+}
 #endif
 
 #if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1
diff --git a/arch/alpha/include/asm/jensen.h b/arch/alpha/include/asm/jensen.h
index 1c4131453db2..66eb049eb421 100644
--- a/arch/alpha/include/asm/jensen.h
+++ b/arch/alpha/include/asm/jensen.h
@@ -98,6 +98,7 @@ __EXTERN_INLINE void jensen_set_hae(unsigned long addr)
 }
 
 #define vuip	volatile unsigned int *
+#define vulp	volatile unsigned long *
 
 /*
  * IO functions
@@ -183,6 +184,12 @@ __EXTERN_INLINE u32 jensen_inl(unsigned long addr)
 	return *(vuip) ((addr << 7) + EISA_IO + 0x60);
 }
 
+__EXTERN_INLINE u64 jensen_inq(unsigned long addr)
+{
+	jensen_set_hae(0);
+	return *(vulp) ((addr << 7) + EISA_IO + 0x60);
+}
+
 __EXTERN_INLINE void jensen_outw(u16 b, unsigned long addr)
 {
 	jensen_set_hae(0);
@@ -197,6 +204,13 @@ __EXTERN_INLINE void jensen_outl(u32 b, unsigned long addr)
 	mb();
 }
 
+__EXTERN_INLINE void jensen_outq(u64 b, unsigned long addr)
+{
+	jensen_set_hae(0);
+	*(vulp) ((addr << 7) + EISA_IO + 0x60) = b;
+	mb();
+}
+
 /*
  * Memory functions.
  */
@@ -305,7 +319,7 @@ __EXTERN_INLINE int jensen_is_mmio(const volatile void __iomem *addr)
    that it doesn't make sense to merge them.  */
 
 #define IOPORT(OS, NS)							\
-__EXTERN_INLINE unsigned int jensen_ioread##NS(const void __iomem *xaddr)	\
+__EXTERN_INLINE u##NS jensen_ioread##NS(const void __iomem *xaddr)	\
 {									\
 	if (jensen_is_mmio(xaddr))					\
 		return jensen_read##OS(xaddr - 0x100000000ul);		\
@@ -323,10 +337,12 @@ __EXTERN_INLINE void jensen_iowrite##NS(u##NS b, void __iomem *xaddr)	\
 IOPORT(b, 8)
 IOPORT(w, 16)
 IOPORT(l, 32)
+IOPORT(q, 64)
 
 #undef IOPORT
 
 #undef vuip
+#undef vulp
 
 #undef __IO_PREFIX
 #define __IO_PREFIX		jensen
diff --git a/arch/alpha/include/asm/machvec.h b/arch/alpha/include/asm/machvec.h
index e49fabce7b33..8623f995d34c 100644
--- a/arch/alpha/include/asm/machvec.h
+++ b/arch/alpha/include/asm/machvec.h
@@ -46,13 +46,15 @@ struct alpha_machine_vector
 	void (*mv_pci_tbi)(struct pci_controller *hose,
 			   dma_addr_t start, dma_addr_t end);
 
-	unsigned int (*mv_ioread8)(const void __iomem *);
-	unsigned int (*mv_ioread16)(const void __iomem *);
-	unsigned int (*mv_ioread32)(const void __iomem *);
+	u8 (*mv_ioread8)(const void __iomem *);
+	u16 (*mv_ioread16)(const void __iomem *);
+	u32 (*mv_ioread32)(const void __iomem *);
+	u64 (*mv_ioread64)(const void __iomem *);
 
 	void (*mv_iowrite8)(u8, void __iomem *);
 	void (*mv_iowrite16)(u16, void __iomem *);
 	void (*mv_iowrite32)(u32, void __iomem *);
+	void (*mv_iowrite64)(u64, void __iomem *);
 
 	u8 (*mv_readb)(const volatile void __iomem *);
 	u16 (*mv_readw)(const volatile void __iomem *);
diff --git a/arch/alpha/kernel/io.c b/arch/alpha/kernel/io.c
index 838586abb1e0..eda09778268f 100644
--- a/arch/alpha/kernel/io.c
+++ b/arch/alpha/kernel/io.c
@@ -41,6 +41,15 @@ unsigned int ioread32(const void __iomem *addr)
 	return ret;
 }
 
+u64 ioread64(const void __iomem *addr)
+{
+	unsigned int ret;
+	mb();
+	ret = IO_CONCAT(__IO_PREFIX,ioread64)(addr);
+	mb();
+	return ret;
+}
+
 void iowrite8(u8 b, void __iomem *addr)
 {
 	mb();
@@ -59,12 +68,20 @@ void iowrite32(u32 b, void __iomem *addr)
 	IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr);
 }
 
+void iowrite64(u64 b, void __iomem *addr)
+{
+	mb();
+	IO_CONCAT(__IO_PREFIX,iowrite64)(b, addr);
+}
+
 EXPORT_SYMBOL(ioread8);
 EXPORT_SYMBOL(ioread16);
 EXPORT_SYMBOL(ioread32);
+EXPORT_SYMBOL(ioread64);
 EXPORT_SYMBOL(iowrite8);
 EXPORT_SYMBOL(iowrite16);
 EXPORT_SYMBOL(iowrite32);
+EXPORT_SYMBOL(iowrite64);
 
 u8 inb(unsigned long port)
 {
diff --git a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h
index 393d5d6ca5d2..c2ebcb39e589 100644
--- a/arch/alpha/kernel/machvec_impl.h
+++ b/arch/alpha/kernel/machvec_impl.h
@@ -78,9 +78,11 @@
 	.mv_ioread8 =		CAT(low,_ioread8),			\
 	.mv_ioread16 =		CAT(low,_ioread16),			\
 	.mv_ioread32 =		CAT(low,_ioread32),			\
+	.mv_ioread64 =		CAT(low,_ioread64),			\
 	.mv_iowrite8 =		CAT(low,_iowrite8),			\
 	.mv_iowrite16 =		CAT(low,_iowrite16),			\
 	.mv_iowrite32 =		CAT(low,_iowrite32),			\
+	.mv_iowrite64 =		CAT(low,_iowrite64),			\
 	.mv_readb =		CAT(low,_readb),			\
 	.mv_readw =		CAT(low,_readw),			\
 	.mv_readl =		CAT(low,_readl),			\

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-10-03 13:03   ` Arnd Bergmann
@ 2022-10-03 15:07     ` Guenter Roeck
  2022-10-03 18:49     ` Linus Walleij
  2022-10-04 19:42     ` Guenter Roeck
  2 siblings, 0 replies; 14+ messages in thread
From: Guenter Roeck @ 2022-10-03 15:07 UTC (permalink / raw)
  To: Arnd Bergmann, Linus Walleij
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, linux-alpha,
	kernel test robot, Mark Brown, Linux-Arch

On 10/3/22 06:03, Arnd Bergmann wrote:
> On Mon, Oct 3, 2022, at 12:45 AM, Guenter Roeck wrote:
> 
>>>
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Link: https://lore.kernel.org/linux-mm/202208181447.G9FLcMkI-lkp@intel.com/
>>> Cc: Mark Brown <broonie@kernel.org>
>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>> Cc: Richard Henderson <richard.henderson@linaro.org>
>>> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
>>> Cc: Matt Turner <mattst88@gmail.com>
>>> Cc: linux-arch@vger.kernel.org
>>> Cc: linux-alpha@vger.kernel.org
>>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>>
>> This patch results in the following build errors when trying to build
>> alpha:allmodconfig.
>>
>> ERROR: modpost: "ioread64" [drivers/pci/switch/switchtec.ko] undefined!
>> ERROR: modpost: "ioread64"
>> [drivers/net/ethernet/freescale/enetc/fsl-enetc.ko] undefined!
>> ERROR: modpost: "ioread64"
>> [drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko] undefined!
>> ERROR: modpost: "iowrite64"
>> [drivers/net/ethernet/xilinx/xilinx_emac.ko] undefined!
>> ERROR: modpost: "iowrite64" [drivers/net/wwan/t7xx/mtk_t7xx.ko]
>> undefined!
>> ERROR: modpost: "ioread64" [drivers/net/wwan/t7xx/mtk_t7xx.ko]
>> undefined!
>> ERROR: modpost: "iowrite64" [drivers/firmware/arm_scmi/scmi-module.ko]
>> undefined!
>> ERROR: modpost: "ioread64" [drivers/firmware/arm_scmi/scmi-module.ko]
>> undefined!
>> ERROR: modpost: "iowrite64" [drivers/vfio/pci/vfio-pci-core.ko]
>> undefined!
>> ERROR: modpost: "ioread64" [drivers/ntb/hw/mscc/ntb_hw_switchtec.ko]
>> undefined!
>>
>> Reverting it doesn't help because that just reintroduces the problem
>> that was supposed to be fixed by this patch.
> 
> Thanks for the report, I've now added this patch on top.
> 
> Matt, can you take a look if this look correct?
> 
>       Arnd
> 
> 8<---
>>From 258382f3ca77b0e50501a0010d8c9abc2d4c51c8 Mon Sep 17 00:00:00 2001
> From: Arnd Bergmann <arnd@arndb.de>
> Date: Mon, 3 Oct 2022 13:12:54 +0200
> Subject: [PATCH] alpha: add full ioread64/iowrite64 implementation
> 
> The previous patch introduced ioread64/iowrite64 declarations, but
> this means we no longer get the io-64-nonatomic variant, and
> run into a long error when someone actually wants to use these:
> 
> ERROR: modpost: "ioread64" [drivers/net/ethernet/freescale/enetc/fsl-enetc.ko] undefined!
> 
> Add the (hopefully) correct implementation for each machine type,
> based on the 32-bit accessor. Since the 32-bit return type does
> not work for ioread64(), change the internal implementation to use
> the correct width consistently, but leave the external interface
> to match the asm-generic/iomap.h header that uses 32-bit or 64-bit
> return values.
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Fixes: 7e772dad9913 ("alpha: Use generic <asm-generic/io.h>")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Tested-by: Guenter Roeck <linux@roeck-us.net>

> 
> diff --git a/arch/alpha/include/asm/core_apecs.h b/arch/alpha/include/asm/core_apecs.h
> index 2d9726fc02ef..69a2fc62c9c3 100644
> --- a/arch/alpha/include/asm/core_apecs.h
> +++ b/arch/alpha/include/asm/core_apecs.h
> @@ -384,7 +384,7 @@ struct el_apecs_procdata
>   		}						\
>   	} while (0)
>   
> -__EXTERN_INLINE unsigned int apecs_ioread8(const void __iomem *xaddr)
> +__EXTERN_INLINE u8 apecs_ioread8(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long) xaddr;
>   	unsigned long result, base_and_type;
> @@ -420,7 +420,7 @@ __EXTERN_INLINE void apecs_iowrite8(u8 b, void __iomem *xaddr)
>   	*(vuip) ((addr << 5) + base_and_type) = w;
>   }
>   
> -__EXTERN_INLINE unsigned int apecs_ioread16(const void __iomem *xaddr)
> +__EXTERN_INLINE u16 apecs_ioread16(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long) xaddr;
>   	unsigned long result, base_and_type;
> @@ -456,7 +456,7 @@ __EXTERN_INLINE void apecs_iowrite16(u16 b, void __iomem *xaddr)
>   	*(vuip) ((addr << 5) + base_and_type) = w;
>   }
>   
> -__EXTERN_INLINE unsigned int apecs_ioread32(const void __iomem *xaddr)
> +__EXTERN_INLINE u32 apecs_ioread32(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long) xaddr;
>   	if (addr < APECS_DENSE_MEM)
> @@ -472,6 +472,22 @@ __EXTERN_INLINE void apecs_iowrite32(u32 b, void __iomem *xaddr)
>   	*(vuip)addr = b;
>   }
>   
> +__EXTERN_INLINE u64 apecs_ioread64(const void __iomem *xaddr)
> +{
> +	unsigned long addr = (unsigned long) xaddr;
> +	if (addr < APECS_DENSE_MEM)
> +		addr = ((addr - APECS_IO) << 5) + APECS_IO + 0x18;
> +	return *(vulp)addr;
> +}
> +
> +__EXTERN_INLINE void apecs_iowrite64(u64 b, void __iomem *xaddr)
> +{
> +	unsigned long addr = (unsigned long) xaddr;
> +	if (addr < APECS_DENSE_MEM)
> +		addr = ((addr - APECS_IO) << 5) + APECS_IO + 0x18;
> +	*(vulp)addr = b;
> +}
> +
>   __EXTERN_INLINE void __iomem *apecs_ioportmap(unsigned long addr)
>   {
>   	return (void __iomem *)(addr + APECS_IO);
> diff --git a/arch/alpha/include/asm/core_cia.h b/arch/alpha/include/asm/core_cia.h
> index cb22991f6761..d26bdfb7ca3b 100644
> --- a/arch/alpha/include/asm/core_cia.h
> +++ b/arch/alpha/include/asm/core_cia.h
> @@ -342,7 +342,7 @@ struct el_CIA_sysdata_mcheck {
>   #define vuip	volatile unsigned int __force *
>   #define vulp	volatile unsigned long __force *
>   
> -__EXTERN_INLINE unsigned int cia_ioread8(const void __iomem *xaddr)
> +__EXTERN_INLINE u8 cia_ioread8(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long) xaddr;
>   	unsigned long result, base_and_type;
> @@ -374,7 +374,7 @@ __EXTERN_INLINE void cia_iowrite8(u8 b, void __iomem *xaddr)
>   	*(vuip) ((addr << 5) + base_and_type) = w;
>   }
>   
> -__EXTERN_INLINE unsigned int cia_ioread16(const void __iomem *xaddr)
> +__EXTERN_INLINE u16 cia_ioread16(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long) xaddr;
>   	unsigned long result, base_and_type;
> @@ -404,7 +404,7 @@ __EXTERN_INLINE void cia_iowrite16(u16 b, void __iomem *xaddr)
>   	*(vuip) ((addr << 5) + base_and_type) = w;
>   }
>   
> -__EXTERN_INLINE unsigned int cia_ioread32(const void __iomem *xaddr)
> +__EXTERN_INLINE u32 cia_ioread32(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long) xaddr;
>   	if (addr < CIA_DENSE_MEM)
> @@ -420,6 +420,22 @@ __EXTERN_INLINE void cia_iowrite32(u32 b, void __iomem *xaddr)
>   	*(vuip)addr = b;
>   }
>   
> +__EXTERN_INLINE u64 cia_ioread64(const void __iomem *xaddr)
> +{
> +	unsigned long addr = (unsigned long) xaddr;
> +	if (addr < CIA_DENSE_MEM)
> +		addr = ((addr - CIA_IO) << 5) + CIA_IO + 0x18;
> +	return *(vulp)addr;
> +}
> +
> +__EXTERN_INLINE void cia_iowrite64(u64 b, void __iomem *xaddr)
> +{
> +	unsigned long addr = (unsigned long) xaddr;
> +	if (addr < CIA_DENSE_MEM)
> +		addr = ((addr - CIA_IO) << 5) + CIA_IO + 0x18;
> +	*(vulp)addr = b;
> +}
> +
>   __EXTERN_INLINE void __iomem *cia_ioportmap(unsigned long addr)
>   {
>   	return (void __iomem *)(addr + CIA_IO);
> diff --git a/arch/alpha/include/asm/core_lca.h b/arch/alpha/include/asm/core_lca.h
> index ec86314418cb..d8c3e72ef8f6 100644
> --- a/arch/alpha/include/asm/core_lca.h
> +++ b/arch/alpha/include/asm/core_lca.h
> @@ -230,7 +230,7 @@ union el_lca {
>   	} while (0)
>   
>   
> -__EXTERN_INLINE unsigned int lca_ioread8(const void __iomem *xaddr)
> +__EXTERN_INLINE u8 lca_ioread8(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long) xaddr;
>   	unsigned long result, base_and_type;
> @@ -266,7 +266,7 @@ __EXTERN_INLINE void lca_iowrite8(u8 b, void __iomem *xaddr)
>   	*(vuip) ((addr << 5) + base_and_type) = w;
>   }
>   
> -__EXTERN_INLINE unsigned int lca_ioread16(const void __iomem *xaddr)
> +__EXTERN_INLINE u16 lca_ioread16(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long) xaddr;
>   	unsigned long result, base_and_type;
> @@ -302,7 +302,7 @@ __EXTERN_INLINE void lca_iowrite16(u16 b, void __iomem *xaddr)
>   	*(vuip) ((addr << 5) + base_and_type) = w;
>   }
>   
> -__EXTERN_INLINE unsigned int lca_ioread32(const void __iomem *xaddr)
> +__EXTERN_INLINE u32 lca_ioread32(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long) xaddr;
>   	if (addr < LCA_DENSE_MEM)
> @@ -318,6 +318,22 @@ __EXTERN_INLINE void lca_iowrite32(u32 b, void __iomem *xaddr)
>   	*(vuip)addr = b;
>   }
>   
> +__EXTERN_INLINE u64 lca_ioread64(const void __iomem *xaddr)
> +{
> +	unsigned long addr = (unsigned long) xaddr;
> +	if (addr < LCA_DENSE_MEM)
> +		addr = ((addr - LCA_IO) << 5) + LCA_IO + 0x18;
> +	return *(vulp)addr;
> +}
> +
> +__EXTERN_INLINE void lca_iowrite64(u64 b, void __iomem *xaddr)
> +{
> +	unsigned long addr = (unsigned long) xaddr;
> +	if (addr < LCA_DENSE_MEM)
> +		addr = ((addr - LCA_IO) << 5) + LCA_IO + 0x18;
> +	*(vulp)addr = b;
> +}
> +
>   __EXTERN_INLINE void __iomem *lca_ioportmap(unsigned long addr)
>   {
>   	return (void __iomem *)(addr + LCA_IO);
> diff --git a/arch/alpha/include/asm/core_marvel.h b/arch/alpha/include/asm/core_marvel.h
> index b266e02e284b..d99f3a82e0e5 100644
> --- a/arch/alpha/include/asm/core_marvel.h
> +++ b/arch/alpha/include/asm/core_marvel.h
> @@ -332,10 +332,10 @@ struct io7 {
>   #define vucp	volatile unsigned char __force *
>   #define vusp	volatile unsigned short __force *
>   
> -extern unsigned int marvel_ioread8(const void __iomem *);
> +extern u8 marvel_ioread8(const void __iomem *);
>   extern void marvel_iowrite8(u8 b, void __iomem *);
>   
> -__EXTERN_INLINE unsigned int marvel_ioread16(const void __iomem *addr)
> +__EXTERN_INLINE u16 marvel_ioread16(const void __iomem *addr)
>   {
>   	return __kernel_ldwu(*(vusp)addr);
>   }
> diff --git a/arch/alpha/include/asm/core_mcpcia.h b/arch/alpha/include/asm/core_mcpcia.h
> index cb24d1bd6141..ed2bf8ad40ed 100644
> --- a/arch/alpha/include/asm/core_mcpcia.h
> +++ b/arch/alpha/include/asm/core_mcpcia.h
> @@ -248,6 +248,7 @@ struct el_MCPCIA_uncorrected_frame_mcheck {
>   
>   #define vip	volatile int __force *
>   #define vuip	volatile unsigned int __force *
> +#define vulp	volatile unsigned long __force *
>   
>   #ifndef MCPCIA_ONE_HAE_WINDOW
>   #define MCPCIA_FROB_MMIO						\
> @@ -267,7 +268,7 @@ extern inline int __mcpcia_is_mmio(unsigned long addr)
>   	return (addr & 0x80000000UL) == 0;
>   }
>   
> -__EXTERN_INLINE unsigned int mcpcia_ioread8(const void __iomem *xaddr)
> +__EXTERN_INLINE u8 mcpcia_ioread8(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
>   	unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
> @@ -291,7 +292,7 @@ __EXTERN_INLINE void mcpcia_iowrite8(u8 b, void __iomem *xaddr)
>   	*(vuip) ((addr << 5) + hose + 0x00) = w;
>   }
>   
> -__EXTERN_INLINE unsigned int mcpcia_ioread16(const void __iomem *xaddr)
> +__EXTERN_INLINE u16 mcpcia_ioread16(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long)xaddr & MCPCIA_MEM_MASK;
>   	unsigned long hose = (unsigned long)xaddr & ~MCPCIA_MEM_MASK;
> @@ -315,7 +316,7 @@ __EXTERN_INLINE void mcpcia_iowrite16(u16 b, void __iomem *xaddr)
>   	*(vuip) ((addr << 5) + hose + 0x08) = w;
>   }
>   
> -__EXTERN_INLINE unsigned int mcpcia_ioread32(const void __iomem *xaddr)
> +__EXTERN_INLINE u32 mcpcia_ioread32(const void __iomem *xaddr)
>   {
>   	unsigned long addr = (unsigned long)xaddr;
>   
> @@ -335,6 +336,26 @@ __EXTERN_INLINE void mcpcia_iowrite32(u32 b, void __iomem *xaddr)
>   	*(vuip)addr = b;
>   }
>   
> +__EXTERN_INLINE u64 mcpcia_ioread64(const void __iomem *xaddr)
> +{
> +	unsigned long addr = (unsigned long)xaddr;
> +
> +	if (!__mcpcia_is_mmio(addr))
> +		addr = ((addr & 0xffff) << 5) + (addr & ~0xfffful) + 0x18;
> +
> +	return *(vulp)addr;
> +}
> +
> +__EXTERN_INLINE void mcpcia_iowrite64(u64 b, void __iomem *xaddr)
> +{
> +	unsigned long addr = (unsigned long)xaddr;
> +
> +	if (!__mcpcia_is_mmio(addr))
> +		addr = ((addr & 0xffff) << 5) + (addr & ~0xfffful) + 0x18;
> +
> +	*(vulp)addr = b;
> +}
> +
>   
>   __EXTERN_INLINE void __iomem *mcpcia_ioportmap(unsigned long addr)
>   {
> @@ -362,6 +383,7 @@ __EXTERN_INLINE int mcpcia_is_mmio(const volatile void __iomem *xaddr)
>   
>   #undef vip
>   #undef vuip
> +#undef vulp
>   
>   #undef __IO_PREFIX
>   #define __IO_PREFIX		mcpcia
> diff --git a/arch/alpha/include/asm/core_t2.h b/arch/alpha/include/asm/core_t2.h
> index 12bb7addc789..ab956b1625b5 100644
> --- a/arch/alpha/include/asm/core_t2.h
> +++ b/arch/alpha/include/asm/core_t2.h
> @@ -360,6 +360,7 @@ struct el_t2_frame_corrected {
>   
>   #define vip	volatile int *
>   #define vuip	volatile unsigned int *
> +#define vulp	volatile unsigned long *
>   
>   extern inline u8 t2_inb(unsigned long addr)
>   {
> @@ -402,6 +403,17 @@ extern inline void t2_outl(u32 b, unsigned long addr)
>   	mb();
>   }
>   
> +extern inline u64 t2_inq(unsigned long addr)
> +{
> +	return *(vulp) ((addr << 5) + T2_IO + 0x18);
> +}
> +
> +extern inline void t2_outq(u64 b, unsigned long addr)
> +{
> +	*(vulp) ((addr << 5) + T2_IO + 0x18) = b;
> +	mb();
> +}
> +
>   
>   /*
>    * Memory functions.
> @@ -572,7 +584,7 @@ __EXTERN_INLINE int t2_is_mmio(const volatile void __iomem *addr)
>      it doesn't make sense to merge the pio and mmio routines.  */
>   
>   #define IOPORT(OS, NS)							\
> -__EXTERN_INLINE unsigned int t2_ioread##NS(const void __iomem *xaddr)		\
> +__EXTERN_INLINE u##NS t2_ioread##NS(const void __iomem *xaddr)		\
>   {									\
>   	if (t2_is_mmio(xaddr))						\
>   		return t2_read##OS(xaddr);				\
> @@ -590,11 +602,13 @@ __EXTERN_INLINE void t2_iowrite##NS(u##NS b, void __iomem *xaddr)	\
>   IOPORT(b, 8)
>   IOPORT(w, 16)
>   IOPORT(l, 32)
> +IOPORT(q, 64)
>   
>   #undef IOPORT
>   
>   #undef vip
>   #undef vuip
> +#undef vulp
>   
>   #undef __IO_PREFIX
>   #define __IO_PREFIX		t2
> diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
> index a887628f2ea6..1c3605d874e9 100644
> --- a/arch/alpha/include/asm/io.h
> +++ b/arch/alpha/include/asm/io.h
> @@ -155,6 +155,7 @@ static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr)	\
>   REMAP1(unsigned int, ioread8, const)
>   REMAP1(unsigned int, ioread16, const)
>   REMAP1(unsigned int, ioread32, const)
> +REMAP1(u64, ioread64, const)
>   REMAP1(u8, readb, const volatile)
>   REMAP1(u16, readw, const volatile)
>   REMAP1(u32, readl, const volatile)
> @@ -163,6 +164,7 @@ REMAP1(u64, readq, const volatile)
>   REMAP2(u8, iowrite8, /**/)
>   REMAP2(u16, iowrite16, /**/)
>   REMAP2(u32, iowrite32, /**/)
> +REMAP2(u64, iowrite64, /**/)
>   REMAP2(u8, writeb, volatile)
>   REMAP2(u16, writew, volatile)
>   REMAP2(u32, writel, volatile)
> @@ -400,12 +402,27 @@ extern inline unsigned int ioread32(const void __iomem *addr)
>   	return ret;
>   }
>   
> +extern inline u64 ioread64(const void __iomem *addr)
> +{
> +	unsigned int ret;
> +	mb();
> +	ret = IO_CONCAT(__IO_PREFIX,ioread64)(addr);
> +	mb();
> +	return ret;
> +}
> +
>   extern inline void iowrite32(u32 b, void __iomem *addr)
>   {
>   	mb();
>   	IO_CONCAT(__IO_PREFIX, iowrite32)(b, addr);
>   }
>   
> +extern inline void iowrite64(u64 b, void __iomem *addr)
> +{
> +	mb();
> +	IO_CONCAT(__IO_PREFIX, iowrite64)(b, addr);
> +}
> +
>   extern inline u32 inl(unsigned long port)
>   {
>   	return ioread32(ioport_map(port, 4));
> @@ -418,7 +435,9 @@ extern inline void outl(u32 b, unsigned long port)
>   #endif
>   
>   #define ioread32 ioread32
> +#define ioread64 ioread64
>   #define iowrite32 iowrite32
> +#define iowrite64 iowrite64
>   
>   #if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1
>   extern inline u8 __raw_readb(const volatile void __iomem *addr)
> diff --git a/arch/alpha/include/asm/io_trivial.h b/arch/alpha/include/asm/io_trivial.h
> index a1a29cbe02fa..00032093bcfc 100644
> --- a/arch/alpha/include/asm/io_trivial.h
> +++ b/arch/alpha/include/asm/io_trivial.h
> @@ -6,13 +6,13 @@
>   /* This file may be included multiple times.  */
>   
>   #if IO_CONCAT(__IO_PREFIX,trivial_io_bw)
> -__EXTERN_INLINE unsigned int
> +__EXTERN_INLINE u8
>   IO_CONCAT(__IO_PREFIX,ioread8)(const void __iomem *a)
>   {
>   	return __kernel_ldbu(*(const volatile u8 __force *)a);
>   }
>   
> -__EXTERN_INLINE unsigned int
> +__EXTERN_INLINE u16
>   IO_CONCAT(__IO_PREFIX,ioread16)(const void __iomem *a)
>   {
>   	return __kernel_ldwu(*(const volatile u16 __force *)a);
> @@ -32,7 +32,7 @@ IO_CONCAT(__IO_PREFIX,iowrite16)(u16 b, void __iomem *a)
>   #endif
>   
>   #if IO_CONCAT(__IO_PREFIX,trivial_io_lq)
> -__EXTERN_INLINE unsigned int
> +__EXTERN_INLINE u32
>   IO_CONCAT(__IO_PREFIX,ioread32)(const void __iomem *a)
>   {
>   	return *(const volatile u32 __force *)a;
> @@ -43,6 +43,18 @@ IO_CONCAT(__IO_PREFIX,iowrite32)(u32 b, void __iomem *a)
>   {
>   	*(volatile u32 __force *)a = b;
>   }
> +
> +__EXTERN_INLINE u64
> +IO_CONCAT(__IO_PREFIX,ioread64)(const void __iomem *a)
> +{
> +	return *(const volatile u64 __force *)a;
> +}
> +
> +__EXTERN_INLINE void
> +IO_CONCAT(__IO_PREFIX,iowrite64)(u64 b, void __iomem *a)
> +{
> +	*(volatile u64 __force *)a = b;
> +}
>   #endif
>   
>   #if IO_CONCAT(__IO_PREFIX,trivial_rw_bw) == 1
> diff --git a/arch/alpha/include/asm/jensen.h b/arch/alpha/include/asm/jensen.h
> index 1c4131453db2..66eb049eb421 100644
> --- a/arch/alpha/include/asm/jensen.h
> +++ b/arch/alpha/include/asm/jensen.h
> @@ -98,6 +98,7 @@ __EXTERN_INLINE void jensen_set_hae(unsigned long addr)
>   }
>   
>   #define vuip	volatile unsigned int *
> +#define vulp	volatile unsigned long *
>   
>   /*
>    * IO functions
> @@ -183,6 +184,12 @@ __EXTERN_INLINE u32 jensen_inl(unsigned long addr)
>   	return *(vuip) ((addr << 7) + EISA_IO + 0x60);
>   }
>   
> +__EXTERN_INLINE u64 jensen_inq(unsigned long addr)
> +{
> +	jensen_set_hae(0);
> +	return *(vulp) ((addr << 7) + EISA_IO + 0x60);
> +}
> +
>   __EXTERN_INLINE void jensen_outw(u16 b, unsigned long addr)
>   {
>   	jensen_set_hae(0);
> @@ -197,6 +204,13 @@ __EXTERN_INLINE void jensen_outl(u32 b, unsigned long addr)
>   	mb();
>   }
>   
> +__EXTERN_INLINE void jensen_outq(u64 b, unsigned long addr)
> +{
> +	jensen_set_hae(0);
> +	*(vulp) ((addr << 7) + EISA_IO + 0x60) = b;
> +	mb();
> +}
> +
>   /*
>    * Memory functions.
>    */
> @@ -305,7 +319,7 @@ __EXTERN_INLINE int jensen_is_mmio(const volatile void __iomem *addr)
>      that it doesn't make sense to merge them.  */
>   
>   #define IOPORT(OS, NS)							\
> -__EXTERN_INLINE unsigned int jensen_ioread##NS(const void __iomem *xaddr)	\
> +__EXTERN_INLINE u##NS jensen_ioread##NS(const void __iomem *xaddr)	\
>   {									\
>   	if (jensen_is_mmio(xaddr))					\
>   		return jensen_read##OS(xaddr - 0x100000000ul);		\
> @@ -323,10 +337,12 @@ __EXTERN_INLINE void jensen_iowrite##NS(u##NS b, void __iomem *xaddr)	\
>   IOPORT(b, 8)
>   IOPORT(w, 16)
>   IOPORT(l, 32)
> +IOPORT(q, 64)
>   
>   #undef IOPORT
>   
>   #undef vuip
> +#undef vulp
>   
>   #undef __IO_PREFIX
>   #define __IO_PREFIX		jensen
> diff --git a/arch/alpha/include/asm/machvec.h b/arch/alpha/include/asm/machvec.h
> index e49fabce7b33..8623f995d34c 100644
> --- a/arch/alpha/include/asm/machvec.h
> +++ b/arch/alpha/include/asm/machvec.h
> @@ -46,13 +46,15 @@ struct alpha_machine_vector
>   	void (*mv_pci_tbi)(struct pci_controller *hose,
>   			   dma_addr_t start, dma_addr_t end);
>   
> -	unsigned int (*mv_ioread8)(const void __iomem *);
> -	unsigned int (*mv_ioread16)(const void __iomem *);
> -	unsigned int (*mv_ioread32)(const void __iomem *);
> +	u8 (*mv_ioread8)(const void __iomem *);
> +	u16 (*mv_ioread16)(const void __iomem *);
> +	u32 (*mv_ioread32)(const void __iomem *);
> +	u64 (*mv_ioread64)(const void __iomem *);
>   
>   	void (*mv_iowrite8)(u8, void __iomem *);
>   	void (*mv_iowrite16)(u16, void __iomem *);
>   	void (*mv_iowrite32)(u32, void __iomem *);
> +	void (*mv_iowrite64)(u64, void __iomem *);
>   
>   	u8 (*mv_readb)(const volatile void __iomem *);
>   	u16 (*mv_readw)(const volatile void __iomem *);
> diff --git a/arch/alpha/kernel/io.c b/arch/alpha/kernel/io.c
> index 838586abb1e0..eda09778268f 100644
> --- a/arch/alpha/kernel/io.c
> +++ b/arch/alpha/kernel/io.c
> @@ -41,6 +41,15 @@ unsigned int ioread32(const void __iomem *addr)
>   	return ret;
>   }
>   
> +u64 ioread64(const void __iomem *addr)
> +{
> +	unsigned int ret;
> +	mb();
> +	ret = IO_CONCAT(__IO_PREFIX,ioread64)(addr);
> +	mb();
> +	return ret;
> +}
> +
>   void iowrite8(u8 b, void __iomem *addr)
>   {
>   	mb();
> @@ -59,12 +68,20 @@ void iowrite32(u32 b, void __iomem *addr)
>   	IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr);
>   }
>   
> +void iowrite64(u64 b, void __iomem *addr)
> +{
> +	mb();
> +	IO_CONCAT(__IO_PREFIX,iowrite64)(b, addr);
> +}
> +
>   EXPORT_SYMBOL(ioread8);
>   EXPORT_SYMBOL(ioread16);
>   EXPORT_SYMBOL(ioread32);
> +EXPORT_SYMBOL(ioread64);
>   EXPORT_SYMBOL(iowrite8);
>   EXPORT_SYMBOL(iowrite16);
>   EXPORT_SYMBOL(iowrite32);
> +EXPORT_SYMBOL(iowrite64);
>   
>   u8 inb(unsigned long port)
>   {
> diff --git a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h
> index 393d5d6ca5d2..c2ebcb39e589 100644
> --- a/arch/alpha/kernel/machvec_impl.h
> +++ b/arch/alpha/kernel/machvec_impl.h
> @@ -78,9 +78,11 @@
>   	.mv_ioread8 =		CAT(low,_ioread8),			\
>   	.mv_ioread16 =		CAT(low,_ioread16),			\
>   	.mv_ioread32 =		CAT(low,_ioread32),			\
> +	.mv_ioread64 =		CAT(low,_ioread64),			\
>   	.mv_iowrite8 =		CAT(low,_iowrite8),			\
>   	.mv_iowrite16 =		CAT(low,_iowrite16),			\
>   	.mv_iowrite32 =		CAT(low,_iowrite32),			\
> +	.mv_iowrite64 =		CAT(low,_iowrite64),			\
>   	.mv_readb =		CAT(low,_readb),			\
>   	.mv_readw =		CAT(low,_readw),			\
>   	.mv_readl =		CAT(low,_readl),			\


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-10-03 13:03   ` Arnd Bergmann
  2022-10-03 15:07     ` Guenter Roeck
@ 2022-10-03 18:49     ` Linus Walleij
  2022-10-04 19:42     ` Guenter Roeck
  2 siblings, 0 replies; 14+ messages in thread
From: Linus Walleij @ 2022-10-03 18:49 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Guenter Roeck, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	linux-alpha, kernel test robot, Mark Brown, Linux-Arch

On Mon, Oct 3, 2022 at 3:04 PM Arnd Bergmann <arnd@arndb.de> wrote:

> From 258382f3ca77b0e50501a0010d8c9abc2d4c51c8 Mon Sep 17 00:00:00 2001
> From: Arnd Bergmann <arnd@arndb.de>
> Date: Mon, 3 Oct 2022 13:12:54 +0200
> Subject: [PATCH] alpha: add full ioread64/iowrite64 implementation
>
> The previous patch introduced ioread64/iowrite64 declarations, but
> this means we no longer get the io-64-nonatomic variant, and
> run into a long error when someone actually wants to use these:
>
> ERROR: modpost: "ioread64" [drivers/net/ethernet/freescale/enetc/fsl-enetc.ko] undefined!
>
> Add the (hopefully) correct implementation for each machine type,
> based on the 32-bit accessor. Since the 32-bit return type does
> not work for ioread64(), change the internal implementation to use
> the correct width consistently, but leave the external interface
> to match the asm-generic/iomap.h header that uses 32-bit or 64-bit
> return values.
>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Fixes: 7e772dad9913 ("alpha: Use generic <asm-generic/io.h>")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

This patch was really sweet for Alpha, it makes all of the code
more complete and consistent.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-10-03 13:03   ` Arnd Bergmann
  2022-10-03 15:07     ` Guenter Roeck
  2022-10-03 18:49     ` Linus Walleij
@ 2022-10-04 19:42     ` Guenter Roeck
  2022-10-04 20:28       ` Arnd Bergmann
  2 siblings, 1 reply; 14+ messages in thread
From: Guenter Roeck @ 2022-10-04 19:42 UTC (permalink / raw)
  To: Arnd Bergmann, Linus Walleij
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, linux-alpha,
	kernel test robot, Mark Brown, Linux-Arch

On 10/3/22 06:03, Arnd Bergmann wrote:
> On Mon, Oct 3, 2022, at 12:45 AM, Guenter Roeck wrote:
> 
>>>
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Link: https://lore.kernel.org/linux-mm/202208181447.G9FLcMkI-lkp@intel.com/
>>> Cc: Mark Brown <broonie@kernel.org>
>>> Cc: Arnd Bergmann <arnd@arndb.de>
>>> Cc: Richard Henderson <richard.henderson@linaro.org>
>>> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
>>> Cc: Matt Turner <mattst88@gmail.com>
>>> Cc: linux-arch@vger.kernel.org
>>> Cc: linux-alpha@vger.kernel.org
>>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
>>
>> This patch results in the following build errors when trying to build
>> alpha:allmodconfig.
>>
>> ERROR: modpost: "ioread64" [drivers/pci/switch/switchtec.ko] undefined!
>> ERROR: modpost: "ioread64"
>> [drivers/net/ethernet/freescale/enetc/fsl-enetc.ko] undefined!
>> ERROR: modpost: "ioread64"
>> [drivers/net/ethernet/freescale/enetc/fsl-enetc-vf.ko] undefined!
>> ERROR: modpost: "iowrite64"
>> [drivers/net/ethernet/xilinx/xilinx_emac.ko] undefined!
>> ERROR: modpost: "iowrite64" [drivers/net/wwan/t7xx/mtk_t7xx.ko]
>> undefined!
>> ERROR: modpost: "ioread64" [drivers/net/wwan/t7xx/mtk_t7xx.ko]
>> undefined!
>> ERROR: modpost: "iowrite64" [drivers/firmware/arm_scmi/scmi-module.ko]
>> undefined!
>> ERROR: modpost: "ioread64" [drivers/firmware/arm_scmi/scmi-module.ko]
>> undefined!
>> ERROR: modpost: "iowrite64" [drivers/vfio/pci/vfio-pci-core.ko]
>> undefined!
>> ERROR: modpost: "ioread64" [drivers/ntb/hw/mscc/ntb_hw_switchtec.ko]
>> undefined!
>>
>> Reverting it doesn't help because that just reintroduces the problem
>> that was supposed to be fixed by this patch.
> 
> Thanks for the report, I've now added this patch on top.
> 
> Matt, can you take a look if this look correct?
> 

Looks like something was missed. When building alpha:allnoconfig
in next-20221004:

Building alpha:allnoconfig ... failed
--------------
Error log:
<stdin>:1517:2: warning: #warning syscall clone3 not implemented [-Wcpp]
arch/alpha/kernel/core_marvel.c:807:1: error: conflicting types for 'marvel_ioread8'; have 'unsigned int(const void *)'
   807 | marvel_ioread8(const void __iomem *xaddr)
       | ^~~~~~~~~~~~~~
In file included from arch/alpha/kernel/core_marvel.c:10:
arch/alpha/include/asm/core_marvel.h:335:11: note: previous declaration of 'marvel_ioread8' with type 'u8(const void *)' {aka 'unsigned char(const void *)'}
   335 | extern u8 marvel_ioread8(const void __iomem *);
       |           ^~~~~~~~~~~~~~

Guenter

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-10-04 19:42     ` Guenter Roeck
@ 2022-10-04 20:28       ` Arnd Bergmann
  2022-10-12 14:05         ` Guenter Roeck
  0 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2022-10-04 20:28 UTC (permalink / raw)
  To: Guenter Roeck, Linus Walleij
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, linux-alpha,
	kernel test robot, Mark Brown, Linux-Arch

On Tue, Oct 4, 2022, at 9:42 PM, Guenter Roeck wrote:
> On 10/3/22 06:03, Arnd Bergmann wrote:
>> On Mon, Oct 3, 2022, at 12:45 AM, Guenter Roeck wrote:
>
> Looks like something was missed. When building alpha:allnoconfig
> in next-20221004:
>
> Building alpha:allnoconfig ... failed
> --------------
> Error log:
> <stdin>:1517:2: warning: #warning syscall clone3 not implemented [-Wcpp]
> arch/alpha/kernel/core_marvel.c:807:1: error: conflicting types for 
> 'marvel_ioread8'; have 'unsigned int(const void *)'
>    807 | marvel_ioread8(const void __iomem *xaddr)
>        | ^~~~~~~~~~~~~~
> In file included from arch/alpha/kernel/core_marvel.c:10:
> arch/alpha/include/asm/core_marvel.h:335:11: note: previous declaration 
> of 'marvel_ioread8' with type 'u8(const void *)' {aka 'unsigned 
> char(const void *)'}
>    335 | extern u8 marvel_ioread8(const void __iomem *);
>        |           ^~~~~~~~~~~~~~

Right, I already noticed this and uploaded a fixed branch earlier today.
Should be ok tomorrow.

     Arnd

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-10-04 20:28       ` Arnd Bergmann
@ 2022-10-12 14:05         ` Guenter Roeck
  2022-10-12 15:32           ` Arnd Bergmann
  0 siblings, 1 reply; 14+ messages in thread
From: Guenter Roeck @ 2022-10-12 14:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	linux-alpha, kernel test robot, Mark Brown, Linux-Arch,
	regressions

On Tue, Oct 04, 2022 at 10:28:24PM +0200, Arnd Bergmann wrote:
> On Tue, Oct 4, 2022, at 9:42 PM, Guenter Roeck wrote:
> > On 10/3/22 06:03, Arnd Bergmann wrote:
> >> On Mon, Oct 3, 2022, at 12:45 AM, Guenter Roeck wrote:
> >
> > Looks like something was missed. When building alpha:allnoconfig
> > in next-20221004:
> >
> > Building alpha:allnoconfig ... failed
> > --------------
> > Error log:
> > <stdin>:1517:2: warning: #warning syscall clone3 not implemented [-Wcpp]
> > arch/alpha/kernel/core_marvel.c:807:1: error: conflicting types for 
> > 'marvel_ioread8'; have 'unsigned int(const void *)'
> >    807 | marvel_ioread8(const void __iomem *xaddr)
> >        | ^~~~~~~~~~~~~~
> > In file included from arch/alpha/kernel/core_marvel.c:10:
> > arch/alpha/include/asm/core_marvel.h:335:11: note: previous declaration 
> > of 'marvel_ioread8' with type 'u8(const void *)' {aka 'unsigned 
> > char(const void *)'}
> >    335 | extern u8 marvel_ioread8(const void __iomem *);
> >        |           ^~~~~~~~~~~~~~
> 
> Right, I already noticed this and uploaded a fixed branch earlier today.
> Should be ok tomorrow.
> 

Unfortunately that did not completely fix the problem, or maybe the fix got
lost. In mainline, when building alpha:allnoconfig:

arch/alpha/kernel/core_marvel.c:807:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'marvel_ioread8'
  807 | marvel_ioread8(const void __iomem *xaddr)

The code is:

unsigned u8
marvel_ioread8(const void __iomem *xaddr)

The compiler doesn't like "unsigned u8".

#regzbot ^introduced: e19d4ebc536d
#regzbot title: alpha:allnoconfig fails to build
#regzbot monitor: https://lore.kernel.org/linux-arch/202210062117.wJypzBWL-lkp@intel.com/

Guenter

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h>
  2022-10-12 14:05         ` Guenter Roeck
@ 2022-10-12 15:32           ` Arnd Bergmann
  2022-10-13 12:36             ` [PATCH] alpha: Use generic <asm-generic/io.h> #forregzbot Thorsten Leemhuis
  0 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2022-10-12 15:32 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Linus Walleij, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	linux-alpha, kernel test robot, Mark Brown, Linux-Arch,
	regressions

On Wed, Oct 12, 2022, at 4:05 PM, Guenter Roeck wrote:
> On Tue, Oct 04, 2022 at 10:28:24PM +0200, Arnd Bergmann wrote:
>> On Tue, Oct 4, 2022, at 9:42 PM, Guenter Roeck wrote:
>> > On 10/3/22 06:03, Arnd Bergmann wrote:
>> >> On Mon, Oct 3, 2022, at 12:45 AM, Guenter Roeck wrote:
>> >
>> > Looks like something was missed. When building alpha:allnoconfig
>> > in next-20221004:
>> >
>> > Building alpha:allnoconfig ... failed
>> > --------------
>> > Error log:
>> > <stdin>:1517:2: warning: #warning syscall clone3 not implemented [-Wcpp]
>> > arch/alpha/kernel/core_marvel.c:807:1: error: conflicting types for 
>> > 'marvel_ioread8'; have 'unsigned int(const void *)'
>> >    807 | marvel_ioread8(const void __iomem *xaddr)
>> >        | ^~~~~~~~~~~~~~
>> > In file included from arch/alpha/kernel/core_marvel.c:10:
>> > arch/alpha/include/asm/core_marvel.h:335:11: note: previous declaration 
>> > of 'marvel_ioread8' with type 'u8(const void *)' {aka 'unsigned 
>> > char(const void *)'}
>> >    335 | extern u8 marvel_ioread8(const void __iomem *);
>> >        |           ^~~~~~~~~~~~~~
>> 
>> Right, I already noticed this and uploaded a fixed branch earlier today.
>> Should be ok tomorrow.
>> 
>
> Unfortunately that did not completely fix the problem, or maybe the fix got
> lost. In mainline, when building alpha:allnoconfig:
>
> arch/alpha/kernel/core_marvel.c:807:1: error: expected '=', ',', ';', 
> 'asm' or '__attribute__' before 'marvel_ioread8'
>   807 | marvel_ioread8(const void __iomem *xaddr)
>
> The code is:
>
> unsigned u8
> marvel_ioread8(const void __iomem *xaddr)
>
> The compiler doesn't like "unsigned u8".

Right, I fixed up a different bug and introduced this wrong type.
I didn't catch my mistake until after the pull request was
merged, but fixed it in

https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git/commit/?id=2e21c1575208

which should be in linux-next. I was giving it a little more
time to be see if there are any other regressions I caused.

     Arnd

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] alpha: Use generic <asm-generic/io.h> #forregzbot
  2022-10-12 15:32           ` Arnd Bergmann
@ 2022-10-13 12:36             ` Thorsten Leemhuis
  0 siblings, 0 replies; 14+ messages in thread
From: Thorsten Leemhuis @ 2022-10-13 12:36 UTC (permalink / raw)
  To: regressions, Guenter Roeck; +Cc: linux-alpha, kernel test robot, Linux-Arch

[Note: this mail is primarily send for documentation purposes and/or for
regzbot, my Linux kernel regression tracking bot. That's why I removed
most or all folks from the list of recipients, but left any that looked
like a mailing lists. These mails usually contain '#forregzbot' in the
subject, to make them easy to spot and filter out.]

On 12.10.22 17:32, Arnd Bergmann wrote:
> On Wed, Oct 12, 2022, at 4:05 PM, Guenter Roeck wrote:
>> On Tue, Oct 04, 2022 at 10:28:24PM +0200, Arnd Bergmann wrote:
>> Unfortunately that did not completely fix the problem, or maybe the fix got
>> lost. In mainline, when building alpha:allnoconfig:
>>
>> arch/alpha/kernel/core_marvel.c:807:1: error: expected '=', ',', ';', 
>> 'asm' or '__attribute__' before 'marvel_ioread8'
>>   807 | marvel_ioread8(const void __iomem *xaddr)
>>
>> The code is:
>>
>> unsigned u8
>> marvel_ioread8(const void __iomem *xaddr)
>>
>> The compiler doesn't like "unsigned u8".
> 
> Right, I fixed up a different bug and introduced this wrong type.
> I didn't catch my mistake until after the pull request was
> merged, but fixed it in
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git/commit/?id=2e21c1575208
> 
> which should be in linux-next. I was giving it a little more
> time to be see if there are any other regressions I caused.

In that case:

#regzbot fixed-by: 2e21c157520

Ciao, Thorsten

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-10-13 12:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-18  9:20 [PATCH] alpha: Use generic <asm-generic/io.h> Linus Walleij
2022-08-18 10:28 ` Arnd Bergmann
2022-09-05 19:30   ` Linus Walleij
2022-09-05 20:52     ` Arnd Bergmann
2022-09-06 14:59       ` Matt Turner
2022-10-02 22:45 ` Guenter Roeck
2022-10-03 13:03   ` Arnd Bergmann
2022-10-03 15:07     ` Guenter Roeck
2022-10-03 18:49     ` Linus Walleij
2022-10-04 19:42     ` Guenter Roeck
2022-10-04 20:28       ` Arnd Bergmann
2022-10-12 14:05         ` Guenter Roeck
2022-10-12 15:32           ` Arnd Bergmann
2022-10-13 12:36             ` [PATCH] alpha: Use generic <asm-generic/io.h> #forregzbot Thorsten Leemhuis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.