Re: [Patch V8 3/3] iommu: Document usage of "/sys/kernel/iommu_groups//type" file

2020-11-19 Thread Lu Baolu

Hi Will

On 11/19/20 4:55 PM, Will Deacon wrote:

Hi Lu,

On Thu, Nov 19, 2020 at 10:32:43AM +0800, Lu Baolu wrote:

On 11/18/20 9:51 PM, Will Deacon wrote:

On Fri, Sep 25, 2020 at 12:06:20PM -0700, Ashok Raj wrote:
I can't figure out from this description what string is returned to
userspace in the case that the group is configured as  blocked or unmanaged.


This series only enables switching a default domain in use between DMA
and IDENTITY. Other cases will result in write failures.


I understood that from the text, but what I couldn't figure out is what
happens if you *read* the file when the default domain is not identity
or DMA. I think that should be documented.


Yes, agreed. I will add this.

Best regards,
baolu
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [Patch V8 3/3] iommu: Document usage of "/sys/kernel/iommu_groups//type" file

2020-11-19 Thread Will Deacon
Hi Lu,

On Thu, Nov 19, 2020 at 10:32:43AM +0800, Lu Baolu wrote:
> On 11/18/20 9:51 PM, Will Deacon wrote:
> > On Fri, Sep 25, 2020 at 12:06:20PM -0700, Ashok Raj wrote:
> > I can't figure out from this description what string is returned to
> > userspace in the case that the group is configured as  blocked or unmanaged.
> 
> This series only enables switching a default domain in use between DMA
> and IDENTITY. Other cases will result in write failures.

I understood that from the text, but what I couldn't figure out is what
happens if you *read* the file when the default domain is not identity
or DMA. I think that should be documented.

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


Re: [Patch V8 3/3] iommu: Document usage of "/sys/kernel/iommu_groups//type" file

2020-11-18 Thread Lu Baolu

Hi Will,

On 11/18/20 9:51 PM, Will Deacon wrote:

On Fri, Sep 25, 2020 at 12:06:20PM -0700, Ashok Raj wrote:

From: Sai Praneeth Prakhya 

The default domain type of an iommu group can be changed by writing to
"/sys/kernel/iommu_groups//type" file. Hence, document it's usage
and more importantly spell out its limitations.

Cc: Christoph Hellwig 
Cc: Joerg Roedel 
Cc: Ashok Raj 
Cc: Will Deacon 
Cc: Lu Baolu 
Cc: Sohil Mehta 
Cc: Robin Murphy 
Cc: Jacob Pan 
Reviewed-by: Lu Baolu 
Signed-off-by: Sai Praneeth Prakhya 
---
  .../ABI/testing/sysfs-kernel-iommu_groups  | 30 ++
  1 file changed, 30 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-kernel-iommu_groups 
b/Documentation/ABI/testing/sysfs-kernel-iommu_groups
index 017f5bc3920c..effde9d23f4f 100644
--- a/Documentation/ABI/testing/sysfs-kernel-iommu_groups
+++ b/Documentation/ABI/testing/sysfs-kernel-iommu_groups
@@ -33,3 +33,33 @@ 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//type
+Date:  September 2020
+KernelVersion: v5.10


^^ Please can you update these two lines?


Sure.




+Contact:   Sai Praneeth Prakhya 
+Description:   Let 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
+   1. DMA: All the DMA transactions from the device in this group
+   are translated by the iommu.
+   2. identity: All the DMA transactions from the device in this
+group are *not* translated by the iommu.
+   3. auto: Change to the type the device was booted with. When the
+user reads the file he would never see "auto". This is


Can we avoid assuming gender here and just use "they" instead of "he", please?
Same thing for the "Caution" note below.


Yes, absolutely.




+just a write only value.


I can't figure out from this description what string is returned to
userspace in the case that the group is configured as  blocked or unmanaged.


This series only enables switching a default domain in use between DMA
and IDENTITY. Other cases will result in write failures.




+   Note:
+   -
+   A group type could be modified only when


s/could be/may be/


+   1. The group has *only* one device
+   2. The device in the group is not bound to any device driver.
+  So, the user must first unbind the appropriate driver and
+  then change the default domain type.
+   Caution:
+   
+   Unbinding a device driver will take away the driver's 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.


Thanks,

Will


