From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750755AbdALGAI (ORCPT ); Thu, 12 Jan 2017 01:00:08 -0500 Received: from mail-lf0-f48.google.com ([209.85.215.48]:35381 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750701AbdALGAH (ORCPT ); Thu, 12 Jan 2017 01:00:07 -0500 Subject: Re: [PATCH 2/2] arm64: avoid increasing DMA masks above what hardware supports To: Arnd Bergmann References: <1484159512-28515-1-git-send-email-nikita.yoush@cogentembedded.com> <1484159512-28515-3-git-send-email-nikita.yoush@cogentembedded.com> <2489599.dXme8sRkvp@wuerfel> Cc: Robin Murphy , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Simon Horman , Bjorn Helgaas , fkan@apm.com, linux-kernel@vger.kernel.org, Artemi Ivanov From: Nikita Yushchenko Message-ID: Date: Thu, 12 Jan 2017 08:53:35 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.5.1 MIME-Version: 1.0 In-Reply-To: <2489599.dXme8sRkvp@wuerfel> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> @@ -959,6 +990,15 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, >> if (!dev->archdata.dma_ops) >> dev->archdata.dma_ops = &swiotlb_dma_ops; >> >> + /* >> + * Whatever the parent bus can set. A device must not set >> + * a DMA mask larger than this. >> + */ >> + if (enforce_range) >> + dev->archdata.parent_dma_mask = size - 1; >> + else >> + dev->archdata.parent_dma_mask = DMA_BIT_MASK(64); >> + >> dev->archdata.dma_coherent = coherent; >> __iommu_setup_dma_ops(dev, dma_base, size, iommu); >> > > Could we just pass the mask instead of the size here? We don't want to change API now. Nikita From mboxrd@z Thu Jan 1 00:00:00 1970 From: nikita.yoush@cogentembedded.com (Nikita Yushchenko) Date: Thu, 12 Jan 2017 08:53:35 +0300 Subject: [PATCH 2/2] arm64: avoid increasing DMA masks above what hardware supports In-Reply-To: <2489599.dXme8sRkvp@wuerfel> References: <1484159512-28515-1-git-send-email-nikita.yoush@cogentembedded.com> <1484159512-28515-3-git-send-email-nikita.yoush@cogentembedded.com> <2489599.dXme8sRkvp@wuerfel> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org >> @@ -959,6 +990,15 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, >> if (!dev->archdata.dma_ops) >> dev->archdata.dma_ops = &swiotlb_dma_ops; >> >> + /* >> + * Whatever the parent bus can set. A device must not set >> + * a DMA mask larger than this. >> + */ >> + if (enforce_range) >> + dev->archdata.parent_dma_mask = size - 1; >> + else >> + dev->archdata.parent_dma_mask = DMA_BIT_MASK(64); >> + >> dev->archdata.dma_coherent = coherent; >> __iommu_setup_dma_ops(dev, dma_base, size, iommu); >> > > Could we just pass the mask instead of the size here? We don't want to change API now. Nikita