Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6795495pxv; Fri, 30 Jul 2021 02:32:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyY9vahISAwOGV2jK5h7GPbmd0LHfJp6pZNABaAKhifWTktRWg575lMNyRbi4SpYXD++wmS X-Received: by 2002:a17:906:839a:: with SMTP id p26mr1683207ejx.547.1627637564542; Fri, 30 Jul 2021 02:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627637564; cv=none; d=google.com; s=arc-20160816; b=uYik1Hp9BQ4yIWfbc1pHzqYKf7EApjbGdgs80ou8zG7AbLY7MkpoKauk9kz8wbumKs 6swAiwYa8cv36rPpioTsCmgEjRlTbVBzk9Y+ifMpN/gxf2OCiF9o2ypFFa9ZLY+Y/q4H k1f8SJtXcMB3/owVRKct5CXv23cG7cDBT+nwDPH7XRMug9yoz+M5XmiVHkdhT2Hk9ip5 cUCnzlyq+feNmnK59uBnlRErnwmZ60PGEJEEHBv0E6En2TzJfAMZZ+2JvVypTlw+wBtk QAZ13g8zVqT6+xbX+om8GH2d4CznAy7WfqMuutzOIy+S0eE+p/SZmWymdydbjB7qAeaB lUBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WxhlzYrYV28az1jXTH92aNSQMW4lNS5B9o0J3BKptsc=; b=ZUz5nN9I+qvXOj2xtVBPuIN9/9vl9XIRaa/K/AtklpOupNFlIrKZiwZfvgPEHJVq1O MzZbTs0yPW3YKEo30rW+ZsE8aQFrSfxXaT1y6d3VDZKayJY8gFqFqw9kgM1as8bweWUk upI4xb6KLzsp0t9DCn+KJwJxuxtcO/rufrxIA5tD5qwv1Cj6Qrz3XQyGZESvZbyqhvTE L0ZaxtoKYM5ywH5MZLBSCGFX+uVJh5jG5ti1bz8Z4xSA3KMLrLSyJ8efS+ILL9ZJzRfv XMe6vtz2aZrBxPTp/PqujPuUP9nRMG87cCj7tSu3z4382uM5LxLJZGwj6BI6koDnAkcd 7gJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RVTBKHUP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x2si1421770ejy.385.2021.07.30.02.32.21; Fri, 30 Jul 2021 02:32:44 -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; dkim=pass header.i=@linaro.org header.s=google header.b=RVTBKHUP; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238156AbhG3J2u (ORCPT + 99 others); Fri, 30 Jul 2021 05:28:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230522AbhG3J2u (ORCPT ); Fri, 30 Jul 2021 05:28:50 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7BD9C061765 for ; Fri, 30 Jul 2021 02:28:45 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id x90so12216656ede.8 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=KHIwXZUMBCwrmloSo1Bq5BwtC5+QkAB7dvYmtCt/7QbKlwlMyyZWtRzblwVhAhjeoN bZkGTYb7VuMsd7mQhyWtcFA7Kg8mGbjoaR70m5U54cD7vuPkcQJNtDc0OZO3PmG2NaqA cbSBN993bLw+G1p4gxEcusfI+wXV/3z/yblWj+AUAZTycX2yZMFeV7orql/Tpak+LdN2 Np4L0otrhNF8ubdSEu9vZdWkbUGE2iA8J1ShJnsK8a1TCQW2KUD1pOX76MZpC+m7V7GT Fzc/mJun24N17ee8hrM9dQ1v1Kvkm5soWsJL1VsMuaWMpGoZXwsvjqKAwf+UJYbdpBG3 YxXg== X-Gm-Message-State: AOAM532cs/7TNSp144uF5OUBmFBY346gX0q53/5YUcuDKLpt3qvNV5bH 3WbitZU94WA6WAEZ+QXUkaekNQ== 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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