All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
@ 2016-09-29 16:58 Glenn Serre
       [not found] ` <2ebef311-b346-f3ed-2fca-ce4715b84c9d-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Glenn Serre @ 2016-09-29 16:58 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt

Allow default to iommu=pt without adding to command line.
Add iommu=nopt to turn off default.

Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
---
  Documentation/kernel-parameters.txt | 3 ++-
  arch/x86/Kconfig                    | 7 +++++++
  arch/x86/kernel/pci-dma.c           | 6 ++++++
  3 files changed, 15 insertions(+), 1 deletion(-)

--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1607,7 +1607,8 @@
  		nomerge
  		forcesac
  		soft
-		pt		[x86, IA-64]
+		pt		[x86]
+		nopt		[x86]
  		nobypass	[PPC/POWERNV]
  			Disable IOMMU bypass, using IOMMU for PCI devices.

--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -845,6 +845,15 @@
  	def_bool y
  	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU

+config IOMMU_DEFAULT_PT
+	int "Default iommu pt value (0-1)"
+	range 0 1
+	default "0"
+	prompt "Set to 1 to default to iommu=pt"
+	help
+	  Setting this option to 1 will set iommu passthrough (iommu=pt)
+	  by default.  Use iommu=nopt to override.
+
  config MAXSMP
  	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
  	depends on X86_64 && SMP && DEBUG_KERNEL
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -43,7 +43,7 @@
   * useful if a user wants to use an IOMMU only for KVM device 
assignment to
   * guests and not for driver dma translation.
   */
-int iommu_pass_through __read_mostly;
+int iommu_pass_through __read_mostly = CONFIG_IOMMU_DEFAULT_PT;

  extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];

@@ -196,6 +196,8 @@
  #endif
  		if (!strncmp(p, "pt", 2))
  			iommu_pass_through = 1;
+		if (!strncmp(p, "nopt", 4))
+			iommu_pass_through = 0;

  		gart_parse_options(p);

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found] ` <2ebef311-b346-f3ed-2fca-ce4715b84c9d-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
@ 2016-09-29 18:11   ` Konrad Rzeszutek Wilk
       [not found]     ` <20160929181150.GC9432-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  2016-09-29 18:31   ` Alex Williamson
  2016-10-04 16:11   ` [PATCH v1 " Glenn Serre
  2 siblings, 1 reply; 16+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-09-29 18:11 UTC (permalink / raw)
  To: Glenn Serre; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On Thu, Sep 29, 2016 at 09:58:55AM -0700, Glenn Serre wrote:
> Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
> 
> Allow default to iommu=pt without adding to command line.
> Add iommu=nopt to turn off default.

What's the reason / use-case for it?

> 
> Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
> ---
>  Documentation/kernel-parameters.txt | 3 ++-
>  arch/x86/Kconfig                    | 7 +++++++
>  arch/x86/kernel/pci-dma.c           | 6 ++++++
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -1607,7 +1607,8 @@
>  		nomerge
>  		forcesac
>  		soft
> -		pt		[x86, IA-64]
> +		pt		[x86]
> +		nopt		[x86]
>  		nobypass	[PPC/POWERNV]
>  			Disable IOMMU bypass, using IOMMU for PCI devices.
> 
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -845,6 +845,15 @@
>  	def_bool y
>  	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
> 
> +config IOMMU_DEFAULT_PT
> +	int "Default iommu pt value (0-1)"
> +	range 0 1
> +	default "0"
> +	prompt "Set to 1 to default to iommu=pt"
> +	help
> +	  Setting this option to 1 will set iommu passthrough (iommu=pt)
> +	  by default.  Use iommu=nopt to override.
> +
>  config MAXSMP
>  	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
>  	depends on X86_64 && SMP && DEBUG_KERNEL
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -43,7 +43,7 @@
>   * useful if a user wants to use an IOMMU only for KVM device assignment to
>   * guests and not for driver dma translation.
>   */
> -int iommu_pass_through __read_mostly;
> +int iommu_pass_through __read_mostly = CONFIG_IOMMU_DEFAULT_PT;
> 
>  extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
> 
> @@ -196,6 +196,8 @@
>  #endif
>  		if (!strncmp(p, "pt", 2))
>  			iommu_pass_through = 1;
> +		if (!strncmp(p, "nopt", 4))
> +			iommu_pass_through = 0;
> 
>  		gart_parse_options(p);
> 
> _______________________________________________
> iommu mailing list
> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]     ` <20160929181150.GC9432-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2016-09-29 18:18       ` Glenn Serre
       [not found]         ` <ed808649-22d6-8447-5ddb-5d19665b7fa3-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Glenn Serre @ 2016-09-29 18:18 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Good morning,

On 09/29/2016 11:11 AM, Konrad Rzeszutek Wilk wrote:
> On Thu, Sep 29, 2016 at 09:58:55AM -0700, Glenn Serre wrote:
>> Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
>>
>> Allow default to iommu=pt without adding to command line.
>> Add iommu=nopt to turn off default.
>
> What's the reason / use-case for it?

The top-level reason is we would prefer our kernel command line to not 
grow any larger than it already is.

The reason we use iommu=pt is to support using the DPDK igb_uio driver, 
which we need to do on servers that have an iommu but lack ACS.

Thanks,
--Glenn S.

>
>>
>> Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
>> ---
>>  Documentation/kernel-parameters.txt | 3 ++-
>>  arch/x86/Kconfig                    | 7 +++++++
>>  arch/x86/kernel/pci-dma.c           | 6 ++++++
>>  3 files changed, 15 insertions(+), 1 deletion(-)
>>
>> --- a/Documentation/kernel-parameters.txt
>> +++ b/Documentation/kernel-parameters.txt
>> @@ -1607,7 +1607,8 @@
>>  		nomerge
>>  		forcesac
>>  		soft
>> -		pt		[x86, IA-64]
>> +		pt		[x86]
>> +		nopt		[x86]
>>  		nobypass	[PPC/POWERNV]
>>  			Disable IOMMU bypass, using IOMMU for PCI devices.
>>
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -845,6 +845,15 @@
>>  	def_bool y
>>  	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
>>
>> +config IOMMU_DEFAULT_PT
>> +	int "Default iommu pt value (0-1)"
>> +	range 0 1
>> +	default "0"
>> +	prompt "Set to 1 to default to iommu=pt"
>> +	help
>> +	  Setting this option to 1 will set iommu passthrough (iommu=pt)
>> +	  by default.  Use iommu=nopt to override.
>> +
>>  config MAXSMP
>>  	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
>>  	depends on X86_64 && SMP && DEBUG_KERNEL
>> --- a/arch/x86/kernel/pci-dma.c
>> +++ b/arch/x86/kernel/pci-dma.c
>> @@ -43,7 +43,7 @@
>>   * useful if a user wants to use an IOMMU only for KVM device assignment to
>>   * guests and not for driver dma translation.
>>   */
>> -int iommu_pass_through __read_mostly;
>> +int iommu_pass_through __read_mostly = CONFIG_IOMMU_DEFAULT_PT;
>>
>>  extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
>>
>> @@ -196,6 +196,8 @@
>>  #endif
>>  		if (!strncmp(p, "pt", 2))
>>  			iommu_pass_through = 1;
>> +		if (!strncmp(p, "nopt", 4))
>> +			iommu_pass_through = 0;
>>
>>  		gart_parse_options(p);
>>
>> _______________________________________________
>> iommu mailing list
>> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.linuxfoundation.org_mailman_listinfo_iommu&d=DQIBAg&c=IL_XqQWOjubgfqINi2jTzg&r=3biwyMBB1JD9rm0R5wqz7zcDVkNif9HJ5Pflrr18dkw&m=JAPHQW96EkN4p33Jc7yZG15XGwK_KprKNxbbQvkgJ1c&s=HSZCSWNkVn-60uhbA_07tZgukoQbP3zZAhU0con30VY&e=

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]         ` <ed808649-22d6-8447-5ddb-5d19665b7fa3-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
@ 2016-09-29 18:20           ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 16+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-09-29 18:20 UTC (permalink / raw)
  To: Glenn Serre; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On Thu, Sep 29, 2016 at 11:18:34AM -0700, Glenn Serre wrote:
