Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp821610pxb; Tue, 3 Nov 2020 13:30:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzG882l+eXSuRi6I5db0GKl01bAZOwHLRHNGcJyZUZnpY57CvLhfIbB90nbKZoE9XEUW6rZ X-Received: by 2002:a17:906:2b8b:: with SMTP id m11mr22982883ejg.457.1604439049657; Tue, 03 Nov 2020 13:30:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604439049; cv=none; d=google.com; s=arc-20160816; b=0tpI1abZ9BWH3LRpP/WQQ/xP7KDG84m1terkh/pkK8yWWy3mFckvubH9PzJSZkrV8L Ctw0gqvoHPtnAVcIok+D8mMc3KJ3ercIStP36QYxoIP2Nz4WbWFUTONJx6bf96+GNf98 0zPSz/HGGk7tUA4pSIXxW872VvkF6y06AOY+L3Uar8bzoYfOTKvilObEpF73PeixxGkp DCnlkmiucu2DaDfPnO/ZCPYG2efiucLU9SW58eDYuqiyEvPE6Tr0AQ2kZV7sCaUZ/A7H mrrNBtBg0lBV7GVWDp9YKPnEJOt8Ie254cv9CONR6xBe/o5PlhhSr3oO6LZbHxsI9YUn HD/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=k7017nIo6DHxEfamxdYKQMbhJb0GGWgm1dedUE3f0k8=; b=Gp/jmQAea4ju6dTnxlJ48fV+BTOdMrBYt88F+4+RCnt2w6o0+/VbhbZqbUtpvSV1X9 4F75qswET39Igi8tAx9mjTjjnerisBzU6ALwKGH4ekRJ4PO9Pq+3v/BFdtRqueAJl7Vq fq5XVHu9TQqJ3y/Sjo7UW6Pm7+GhhBc6dWWA07y9aKU4QXiaWbs3+78ZyTGgx68+h/+y soX0my06dzP4OzBrXhZeGbjQ/gEVhNgmLybV5s1kEC8XueS5pAl4vnKk2rPeFJcXZ1mw uH8tVPPeiFyOlxq9IPvFoOynctf4d0lrbo4+qNpiHHHHjXAA1Ou/xHEDx2PwXGjbdTYW kQTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1Z7NzFg6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zc3si65637ejb.158.2020.11.03.13.30.26; Tue, 03 Nov 2020 13:30:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1Z7NzFg6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388503AbgKCV0B (ORCPT + 99 others); Tue, 3 Nov 2020 16:26:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:39046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387568AbgKCVCH (ORCPT ); Tue, 3 Nov 2020 16:02:07 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B840420658; Tue, 3 Nov 2020 21:02:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437326; bh=Y94bS825I46t6kx1vs03CSmnAJfoD+XnMDcOJcT0abk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Z7NzFg6BhI7QF4Djsq0rDwpjhkKIWUNC0UVqXBoazYGtj/Ixq1azsnuf7KYuJnJH Yo8wlh1TzDthAOgPcqSe2pMYyu7Z0/bUUF6rOdD8+aFex4qKbefoNN2po+QX3HCvS3 UqmSWGXQ9u657CubdefWCDSKC5/YAFkAfaFPHDkU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Lad Prabhakar , Yoshihiro Shimoda , Christoph Hellwig , Sergei Shtylyov , Ulf Hansson , Jens Axboe Subject: [PATCH 4.19 028/191] ata: sata_rcar: Fix DMA boundary mask Date: Tue, 3 Nov 2020 21:35:20 +0100 Message-Id: <20201103203236.363359597@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Geert Uytterhoeven commit df9c590986fdb6db9d5636d6cd93bc919c01b451 upstream. Before commit 9495b7e92f716ab2 ("driver core: platform: Initialize dma_parms for platform devices"), the R-Car SATA device didn't have DMA parameters. Hence the DMA boundary mask supplied by its driver was silently ignored, as __scsi_init_queue() doesn't check the return value of dma_set_seg_boundary(), and the default value of 0xffffffff was used. Now the device has gained DMA parameters, the driver-supplied value is used, and the following warning is printed on Salvator-XS: DMA-API: sata_rcar ee300000.sata: mapping sg segment across boundary [start=0x00000000ffffe000] [end=0x00000000ffffefff] [boundary=0x000000001ffffffe] WARNING: CPU: 5 PID: 38 at kernel/dma/debug.c:1233 debug_dma_map_sg+0x298/0x300 (the range of start/end values depend on whether IOMMU support is enabled or not) The issue here is that SATA_RCAR_DMA_BOUNDARY doesn't have bit 0 set, so any typical end value, which is odd, will trigger the check. Fix this by increasing the DMA boundary value by 1. This also fixes the following WRITE DMA EXT timeout issue: # dd if=/dev/urandom of=/mnt/de1/file1-1024M bs=1M count=1024 ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen ata1.00: failed command: WRITE DMA EXT ata1.00: cmd 35/00:00:00:e6:0c/00:0a:00:00:00/e0 tag 0 dma 1310720 out res 40/00:01:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout) ata1.00: status: { DRDY } as seen by Shimoda-san since commit 429120f3df2dba2b ("block: fix splitting segments on boundary masks"). Fixes: 8bfbeed58665dbbf ("sata_rcar: correct 'sata_rcar_sht'") Fixes: 9495b7e92f716ab2 ("driver core: platform: Initialize dma_parms for platform devices") Fixes: 429120f3df2dba2b ("block: fix splitting segments on boundary masks") Signed-off-by: Geert Uytterhoeven Tested-by: Lad Prabhakar Tested-by: Yoshihiro Shimoda Reviewed-by: Christoph Hellwig Reviewed-by: Greg Kroah-Hartman Reviewed-by: Sergei Shtylyov Reviewed-by: Ulf Hansson Cc: stable Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/ata/sata_rcar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c @@ -124,7 +124,7 @@ /* Descriptor table word 0 bit (when DTA32M = 1) */ #define SATA_RCAR_DTEND BIT(0) -#define SATA_RCAR_DMA_BOUNDARY 0x1FFFFFFEUL +#define SATA_RCAR_DMA_BOUNDARY 0x1FFFFFFFUL /* Gen2 Physical Layer Control Registers */ #define RCAR_GEN2_PHY_CTL1_REG 0x1704