From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751022AbdIKHjN (ORCPT ); Mon, 11 Sep 2017 03:39:13 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:41901 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750903AbdIKHjL (ORCPT ); Mon, 11 Sep 2017 03:39:11 -0400 Date: Mon, 11 Sep 2017 00:39:06 -0700 From: Christoph Hellwig To: Huacai Chen Cc: "James E . J . Bottomley" , "Martin K . Petersen" , Fuxin Zhang , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 2/2] scsi: Align queue to ARCH_DMA_MINALIGN in non-coherent DMA mode Message-ID: <20170911073906.GA7074@infradead.org> References: <1504774131-11691-1-git-send-email-chenhc@lemote.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1504774131-11691-1-git-send-email-chenhc@lemote.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > + if (plat_device_is_coherent(dev)) We can't just call platform device code. We'll need a proper DMA API call for this. > + blk_queue_dma_alignment(q, 0x04 - 1); > + else > + blk_queue_dma_alignment(q, dma_get_cache_alignment() - 1); Which we already have with dma_get_cache_alignment, except that it doesn't take a struct device pointer and doesn't call into dma_map ops. So please add a struct device argument to dma_get_cache_alignment, and let it call into dma_map_ops where needed. With that you can replace the above with: blk_queue_dma_alignment(q, max(0x04U, dma_get_cache_alignment(dev)) - 1);