> Good morning,
> 
> On 09/29/2016 11:11 AM, Konrad Rzeszutek Wilk wrote:
> > On Thu, Sep 29, 2016 at 09:58:55AM -0700, Glenn Serre wrote:
> > > Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
> > > 
> > > Allow default to iommu=pt without adding to command line.
> > > Add iommu=nopt to turn off default.
> > 
> > What's the reason / use-case for it?
> 
> The top-level reason is we would prefer our kernel command line to not grow
> any larger than it already is.
> 

That:
> The reason we use iommu=pt is to support using the DPDK igb_uio driver,
> which we need to do on servers that have an iommu but lack ACS.
> 

Should be part of the commit description.


> Thanks,
> --Glenn S.
> 
> > 
> > > 
> > > Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
> > > ---
> > >  Documentation/kernel-parameters.txt | 3 ++-
> > >  arch/x86/Kconfig                    | 7 +++++++
> > >  arch/x86/kernel/pci-dma.c           | 6 ++++++
> > >  3 files changed, 15 insertions(+), 1 deletion(-)
> > > 
> > > --- a/Documentation/kernel-parameters.txt
> > > +++ b/Documentation/kernel-parameters.txt
> > > @@ -1607,7 +1607,8 @@
> > >  		nomerge
> > >  		forcesac
> > >  		soft
> > > -		pt		[x86, IA-64]
> > > +		pt		[x86]
> > > +		nopt		[x86]
> > >  		nobypass	[PPC/POWERNV]
> > >  			Disable IOMMU bypass, using IOMMU for PCI devices.
> > > 
> > > --- a/arch/x86/Kconfig
> > > +++ b/arch/x86/Kconfig
> > > @@ -845,6 +845,15 @@
> > >  	def_bool y
> > >  	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
> > > 
> > > +config IOMMU_DEFAULT_PT
> > > +	int "Default iommu pt value (0-1)"
> > > +	range 0 1
> > > +	default "0"
> > > +	prompt "Set to 1 to default to iommu=pt"
> > > +	help
> > > +	  Setting this option to 1 will set iommu passthrough (iommu=pt)
> > > +	  by default.  Use iommu=nopt to override.
> > > +
> > >  config MAXSMP
> > >  	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
> > >  	depends on X86_64 && SMP && DEBUG_KERNEL
> > > --- a/arch/x86/kernel/pci-dma.c
> > > +++ b/arch/x86/kernel/pci-dma.c
> > > @@ -43,7 +43,7 @@
> > >   * useful if a user wants to use an IOMMU only for KVM device assignment to
> > >   * guests and not for driver dma translation.
> > >   */
> > > -int iommu_pass_through __read_mostly;
> > > +int iommu_pass_through __read_mostly = CONFIG_IOMMU_DEFAULT_PT;
> > > 
> > >  extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
> > > 
> > > @@ -196,6 +196,8 @@
> > >  #endif
> > >  		if (!strncmp(p, "pt", 2))
> > >  			iommu_pass_through = 1;
> > > +		if (!strncmp(p, "nopt", 4))
> > > +			iommu_pass_through = 0;
> > > 
> > >  		gart_parse_options(p);
> > > 
> > > _______________________________________________
> > > iommu mailing list
> > > iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.linuxfoundation.org_mailman_listinfo_iommu&d=DQIBAg&c=IL_XqQWOjubgfqINi2jTzg&r=3biwyMBB1JD9rm0R5wqz7zcDVkNif9HJ5Pflrr18dkw&m=JAPHQW96EkN4p33Jc7yZG15XGwK_KprKNxbbQvkgJ1c&s=HSZCSWNkVn-60uhbA_07tZgukoQbP3zZAhU0con30VY&e=

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found] ` <2ebef311-b346-f3ed-2fca-ce4715b84c9d-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
  2016-09-29 18:11   ` Konrad Rzeszutek Wilk
