Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932150AbaFLGWl (ORCPT ); Thu, 12 Jun 2014 02:22:41 -0400 Received: from mail-bn1blp0185.outbound.protection.outlook.com ([207.46.163.185]:34889 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752158AbaFLGWj (ORCPT ); Thu, 12 Jun 2014 02:22:39 -0400 X-WSS-ID: 0N71LPI-07-ZJU-02 X-M-MSG: Message-ID: <53994725.5000001@amd.com> Date: Thu, 12 Jun 2014 01:22:29 -0500 From: Suravee Suthikulpanit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Bartlomiej Zolnierkiewicz CC: Tejun Heo , Hans de Goede , , , , , Subject: Re: [PATCH 1/1] ata: Check and set 64-bit DMA mask for platform AHCI driver References: <1400866510-3130-1-git-send-email-suravee.suthikulpanit@amd.com> <20140603175827.GH26210@htj.dyndns.org> <5391E812.1060009@amd.com> <1666501.UPn96gHtAf@amdc1032> In-Reply-To: <1666501.UPn96gHtAf@amdc1032> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(6009001)(428001)(189002)(199002)(51704005)(24454002)(479174003)(377454003)(85852003)(83072002)(80022001)(50466002)(65806001)(65956001)(87266999)(54356999)(76176999)(77096999)(47776003)(59896001)(21056001)(20776003)(77982001)(76482001)(64706001)(50986999)(102836001)(65816999)(74662001)(99136001)(74502001)(19580395003)(83322001)(19580405001)(23756003)(44976005)(101416001)(97736001)(92726001)(68736004)(81542001)(84676001)(83506001)(36756003)(81342001)(4396001)(46102001)(87936001)(86362001)(61793002)(62816006);DIR:OUT;SFP:;SCL:1;SRVR:CY1PR0201MB0827;H:atltwp01.amd.com;FPR:;MLV:sfv;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Antispam: BL:0;ACTION:Default;RISK:Low;SCL:0;SPMLVL:NotSpam;PCL:0;RULEID: X-Forefront-PRVS: 02408926C4 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; X-OriginatorOrg: amd4.onmicrosoft.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/11/2014 04:41 AM, Bartlomiej Zolnierkiewicz wrote: >>> On Fri, May 23, 2014 at 12:35:10PM -0500,suravee.suthikulpanit@amd.com wrote: >>>> > >>From: Suravee Suthikulpanit >>>> > >> >>>> > >>The current platform AHCI drier does not set the dma_mask correctly >>>> > >>for 64-bit DMA capable AHCI controller. This patch checks the AHCI >>>> > >>capability bit and set the dma_mask and coherent_dma_mask accordingly. >>>> > >> >>>> > >>Signed-off-by: Suravee Suthikulpanit >>>> > >>--- >>>> > >> drivers/ata/libahci_platform.c | 9 +++++++++ >>>> > >> 1 file changed, 9 insertions(+) >>>> > >> >>>> > >>diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c >>>> > >>index 7cb3a85..85049ef 100644 >>>> > >>--- a/drivers/ata/libahci_platform.c >>>> > >>+++ b/drivers/ata/libahci_platform.c >>>> > >>@@ -368,6 +368,15 @@ int ahci_platform_init_host(struct platform_device *pdev, >>>> > >> ahci_init_controller(host); >>>> > >> ahci_print_info(host, "platform"); >>>> > >> >>>> > >>+ if (hpriv->cap & HOST_CAP_64) { >>>> > >>+ if (!dev->dma_mask) > What configuration is the above dev->dma_mask checking supposed to handle? > Is it really needed? If not the current dma_set_mask_and_coherent() call > can be replaced by dma_coerce_mask_and_coherent() one. I was just trying to be safe and not always assuming that dev->dma_mask is pointing to the dev->coherent_dma_mask. If you think this is not necessary, I can remove this. > >>>> > >>+ dev->dma_mask = &dev->coherent_dma_mask; >>>> > >>+ >>>> > >>+ rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); >>>> > >>+ if (rc) >>>> > >>+ return rc; > Shouldn't we try to set DMA masks to 32-bit ones on error (like it is done > in ahci_configure_dma_masks()) instead of failing the initialization? I can also add the additional logic to try for 32-bit. > >>>> > >>+ } >>>> > >>+ >>>> > >> return ata_host_activate(host, irq, ahci_interrupt, IRQF_SHARED, >>>> > >> &ahci_platform_sht); >>>> > >> } >>>> > >>-- >>>> > >>1.9.0 > BTW It seems that after DMA masks handling is fixed in the generic AHCI > platform code the driver specific code in ahci_xgene.c can be removed. I am including Loc Ho, Tuan Phan, and Suman Tripathi to help verifying if code could be removed. If so, I'll send out the change in V2. Suravee > > Best regards, > -- > Bartlomiej Zolnierkiewicz > Samsung R&D Institute Poland > Samsung Electronics > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/