From patchwork Sun Sep 2 11:30:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darren Stevens X-Patchwork-Id: 965082 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 423CDV5Y8qz9ryt for ; Sun, 2 Sep 2018 22:32:58 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=stevens-zone.net Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 423CDV3TBczF3Bk for ; Sun, 2 Sep 2018 22:32:58 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=stevens-zone.net X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=stevens-zone.net (client-ip=212.227.126.130; helo=mout.kundenserver.de; envelope-from=darren@stevens-zone.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=stevens-zone.net Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 423CBT2WYgzF39r for ; Sun, 2 Sep 2018 22:31:10 +1000 (AEST) Received: from mintppc.home ([86.171.142.179]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.163]) with ESMTPA (Nemesis) id 0MTcE0-1gMo7O1gmW-00QRDE; Sun, 02 Sep 2018 14:30:58 +0200 From: Darren Stevens To: linuxppc-dev@lists.ozlabs.org, Christian Zigotzky , Julian Margetson , Scott Wood Date: Sun, 02 Sep 2018 12:30:34 +0100 (BST) Message-ID: <4c7f98c86ad.343ea8c1@auth.smtp.1and1.co.uk> User-Agent: YAM/2.9p1 (AmigaOS4; PPC; rv:20140418r7798) Subject: [PATCH RFC] powerpc/kernel: Don't check for dev->dma_mask in fsl_set_dma_mask MIME-Version: 1.0 Content-type: multipart/mixed; boundary="--=_BOUNDARY.6cc13ac07145c3fc.a7" X-Provags-ID: V03:K1:7cx7/yvGTrvpNPfrUmvKHbeNJlqJxIY1vgDhH8bmpEkH92USNKB nkZ3qIp3hLKZW3FcEBMyH0WPV/QhbGnW/6UpKf8qOjB/oKxpveb3wCU/TcwS1qdvi9ITBoe LeSL1AwM90s2fI3dbbd2mo5MWxLdrUIZ8AYy6wdI7NWkaa3yRXjTOs3wS6Jn+8F20idHlgC 8sRf40ObxT+jii8jmiMfg== X-UI-Out-Filterresults: notjunk:1; V01:K0:31Mi90V+DRI=:yVqBWe6LqgH0MEWhHDBR2Z vVwhL6XUAPRP2KLJBlrspIXoZDMl26Sotcnjf58BONxf3BhOZDMuLEgvZL+2FRAzvpOSqR2jm qKbIfqpREDZ+Ju1ww7uKa3HinTJ7Y4Q+1OwfjVmCa/4KFhqFqVcCjyni7+XWBZyyyXQT73RDH 7ge5Q3J4z4/ZdeNu2pqJo37HZdbAi7AJx4xCLVVVmIVKw+LeBMV0e6X1IflkgShJMmUdlP7UJ M/3z2vMBf75UvUOa/iNBRuUCh/J/NWB94HecCVimxFJP1cKx7gSmAC4emnWRJU41Lf+cQwZbq EKlwLrdrxMV4CIoaUtlP0COMcTMTug76oqDBfnJNKsIBPoab95PSeey2aj0lX6//NKxHzNLe4 23THoSve+sa86yLrHgOsK7wisa4rWavqb72yBwye8ds3DJQCOMLJaggmnxoe2kRQ0TSSOA7f4 J2J6ImibsPBC0SCjE76sRYB9h1MMtbcZCRajw09tCnx0T0k5LTmdD5hmeXgSRKySQ9U69UBmK ON1lu1xORdTYhHrCn5t8OMTD/jXIBk5qGZrVonkmtUoFsdhNqTGhyAqFkroRnZyxhgG37Tc3m PHXzXgc8WJOrvI6f5Fvdx/Wi/bj6dau6Lg2X/wlnmjPHeIm3FLMx/4j4+4QLeyESX2UfA/VpB QKfKE5IlX/sNRVxp7gOt4Oa35tLrOHF9Qfjc+9rcZ+r8F2yrH/98QJcQBZRtPM/ffu10= X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" To enable use of dma to all ram on a corenet generic system, we add the function fsl_pci_dma_set_mask, and link it into the ppc.md structure. But this function checks for the presence of dev->dma_mask and dma_ops at entry, and fails if one or other are missing. Powerpc's dma_set_mask (which it is called from) doesn't check this until after it has set the dma_mask for pci devs, this difference shows up on a Cyrus (AmigaOne X5000) - a soundblaster live pci card, will works properly if memory is limited to <4G, but fail on probe with the following message if the memory is >=4G [ 4.646531] snd_emu10k1 1000:04:04.0: architecture does not support PCI busmaster DMA with mask 0x7fffffff Remove the dev->mask tests to make the routines behave similarly. Signed-off-by: Darren Stevens --- This fix looks wrong to me, although it works. The test needs to be removed, moving it to the end of the function doesn't work either. This needs someone with more knowledge of what's going on to take a look. diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 918be81..36b3c86 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -127,9 +127,6 @@ static inline void setup_swiotlb_ops(struct pci_controller *hose) {} static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask) { - if (!dev->dma_mask || !dma_supported(dev, dma_mask)) - return -EIO; - /* * Fix up PCI devices that are able to DMA to the large inbound * mapping that allows addressing any RAM address from across PCI.