[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1504774131-11691-1-git-send-email-chenhc@lemote.com>
Date: Thu, 7 Sep 2017 16:48:51 +0800
From: Huacai Chen <chenhc@...ote.com>
To: "James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>
Cc: "Martin K . Petersen" <martin.petersen@...cle.com>,
Fuxin Zhang <zhangfx@...ote.com>, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org, Huacai Chen <chenhc@...ote.com>,
stable@...r.kernel.org
Subject: [PATCH 2/2] scsi: Align queue to ARCH_DMA_MINALIGN in non-coherent DMA mode
In non-coherent DMA mode, kernel uses cache flushing operations to
maintain I/O coherency, so scsi's block queue should be aligned to
ARCH_DMA_MINALIGN.
Cc: stable@...r.kernel.org
Signed-off-by: Huacai Chen <chenhc@...ote.com>
---
drivers/scsi/scsi_lib.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f6097b8..800bf2a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2096,11 +2096,14 @@ void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q)
q->limits.cluster = 0;
/*
- * set a reasonable default alignment on word boundaries: the
- * host and device may alter it using
+ * set a reasonable default alignment on word/cacheline boundaries:
+ * the host and device may alter it using
* blk_queue_update_dma_alignment() later.
*/
- blk_queue_dma_alignment(q, 0x03);
+ if (plat_device_is_coherent(dev))
+ blk_queue_dma_alignment(q, 0x04 - 1);
+ else
+ blk_queue_dma_alignment(q, dma_get_cache_alignment() - 1);
}
EXPORT_SYMBOL_GPL(__scsi_init_queue);
--
2.7.0
}I
Powered by blists - more mailing lists