mbox series

[0/1] Skip flatview_simplify() for specific cpu vendor

Message ID 20200903094935.2361-1-FelixCui-oc@zhaoxin.com
Headers show
Series Skip flatview_simplify() for specific cpu vendor | expand

Message

FelixCuioc Sept. 3, 2020, 9:49 a.m. UTC
The reason we want to skip flatview_simplify() is
to prevent unnecessary IOVA address range mapping
from being unmapped.

The actual situation we encountered is:
When assign EHCI device to the virtual machine,
after initializing EHCI in seabios, it will continuously
send dma cycles.And EHCI dma buffer is allocated from
the range 0xd9000-0xexxxx belonging to zonelow.
But in seabios, make_bios_readonly_intel() will modify
the attributes in the range of 0xc0000-0x100000,except
for the zonelow range.
Before these ranges attributes are not changed,qemu will
perform flatview_simplify(),and the actual address range
formed in flatview is 0xc0000-0xbfffffff.When the properties
of this large range are modified to readonly,qemu will
unmap all the IOVA mappings in the address range 0xc0000-0xbfffffff.
But EHCI device still send dma cycle.

So dma cycles of the EHCI device will be blocked by the IOMMU.
And we want to skip flatview_simplify().

Error log when starting the virtual machine:
DMAR: [DMA Read] Request device [00:10.7] fault addr eb000 [fault reason 06] PTE Read access is not set
DMAR: [DMA Read] Request device [00:10.7] fault addr eb000 [fault reason 06] PTE Read access is not set

FelixCuioc (1):
  Skip flatview_simplify() for specific cpu vendor

 softmmu/memory.c  | 16 +++++++++++++++-
 target/i386/cpu.c |  8 ++++++++
 target/i386/cpu.h |  3 +++
 3 files changed, 26 insertions(+), 1 deletion(-)