s390x/pci: fixup the code walking IOMMU tables
commit0125861eacc37478308b462dc9f41438c94fb5e2
authorYi Min Zhao <zyimin@linux.vnet.ibm.com>
Mon, 5 Feb 2018 07:22:56 +0000 (5 15:22 +0800)
committerCornelia Huck <cohuck@redhat.com>
Fri, 9 Feb 2018 08:37:13 +0000 (9 09:37 +0100)
treeea77c94509085143671549f29c9cee8f2471187c
parent46a99c9f73c7a93c3509782030b45d4e2c77d95a
s390x/pci: fixup the code walking IOMMU tables

Current s390x PCI IOMMU code is lack of flags' checking, including:
1) protection bit
2) table length
3) table offset
4) intermediate tables' invalid bit
5) format control bit

This patch introduces a new struct named S390IOTLBEntry, and makes up
these missed checkings. At the same time, inform the guest with the
corresponding error number when the check fails. Finally, in order to
get the error number, we export s390_guest_io_table_walk().

Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com>
Message-Id: <20180205072258.5968-2-zyimin@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
hw/s390x/s390-pci-bus.c
hw/s390x/s390-pci-bus.h
hw/s390x/s390-pci-inst.c