intel_iommu: support snoop control
commitb8ffd7d6713fb2703f4b09cea3e62d1c61767107
authorJason Wang <jasowang@redhat.com>
Mon, 14 Feb 2022 06:03:46 +0000 (14 14:03 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 6 Mar 2022 10:08:23 +0000 (6 05:08 -0500)
treec4d35897c53f09c81366f67f682be60be2b5d13c
parentb1f030a0a2e281193b09350c0281c0084e84bcf4
intel_iommu: support snoop control

SC is required for some kernel features like vhost-vDPA. So this patch
implements basic SC feature. The idea is pretty simple, for software
emulated DMA it would be always coherent. In this case we can simple
advertise ECAP_SC bit. For VFIO and vhost, thing will be more much
complicated, so this patch simply fail the IOMMU notifier
registration.

In the future, we may want to have a dedicated notifiers flag or
similar mechanism to demonstrate the coherency so VFIO could advertise
that if it has VFIO_DMA_CC_IOMMU, for vhost kernel backend we don't
need that since it's a software backend.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220214060346.72455-1-jasowang@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/i386/intel_iommu.c
hw/i386/intel_iommu_internal.h
include/hw/i386/intel_iommu.h