mbox series

[v4,0/6] normalize IOMMU dma mode boot options

Message ID 20190407124147.13576-1-thunder.leizhen@huawei.com
Headers show
Series normalize IOMMU dma mode boot options | expand

Message

Leizhen (ThunderTown) April 7, 2019, 12:41 p.m. UTC
As Robin Murphy's suggestion:
"It's also not necessarily obvious to the user how this interacts with
IOMMU_DEFAULT_PASSTHROUGH, so if we really do go down this route, maybe it
would be better to refactor the whole lot into a single selection of something
like IOMMU_DEFAULT_MODE anyway."

In this version, I tried to normalize the IOMMU dma mode boot options for all
ARCHs. When IOMMU is enabled, there are 3 dma modes: paasthrough(bypass),
lazy(mapping but defer the IOTLB invalidation), strict. But currently each
ARCHs defined their private boot options, different with each other. For
example, to enable/disable "passthrough", ARM64 use iommu.passthrough=1/0,
X86 use iommu=pt/nopt, PPC/POWERNV use iommu=nobypass.


Zhen Lei (6):
  iommu: use iommu.dma_mode to replace iommu.passthrough and
    iommu.strict
  iommu: keep dma mode build options consistent with cmdline options
  iommu: add iommu_default_dma_mode_get() helper
  s390/pci: use common boot option iommu.dma_mode
  powernv/iommu: use common boot option iommu.dma_mode
  x86/iommu: use common boot option iommu.dma_mode

 Documentation/admin-guide/kernel-parameters.txt | 42 +++++++-------------
 arch/ia64/include/asm/iommu.h                   |  2 -
 arch/ia64/kernel/pci-dma.c                      |  2 -
 arch/powerpc/platforms/powernv/pci-ioda.c       | 23 +----------
 arch/s390/pci/pci_dma.c                         | 20 +++-------
 arch/x86/include/asm/iommu.h                    |  1 -
 arch/x86/kernel/pci-dma.c                       | 20 ----------
 drivers/iommu/Kconfig                           | 36 ++++++++++++++---
 drivers/iommu/amd_iommu.c                       | 12 +++---
 drivers/iommu/amd_iommu_init.c                  |  4 --
 drivers/iommu/amd_iommu_types.h                 |  6 ---
 drivers/iommu/intel-iommu.c                     |  7 +---
 drivers/iommu/iommu.c                           | 52 ++++++++++++++++---------
 include/linux/iommu.h                           | 16 ++++++++
 14 files changed, 108 insertions(+), 135 deletions(-)

-- 
1.8.3

Comments

Hanjun Guo April 8, 2019, 1:14 a.m. UTC | #1
Hi Zhen,

On 2019/4/7 20:41, Zhen Lei wrote:
> As Robin Murphy's suggestion:

> "It's also not necessarily obvious to the user how this interacts with

> IOMMU_DEFAULT_PASSTHROUGH, so if we really do go down this route, maybe it

> would be better to refactor the whole lot into a single selection of something

> like IOMMU_DEFAULT_MODE anyway."

> 

> In this version, I tried to normalize the IOMMU dma mode boot options for all

> ARCHs. When IOMMU is enabled, there are 3 dma modes: paasthrough(bypass),

> lazy(mapping but defer the IOTLB invalidation), strict. But currently each

> ARCHs defined their private boot options, different with each other. For

> example, to enable/disable "passthrough", ARM64 use iommu.passthrough=1/0,

> X86 use iommu=pt/nopt, PPC/POWERNV use iommu=nobypass.

> 

> 

> Zhen Lei (6):

>   iommu: use iommu.dma_mode to replace iommu.passthrough and

>     iommu.strict

>   iommu: keep dma mode build options consistent with cmdline options

>   iommu: add iommu_default_dma_mode_get() helper

>   s390/pci: use common boot option iommu.dma_mode

>   powernv/iommu: use common boot option iommu.dma_mode

>   x86/iommu: use common boot option iommu.dma_mode


This will break systems using boot options as now, and I think
this is unacceptable. If you want to do so, just introduce iommu.dma_mode
on top of those iommu boot options with dma mode boot options unchanged,
and iommu.dma_mode is for all archs but compatible with them.

