iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>,
	<iommu@lists.linux-foundation.org>
Cc: Robin Murphy <robin.murphy@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Ashok Raj <ashok.raj@intel.com>, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 4/4] iommu: Document usage of "/sys/kernel/iommu_groups/<grp_id>/type" file
Date: Wed, 21 Aug 2019 15:52:49 +0100	[thread overview]
Message-ID: <0891489c-5753-09c1-ab9d-ee2eb6e175a9@huawei.com> (raw)
In-Reply-To: <414989e92e361ca8f3108956135c1bbfa4ce6788.1566353521.git.sai.praneeth.prakhya@intel.com>

On 21/08/2019 03:42, Sai Praneeth Prakhya wrote:
> The default domain type of an iommu group can be changed using file
> "/sys/kernel/iommu_groups/<grp_id>/type". Hence, document it's usage and
> more importantly spell out it's limitations and an example.
>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Joerg Roedel <joro@8bytes.org>
> Cc: Ashok Raj <ashok.raj@intel.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Lu Baolu <baolu.lu@linux.intel.com>
> Cc: Sohil Mehta <sohil.mehta@intel.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
> ---
>  .../ABI/testing/sysfs-kernel-iommu_groups     | 35 +++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/Documentation/ABI/testing/sysfs-kernel-iommu_groups b/Documentation/ABI/testing/sysfs-kernel-iommu_groups
> index 017f5bc3920c..0a70b3a66ff3 100644
> --- a/Documentation/ABI/testing/sysfs-kernel-iommu_groups
> +++ b/Documentation/ABI/testing/sysfs-kernel-iommu_groups
> @@ -33,3 +33,38 @@ Description:    In case an RMRR is used only by graphics or USB devices
>  		it is now exposed as "direct-relaxable" instead of "direct".
>  		In device assignment use case, for instance, those RMRR
>  		are considered to be relaxable and safe.
> +
> +What:		/sys/kernel/iommu_groups/<grp_id>/type
> +Date:		August 2019
> +KernelVersion:	v5.4
> +Contact:	Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
> +Description:	/sys/kernel/iommu_groups/<grp_id>/type lets the user know the
> +		type of default domain in use by iommu for this group. A
> +		privileged user could request kernel to change the group type by
> +		writing to this file. Presently, only three types are supported

It's unclear whether the following is a list of all values the user 
could both read and write (which it isn't).

> +		1. dma: All the DMA transactions from the devices in this group
> +			are translated by the iommu.

Why "dma", and not "DMA" (which is what we would read for DMA type)?

> +		2. identity: All the DMA transactions from the devices in this
> +			     group are *not* translated by the iommu.
> +		3. auto: Kernel decides one among dma/identity

Isn't this the same as reset value, which we could read and remember?

(And the kernel could reject when we attempt to change to a disallowed 
type).

> +		Note:
> +		-----
> +		A group type could be modified only when *all* the devices in
> +		the group are not binded to any device driver. So, the user has
> +		to first unbind the appropriate drivers and then change the
> +		default domain type.
> +		Caution:
> +		--------
> +		Unbinding a device driver will take away the drivers control
> +		over the device and if done on devices that host root file
> +		system could lead to catastrophic effects (the user might
> +		need to reboot the machine to get it to normal state). So, it's
> +		expected that the user understands what he is doing.

I think that this goes without saying.

> +		Example:
> +		--------
> +		# Unbind USB device driver
> +		1. echo "0000:00:14.0" > /sys/bus/pci/drivers/xhci_hcd/unbind
> +		# Put the USB device in identity mode (a.k.a pass through)
> +		2. echo "identity" > /sys/kernel/iommu_groups/<grp_id>/type
> +		# Re-bind the driver
> +		3. echo "0000:00:14.0" > /sys/bus/pci/drivers/xhci_hcd/bind
>

Thanks,
John


_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2019-08-21 14:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21  2:42 [PATCH 0/4] iommu: Add support to change default domain of a group Sai Praneeth Prakhya
2019-08-21  2:42 ` [PATCH 1/4] iommu/vt-d: Modify device_def_domain_type() to use at runtime Sai Praneeth Prakhya
2019-08-21  2:42 ` [PATCH 2/4] iommu: Add device_def_domain_type() call back function to iommu_ops Sai Praneeth Prakhya
2019-08-21  2:42 ` [PATCH 3/4] iommu: Add support to change default domain of an iommu_group Sai Praneeth Prakhya
2019-09-03 12:50   ` Joerg Roedel
2019-09-04  3:09     ` Prakhya, Sai Praneeth
2019-09-04  3:17       ` Lu Baolu
2019-09-04 16:18         ` Prakhya, Sai Praneeth
2019-08-21  2:42 ` [PATCH 4/4] iommu: Document usage of "/sys/kernel/iommu_groups/<grp_id>/type" file Sai Praneeth Prakhya
2019-08-21 14:52   ` John Garry [this message]
2019-08-21 17:08     ` Sai Praneeth Prakhya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0891489c-5753-09c1-ab9d-ee2eb6e175a9@huawei.com \
    --to=john.garry@huawei.com \
    --cc=ashok.raj@intel.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=robin.murphy@arm.com \
    --cc=sai.praneeth.prakhya@intel.com \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).