x86 / iommu: set up a scratch page in the quarantine domain
authorPaul Durrant <pdurrant@amazon.com>
Wed, 27 Nov 2019 17:11:43 +0000 (17:11 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 Nov 2019 18:27:54 +0000 (18:27 +0000)
commitea38867831da67eed0e9c61672c8941016b63dd9
treea0b6894c9b86c1a00594dc8312de30d9af6156d9
parentbe18e39d2f69038804b27c30026754deaeefa543
x86 / iommu: set up a scratch page in the quarantine domain

This patch introduces a new iommu_op to facilitate a per-implementation
quarantine set up, and then further code for x86 implementations
(amd and vtd) to set up a read-only scratch page to serve as the source
for DMA reads whilst a device is assigned to dom_io. DMA writes will
continue to fault as before.

The reason for doing this is that some hardware may continue to re-try
DMA (despite FLR) in the event of an error, or even BME being cleared, and
will fail to deal with DMA read faults gracefully. Having a scratch page
mapped will allow pending DMA reads to complete and thus such buggy
hardware will eventually be quiesced.

NOTE: These modifications are restricted to x86 implementations only as
      the buggy h/w I am aware of is only used with Xen in an x86
      environment. ARM may require similar code but, since I am not
      aware of the need, this patch does not modify any ARM implementation.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/drivers/passthrough/amd/iommu_map.c
xen/drivers/passthrough/amd/pci_amd_iommu.c
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/vtd/iommu.c
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
xen/include/xen/iommu.h