@ 2016-09-29 18:31   ` Alex Williamson
       [not found]     ` <20160929123115.7afcc88e-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
  2016-10-04 16:11   ` [PATCH v1 " Glenn Serre
  2 siblings, 1 reply; 16+ messages in thread
From: Alex Williamson @ 2016-09-29 18:31 UTC (permalink / raw)
  To: Glenn Serre; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On Thu, 29 Sep 2016 09:58:55 -0700
Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org> wrote:

> Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
> 
> Allow default to iommu=pt without adding to command line.
> Add iommu=nopt to turn off default.
> 
> Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
> ---
>   Documentation/kernel-parameters.txt | 3 ++-
>   arch/x86/Kconfig                    | 7 +++++++
>   arch/x86/kernel/pci-dma.c           | 6 ++++++
>   3 files changed, 15 insertions(+), 1 deletion(-)
> 
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -1607,7 +1607,8 @@
>   		nomerge
>   		forcesac
>   		soft
> -		pt		[x86, IA-64]
> +		pt		[x86]
> +		nopt		[x86]
>   		nobypass	[PPC/POWERNV]
>   			Disable IOMMU bypass, using IOMMU for PCI devices.
> 
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -845,6 +845,15 @@
>   	def_bool y
>   	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
> 
> +config IOMMU_DEFAULT_PT
> +	int "Default iommu pt value (0-1)"
> +	range 0 1
> +	default "0"
> +	prompt "Set to 1 to default to iommu=pt"

An integer that can be either zero or one... IOW a bool.  There's
support for bools in Kconfig.

> +	help
> +	  Setting this option to 1 will set iommu passthrough (iommu=pt)
> +	  by default.  Use iommu=nopt to override.
> +
>   config MAXSMP
>   	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
>   	depends on X86_64 && SMP && DEBUG_KERNEL
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -43,7 +43,7 @@
>    * useful if a user wants to use an IOMMU only for KVM device 
> assignment to
>    * guests and not for driver dma translation.
>    */
> -int iommu_pass_through __read_mostly;
> +int iommu_pass_through __read_mostly = CONFIG_IOMMU_DEFAULT_PT;
> 
>   extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
> 
> @@ -196,6 +196,8 @@
>   #endif
>   		if (!strncmp(p, "pt", 2))
>   			iommu_pass_through = 1;
> +		if (!strncmp(p, "nopt", 4))
> +			iommu_pass_through = 0;
> 
>   		gart_parse_options(p);
> 
> _______________________________________________
> iommu mailing list
> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]     ` <20160929123115.7afcc88e-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
@ 2016-09-29 18:41       ` Glenn Serre
       [not found]         ` <66f8f023-41a6-17e0-2df0-190cf5edb7ec-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Glenn Serre @ 2016-09-29 18:41 UTC (permalink / raw)
  To: Alex Williamson; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Good morning,

On 09/29/2016 11:31 AM, Alex Williamson wrote:
> On Thu, 29 Sep 2016 09:58:55 -0700
> Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org> wrote:
>
>> Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
>>
>> Allow default to iommu=pt without adding to command line.
>> Add iommu=nopt to turn off default.
>>
>> Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
>> ---
>>   Documentation/kernel-parameters.txt | 3 ++-
>>   arch/x86/Kconfig                    | 7 +++++++
>>   arch/x86/kernel/pci-dma.c           | 6 ++++++
>>   3 files changed, 15 insertions(+), 1 deletion(-)
>>
>> --- a/Documentation/kernel-parameters.txt
>> +++ b/Documentation/kernel-parameters.txt
>> @@ -1607,7 +1607,8 @@
>>   		nomerge
>>   		forcesac
>>   		soft
>> -		pt		[x86, IA-64]
>> +		pt		[x86]
>> +		nopt		[x86]
>>   		nobypass	[PPC/POWERNV]
>>   			Disable IOMMU bypass, using IOMMU for PCI devices.
>>
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -845,6 +845,15 @@
>>   	def_bool y
>>   	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
>>
>> +config IOMMU_DEFAULT_PT
>> +	int "Default iommu pt value (0-1)"
>> +	range 0 1
>> +	default "0"
>> +	prompt "Set to 1 to default to iommu=pt"
>
> An integer that can be either zero or one... IOW a bool.  There's
> support for bools in Kconfig.

We had discussion about that during in-house code review.  My initial 
take was bool like INTEL_IOMMU_DEFAULT_ON, but reviewers thought the 
current "right" way was range 0-1 like MTRR_SANITIZER_ENABLE_DEFAULT to 
avoid an ifdef, else, endif:

#ifdef CONFIG_IOMMU_DEFAULT_PT
int iommu_pass_through __read_mostly = 1;
#else
int iommu_pass_through __read_mostly;
#endif /* CONFIG_IOMMU_DEFAULT_PT */

I'll go with whatever y'all prefer.

Thanks,
--Glenn S.

