From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933062AbbA0VD1 (ORCPT ); Tue, 27 Jan 2015 16:03:27 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:50303 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759158AbbA0VBH (ORCPT ); Tue, 27 Jan 2015 16:01:07 -0500 From: Murali Karicheri To: , , , , CC: Murali Karicheri , Joerg Roedel , Grant Likely , Rob Herring , Bjorn Helgaas , Will Deacon , Russell King , Arnd Bergmann , Suravee Suthikulpanit Subject: [PATCH v5 8/8] of: limit dma_mask of the device based on dma-range size Date: Tue, 27 Jan 2015 16:00:05 -0500 Message-ID: <1422392405-32196-9-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1422392405-32196-1-git-send-email-m-karicheri2@ti.com> References: <1422392405-32196-1-git-send-email-m-karicheri2@ti.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org limit the device dma_mask to the min of default dma_mask and mask calculate from the dma-range size. Cc: Joerg Roedel Cc: Grant Likely Cc: Rob Herring Cc: Bjorn Helgaas Cc: Will Deacon Cc: Russell King Cc: Arnd Bergmann Cc: Suravee Suthikulpanit Signed-off-by: Murali Karicheri --- drivers/of/device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/device.c b/drivers/of/device.c index 17504f4..bcb8a35 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -128,6 +128,9 @@ void of_dma_configure(struct device *dev, struct device_node *np) dev_dbg(dev, "device is%sbehind an iommu\n", iommu ? " " : " not "); + /* limit dma_mask to the lower of the two values */ + *dev->dma_mask = min((*dev->dma_mask), (dma_addr + size - 1)); + arch_setup_dma_ops(dev, dma_addr, size, iommu, coherent); } EXPORT_SYMBOL_GPL(of_dma_configure); -- 1.7.9.5 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Murali Karicheri Subject: [PATCH v5 8/8] of: limit dma_mask of the device based on dma-range size Date: Tue, 27 Jan 2015 16:00:05 -0500 Message-ID: <1422392405-32196-9-git-send-email-m-karicheri2@ti.com> References: <1422392405-32196-1-git-send-email-m-karicheri2@ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1422392405-32196-1-git-send-email-m-karicheri2-l0cyMroinI0@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: Russell King , Arnd Bergmann , Will Deacon , Rob Herring , Bjorn Helgaas , Murali Karicheri , Grant Likely List-Id: devicetree@vger.kernel.org limit the device dma_mask to the min of default dma_mask and mask calculate from the dma-range size. Cc: Joerg Roedel Cc: Grant Likely Cc: Rob Herring Cc: Bjorn Helgaas Cc: Will Deacon Cc: Russell King Cc: Arnd Bergmann Cc: Suravee Suthikulpanit Signed-off-by: Murali Karicheri --- drivers/of/device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/device.c b/drivers/of/device.c index 17504f4..bcb8a35 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -128,6 +128,9 @@ void of_dma_configure(struct device *dev, struct device_node *np) dev_dbg(dev, "device is%sbehind an iommu\n", iommu ? " " : " not "); + /* limit dma_mask to the lower of the two values */ + *dev->dma_mask = min((*dev->dma_mask), (dma_addr + size - 1)); + arch_setup_dma_ops(dev, dma_addr, size, iommu, coherent); } EXPORT_SYMBOL_GPL(of_dma_configure); -- 1.7.9.5 From mboxrd@z Thu Jan 1 00:00:00 1970 From: m-karicheri2@ti.com (Murali Karicheri) Date: Tue, 27 Jan 2015 16:00:05 -0500 Subject: [PATCH v5 8/8] of: limit dma_mask of the device based on dma-range size In-Reply-To: <1422392405-32196-1-git-send-email-m-karicheri2@ti.com> References: <1422392405-32196-1-git-send-email-m-karicheri2@ti.com> Message-ID: <1422392405-32196-9-git-send-email-m-karicheri2@ti.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org limit the device dma_mask to the min of default dma_mask and mask calculate from the dma-range size. Cc: Joerg Roedel Cc: Grant Likely Cc: Rob Herring Cc: Bjorn Helgaas Cc: Will Deacon Cc: Russell King Cc: Arnd Bergmann Cc: Suravee Suthikulpanit Signed-off-by: Murali Karicheri --- drivers/of/device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/device.c b/drivers/of/device.c index 17504f4..bcb8a35 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -128,6 +128,9 @@ void of_dma_configure(struct device *dev, struct device_node *np) dev_dbg(dev, "device is%sbehind an iommu\n", iommu ? " " : " not "); + /* limit dma_mask to the lower of the two values */ + *dev->dma_mask = min((*dev->dma_mask), (dma_addr + size - 1)); + arch_setup_dma_ops(dev, dma_addr, size, iommu, coherent); } EXPORT_SYMBOL_GPL(of_dma_configure); -- 1.7.9.5