Best regards,
baolu
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [Patch V8 3/3] iommu: Document usage of "/sys/kernel/iommu_groups//type" file

2020-11-18 Thread Will Deacon
On Fri, Sep 25, 2020 at 12:06:20PM -0700, Ashok Raj wrote:
> From: Sai Praneeth Prakhya 
> 
> The default domain type of an iommu group can be changed by writing to
> "/sys/kernel/iommu_groups//type" file. Hence, document it's usage
> and more importantly spell out its limitations.
> 
> Cc: Christoph Hellwig 
> Cc: Joerg Roedel 
> Cc: Ashok Raj 
> Cc: Will Deacon 
> Cc: Lu Baolu 
> Cc: Sohil Mehta 
> Cc: Robin Murphy 
> Cc: Jacob Pan 
> Reviewed-by: Lu Baolu 
> Signed-off-by: Sai Praneeth Prakhya 
> ---
>  .../ABI/testing/sysfs-kernel-iommu_groups  | 30 
> ++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-kernel-iommu_groups 
> b/Documentation/ABI/testing/sysfs-kernel-iommu_groups
> index 017f5bc3920c..effde9d23f4f 100644
> --- a/Documentation/ABI/testing/sysfs-kernel-iommu_groups
> +++ b/Documentation/ABI/testing/sysfs-kernel-iommu_groups
> @@ -33,3 +33,33 @@ 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//type
> +Date:September 2020
> +KernelVersion:   v5.10

^^ Please can you update these two lines?

> +Contact: Sai Praneeth Prakhya 
> +Description: Let 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
> + 1. DMA: All the DMA transactions from the device in this group
> + are translated by the iommu.
> + 2. identity: All the DMA transactions from the device in this
> +  group are *not* translated by the iommu.
> + 3. auto: Change to the type the device was booted with. When the
> +  user reads the file he would never see "auto". This is

Can we avoid assuming gender here and just use "they" instead of "he", please?
Same thing for the "Caution" note below.

> +  just a write only value.

I can't figure out from this description what string is returned to
userspace in the case that the group is configured as  blocked or unmanaged.

> + Note:
> + -
> + A group type could be modified only when

s/could be/may be/

> + 1. The group has *only* one device
> + 2. The device in the group is not bound to any device driver.
> +So, the user must first unbind the appropriate driver and
> +then change the default domain type.
> + Caution:
> + 
> + Unbinding a device driver will take away the driver's 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.

Thanks,

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


[Patch V8 3/3] iommu: Document usage of "/sys/kernel/iommu_groups//type" file

2020-09-25 Thread Ashok Raj
From: Sai Praneeth Prakhya 

The default domain type of an iommu group can be changed by writing to
"/sys/kernel/iommu_groups//type" file. Hence, document it's usage
and more importantly spell out its limitations.

Cc: Christoph Hellwig 
Cc: Joerg Roedel 
Cc: Ashok Raj 
Cc: Will Deacon 
Cc: Lu Baolu 
Cc: Sohil Mehta 
Cc: Robin Murphy 
Cc: Jacob Pan 
Reviewed-by: Lu Baolu 
Signed-off-by: Sai Praneeth Prakhya 
---
 .../ABI/testing/sysfs-kernel-iommu_groups  | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-kernel-iommu_groups 
b/Documentation/ABI/testing/sysfs-kernel-iommu_groups
index 017f5bc3920c..effde9d23f4f 100644
--- a/Documentation/ABI/testing/sysfs-kernel-iommu_groups
+++ b/Documentation/ABI/testing/sysfs-kernel-iommu_groups
@@ -33,3 +33,33 @@ 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//type
+Date:  September 2020
+KernelVersion: v5.10
+Contact:   Sai Praneeth Prakhya 
+Description:   Let 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
+   1. DMA: All the DMA transactions from the device in this group
+   are translated by the iommu.
+   2. identity: All the DMA transactions from the device in this
+group are *not* translated by the iommu.
+   3. auto: Change to the type the device was booted with. When the
+user reads the file he would never see "auto". This is
+just a write only value.
+   Note:
+   -
+   A group type could be modified only when
+   1. The group has *only* one device
+   2. The device in the group is not bound to any device driver.
+  So, the user must first unbind the appropriate driver and
+  then change the default domain type.
+   Caution:
+   
+   Unbinding a device driver will take away the driver's 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.
-- 
2.7.4

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