Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp620394pxv; Wed, 14 Jul 2021 11:20:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0fz4Kdo+JTIpTxLX6BJYxQLKGg7Hevq4JYhl/zaYWtURcug26W1c/+hsJfLZbbAMTGJ9T X-Received: by 2002:a92:8e10:: with SMTP id c16mr7490337ild.237.1626286847065; Wed, 14 Jul 2021 11:20:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626286847; cv=none; d=google.com; s=arc-20160816; b=0iiqPXOdP8RU4D+Z6mI3ngLYZOIhJx6QL1/Qz5BpC921qrTGXT6dFE8VoIXfyhGGSR NAmC3sD9YCFDtn+ViB3E/4ZBQHam7lWMov385LyqmO0TfsxEQe1HPCE4mN0O1zxGIQPj flUljOijKHhCawDO7/MpskscgIfAo0eQ9cJWmFIvOWdJK8SrwKFWG1fGmGyBeD2hVMPB KZBMpJD81VUvGjJ/XqCx+anV60DvNSspEVcj2xFhZPJWH0BIa5DsZkpx+z431oiPk+Q0 dOcg3PvpxaJiHmwCCw3MskFTZ4cs+OUZqDNBLZG9LwiQcuU1K3H8d/LyiTxBrYfxXQsy RzUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=rrny+VuuXkCPpG787qtSuw4L15P6/KxojAWMSArWrUU=; b=zVgerYK5LrU92qqSrGJxMlbDe263vkgH1MnYTcu6Xn6QCfzYu420UMJRuAd5bwRcLZ FAIJYYHYRc3hSeLv8YvTmTi0aqHHAOwjhLu6tT4Thk3qWMeITh43tOBq1VcbfXyXVgNL 3tQ45ZfdIObEKMMLGbcTKkU4R3teDWvVtW6skXXu25QWYZDdImgV8D37JaSnjMzBo59q meoBByuRGoqnLvADeB39WDZ9mIh1S2YbEqjUv+gPyp6fgtc+OTCHo7cNHnNLlo917pht A4tFeqsOXa0bed2GWW7GiE7V5hjWws1QV2G2ChO0CxFxMjV4v1sQWqb9dSiZZPkm6DCH qbew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l17si3077976ilk.49.2021.07.14.11.20.35; Wed, 14 Jul 2021 11:20:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230264AbhGNSWu (ORCPT + 99 others); Wed, 14 Jul 2021 14:22:50 -0400 Received: from foss.arm.com ([217.140.110.172]:38086 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230091AbhGNSWu (ORCPT ); Wed, 14 Jul 2021 14:22:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E3219D6E; Wed, 14 Jul 2021 11:19:57 -0700 (PDT) Received: from [10.57.36.240] (unknown [10.57.36.240]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 830E83F774; Wed, 14 Jul 2021 11:19:55 -0700 (PDT) Subject: Re: [PATCH v4 0/3] Apple M1 DART IOMMU driver To: Sven Peter , Will Deacon , Joerg Roedel Cc: Arnd Bergmann , devicetree@vger.kernel.org, Hector Martin , linux-kernel@vger.kernel.org, Marc Zyngier , Mohamed Mediouni , Stan Skowronek , linux-arm-kernel@lists.infradead.org, Mark Kettenis , iommu@lists.linux-foundation.org, Alexander Graf , Alyssa Rosenzweig , Rob Herring , r.czerwinski@pengutronix.de References: <20210627143405.77298-1-sven@svenpeter.dev> From: Robin Murphy Message-ID: <7261df01-34a9-4e53-37cd-ae1aa15b1fb4@arm.com> Date: Wed, 14 Jul 2021 19:19:50 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210627143405.77298-1-sven@svenpeter.dev> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-06-27 15:34, Sven Peter wrote: [...] > In the long term, I'd like to extend the dma-iommu framework itself to > support iommu pagesizes with a larger granule than the CPU pagesize if that is > something you agree with. BTW this isn't something we can fully support in general. IOMMU API users may expect this to work: iommu_map(domain, iova, page_to_phys(p1), PAGE_SIZE, prot); iommu_map(domain, iova + PAGE_SIZE, page_to_phys(p2), PAGE_SIZE, prot); Although they do in principle have visibility of pgsize_bitmap, I still doubt anyone is really prepared for CPU-page-aligned mappings to fail. Even at the DMA API level you could hide *some* of it (at the cost of effectively only having 1/4 of the usable address space), but there are still cases like where v4l2 has a hard requirement that a page-aligned scatterlist can be mapped into a contiguous region of DMA addresses. > This would be important to later support the thunderbolt DARTs since I would be > very uncomfortable to have these running in (software or hardware) bypass mode. Funnily enough that's the one case that would be relatively workable, since untrusted devices are currently subject to bounce-buffering of the entire DMA request, so it doesn't matter so much how the bounce buffer itself is mapped. Even with the possible future optimisation of only bouncing the non-page-aligned start and end parts of a buffer I think it still works (the physical alignment just has to be considered in terms of the IOMMU granule). Robin.