From patchwork Wed Jun 26 08:43:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 167785 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp660519ilk; Wed, 26 Jun 2019 01:45:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyD8KS/PwTd8gDrYH6jH6O/pVvQJCTRuAYeKtUKPQ3imvLCev8HaHEGj31mXL91aT/qi9Jm X-Received: by 2002:a17:90a:25e6:: with SMTP id k93mr3396959pje.100.1561538719562; Wed, 26 Jun 2019 01:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561538719; cv=none; d=google.com; s=arc-20160816; b=nrI8kDP1f4D6Nr2sMRggehToZJo5WA4C5M/8zUKd0csJrVXC3v01xVf/XiMJbIpEyH ao3OOIOy3qHB6PNOIi+mBM9UUlaTWDaPAnCR+GdpTbgeF8CqwU5SNhO9oMHYCWlY5WFK sIGHV8FGewC0vbjnL5Z7k8owuNddAwaiJlvcmebxsXGtEATXukLlLOShypIotvAJeFuK xzR5rCnG0aqT6IrlNsvMg5ZLQmlyM9JKrjaRh9VawEi6UPVVu1c9oMXUohyNbJjNvfo2 BZh8O6lcvo7i16HXCe7FGYCn/4Fzcd3aWfU28ApFDHPFbiavYxl7ppxQhAtRNtyQJufL xohQ== 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 :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to:dkim-signature; bh=LtR8YqPAxJoiiaQr+rKC4/jbAgDp9J8cOhOylP72rFk=; b=bcDEppP7yo4r9cobLs1HyPrbBFkDam+K5RoVmhBPXaZ1orWbAUF2rnDg/evLNOB/ER zda4GNMmJhZ74jA/xE3lOWrsTcoyK2Ci5seeN8RMUrZYlgWs6krzbgS/NBRj2aC19H3J ZGFX7Foj0BtSTKUU5YTF+jyB4H7r2SFcO3piqRHGlNWSWUuNYO1uDcxXtUdTpsSnZ0oN Q8PDPu1jfJew8spOxKjqnstcSIVIAMUcF99EwAQSvs+NczCWAxq68QEPR+Hd38mJbrcj yV0hOPljGb2jdvSXFcnLKmQuSpULWuDFh9ZMawB2y0QkZjgOY16l/ZLCmCDyCwf8FrO4 ADsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=uCmi320p; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 28si16172846pgy.252.2019.06.26.01.45.19; Wed, 26 Jun 2019 01:45:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=uCmi320p; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726006AbfFZIpS (ORCPT + 5 others); Wed, 26 Jun 2019 04:45:18 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50632 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbfFZIpS (ORCPT ); Wed, 26 Jun 2019 04:45:18 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x5Q8i5Ep068189; Wed, 26 Jun 2019 03:44:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1561538645; bh=LtR8YqPAxJoiiaQr+rKC4/jbAgDp9J8cOhOylP72rFk=; h=To:CC:From:Subject:Date; b=uCmi320peXxY+9VVMxlqGczAuesFTOnvNiO719Tx3/VfLpv8kLRtAVEsLt4v9TA7u 5S+K5IDrMWs93S4SgZ9ClOyFe6U6KQdl8IHCb3oj1q3y7mPbMhe7PSkHAchIXdmQDp J4CK53JrZx6ou4nwx9Ry5ka0o64SD8lcxWmsRaA0= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x5Q8i5lN006920 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 26 Jun 2019 03:44:05 -0500 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 26 Jun 2019 03:44:03 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Wed, 26 Jun 2019 03:44:03 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x5Q8hxVh129407; Wed, 26 Jun 2019 03:44:00 -0500 To: , "hdegoede@redhat.com" CC: , , , , , , , "Nori, Sekhar" , Vignesh Raghavendra , Tony Lindgren From: Roger Quadros Subject: SATA broken with LPAE Message-ID: <16f065ef-f4ac-46b4-de2a-6b5420ae873a@ti.com> Date: Wed, 26 Jun 2019 11:43:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Hi Christoph / Hans, SATA has been broken on TI platforms with LPAE, on systems with RAM addresses > 32-bits, (e.g. DRA7 rev.H+) since v4.18. The commit at which it breaks is 21e07dba9fb1179148089d611fc9e6e70d1887c3 ("scsi: reduce use of block bounce buffers"). The effect is that the SATA controller starts to see DMA addresses above 32-bit which it does not support. Could you please shed some light on how it is supposed to work if we don't call blk_queue_bounce_limit() for devices that can do only 32-bit DMA on a system that has addressable RAM above 32-bit Physical? The below patch fixes it. Is this the right thing to do? } blk_queue_max_hw_sectors(q, shost->max_sectors); - if (shost->unchecked_isa_dma) - blk_queue_bounce_limit(q, BLK_BOUNCE_ISA); + blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost)); blk_queue_segment_boundary(q, shost->dma_boundary); dma_set_seg_boundary(dev, shost->dma_boundary); cheers, -roger -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 3aab2e3d57f3..b925dc54cfa5 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -62,6 +62,9 @@ static int ahci_probe(struct platform_device *pdev) if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; + if (of_device_is_compatible(dev->of_node, "snps,dwc-ahci")) + hpriv->flags |= AHCI_HFLAG_32BIT_ONLY; + port = acpi_device_get_match_data(dev); if (!port) port = &ahci_port_info; diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 65d0a10c76ad..9083c7b89dfc 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1750,6 +1750,21 @@ static int scsi_map_queues(struct blk_mq_tag_set *set) return blk_mq_map_queues(&set->map[HCTX_TYPE_DEFAULT]); } +static u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost) +{ + struct device *dma_dev = shost->dma_dev; + u64 bounce_limit = 0xffffffff; + + if (shost->unchecked_isa_dma) + return BLK_BOUNCE_ISA; + + if (dma_dev && dma_dev->dma_mask) + bounce_limit = (u64)dma_max_pfn(dma_dev) << PAGE_SHIFT; + + return bounce_limit; +} + void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) { struct device *dev = shost->dma_dev; @@ -1769,8 +1784,7 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)