summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2017-02-07 16:28:11 +0800
committerMichael S. Tsirkin <mst@redhat.com>2017-02-17 21:52:31 +0200
commit7e58326ad7e79b8c5dbcc6f24e9dc1523d84c11b (patch)
tree146f1c9b310813894b79976e28a092b5cbf2ed12
parent6c441e1d613a1f91a53bd215f2ed1f9559194f21 (diff)
downloadfocaccia-qemu-7e58326ad7e79b8c5dbcc6f24e9dc1523d84c11b.tar.gz
focaccia-qemu-7e58326ad7e79b8c5dbcc6f24e9dc1523d84c11b.zip
intel_iommu: vtd_slpt_level_shift check level
This helps in debugging incorrect level passed in.

Reviewed-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/i386/intel_iommu.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index ad304f681c..22d8226e43 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -168,6 +168,7 @@ static gboolean vtd_hash_remove_by_domain(gpointer key, gpointer value,
 /* The shift of an addr for a certain level of paging structure */
 static inline uint32_t vtd_slpt_level_shift(uint32_t level)
 {
+    assert(level != 0);
     return VTD_PAGE_SHIFT_4K + (level - 1) * VTD_SL_LEVEL_BITS;
 }