From patchwork Fri Jan 13 03:06:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 714753 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v06zQ3xLZz9t1L for ; Fri, 13 Jan 2017 14:09:06 +1100 (AEDT) Received: from localhost ([::1]:38771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRsEi-0003Wl-3O for incoming@patchwork.ozlabs.org; Thu, 12 Jan 2017 22:09:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRsDH-0002Bf-Df for qemu-devel@nongnu.org; Thu, 12 Jan 2017 22:07:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cRsDG-0007WW-9B for qemu-devel@nongnu.org; Thu, 12 Jan 2017 22:07:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60884) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cRsDG-0007VI-3A for qemu-devel@nongnu.org; Thu, 12 Jan 2017 22:07:34 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 441C383F44; Fri, 13 Jan 2017 03:07:34 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-8-26.pek2.redhat.com [10.72.8.26]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0D36mBA012131; Thu, 12 Jan 2017 22:07:28 -0500 From: Peter Xu To: qemu-devel@nongnu.org Date: Fri, 13 Jan 2017 11:06:32 +0800 Message-Id: <1484276800-26814-7-git-send-email-peterx@redhat.com> In-Reply-To: <1484276800-26814-1-git-send-email-peterx@redhat.com> References: <1484276800-26814-1-git-send-email-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 13 Jan 2017 03:07:34 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH RFC v3 06/14] intel_iommu: vtd_slpt_level_shift check level X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tianyu.lan@intel.com, kevin.tian@intel.com, mst@redhat.com, jan.kiszka@siemens.com, jasowang@redhat.com, peterx@redhat.com, alex.williamson@redhat.com, bd.aviv@gmail.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This helps in debugging incorrect level passed in. Signed-off-by: Peter Xu --- hw/i386/intel_iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index b4166e0..b4019d0 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; }