Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751808AbbHELU7 (ORCPT ); Wed, 5 Aug 2015 07:20:59 -0400 Received: from aso-006-i438.relay.mailchannels.net ([23.91.64.119]:48455 "EHLO aso-006-i438.relay.mailchannels.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750980AbbHELU6 (ORCPT ); Wed, 5 Aug 2015 07:20:58 -0400 X-Greylist: delayed 4583 seconds by postgrey-1.27 at vger.kernel.org; Wed, 05 Aug 2015 07:20:58 EDT X-Sender-Id: totalchoicehosting|x-authuser|billaue X-Sender-Id: totalchoicehosting|x-authuser|billaue X-MC-Relay: Neutral X-MailChannels-SenderId: totalchoicehosting|x-authuser|billaue X-MailChannels-Auth-Id: totalchoicehosting X-MC-Loop-Signature: 1438769073937:3212567965 X-MC-Ingress-Time: 1438769073937 From: Eli Billauer To: arnd@arndb.de, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Eli Billauer Subject: [PATCH] char: xillybus: Allow 64-bit DMA on PCIe interface Date: Wed, 5 Aug 2015 13:03:26 +0300 Message-Id: <1438769006-11755-1-git-send-email-eli.billauer@gmail.com> X-Mailer: git-send-email 1.7.2.3 X-AuthUser: billaue Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1903 Lines: 46 Until now, only 32-bit DMA addressing was allowed, following a report on some old Intel machine that dropped 64-bit PCIe packets, even though pci_set_dma_mask() was successful with DMA_BIT_MASK(64). But then came TI's Keystone II chip (ARM Cortex A15 + DSPs), which refuses 32-bit DMA addressing (for good reasons). So 64-bit DMA is allowed as a fallback option. Signed-off-by: Eli Billauer --- drivers/char/xillybus/xillybus_pcie.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/char/xillybus/xillybus_pcie.c b/drivers/char/xillybus/xillybus_pcie.c index d8266bc..9418300 100644 --- a/drivers/char/xillybus/xillybus_pcie.c +++ b/drivers/char/xillybus/xillybus_pcie.c @@ -193,14 +193,16 @@ static int xilly_probe(struct pci_dev *pdev, } /* - * In theory, an attempt to set the DMA mask to 64 and dma_using_dac=1 - * is the right thing. But some unclever PCIe drivers report it's OK - * when the hardware drops those 64-bit PCIe packets. So trust - * nobody and use 32 bits DMA addressing in any case. + * Some (old and buggy?) hardware drops 64-bit addressed PCIe packets, + * even when the PCIe driver claims that a 64-bit mask is OK. On the + * other hand, on some architectures, 64-bit addressing is mandatory. + * So go for the 64-bit mask only when failing is the other option. */ if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { endpoint->dma_using_dac = 0; + } else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { + endpoint->dma_using_dac = 1; } else { dev_err(endpoint->dev, "Failed to set DMA mask. Aborting.\n"); return -ENODEV; -- 1.7.2.3 -- 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/