>
>> +	help
>> +	  Setting this option to 1 will set iommu passthrough (iommu=pt)
>> +	  by default.  Use iommu=nopt to override.
>> +
>>   config MAXSMP
>>   	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
>>   	depends on X86_64 && SMP && DEBUG_KERNEL
>> --- a/arch/x86/kernel/pci-dma.c
>> +++ b/arch/x86/kernel/pci-dma.c
>> @@ -43,7 +43,7 @@
>>    * useful if a user wants to use an IOMMU only for KVM device
>> assignment to
>>    * guests and not for driver dma translation.
>>    */
>> -int iommu_pass_through __read_mostly;
>> +int iommu_pass_through __read_mostly = CONFIG_IOMMU_DEFAULT_PT;
>>
>>   extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
>>
>> @@ -196,6 +196,8 @@
>>   #endif
>>   		if (!strncmp(p, "pt", 2))
>>   			iommu_pass_through = 1;
>> +		if (!strncmp(p, "nopt", 4))
>> +			iommu_pass_through = 0;
>>
>>   		gart_parse_options(p);
>>
>> _______________________________________________
>> iommu mailing list
>> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.linuxfoundation.org_mailman_listinfo_iommu&d=DQICAg&c=IL_XqQWOjubgfqINi2jTzg&r=3biwyMBB1JD9rm0R5wqz7zcDVkNif9HJ5Pflrr18dkw&m=6weXbuobXVwdVUVGUJUzgHf_32Tr95Ey128v4XLFPjs&s=XTyH-JkxzIj-W47wN4KHobMOdUQjXNnrngKhCndmG9I&e=
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]         ` <66f8f023-41a6-17e0-2df0-190cf5edb7ec-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
@ 2016-09-29 19:01           ` Alex Williamson
       [not found]             ` <20160929130122.401aa85d-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Alex Williamson @ 2016-09-29 19:01 UTC (permalink / raw)
  To: Glenn Serre; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On Thu, 29 Sep 2016 11:41:53 -0700
Glenn Serre <gserre-yk0uUPyXz1dBDgjK7y7TUQ@public.gmane.org> wrote:

> Good morning,
> 
> On 09/29/2016 11:31 AM, Alex Williamson wrote:
> > On Thu, 29 Sep 2016 09:58:55 -0700
> > Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org> wrote:
> >  
> >> Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
> >>
> >> Allow default to iommu=pt without adding to command line.
> >> Add iommu=nopt to turn off default.
> >>
> >> Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
> >> ---
> >>   Documentation/kernel-parameters.txt | 3 ++-
> >>   arch/x86/Kconfig                    | 7 +++++++
> >>   arch/x86/kernel/pci-dma.c           | 6 ++++++
> >>   3 files changed, 15 insertions(+), 1 deletion(-)
> >>
> >> --- a/Documentation/kernel-parameters.txt
> >> +++ b/Documentation/kernel-parameters.txt
> >> @@ -1607,7 +1607,8 @@
> >>   		nomerge
> >>   		forcesac
> >>   		soft
> >> -		pt		[x86, IA-64]
> >> +		pt		[x86]
> >> +		nopt		[x86]
> >>   		nobypass	[PPC/POWERNV]
> >>   			Disable IOMMU bypass, using IOMMU for PCI devices.
> >>
> >> --- a/arch/x86/Kconfig
> >> +++ b/arch/x86/Kconfig
> >> @@ -845,6 +845,15 @@
> >>   	def_bool y
> >>   	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
> >>
> >> +config IOMMU_DEFAULT_PT
> >> +	int "Default iommu pt value (0-1)"
> >> +	range 0 1
> >> +	default "0"
> >> +	prompt "Set to 1 to default to iommu=pt"  
> >
> > An integer that can be either zero or one... IOW a bool.  There's
> > support for bools in Kconfig.  
> 
> We had discussion about that during in-house code review.  My initial 
> take was bool like INTEL_IOMMU_DEFAULT_ON, but reviewers thought the 
> current "right" way was range 0-1 like MTRR_SANITIZER_ENABLE_DEFAULT to 
> avoid an ifdef, else, endif:
> 
> #ifdef CONFIG_IOMMU_DEFAULT_PT
> int iommu_pass_through __read_mostly = 1;
> #else
> int iommu_pass_through __read_mostly;
> #endif /* CONFIG_IOMMU_DEFAULT_PT */
> 
> I'll go with whatever y'all prefer.

Ok, I didn't really think it all the way through I guess.  Still, my
opinion is that it's strange to have a yes/no Kconfig option take a 0/1
parameter and I'd probably rather have the slightly uglier code for the
benefit of a more intuitive Kconfig.  Maybe others disagree.  Thanks,

Alex

> >  
> >> +	help
> >> +	  Setting this option to 1 will set iommu passthrough (iommu=pt)
> >> +	  by default.  Use iommu=nopt to override.
> >> +
> >>   config MAXSMP
> >>   	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
> >>   	depends on X86_64 && SMP && DEBUG_KERNEL
> >> --- a/arch/x86/kernel/pci-dma.c
> >> +++ b/arch/x86/kernel/pci-dma.c
> >> @@ -43,7 +43,7 @@
> >>    * useful if a user wants to use an IOMMU only for KVM device
> >> assignment to
> >>    * guests and not for driver dma translation.
> >>    */
> >> -int iommu_pass_through __read_mostly;
> >> +int iommu_pass_through __read_mostly = CONFIG_IOMMU_DEFAULT_PT;
> >>
> >>   extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
> >>
> >> @@ -196,6 +196,8 @@
> >>   #endif
> >>   		if (!strncmp(p, "pt", 2))
> >>   			iommu_pass_through = 1;
> >> +		if (!strncmp(p, "nopt", 4))
> >> +			iommu_pass_through = 0;
> >>
> >>   		gart_parse_options(p);
> >>
> >> _______________________________________________
> >> iommu mailing list
> >> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> >> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.linuxfoundation.org_mailman_listinfo_iommu&d=DQICAg&c=IL_XqQWOjubgfqINi2jTzg&r=3biwyMBB1JD9rm0R5wqz7zcDVkNif9HJ5Pflrr18dkw&m=6weXbuobXVwdVUVGUJUzgHf_32Tr95Ey128v4XLFPjs&s=XTyH-JkxzIj-W47wN4KHobMOdUQjXNnrngKhCndmG9I&e=  
> >  

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]             ` <20160929130122.401aa85d-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
@ 2016-09-30 16:19               ` Robin Murphy
  0 siblings, 0 replies; 16+ messages in thread
From: Robin Murphy @ 2016-09-30 16:19 UTC (permalink / raw)
  To: Alex Williamson, Glenn Serre
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On 29/09/16 20:01, Alex Williamson wrote:
> On Thu, 29 Sep 2016 11:41:53 -0700
> Glenn Serre <gserre-yk0uUPyXz1dBDgjK7y7TUQ@public.gmane.org> wrote:
> 
>> Good morning,
>>
>> On 09/29/2016 11:31 AM, Alex Williamson wrote:
>>> On Thu, 29 Sep 2016 09:58:55 -0700
>>> Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org> wrote:
>>>  
>>>> Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
>>>>
>>>> Allow default to iommu=pt without adding to command line.
>>>> Add iommu=nopt to turn off default.
>>>>
>>>> Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
>>>> ---
>>>>   Documentation/kernel-parameters.txt | 3 ++-
>>>>   arch/x86/Kconfig                    | 7 +++++++
>>>>   arch/x86/kernel/pci-dma.c           | 6 ++++++
>>>>   3 files changed, 15 insertions(+), 1 deletion(-)
>>>>
>>>> --- a/Documentation/kernel-parameters.txt
>>>> +++ b/Documentation/kernel-parameters.txt
>>>> @@ -1607,7 +1607,8 @@
>>>>   		nomerge
>>>>   		forcesac
>>>>   		soft
>>>> -		pt		[x86, IA-64]
>>>> +		pt		[x86]
>>>> +		nopt		[x86]
>>>>   		nobypass	[PPC/POWERNV]
>>>>   			Disable IOMMU bypass, using IOMMU for PCI devices.
>>>>
>>>> --- a/arch/x86/Kconfig
>>>> +++ b/arch/x86/Kconfig
>>>> @@ -845,6 +845,15 @@
>>>>   	def_bool y
>>>>   	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
>>>>
>>>> +config IOMMU_DEFAULT_PT
>>>> +	int "Default iommu pt value (0-1)"
>>>> +	range 0 1
>>>> +	default "0"
>>>> +	prompt "Set to 1 to default to iommu=pt"  
>>>
>>> An integer that can be either zero or one... IOW a bool.  There's
>>> support for bools in Kconfig.  
>>
>> We had discussion about that during in-house code review.  My initial 
>> take was bool like INTEL_IOMMU_DEFAULT_ON, but reviewers thought the 
>> current "right" way was range 0-1 like MTRR_SANITIZER_ENABLE_DEFAULT to 
>> avoid an ifdef, else, endif:
>>
>> #ifdef CONFIG_IOMMU_DEFAULT_PT
>> int iommu_pass_through __read_mostly = 1;
>> #else
>> int iommu_pass_through __read_mostly;
>> #endif /* CONFIG_IOMMU_DEFAULT_PT */
>>
>> I'll go with whatever y'all prefer.
> 
> Ok, I didn't really think it all the way through I guess.  Still, my
> opinion is that it's strange to have a yes/no Kconfig option take a 0/1
> parameter and I'd probably rather have the slightly uglier code for the
> benefit of a more intuitive Kconfig.  Maybe others disagree.  Thanks,

Actually, there's no need for ugly code *or* an unintuitive Kconfig
type. See e.g. __pat_enabled in arch/x86/mm/pat.c ;)

Robin.

> 
> Alex
> 
>>>  
>>>> +	help
>>>> +	  Setting this option to 1 will set iommu passthrough (iommu=pt)
>>>> +	  by default.  Use iommu=nopt to override.
>>>> +
>>>>   config MAXSMP
>>>>   	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
>>>>   	depends on X86_64 && SMP && DEBUG_KERNEL
>>>> --- a/arch/x86/kernel/pci-dma.c
>>>> +++ b/arch/x86/kernel/pci-dma.c
>>>> @@ -43,7 +43,7 @@
>>>>    * useful if a user wants to use an IOMMU only for KVM device
>>>> assignment to
>>>>    * guests and not for driver dma translation.
>>>>    */
>>>> -int iommu_pass_through __read_mostly;
>>>> +int iommu_pass_through __read_mostly = CONFIG_IOMMU_DEFAULT_PT;
>>>>
>>>>   extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
>>>>
>>>> @@ -196,6 +196,8 @@
>>>>   #endif
>>>>   		if (!strncmp(p, "pt", 2))
>>>>   			iommu_pass_through = 1;
>>>> +		if (!strncmp(p, "nopt", 4))
>>>> +			iommu_pass_through = 0;
>>>>
>>>>   		gart_parse_options(p);
>>>>
>>>> _______________________________________________
>>>> iommu mailing list
>>>> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.linuxfoundation.org_mailman_listinfo_iommu&d=DQICAg&c=IL_XqQWOjubgfqINi2jTzg&r=3biwyMBB1JD9rm0R5wqz7zcDVkNif9HJ5Pflrr18dkw&m=6weXbuobXVwdVUVGUJUzgHf_32Tr95Ey128v4XLFPjs&s=XTyH-JkxzIj-W47wN4KHobMOdUQjXNnrngKhCndmG9I&e=  
>>>  
> 
> _______________________________________________
> iommu mailing list
> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu
> 

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v1 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found] ` <2ebef311-b346-f3ed-2fca-ce4715b84c9d-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
  2016-09-29 18:11   ` Konrad Rzeszutek Wilk
  2016-09-29 18:31   ` Alex Williamson
