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=-14.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 C8E10C4338F for ; Fri, 30 Jul 2021 09:30:41 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9927961042 for ; Fri, 30 Jul 2021 09:30:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9927961042 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=68v/8sL0Sd+jRoenKElO5Zoq4WA8W3vwTgwpxoXenVI=; b=BYpHfNGMPiFwHQ sNP7Yai6A+V2U4V8aba+a397Mq0pWzHBLM874AdGkuGgmIMrAlS38hUPvfEUDyLEch1Z65zNagLeP /8sHJ1laip1uIH9I/6GoJnH01wgGMCUcPqSeRvnXVSAYfiELn7py1K8ipqw8KVtwZd2Y8zUwIlvyA bJgO1+n6mK3Cznrx9m2i8w9xydOvchfIvlpbPpMABh/IHRfLYUp451y1j7qkumRA5WZOJ8XNMurDJ lBQRtOjnOaGX6B6vJDK36H4GXu+5lK7zLn2SQm5IQECANsvIAGCBnKgE8spJhsBkV7RBW6iGieQ4w AqooJIN/DfnQN1P6phnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9Op3-007ssc-AP; Fri, 30 Jul 2021 09:28:53 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9Oox-007srD-FK for linux-arm-kernel@lists.infradead.org; Fri, 30 Jul 2021 09:28:49 +0000 Received: by mail-ed1-x52c.google.com with SMTP id f13so12183361edq.13 for ; Fri, 30 Jul 2021 02:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=WxhlzYrYV28az1jXTH92aNSQMW4lNS5B9o0J3BKptsc=; b=RVTBKHUPkJGMHQr5TC6/sYRTWrnQgV3jEyRw4RI12fsX+efJSbQOhg3RVAAi0s0MmJ D+m9kebK87MkoNUf56TrmJECOkAiYn4jnIuQ0nCu8rGxKrbO0nLoWm+cSP67lKVlxLqJ HwbJTvz2w7/kBbdJUZ9sq93DTHT8/TqYPx7lLdYbnSke0ukvdHFP5F5YO1ghHVG/eRoF GLM4x2/TJ9VwtOmeVkOyA66sPajVF5QZtCxzYZjUsXALSiF8ByP5s+ThBviMql30Q77M fVHU7R1/0CL8c2FK/CBc/a0i4zbQHqM9FlGS82CbnuzBEejzJK+yLwr1Dz9yCxfmidhV 1jdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WxhlzYrYV28az1jXTH92aNSQMW4lNS5B9o0J3BKptsc=; b=uLs02/uKgEgbJSxPOrcBq5JKFdj18yLPIndkcMhHwD9M5ERkdrX1iDe0R0rZjuJMG6 LQIrQ/iWupStMLL3RZhCPtoToQt5NqGJtCovu1KM3SiSkc9W1dM6PTVcHx+YFKj7mee1 GyIb352/vxMM0DcQIlWn+p6EioyehIggpfC9EusQ8Jx4MAYoLM6uv1HR2SApdModlBic 9WG9ZK07m6Llz0dDNKtn7eU5QZJArI10DW2CgE5t5On1EbQM9LSETceQxlxTR8m2w49p YMGZnHVTMMfZKHLI6bWBnBhsHMajZuB8rXitwabcKTT/kiB7/LihBCJFDvICLdaAOdfq n7WQ== X-Gm-Message-State: AOAM532pWeEs1tZlEd8WZSEfhf318ghsC2jNMSeQ55dYhdnlVl+qqUrh aKvdM08f9XjLKJdXd5HRrL7V+g== X-Google-Smtp-Source: ABdhPJz7v59AkGLe4ncF8sDSsbs4m/88saDYcXaP0lDGk9+fMwno6QtbmMRD+lr3lYSTMH8XQi1Rcg== X-Received: by 2002:aa7:dbc8:: with SMTP id v8mr1860784edt.242.1627637324222; Fri, 30 Jul 2021 02:28:44 -0700 (PDT) Received: from myrica (adsl-84-226-111-173.adslplus.ch. [84.226.111.173]) by smtp.gmail.com with ESMTPSA id fr4sm367026ejc.42.2021.07.30.02.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jul 2021 02:28:43 -0700 (PDT) Date: Fri, 30 Jul 2021 11:28:23 +0200 From: Jean-Philippe Brucker To: Robin Murphy Cc: joro@8bytes.org, will@kernel.org, linux-kernel@vger.kernel.org, dianders@chromium.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 19/24] iommu: Expose DMA domain strictness via sysfs Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210730_022847_595081_422CFA46 X-CRM114-Status: GOOD ( 26.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 28, 2021 at 04:58:40PM +0100, Robin Murphy wrote: > The sysfs interface for default domain types exists primarily so users > can choose the performance/security tradeoff relevant to their own > workload. As such, the choice between the policies for DMA domains fits > perfectly as an additional point on that scale - downgrading a > particular device from a strict default to non-strict may be enough to > let it reach the desired level of performance, while still retaining > more peace of mind than with a wide-open identity domain. Now that we've > abstracted non-strict mode as a distinct type of DMA domain, allow it to > be chosen through the user interface as well. > > Signed-off-by: Robin Murphy > --- > Documentation/ABI/testing/sysfs-kernel-iommu_groups | 2 ++ > drivers/iommu/iommu.c | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/Documentation/ABI/testing/sysfs-kernel-iommu_groups b/Documentation/ABI/testing/sysfs-kernel-iommu_groups > index eae2f1c1e11e..43ba764ba5b7 100644 > --- a/Documentation/ABI/testing/sysfs-kernel-iommu_groups > +++ b/Documentation/ABI/testing/sysfs-kernel-iommu_groups > @@ -42,6 +42,8 @@ Description: /sys/kernel/iommu_groups//type shows the type of default > ======== ====================================================== > DMA All the DMA transactions from the device in this group > are translated by the iommu. > + DMA-FQ As above, but using batched invalidation to lazily > + remove translations after use. It might be useful to desribe the security/performance tradeoff here as well. I guess a normal user is more likely to look at the doc for this sysfs knob than the kernel config or parameters. Thanks, Jean > identity All the DMA transactions from the device in this group > are not translated by the iommu. > auto Change to the type the device was booted with. > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index eecb5657de69..5a08e0806cbb 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -3265,6 +3265,8 @@ static ssize_t iommu_group_store_type(struct iommu_group *group, > req_type = IOMMU_DOMAIN_IDENTITY; > else if (sysfs_streq(buf, "DMA")) > req_type = IOMMU_DOMAIN_DMA; > + else if (sysfs_streq(buf, "DMA-FQ")) > + req_type = IOMMU_DOMAIN_DMA_FQ; > else if (sysfs_streq(buf, "auto")) > req_type = 0; > else > -- > 2.25.1 > > _______________________________________________ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel