From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D564CC11F66 for ; Wed, 14 Jul 2021 10:29:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B850F61374 for ; Wed, 14 Jul 2021 10:29:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238058AbhGNKcL (ORCPT ); Wed, 14 Jul 2021 06:32:11 -0400 Received: from foss.arm.com ([217.140.110.172]:33100 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237788AbhGNKcL (ORCPT ); Wed, 14 Jul 2021 06:32:11 -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 51AFAD6E; Wed, 14 Jul 2021 03:29:19 -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 B4FA73F774; Wed, 14 Jul 2021 03:29:14 -0700 (PDT) Subject: Re: [PATCH v2 0/3] iommu: Enable non-strict DMA on QCom SD/MMC To: Joerg Roedel Cc: Doug Anderson , Ulf Hansson , Linux Doc Mailing List , Peter Zijlstra , linux-pci@vger.kernel.org, Konrad Dybcio , Thierry Reding , Joel Fernandes , Rajat Jain , Will Deacon , Rob Clark , Saravana Kannan , Jonathan Corbet , quic_c_gdjako@quicinc.com, Linux ARM , Viresh Kumar , Veerabhadrarao Badiganti , "Paul E. McKenney" , linux-arm-msm , Bjorn Helgaas , Sonny Rao , Vlastimil Babka , Randy Dunlap , Linux MMC List , Adrian Hunter , LKML , "list@263.net:IOMMU DRIVERS" , Andrew Morton , "Maciej W. Rozycki" References: <20210624171759.4125094-1-dianders@chromium.org> From: Robin Murphy Message-ID: <255adda2-3b5f-b080-4da1-f3c5d5a4f7a6@arm.com> Date: Wed, 14 Jul 2021 11:29:08 +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: 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-arm-msm@vger.kernel.org On 2021-07-14 11:15, Joerg Roedel wrote: > Hi Robin, > > On Fri, Jul 09, 2021 at 02:56:47PM +0100, Robin Murphy wrote: >> As I mentioned before, conceptually I think this very much belongs in sysfs >> as a user decision. We essentially have 4 levels of "strictness": >> >> 1: DMA domain with bounce pages >> 2: DMA domain >> 3: DMA domain with flush queue >> 4: Identity domain > > Together with reasonable defaults (influenced by compile-time > options) it seems to be a good thing to configure at runtime via > sysfs. > > We already have CONFIG_IOMMU_DEFAULT_PASSTHROUGH, which can probably be > extended to be an option list: > > - CONFIG_IOMMU_DEFAULT_PASSTHROUGH: Trusted devices are identity > mapped > > - CONFIG_IOMMU_DEFAULT_DMA_STRICT: Trusted devices are DMA > mapped with strict flush > behavior on unmap > > - CONFIG_IOMMU_DEFAULT_DMA_LAZY: Trusted devices are DMA mapped > with flush queues for performance Indeed, I got focused on the sysfs angle, but rearranging the Kconfig default that way to match makes a lot of sense, and is another thing which should fall out really easily from my domain type rework, so I'll add that to my branch now before I forget again. > Untrusted devices always get into the DMA domain with bounce pages by > default. > > The defaults can be changed at runtime via sysfs. We already have basic > support for runtime switching of the default domain, so that can be > re-used. As mentioned yesterday, already done! I'm hoping to be able to post the patches next week after some testing :) Cheers, Robin.