@ 2016-10-04 16:11   ` Glenn Serre
       [not found]     ` <6b2c6f0b-cce8-b8f6-37c2-d4cc453bd603-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
  2 siblings, 1 reply; 16+ messages in thread
From: Glenn Serre @ 2016-10-04 16:11 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt

Allow default to iommu=pt without adding to command line.
Add iommu=nopt to turn off default.

The reason we use iommu=pt is to support using the DPDK igb_uio driver,
which we need to do on servers that have an iommu but lack ACS.

Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
---
  Documentation/kernel-parameters.txt | 3 ++-
  arch/x86/Kconfig                    | 7 +++++++
  arch/x86/kernel/pci-dma.c           | 6 ++++++
  3 files changed, 15 insertions(+), 1 deletion(-)

--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1607,7 +1607,8 @@
  		nomerge
  		forcesac
  		soft
-		pt		[x86, IA-64]
+		pt		[x86]
+		nopt		[x86]
  		nobypass	[PPC/POWERNV]
  			Disable IOMMU bypass, using IOMMU for PCI devices.

--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -845,6 +845,13 @@
  	def_bool y
  	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU

+config IOMMU_DEFAULT_PT
+	def_bool n
+	prompt "Set iommu=pt by default"
+	help
+	  Selecting this option will set iommu passthrough (iommu=pt)
+	  by default.  Use iommu=nopt to override.
+
  config MAXSMP
  	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
  	depends on X86_64 && SMP && DEBUG_KERNEL
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -43,7 +43,7 @@
   * useful if a user wants to use an IOMMU only for KVM device assignment to
   * guests and not for driver dma translation.
   */
-int iommu_pass_through __read_mostly;
+int iommu_pass_through __read_mostly = IS_ENABLED(CONFIG_IOMMU_DEFAULT_PT);

  extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];

@@ -196,6 +196,8 @@
  #endif
  		if (!strncmp(p, "pt", 2))
  			iommu_pass_through = 1;
+		if (!strncmp(p, "nopt", 4))
+			iommu_pass_through = 0;

  		gart_parse_options(p);

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]     ` <6b2c6f0b-cce8-b8f6-37c2-d4cc453bd603-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
@ 2016-10-04 16:52       ` Konrad Rzeszutek Wilk
       [not found]         ` <20161004165232.GD2428-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-10-04 16:52 UTC (permalink / raw)
  To: Glenn Serre; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On Tue, Oct 04, 2016 at 09:11:39AM -0700, Glenn Serre wrote:
> Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
> 
> Allow default to iommu=pt without adding to command line.
> Add iommu=nopt to turn off default.
> 
> The reason we use iommu=pt is to support using the DPDK igb_uio driver,
> which we need to do on servers that have an iommu but lack ACS.
> 
> Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
> ---
>  Documentation/kernel-parameters.txt | 3 ++-
>  arch/x86/Kconfig                    | 7 +++++++
>  arch/x86/kernel/pci-dma.c           | 6 ++++++
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -1607,7 +1607,8 @@
>  		nomerge
>  		forcesac
>  		soft
> -		pt		[x86, IA-64]
> +		pt		[x86]

What about adding IA-64 back on?

> +		nopt		[x86]

Or here?
>  		nobypass	[PPC/POWERNV]
>  			Disable IOMMU bypass, using IOMMU for PCI devices.
> 
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -845,6 +845,13 @@
>  	def_bool y
>  	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
> 
> +config IOMMU_DEFAULT_PT
> +	def_bool n
> +	prompt "Set iommu=pt by default"
> +	help
> +	  Selecting this option will set iommu passthrough (iommu=pt)
> +	  by default.  Use iommu=nopt to override.
> +
>  config MAXSMP
>  	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
>  	depends on X86_64 && SMP && DEBUG_KERNEL
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -43,7 +43,7 @@
>   * useful if a user wants to use an IOMMU only for KVM device assignment to
>   * guests and not for driver dma translation.
>   */
> -int iommu_pass_through __read_mostly;
> +int iommu_pass_through __read_mostly = IS_ENABLED(CONFIG_IOMMU_DEFAULT_PT);
> 
>  extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
> 
> @@ -196,6 +196,8 @@
>  #endif
>  		if (!strncmp(p, "pt", 2))
>  			iommu_pass_through = 1;
> +		if (!strncmp(p, "nopt", 4))
> +			iommu_pass_through = 0;
> 
>  		gart_parse_options(p);
> 
> _______________________________________________
> iommu mailing list
> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]         ` <20161004165232.GD2428-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2016-10-04 17:00           ` Glenn Serre
       [not found]             ` <04ab568e-8088-cf23-facb-7ef3fecf4bb6-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Glenn Serre @ 2016-10-04 17:00 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Good afternoon,