Thanks
Hanjun
Leizhen (ThunderTown) April 8, 2019, 3:16 a.m. UTC | #2
On 2019/4/8 9:14, Hanjun Guo wrote:
> Hi Zhen,

> 

> On 2019/4/7 20:41, Zhen Lei wrote:

>> As Robin Murphy's suggestion:

>> "It's also not necessarily obvious to the user how this interacts with

>> IOMMU_DEFAULT_PASSTHROUGH, so if we really do go down this route, maybe it

>> would be better to refactor the whole lot into a single selection of something

>> like IOMMU_DEFAULT_MODE anyway."

>>

>> In this version, I tried to normalize the IOMMU dma mode boot options for all

>> ARCHs. When IOMMU is enabled, there are 3 dma modes: paasthrough(bypass),

>> lazy(mapping but defer the IOTLB invalidation), strict. But currently each

>> ARCHs defined their private boot options, different with each other. For

>> example, to enable/disable "passthrough", ARM64 use iommu.passthrough=1/0,

>> X86 use iommu=pt/nopt, PPC/POWERNV use iommu=nobypass.

>>

>>

>> Zhen Lei (6):

>>   iommu: use iommu.dma_mode to replace iommu.passthrough and

>>     iommu.strict

>>   iommu: keep dma mode build options consistent with cmdline options

>>   iommu: add iommu_default_dma_mode_get() helper

>>   s390/pci: use common boot option iommu.dma_mode

>>   powernv/iommu: use common boot option iommu.dma_mode

>>   x86/iommu: use common boot option iommu.dma_mode

> 

> This will break systems using boot options as now, and I think

> this is unacceptable. If you want to do so, just introduce iommu.dma_mode

> on top of those iommu boot options with dma mode boot options unchanged,

> and iommu.dma_mode is for all archs but compatible with them.


I just changed the boot options name, but keep the function no change. I added
all related maintainers/supporters in the "to=" list, maybe we can disuss this.
Should I add some "obsoleted" warnings for old options and keep them for a while?
But I think this kind of thing is best done in one go.

> 

> Thanks

> Hanjun

> 

> 

> .

> 


-- 
Thanks!
BestRegards
Thomas Gleixner April 8, 2019, 6:32 a.m. UTC | #3
On Mon, 8 Apr 2019, Leizhen (ThunderTown) wrote:
> > 

> > This will break systems using boot options as now, and I think

> > this is unacceptable. If you want to do so, just introduce iommu.dma_mode

> > on top of those iommu boot options with dma mode boot options unchanged,

> > and iommu.dma_mode is for all archs but compatible with them.

> 

> I just changed the boot options name, but keep the function no change. I added

> all related maintainers/supporters in the "to=" list, maybe we can disuss this.


Changing the name _IS_ the problem. Think about unattended updates.

> Should I add some "obsoleted" warnings for old options and keep them for a while?


No, just keep the old options around for backwards compatibilty sake. We
just do not add new arch specific options in the future. New options need
to use the generic iommu.dma_mode name space.

Thanks,

	tglx
Leizhen (ThunderTown) April 8, 2019, 9:51 a.m. UTC | #4
On 2019/4/8 14:32, Thomas Gleixner wrote:
> On Mon, 8 Apr 2019, Leizhen (ThunderTown) wrote:

>>>

>>> This will break systems using boot options as now, and I think

>>> this is unacceptable. If you want to do so, just introduce iommu.dma_mode

>>> on top of those iommu boot options with dma mode boot options unchanged,

>>> and iommu.dma_mode is for all archs but compatible with them.

>>

>> I just changed the boot options name, but keep the function no change. I added

>> all related maintainers/supporters in the "to=" list, maybe we can disuss this.

> 

> Changing the name _IS_ the problem. Think about unattended updates.

> 

>> Should I add some "obsoleted" warnings for old options and keep them for a while?

> 

> No, just keep the old options around for backwards compatibilty sake. We

> just do not add new arch specific options in the future. New options need

> to use the generic iommu.dma_mode name space.


OK, thanks for your advise.


> 

> Thanks,

> 

> 	tglx

> 

> .

> 


-- 
Thanks!
BestRegards