On 30/03/21 18:33, Richard Henderson wrote:
Flatview_simplify() can merge many small memory ranges
into a large one and contains EHCI dma buffers.
For example,the merged range maybe0xc0000-0xbfffffff.
When seabios write PAM register to change the properties
of part of the merged range from RW to readonly,
this action cause the merged IOVA mapping will be
unmapped.But EHCI device still send DMA cycles
and then IOMMU blocks the DMA cycles of EHCI device.
You've described the problem, and it is quite obviously *not* in memory.c.
Well, sort of.
The problem is that neither VFIO nor KVM support atomically switching
the memory map. For KVM that would be possible, for VFIO based on past
discussion it would be much harder. Removing flatview_simplify() seems
to be the easiest way to bypass the issue.
That said, perhaps it's better to keep the simplification within a
page-sized range, to avoid introducing subpages unnecessarily.
Paolo