On 10/04/2016 09:52 AM, Konrad Rzeszutek Wilk wrote:
> On Tue, Oct 04, 2016 at 09:11:39AM -0700, Glenn Serre wrote:
>> Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
>>
>> Allow default to iommu=pt without adding to command line.
>> Add iommu=nopt to turn off default.
>>
>> The reason we use iommu=pt is to support using the DPDK igb_uio driver,
>> which we need to do on servers that have an iommu but lack ACS.
>>
>> Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
>> ---
>>  Documentation/kernel-parameters.txt | 3 ++-
>>  arch/x86/Kconfig                    | 7 +++++++
>>  arch/x86/kernel/pci-dma.c           | 6 ++++++
>>  3 files changed, 15 insertions(+), 1 deletion(-)
>>
>> --- a/Documentation/kernel-parameters.txt
>> +++ b/Documentation/kernel-parameters.txt
>> @@ -1607,7 +1607,8 @@
>>  		nomerge
>>  		forcesac
>>  		soft
>> -		pt		[x86, IA-64]
>> +		pt		[x86]
>
> What about adding IA-64 back on?

As far as I can see, IA-64 doesn't pay any attention at all to the iommu 
parameter.  In arch/ia64/kernel/pci-dma.c, I see

int iommu_pass_through;

but no early_param("iommu"), other occurrence of "iommu", or reference to 
iommu_pass_through.

Thanks,
--Glenn S.

>
>> +		nopt		[x86]
>
> Or here?
>>  		nobypass	[PPC/POWERNV]
>>  			Disable IOMMU bypass, using IOMMU for PCI devices.
>>
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -845,6 +845,13 @@
>>  	def_bool y
>>  	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
>>
>> +config IOMMU_DEFAULT_PT
>> +	def_bool n
>> +	prompt "Set iommu=pt by default"
>> +	help
>> +	  Selecting this option will set iommu passthrough (iommu=pt)
>> +	  by default.  Use iommu=nopt to override.
>> +
>>  config MAXSMP
>>  	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
>>  	depends on X86_64 && SMP && DEBUG_KERNEL
>> --- a/arch/x86/kernel/pci-dma.c
>> +++ b/arch/x86/kernel/pci-dma.c
>> @@ -43,7 +43,7 @@
>>   * useful if a user wants to use an IOMMU only for KVM device assignment to
>>   * guests and not for driver dma translation.
>>   */
>> -int iommu_pass_through __read_mostly;
>> +int iommu_pass_through __read_mostly = IS_ENABLED(CONFIG_IOMMU_DEFAULT_PT);
>>
>>  extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
>>
>> @@ -196,6 +196,8 @@
>>  #endif
>>  		if (!strncmp(p, "pt", 2))
>>  			iommu_pass_through = 1;
>> +		if (!strncmp(p, "nopt", 4))
>> +			iommu_pass_through = 0;
>>
>>  		gart_parse_options(p);
>>
>> _______________________________________________
>> iommu mailing list
>> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.linuxfoundation.org_mailman_listinfo_iommu&d=DQIBAg&c=IL_XqQWOjubgfqINi2jTzg&r=3biwyMBB1JD9rm0R5wqz7zcDVkNif9HJ5Pflrr18dkw&m=sJQfEY5rZcAq-0QEyNvDxZkeujsoeiY8B_gabGOkyv8&s=ctQKeFfmQJ0ET8hJNBJmeRxdv_gwYgvysgku7sxdV4o&e=

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]             ` <04ab568e-8088-cf23-facb-7ef3fecf4bb6-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
@ 2016-10-04 17:03               ` Konrad Rzeszutek Wilk
       [not found]                 ` <20161004170358.GE2428-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-10-04 17:03 UTC (permalink / raw)
  To: Glenn Serre; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

On Tue, Oct 04, 2016 at 10:00:50AM -0700, Glenn Serre wrote:
> Good afternoon,
> 
> On 10/04/2016 09:52 AM, Konrad Rzeszutek Wilk wrote:
> > On Tue, Oct 04, 2016 at 09:11:39AM -0700, Glenn Serre wrote:
> > > Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
> > > 
> > > Allow default to iommu=pt without adding to command line.
> > > Add iommu=nopt to turn off default.
> > > 
> > > The reason we use iommu=pt is to support using the DPDK igb_uio driver,
> > > which we need to do on servers that have an iommu but lack ACS.
> > > 
> > > Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
> > > ---
> > >  Documentation/kernel-parameters.txt | 3 ++-
> > >  arch/x86/Kconfig                    | 7 +++++++
> > >  arch/x86/kernel/pci-dma.c           | 6 ++++++
> > >  3 files changed, 15 insertions(+), 1 deletion(-)
> > > 
> > > --- a/Documentation/kernel-parameters.txt
> > > +++ b/Documentation/kernel-parameters.txt
> > > @@ -1607,7 +1607,8 @@
> > >  		nomerge
> > >  		forcesac
> > >  		soft
> > > -		pt		[x86, IA-64]
> > > +		pt		[x86]
> > 
> > What about adding IA-64 back on?
> 
> As far as I can see, IA-64 doesn't pay any attention at all to the iommu
> parameter.  In arch/ia64/kernel/pci-dma.c, I see
> 
> int iommu_pass_through;
> 
> but no early_param("iommu"), other occurrence of "iommu", or reference to
> iommu_pass_through.

That ought to be a seperate patch - one functional change per patch (see
Documentation/SubmittingPatches).

Or you can mention this in the commit description..
> 
> Thanks,
> --Glenn S.
> 
> > 
> > > +		nopt		[x86]
> > 
> > Or here?
> > >  		nobypass	[PPC/POWERNV]
> > >  			Disable IOMMU bypass, using IOMMU for PCI devices.
> > > 
> > > --- a/arch/x86/Kconfig
> > > +++ b/arch/x86/Kconfig
> > > @@ -845,6 +845,13 @@
> > >  	def_bool y
> > >  	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
> > > 
> > > +config IOMMU_DEFAULT_PT
> > > +	def_bool n
> > > +	prompt "Set iommu=pt by default"
> > > +	help
> > > +	  Selecting this option will set iommu passthrough (iommu=pt)
> > > +	  by default.  Use iommu=nopt to override.
> > > +
> > >  config MAXSMP
> > >  	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
> > >  	depends on X86_64 && SMP && DEBUG_KERNEL
> > > --- a/arch/x86/kernel/pci-dma.c
> > > +++ b/arch/x86/kernel/pci-dma.c
> > > @@ -43,7 +43,7 @@
> > >   * useful if a user wants to use an IOMMU only for KVM device assignment to
> > >   * guests and not for driver dma translation.
> > >   */
> > > -int iommu_pass_through __read_mostly;
> > > +int iommu_pass_through __read_mostly = IS_ENABLED(CONFIG_IOMMU_DEFAULT_PT);
> > > 
> > >  extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
> > > 
> > > @@ -196,6 +196,8 @@
> > >  #endif
> > >  		if (!strncmp(p, "pt", 2))
> > >  			iommu_pass_through = 1;
> > > +		if (!strncmp(p, "nopt", 4))
> > > +			iommu_pass_through = 0;
> > > 
> > >  		gart_parse_options(p);
> > > 
> > > _______________________________________________
> > > iommu mailing list
> > > iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> > > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.linuxfoundation.org_mailman_listinfo_iommu&d=DQIBAg&c=IL_XqQWOjubgfqINi2jTzg&r=3biwyMBB1JD9rm0R5wqz7zcDVkNif9HJ5Pflrr18dkw&m=sJQfEY5rZcAq-0QEyNvDxZkeujsoeiY8B_gabGOkyv8&s=ctQKeFfmQJ0ET8hJNBJmeRxdv_gwYgvysgku7sxdV4o&e=

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v1 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]                 ` <20161004170358.GE2428-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2016-10-04 17:32                   ` Glenn Serre
       [not found]                     ` <ad5f24df-99e3-d9c7-4ca3-ba3de820da8e-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Glenn Serre @ 2016-10-04 17:32 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Good morning,

