Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4826823yba; Tue, 30 Apr 2019 05:08:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDW3JE2uIoLZhik3igQaiDtzFSWudMuQJck4fatuZbeoeiiQPmZvuj5n7BOEQ8UnyvFoqU X-Received: by 2002:a17:902:900a:: with SMTP id a10mr62083230plp.336.1556626112317; Tue, 30 Apr 2019 05:08:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556626112; cv=none; d=google.com; s=arc-20160816; b=FYyDqyd0B1IyObcpYuwS/yLX+Nnh3tf4LlwP2RD91/kI8BgBfTRbY66nfAisDbSh7Y jaz0CRUHyZvpJZ2oaek5M8j2JGuwSmvthMTKDEqPXLtCzGP0AK7cwAUIxe9iGfb0IAvA Dxub7zGycE/+fS3M3hC7GoBtoA5MUYnTsWLO4R/C3J6tRUA26560iYZouHY/KR230sNQ wY84/qQPvdbUnh0Ua2hkQWUkTQqeLWKU5tj87dgSPoNIxjj/18ewq0dLzHtaLJbdJ8va oZQ4tM/d8JP0QRRRuos0Ixo4pxLsTK13BP43grThe2Ke+HV3crqNRGOVFz/qOH64CPlX yzfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=E+HFxcRSX8mKasM8JKKiZ1QK1d/vK1cC2imAPQCH2YI=; b=UezIVEu4xrqMkdCEvvSPIWbn4TXk6kMJnxvOIEB9cz52riywHkMgX8qM+4r8wZxsEf b8q/QlMmjTMC8rmXer6LGxIFLZJ5MceNS231rw1oaP3Z2WajQxbaeZDR+OkX9G3fQD95 wsyMQCSzRzQfqtHAKHeBC/qTNoyMj2QR9/7JvmtYIgGAPJ+uIlyPvP+Ja5JFtEnXwdfe OqV8bU0aXQ6uU543yhfSDtb0i5m0wzTxIQmPo98DT0hv49jg5NQfCY+oLCtI8ZQGQTTK ke6uPMYtcL8rCXmXNlU2OFR5X7AF3+OU+INXgpy3ixAB+7f240bv6dj5iwmZy6Xp0nrv g6Sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t21si4526190pgm.438.2019.04.30.05.08.14; Tue, 30 Apr 2019 05:08:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728914AbfD3MFD (ORCPT + 99 others); Tue, 30 Apr 2019 08:05:03 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45888 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728465AbfD3MFB (ORCPT ); Tue, 30 Apr 2019 08:05:01 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 82D9680D; Tue, 30 Apr 2019 05:05:00 -0700 (PDT) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CB4A83F5C1; Tue, 30 Apr 2019 05:04:56 -0700 (PDT) Subject: Re: [PATCH v2 3/4] iommu/dma-iommu: Use the dev->coherent_dma_mask To: Christoph Hellwig Cc: Tom Murphy , iommu@lists.linux-foundation.org, Heiko Stuebner , Will Deacon , David Brown , Thierry Reding , linux-s390@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Krzysztof Kozlowski , Jonathan Hunter , linux-rockchip@lists.infradead.org, Kukjin Kim , Gerald Schaefer , Andy Gross , linux-tegra@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, murphyt7@tcd.ie, David Woodhouse References: <20190430002952.18909-1-tmurphy@arista.com> <20190430002952.18909-4-tmurphy@arista.com> <20190430111222.GA3191@infradead.org> <20190430113253.GA23210@infradead.org> From: Robin Murphy Message-ID: <96ebb6fc-a889-fa94-09ba-65d505b85724@arm.com> Date: Tue, 30 Apr 2019 13:04:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190430113253.GA23210@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/04/2019 12:32, Christoph Hellwig wrote: > On Tue, Apr 30, 2019 at 12:27:02PM +0100, Robin Murphy wrote: >>> Hmm, I don't think we need the DMA mask for the MSI mapping, this >>> should probably always use a 64-bit mask. >> >> If that were true then we wouldn't need DMA masks for regular mappings >> either. If we have to map the MSI doorbell at all, then we certainly have to >> place it at an IOVA that the relevant device is actually capable of >> addressing. > > Well, as shown by the patch below we don't even look at the DMA mask > for the MSI page - we just allocate from bottom to top. In the trivial cookie for unmanaged domains, yes, but in that case the responsibility is on VFIO to provide a suitable (i.e. sub-32-bit) address range for that cookie in the first place. In the managed case, allocation uses the streaming mask via iommu_dma_get_msi_page() calling __iommu_dma_map(). Admittedly the mask can then get overlooked when reusing an existing mapping, which strictly could pose a problem if you have multiple devices with incompatible masks in the same group (and such that the PCI stuff doesn't already mitigate it), but that's such an obscure corner case that I'm reticent to introduce the complication to handle it until it's actually proven necessary. Robin.