From patchwork Tue May 12 23:24:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian King X-Patchwork-Id: 6392681 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EC1B8BEEE1 for ; Tue, 12 May 2015 23:24:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F2D8D203FB for ; Tue, 12 May 2015 23:24:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5E42203EB for ; Tue, 12 May 2015 23:24:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933932AbbELXYu (ORCPT ); Tue, 12 May 2015 19:24:50 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:37024 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964961AbbELXYu (ORCPT ); Tue, 12 May 2015 19:24:50 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 May 2015 17:24:49 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e39.co.us.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 12 May 2015 17:24:47 -0600 Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 6A68B19D8040 for ; Tue, 12 May 2015 17:15:50 -0600 (MDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t4CNOceI48169148 for ; Tue, 12 May 2015 16:24:38 -0700 Received: from d03av03.boulder.ibm.com (localhost [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t4CNOkcq019557 for ; Tue, 12 May 2015 17:24:46 -0600 Received: from skaro.rchland.ibm.com ([9.50.22.180]) by d03av03.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t4CNOiaT019421; Tue, 12 May 2015 17:24:44 -0600 Message-ID: <55528BBB.3000809@linux.vnet.ibm.com> Date: Tue, 12 May 2015 18:24:43 -0500 From: Brian King User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Benjamin Herrenschmidt CC: Sreekanth Reddy , linux-scsi , linuxppc-dev , Daniel Kreling Subject: [PATCH] mpt2sas: Fall back to 64 bit coherent mask if 64 bit DMA / 32 bit coherent mask not supported References: <555279A8.6060906@linux.vnet.ibm.com> <1431468627.20218.64.camel@kernel.crashing.org> In-Reply-To: <1431468627.20218.64.camel@kernel.crashing.org> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15051223-0033-0000-0000-0000047DDE03 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 05/12/2015 05:10 PM, Benjamin Herrenschmidt wrote: > On Tue, 2015-05-12 at 17:07 -0500, Brian King wrote: >> The mpt2sas driver was changed late last year in that it now requests a 64 bit DMA >> mask, then requests a 32 bit coherent DMA mask, then later requests a 64 bit coherent >> DMA mask. This was 5fb1bf8aaa832e1e9ca3198de7bbecb8eff7db9c. This breaks 64 bit DMA >> support for mpt2sas on Power and we always fall back to using 32 bit DMA. Looking >> at the commit log, it looks like this was an intentional change. >> >> Ben - you had a patch set you had posted to the list back in Feb of this year, but it >> doesn't look like it got merged. > > Right, it was broken, we can't do that unfortunately. It's a hard > problem to fix. > >> https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-February/125087.html >> >> This would fix the issue I'm seeing on mpt2sas. Do you plan to dust that patch set >> off and upstream it? Were there issues with it that still need to be resolved? > > No that patch doesn't actually work. > > What we need is essentially a new set of DMA ops that can route an > individual map request via the iommu or the bypass window depending on > what mask applies. Ok. For the interim, then, Sreekanth, would you consider a patch such as the one below to allow mpt2sas to support 64 bit DMA on architectures that don't support a 32 bit coherent mask and a 64 bit dma mask at the same time? Only compile tested at this point. Will run it on a Power machine shortly to confirm it doesn't break anything... diff -puN drivers/scsi/mpt2sas/mpt2sas_base.c~mpt2sas_dma_mask drivers/scsi/mpt2sas/mpt2sas_base.c --- linux/drivers/scsi/mpt2sas/mpt2sas_base.c~mpt2sas_dma_mask 2015-05-12 16:09:58.228687852 -0500 +++ linux-bjking1/drivers/scsi/mpt2sas/mpt2sas_base.c 2015-05-12 17:38:31.588060903 -0500 @@ -1200,12 +1200,14 @@ _base_config_dma_addressing(struct MPT2S const uint64_t required_mask = dma_get_required_mask(&pdev->dev); if ((required_mask > DMA_BIT_MASK(32)) && - !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && - !pci_set_consistent_dma_mask(pdev, consistent_dma_mask)) { - ioc->base_add_sg_single = &_base_add_sg_single_64; - ioc->sge_size = sizeof(Mpi2SGESimple64_t); - ioc->dma_mask = 64; - goto out; + !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { + if (!pci_set_consistent_dma_mask(pdev, consistent_dma_mask) || + !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { + ioc->base_add_sg_single = &_base_add_sg_single_64; + ioc->sge_size = sizeof(Mpi2SGESimple64_t); + ioc->dma_mask = 64; + goto out; + } } }