On 10/04/2016 10:03 AM, Konrad Rzeszutek Wilk wrote:
> On Tue, Oct 04, 2016 at 10:00:50AM -0700, Glenn Serre wrote:
>> Good afternoon,
>>
>> On 10/04/2016 09:52 AM, Konrad Rzeszutek Wilk wrote:
>>> On Tue, Oct 04, 2016 at 09:11:39AM -0700, Glenn Serre wrote:
>>>> Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
>>>>
>>>> Allow default to iommu=pt without adding to command line.
>>>> Add iommu=nopt to turn off default.
>>>>
>>>> The reason we use iommu=pt is to support using the DPDK igb_uio driver,
>>>> which we need to do on servers that have an iommu but lack ACS.
>>>>
>>>> Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
>>>> ---
>>>>  Documentation/kernel-parameters.txt | 3 ++-
>>>>  arch/x86/Kconfig                    | 7 +++++++
>>>>  arch/x86/kernel/pci-dma.c           | 6 ++++++
>>>>  3 files changed, 15 insertions(+), 1 deletion(-)
>>>>
>>>> --- a/Documentation/kernel-parameters.txt
>>>> +++ b/Documentation/kernel-parameters.txt
>>>> @@ -1607,7 +1607,8 @@
>>>>  		nomerge
>>>>  		forcesac
>>>>  		soft
>>>> -		pt		[x86, IA-64]
>>>> +		pt		[x86]
>>>
>>> What about adding IA-64 back on?
>>
>> As far as I can see, IA-64 doesn't pay any attention at all to the iommu
>> parameter.  In arch/ia64/kernel/pci-dma.c, I see
>>
>> int iommu_pass_through;
>>
>> but no early_param("iommu"), other occurrence of "iommu", or reference to
>> iommu_pass_through.
>
> That ought to be a seperate patch - one functional change per patch (see
> Documentation/SubmittingPatches).

OK.  One for remove IA-64 in kernel-parameters.txt, one for other stuff.

--Glenn S.

>
> Or you can mention this in the commit description..
>>
>> Thanks,
>> --Glenn S.
>>
>>>
>>>> +		nopt		[x86]
>>>
>>> Or here?
>>>>  		nobypass	[PPC/POWERNV]
>>>>  			Disable IOMMU bypass, using IOMMU for PCI devices.
>>>>
>>>> --- a/arch/x86/Kconfig
>>>> +++ b/arch/x86/Kconfig
>>>> @@ -845,6 +845,13 @@
>>>>  	def_bool y
>>>>  	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU
>>>>
>>>> +config IOMMU_DEFAULT_PT
>>>> +	def_bool n
>>>> +	prompt "Set iommu=pt by default"
>>>> +	help
>>>> +	  Selecting this option will set iommu passthrough (iommu=pt)
>>>> +	  by default.  Use iommu=nopt to override.
>>>> +
>>>>  config MAXSMP
>>>>  	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
>>>>  	depends on X86_64 && SMP && DEBUG_KERNEL
>>>> --- a/arch/x86/kernel/pci-dma.c
>>>> +++ b/arch/x86/kernel/pci-dma.c
>>>> @@ -43,7 +43,7 @@
>>>>   * useful if a user wants to use an IOMMU only for KVM device assignment to
>>>>   * guests and not for driver dma translation.
>>>>   */
>>>> -int iommu_pass_through __read_mostly;
>>>> +int iommu_pass_through __read_mostly = IS_ENABLED(CONFIG_IOMMU_DEFAULT_PT);
>>>>
>>>>  extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
>>>>
>>>> @@ -196,6 +196,8 @@
>>>>  #endif
>>>>  		if (!strncmp(p, "pt", 2))
>>>>  			iommu_pass_through = 1;
>>>> +		if (!strncmp(p, "nopt", 4))
>>>> +			iommu_pass_through = 0;
>>>>
>>>>  		gart_parse_options(p);
>>>>
>>>> _______________________________________________
>>>> iommu mailing list
>>>> iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
>>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.linuxfoundation.org_mailman_listinfo_iommu&d=DQIBAg&c=IL_XqQWOjubgfqINi2jTzg&r=3biwyMBB1JD9rm0R5wqz7zcDVkNif9HJ5Pflrr18dkw&m=sJQfEY5rZcAq-0QEyNvDxZkeujsoeiY8B_gabGOkyv8&s=ctQKeFfmQJ0ET8hJNBJmeRxdv_gwYgvysgku7sxdV4o&e=

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 1/2] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]                     ` <ad5f24df-99e3-d9c7-4ca3-ba3de820da8e-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
@ 2016-10-17 18:13                       ` Glenn Serre
       [not found]                         ` <f3608ce9-af12-9ac8-7503-1ccd45983ee7-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Glenn Serre @ 2016-10-17 18:13 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt

Allow default to iommu=pt without adding to command line.
Add iommu=nopt to turn off default.

The reason we use iommu=pt is to support using the DPDK igb_uio driver,
which we need to do on servers that have an iommu but lack ACS.

Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
---
  Documentation/kernel-parameters.txt | 3 ++-
  arch/x86/Kconfig                    | 7 +++++++
  arch/x86/kernel/pci-dma.c           | 6 ++++++
  3 files changed, 15 insertions(+), 1 deletion(-)

--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1748,6 +1748,7 @@
  		forcesac
  		soft
  		pt		[x86, IA-64]
+		nopt		[x86]
  		nobypass	[PPC/POWERNV]
  			Disable IOMMU bypass, using IOMMU for PCI devices.

--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -882,6 +882,13 @@
  	def_bool y
  	depends on CALGARY_IOMMU || GART_IOMMU || SWIOTLB || AMD_IOMMU

+config IOMMU_DEFAULT_PT
+	def_bool n
+	prompt "Set iommu=pt by default"
+	help
+	  Selecting this option will set iommu passthrough (iommu=pt)
+	  by default.  Use iommu=nopt to override.
+
  config MAXSMP
  	bool "Enable Maximum number of SMP Processors and NUMA Nodes"
  	depends on X86_64 && SMP && DEBUG_KERNEL
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -43,7 +43,7 @@
   * useful if a user wants to use an IOMMU only for KVM device assignment to
   * guests and not for driver dma translation.
   */
-int iommu_pass_through __read_mostly;
+int iommu_pass_through __read_mostly = IS_ENABLED(CONFIG_IOMMU_DEFAULT_PT);

  extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];

@@ -196,6 +196,8 @@
  #endif
  		if (!strncmp(p, "pt", 2))
  			iommu_pass_through = 1;
+		if (!strncmp(p, "nopt", 4))
+			iommu_pass_through = 0;

  		gart_parse_options(p);

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 2/2] Documentation/kernel-parameters.txt : Remove IA-64 from iommu=pt doc
       [not found]                         ` <f3608ce9-af12-9ac8-7503-1ccd45983ee7-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
