Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1688284ybn; Thu, 26 Sep 2019 00:12:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiEtQ6Sw5jGVwrtENLr+/s0mZ1lUqs+9h0A3XvHXZJGxpJA16ADicOYUdsIMujhzmiLwZw X-Received: by 2002:a50:d084:: with SMTP id v4mr2047912edd.48.1569481921432; Thu, 26 Sep 2019 00:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569481921; cv=none; d=google.com; s=arc-20160816; b=dTlg3VAF+Clrc1w4t9wKwfp3CS5lUrursGIAVET/TsiPnisga0M7CLj8oLfMHJyHXE y7glD/3d7hX52gV396blqdJ5cAiwd2cBTEAJ0BYZ8HIVkHFOD8EdhrJYosu93g0nlUmx FdZ8iWAiQ8hlo++G20EpWU/cfYPaTO/LFS4OVCSm4uCsKkgS03dmwviejGMr8yJZ/zBe YyaN3o6N00ulPRJIwNaeUiniDYpjkzHG0OBg2swTkxFAfBWmITiUzGMOb4pAL5a1XMmC ks5J0PR8MDubipgtpuoPmkTA3knUAvzdeCqiWwhElhVIygkGZR5Oj0vlV7RLQqgh59fz Gj3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:dkim-signature; bh=7Wft7DkpADyBZ4LFMIABklZBdQvK59L+tKGaHFUtZgc=; b=mkltAm1vnUz+Wb+H2MEyLfRnX2zlb0iI7D+UgWqDVDkwsgZy2cjmPAXJLcteaVD5k4 6L4o8Zk6CcJOSuaHF2xD6Fw+cpIldPr+c8FiHROjwdyQ+QKojTNihU1JVWYjTMV03jvP tfYoy9MNfZHmV/mTbaKxubeZgQOMNswte4f4M+URmmotSQP0DaUsrrKx6B6QV+HRz47h 4ACmofeJ815cC1VgS6SA6ovaFaNqizPJE6FAo3E+G694ZBoviw6OYSKZV+NIorfj3lOW JIi3aCYTtpZ4SLWomouve5M1rSjYGkT61DN8j1tPb3OfVhP5gyiMqzR8JVlfFDMK1lNC OzEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=cmN5Vtc7; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=ozI6fWgx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3si774317edq.163.2019.09.26.00.11.37; Thu, 26 Sep 2019 00:12:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=cmN5Vtc7; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=ozI6fWgx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503696AbfIXA77 (ORCPT + 99 others); Mon, 23 Sep 2019 20:59:59 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:55368 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503497AbfIXA77 (ORCPT ); Mon, 23 Sep 2019 20:59:59 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 1F43B8EE175; Mon, 23 Sep 2019 17:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1569286799; bh=PMEg8ieV56yiI9Zsc7N2G24OJU6ZZnC2v4ENnREABOE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=cmN5Vtc7t+RR2IluXJ036tHvzf+G5W2bBnDCVxOoZub7O1syGDdSMSgeSdkCG32w4 p+4HIA7CY6w5MFkqWkBpXkKUxs2MUEAENMNZz/ZKPmgk3nT87aUFCUWWYJ5XKEIR0S zbDkMxW4QSLWCdrulTXFuLRitdX2N5zFd5RLZBYQ= Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B0eV4ZDqEney; Mon, 23 Sep 2019 17:59:55 -0700 (PDT) Received: from [172.19.130.119] (unknown [8.46.76.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 759C28EE02B; Mon, 23 Sep 2019 17:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1569286794; bh=PMEg8ieV56yiI9Zsc7N2G24OJU6ZZnC2v4ENnREABOE=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ozI6fWgxMgG6Z1epxX+PIvJT6RIFYI0DyVT24F6P579fPsAe5K2BL7XYZpeWKvHfT tGT6BURQ1PDv2CX3SA2A3SwSLu+3xxvMYlGfa77D35c2PCTkJkGVTpK1ab9nKJVfv2 +c22yfTVmBxRQ6fpkYp5t6b/DQaTLyP1b++ajWFs= Message-ID: <1569286782.3657.29.camel@HansenPartnership.com> Subject: Re: allow larger than require DMA masks From: James Bottomley To: Sven Schnelle , Christoph Hellwig Cc: Helge Deller , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 23 Sep 2019 20:59:42 -0400 In-Reply-To: <20190923211415.GA1875@stackframe.org> References: <20190215144559.8777-1-hch@lst.de> <20190923211415.GA1875@stackframe.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-09-23 at 23:14 +0200, Sven Schnelle wrote: > Hi, > > On Fri, Feb 15, 2019 at 03:45:54PM +0100, Christoph Hellwig wrote: > > Hi all, > > > > this series finishes off converting our dma mask model to split > > between device capabilities (dev->dma_mask and dev- > > >coherent_dma_mask) and system limitations (dev->bus_dma_mask). We > > already accept larger than required masks in most dma_map_ops > > implementation, in case of x86 and implementations based on it > > since the dawn of time. Only one parisc and two sparc64 instances > > failed larger than required DMA masks, and this series fixes that > > up and updates the documentation that devices don't need to handle > > DMA mask fallbacks. > > > > I just tried latest linux-5.4 git on my hp c8000 (parisc), and got > the following > error: > > [ 27.246866] sata_sil24 0000:00:01.0: Applying completion IRQ loss > on PCI-X errata fix > [ 27.336968] sata_sil24 0000:00:01.0: DMA enable failed > [ 27.476922] sata_sil24: probe of 0000:00:01.0 failed with error -5 > > This is caused by commit dcc02c19cc06bd7bc1b6db0aa0087a2b6eb05b94: > Author: Christoph Hellwig > Date: Mon Aug 26 12:57:24 2019 +0200 > > sata_sil24: use dma_set_mask_and_coherent > > Use the dma_set_mask_and_coherent helper to set the DMA mask. > Rely > on the relatively recent change that setting a larger than > required > mask will never fail to avoid the need for the boilerplate 32-bit > fallback code. > > Signed-off-by: Christoph Hellwig > Signed-off-by: Jens Axboe > > However, the real problem seems to be in sba_dma_supported(): > > » /* Documentation/DMA-API-HOWTO.txt tells drivers to try > » * first, then fall back to 32-bit if that fails. > » * We are just "encouraging" 32-bit DMA masks here since we > can > » * never allow IOMMU bypass unless we add special support for > ZX1. > » */ > if (mask > ~0U) > » » return 0; > > Removing the if() makes the DMA mapping work. It's almost midnight > here, so i won't look into that any further today. Does anyone have > an opinion on this behaviour? Otherwise i will look a bit more into > this in the next days. The reason for the if was to kick the device into 32 bit descriptors, which are usually more efficient, especially with older dual descriptor format cards like we have on parisc systems. Nothing should go wrong if we don't fail the larger mask request except that the card uses the inefficient descriptors whereas we'll only supply it with 32 bit addresses. James