Re: [PATCH 1/2] iommu: Add config option to set passthrough as default
On Fri, Jul 20, 2018 at 5:16 AM, Joerg Roedel wrote: > Hi Olof, > > On Wed, Jul 11, 2018 at 01:59:35PM -0700, Olof Johansson wrote: >> +config IOMMU_DEFAULT_PASSTHROUGH >> + bool "IOMMU passthrough by default" >> + depends on IOMMU_API >> +help >> + Enable passthrough by default (removing the need to pass in >> + iommu.passthrough=on through command line). If this is enabled, >> + you can still disable with iommu.passthrough=off >> + >> + If unsure, say N here. >> + > > The patch is a good start, but the description above indicates that it > affects all IOMMU driver, which it does not. Please make the Intel and > AMD IOMMU drivers also take this option into account. It looks like it should make the AMD driver should honor it, since it uses the generic infrastructure for domain types? But it also shares iommu_pass_through variable usage with Intel, so if I change it over there it'll be covered for sure. One unfortunate thing here is the divergence in command line options between arm64 and x86. I'll add a 'iommu=nopt' on x86 so it can be turned off at runtime if enabled in config, but it'd be nice to also have it adhere to the .passthrough options. That's a larger topic than just this specific patch though. Posting new patch shortly. -Olof ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH 1/2] iommu: Add config option to set passthrough as default
Hi Olof, On Wed, Jul 11, 2018 at 01:59:35PM -0700, Olof Johansson wrote: > +config IOMMU_DEFAULT_PASSTHROUGH > + bool "IOMMU passthrough by default" > + depends on IOMMU_API > +help > + Enable passthrough by default (removing the need to pass in > + iommu.passthrough=on through command line). If this is enabled, > + you can still disable with iommu.passthrough=off > + > + If unsure, say N here. > + The patch is a good start, but the description above indicates that it affects all IOMMU driver, which it does not. Please make the Intel and AMD IOMMU drivers also take this option into account. Joerg ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
Re: [PATCH 1/2] iommu: Add config option to set passthrough as default
Hi, Olof, Tired of changing command line. I like this patch. Thanks. Shunyong. On Wed, 2018-07-11 at 13:59 -0700, Olof Johansson wrote: > This allows the default behavior to be controlled by a kernel config > option instead of changing the commandline for the kernel to include > "iommu.passthrough=on" on machines where this is desired. > > Signed-off-by: Olof Johansson > --- > drivers/iommu/Kconfig | 10 ++ > drivers/iommu/iommu.c | 4 > 2 files changed, 14 insertions(+) > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig > index 689ffe538370..a9bb1a5b5e43 100644 > --- a/drivers/iommu/Kconfig > +++ b/drivers/iommu/Kconfig > @@ -60,6 +60,16 @@ config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST > > endmenu > > +config IOMMU_DEFAULT_PASSTHROUGH > + bool "IOMMU passthrough by default" > + depends on IOMMU_API > +help > + Enable passthrough by default (removing the need to pass > in > + iommu.passthrough=on through command line). If this is > enabled, > + you can still disable with iommu.passthrough=off > + > + If unsure, say N here. > + > config IOMMU_IOVA > tristate > > diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c > index 63b37563db7e..ab8fc54467e0 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -36,7 +36,11 @@ > > static struct kset *iommu_group_kset; > static DEFINE_IDA(iommu_group_ida); > +#ifdef CONFIG_IOMMU_DEFAULT_PASSTHROUGH > +static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY; > +#else > static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_DMA; > +#endif > > struct iommu_callback_data { > const struct iommu_ops *ops; ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
[PATCH 1/2] iommu: Add config option to set passthrough as default
This allows the default behavior to be controlled by a kernel config option instead of changing the commandline for the kernel to include "iommu.passthrough=on" on machines where this is desired. Signed-off-by: Olof Johansson --- drivers/iommu/Kconfig | 10 ++ drivers/iommu/iommu.c | 4 2 files changed, 14 insertions(+) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index 689ffe538370..a9bb1a5b5e43 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -60,6 +60,16 @@ config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST endmenu +config IOMMU_DEFAULT_PASSTHROUGH + bool "IOMMU passthrough by default" + depends on IOMMU_API +help + Enable passthrough by default (removing the need to pass in + iommu.passthrough=on through command line). If this is enabled, + you can still disable with iommu.passthrough=off + + If unsure, say N here. + config IOMMU_IOVA tristate diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 63b37563db7e..ab8fc54467e0 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -36,7 +36,11 @@ static struct kset *iommu_group_kset; static DEFINE_IDA(iommu_group_ida); +#ifdef CONFIG_IOMMU_DEFAULT_PASSTHROUGH +static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_IDENTITY; +#else static unsigned int iommu_def_domain_type = IOMMU_DOMAIN_DMA; +#endif struct iommu_callback_data { const struct iommu_ops *ops; -- 2.11.0 ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu