summaryrefslogtreecommitdiffstats
path: root/drivers/parisc
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2022-09-04 00:45:25 +0200
committerArnd Bergmann <arnd@arndb.de>2022-09-10 09:55:55 +0200
commit77bfc8bdb5a1cdbcea21daccdf1686e1bfea3db6 (patch)
tree12b2dffc8c73c6444a0b1a7ab8f8b60a6ae9c606 /drivers/parisc
parentsparc: Fix the generic IO helpers (diff)
downloadlinux-77bfc8bdb5a1cdbcea21daccdf1686e1bfea3db6.tar.xz
linux-77bfc8bdb5a1cdbcea21daccdf1686e1bfea3db6.zip
parisc: Remove 64bit access on 32bit machines
The parisc was using some readq/writeq accessors without special considerations as to what will happen on 32bit CPUs if you do this. Maybe we have been lucky that it "just worked" on 32bit due to the compiler behaviour, or the code paths were never executed. Fix the two offending code sites like this: arch/parisc/lib/iomap.c: - Put ifdefs around the 64bit accessors and make sure that ioread64, ioread64be, iowrite64 and iowrite64be are not available on 32bit builds. - Also fold in a bug fix where 64bit access was by mistake using 32bit writel() accessors rather than 64bit writeq(). drivers/parisc/sba_iommu.c: - Access any 64bit registers using _lo_hi-semantics by way of the readq and writeq operations provided by <linux/io-64-nonatomic-lo-hi.h> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com> Cc: Helge Deller <deller@gmx.de> Cc: linux-parisc@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: Arnd Bergmann <arnd@arndb.de> Cc: John David Anglin <dave.anglin@bell.net> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/parisc')
-rw-r--r--drivers/parisc/sba_iommu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 374b9199878d..ecd870087a3d 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -28,6 +28,12 @@
#include <linux/dma-map-ops.h>
#include <linux/scatterlist.h>
#include <linux/iommu-helper.h>
+/*
+ * The semantics of 64 register access on 32bit systems can't be guaranteed
+ * by the C standard, we hope the _lo_hi() macros defining readq and writeq
+ * here will behave as expected.
+ */
+#include <linux/io-64-nonatomic-lo-hi.h>
#include <asm/byteorder.h>
#include <asm/io.h>