lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191018154201.1276638-43-arnd@arndb.de>
Date:   Fri, 18 Oct 2019 17:41:58 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Daniel Mack <daniel@...que.org>,
        Haojian Zhuang <haojian.zhuang@...il.com>,
        Robert Jarzmik <robert.jarzmik@...e.fr>
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Linus Walleij <linus.walleij@...aro.org>,
        Arnd Bergmann <arnd@...db.de>
Subject: [PATCH 43/46] ARM: pxa: pci-it8152: add platform checks

The it8152 driver does a few things differently from
everyone else. Make sure that these have no effect when
running on anything other than a pxa2xx.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 arch/arm/mach-pxa/pci-it8152.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-pxa/pci-it8152.c b/arch/arm/mach-pxa/pci-it8152.c
index af99c990f0c1..fe8cf7d2234d 100644
--- a/arch/arm/mach-pxa/pci-it8152.c
+++ b/arch/arm/mach-pxa/pci-it8152.c
@@ -23,6 +23,7 @@
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/export.h>
+#include <linux/soc/pxa/cpu.h>
 
 #include <asm/mach/pci.h>
 
@@ -274,10 +275,21 @@ static int it8152_pci_platform_notify_remove(struct device *dev)
 
 int dma_set_coherent_mask(struct device *dev, u64 mask)
 {
-	if (mask >= PHYS_OFFSET + SZ_64M - 1)
-		return 0;
+	/* We've always done it like this, but it looks wrong */
+	if (cpu_is_pxa2xx()) {
+		if (mask >= PHYS_OFFSET + SZ_64M - 1)
+			return 0;
 
-	return -EIO;
+		return -EIO;
+	}
+
+	/* generic implementation from kernel/dma/mapping.c */
+	mask = (dma_addr_t)mask;
+	if (!dma_supported(dev, mask))
+		return -EIO;
+
+	dev->coherent_dma_mask = mask;
+	return 0;
 }
 
 int __init it8152_pci_setup(int nr, struct pci_sys_data *sys)
@@ -331,6 +343,10 @@ void pcibios_set_master(struct pci_dev *dev)
 {
 	u8 lat;
 
+	/* running on something else */
+	if (!cpu_is_pxa2xx())
+		return;
+
 	/* no need to update on-chip OHCI controller */
 	if ((dev->vendor == PCI_VENDOR_ID_ITE) &&
 	    (dev->device == PCI_DEVICE_ID_ITE_8152) &&
-- 
2.20.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