iommu/arm-smmu: Don't fail device attach if already attached to a domain
authorWill Deacon <will.deacon@arm.com>
Wed, 17 Feb 2016 17:41:57 +0000 (17:41 +0000)
committerWill Deacon <will.deacon@arm.com>
Thu, 18 Feb 2016 15:02:44 +0000 (15:02 +0000)
commitbc7f2ce0a7b54ba7703f81995fe434f0926424d2
tree1e27c323f9c3becd069a36abb54ff2fb2ca7d93b
parent25a1c96cd22c949b50d6f0269c23e1c5cb55e5a5
iommu/arm-smmu: Don't fail device attach if already attached to a domain

The ARM SMMU attach_dev implementations returns -EEXIST if the device
being attached is already attached to a domain. This doesn't play nicely
with the default domain, resulting in splats such as:

  WARNING: at drivers/iommu/iommu.c:1257
  Modules linked in:

  CPU: 3 PID: 1939 Comm: virtio-net-tx Tainted: G S              4.5.0-rc4+ #1
  Hardware name: FVP Base (DT)
  task: ffffffc87a9d0000 ti: ffffffc07a278000 task.ti: ffffffc07a278000
  PC is at __iommu_detach_group+0x68/0xe8
  LR is at __iommu_detach_group+0x48/0xe8

This patch fixes the problem by forcefully detaching the device from
its old domain, if present, when attaching to a new one. The unused
->detach_dev callback is also removed the iommu_ops structures.

Signed-off-by: Will Deacon <will.deacon@arm.com>
drivers/iommu/arm-smmu-v3.c
drivers/iommu/arm-smmu.c