@ 2016-10-17 18:15                           ` Glenn Serre
  2018-08-15 13:01                           ` [v2,1/2] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt luca.boccassi-Re5JQEeQqe8AvxtiuMwx3w
  1 sibling, 0 replies; 16+ messages in thread
From: Glenn Serre @ 2016-10-17 18:15 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Remove IA-64 from iommu=pt doc

There is no sign of either iommu parameter parsing
or use of iommu_pass_through in arch/ia64/kernel/pci-dma.c,
so remove IA-64 from iommu=pt documentation.

This patch depends on patch iommu_default_pt.patch.

Signed-off-by: Glenn Serre <gserre-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
---
  Documentation/kernel-parameters.txt |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1747,7 +1747,7 @@
  		nomerge
  		forcesac
  		soft
-		pt		[x86, IA-64]
+		pt		[x86]
  		nopt		[x86]
  		nobypass	[PPC/POWERNV]
  			Disable IOMMU bypass, using IOMMU for PCI devices.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [v2,1/2] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt
       [not found]                         ` <f3608ce9-af12-9ac8-7503-1ccd45983ee7-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
  2016-10-17 18:15                           ` [PATCH v2 2/2] Documentation/kernel-parameters.txt : Remove IA-64 from iommu=pt doc Glenn Serre
@ 2018-08-15 13:01                           ` luca.boccassi-Re5JQEeQqe8AvxtiuMwx3w
  1 sibling, 0 replies; 16+ messages in thread
From: luca.boccassi-Re5JQEeQqe8AvxtiuMwx3w @ 2018-08-15 13:01 UTC (permalink / raw)
  To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
  Cc: alex.williamson-H+wXaHxf7aLQT0dZR+AlfA,
	dwmw2-wEGCiKHe2LqWVfeAwA7xHQ, konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA

Hello,

Any chance this patchset could be looked at, please? As far as I can see all
comments have been addressed in v2.

We still need this change at $work, and have been using it out-of-tree for
years now.

Patchwork links:
https://patchwork.codeaurora.org/patch/98465/
https://patchwork.codeaurora.org/patch/98467/

Thanks!

Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-08-15 13:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-29 16:58 [PATCH 1/1] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt Glenn Serre
     [not found] ` <2ebef311-b346-f3ed-2fca-ce4715b84c9d-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
2016-09-29 18:11   ` Konrad Rzeszutek Wilk
     [not found]     ` <20160929181150.GC9432-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2016-09-29 18:18       ` Glenn Serre
     [not found]         ` <ed808649-22d6-8447-5ddb-5d19665b7fa3-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
2016-09-29 18:20           ` Konrad Rzeszutek Wilk
2016-09-29 18:31   ` Alex Williamson
     [not found]     ` <20160929123115.7afcc88e-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
2016-09-29 18:41       ` Glenn Serre
     [not found]         ` <66f8f023-41a6-17e0-2df0-190cf5edb7ec-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
2016-09-29 19:01           ` Alex Williamson
     [not found]             ` <20160929130122.401aa85d-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
2016-09-30 16:19               ` Robin Murphy
2016-10-04 16:11   ` [PATCH v1 " Glenn Serre
     [not found]     ` <6b2c6f0b-cce8-b8f6-37c2-d4cc453bd603-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
2016-10-04 16:52       ` Konrad Rzeszutek Wilk
     [not found]         ` <20161004165232.GD2428-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2016-10-04 17:00           ` Glenn Serre
     [not found]             ` <04ab568e-8088-cf23-facb-7ef3fecf4bb6-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
2016-10-04 17:03               ` Konrad Rzeszutek Wilk
     [not found]                 ` <20161004170358.GE2428-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2016-10-04 17:32                   ` Glenn Serre
     [not found]                     ` <ad5f24df-99e3-d9c7-4ca3-ba3de820da8e-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
2016-10-17 18:13                       ` [PATCH v2 1/2] " Glenn Serre
     [not found]                         ` <f3608ce9-af12-9ac8-7503-1ccd45983ee7-43mecJUBy8ZBDgjK7y7TUQ@public.gmane.org>
2016-10-17 18:15                           ` [PATCH v2 2/2] Documentation/kernel-parameters.txt : Remove IA-64 from iommu=pt doc Glenn Serre
2018-08-15 13:01                           ` [v2,1/2] arch/x86: Add CONFIG_IOMMU_DEFAULT_PT for iommu=pt luca.boccassi-Re5JQEeQqe8AvxtiuMwx3w

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.