IOMMU Fixes for Linux v5.7-rc4

Including:

	- The race condition fixes for the AMD IOMMU driver. This are 5
	  patches fixing two race conditions around
	  increase_address_space(). The first race condition was around
	  the non-atomic update of the domain page-table root pointer
	  and the variable containing the page-table depth (called
	  mode). This is fixed now be merging page-table root and mode
	  into one 64-bit field which is read/written atomically.

	  The second race condition was around updating the page-table
	  root pointer and making it public before the hardware caches
	  were flushed. This could cause addresses to be mapped and
	  returned to drivers which are not reachable by IOMMU hardware
	  yet, causing IO page-faults. This is fixed too by adding the
	  necessary flushes before a new page-table root is published.

	  Related to the race condition fixes these patches also add a
	  missing domain_flush_complete() barrier to update_domain() and
	  a fix to bail out of the loop which tries to increase the
	  address space when the call to increase_address_space() fails.

	  Qian was able to trigger the race conditions under high load
	  and memory pressure within a few days of testing. He confirmed
	  that he has seen no issues anymore with the fixes included
	  here.

	- Fix for a list-handling bug in the VirtIO IOMMU driver.
iommu/virtio: Reverse arguments to list_add

Elsewhere in the file, there is a list_for_each_entry with
&vdev->resv_regions as the second argument, suggesting that
&vdev->resv_regions is the list head.  So exchange the
arguments on the list_add call to put the list head in the
second argument.

Fixes: 2a5a31487445 ("iommu/virtio: Add probe request")
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Link: https://lore.kernel.org/r/1588704467-13431-1-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 file changed