From nobody Mon Feb 9 02:27:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1571923913; cv=none; d=zoho.com; s=zohoarc; b=dGqhgdr8mtsis1EBu40kH+JW3TqEVxbM+87FR/YkARqJTT+O984skNqfHagC30kxblozX+AelrlPUeeoQ6unWV2FSB3GRJFHuDAAflk5poEWdfAssxlhqfFhywR4rNJPR65a+ZA8XpD5TAuiwVy0zOAi7x4LFsj6cxDns1OxY+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571923913; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=luG707iQWvt+p9csyBli2w7+oGfoTXTjrc9QoA0/j1s=; b=h4sL8XcB7jmBnXxxA4oUNVf6bWytfnQTFQ873QITpoaeFV1RByPdM+XL+YRtwcZ+PYUPJMDDnx+9jeCiZq1AyoaPb1W7uk8HAd35Jd+ycHz5zalLETo5CVk3oc1Ui/pv7db+UGTu4Tm88xB0dSwClYT9S9DZWwMumfsVX/uTI70= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1571923913703197.442417093946; Thu, 24 Oct 2019 06:31:53 -0700 (PDT) Received: from localhost ([::1]:42638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNdDU-0001QE-LN for importer@patchew.org; Thu, 24 Oct 2019 09:31:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51394) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNckH-0005Ex-Ta for qemu-devel@nongnu.org; Thu, 24 Oct 2019 09:01:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNckG-0002SH-Cl for qemu-devel@nongnu.org; Thu, 24 Oct 2019 09:01:41 -0400 Received: from mga11.intel.com ([192.55.52.93]:40482) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNckF-0002MX-FT for qemu-devel@nongnu.org; Thu, 24 Oct 2019 09:01:39 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Oct 2019 06:01:24 -0700 Received: from iov.bj.intel.com ([10.238.145.67]) by fmsmga001.fm.intel.com with ESMTP; 24 Oct 2019 06:01:21 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,224,1569308400"; d="scan'208";a="210156186" From: Liu Yi L To: qemu-devel@nongnu.org, mst@redhat.com, pbonzini@redhat.com, alex.williamson@redhat.com, peterx@redhat.com Subject: [RFC v2 05/22] vfio/common: add iommu_ctx_notifier in container Date: Thu, 24 Oct 2019 08:34:26 -0400 Message-Id: <1571920483-3382-6-git-send-email-yi.l.liu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1571920483-3382-1-git-send-email-yi.l.liu@intel.com> References: <1571920483-3382-1-git-send-email-yi.l.liu@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.93 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tianyu.lan@intel.com, kevin.tian@intel.com, yi.l.liu@intel.com, Yi Sun , kvm@vger.kernel.org, jun.j.tian@intel.com, eric.auger@redhat.com, yi.y.sun@intel.com, jacob.jun.pan@linux.intel.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch adds a list in VFIOContainer to store iommu_ctx_notifier which is based on IOMMUContext. As a preparation of registering iommu_ctx_notifiers. Cc: Kevin Tian Cc: Jacob Pan Cc: Peter Xu Cc: Eric Auger Cc: Yi Sun Cc: David Gibson Signed-off-by: Liu Yi L --- hw/vfio/common.c | 1 + include/hw/vfio/vfio-common.h | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 5ca1148..d418527 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1271,6 +1271,7 @@ static int vfio_connect_container(VFIOGroup *group, A= ddressSpace *as, container->error =3D NULL; QLIST_INIT(&container->giommu_list); QLIST_INIT(&container->hostwin_list); + QLIST_INIT(&container->iommu_ctx_list); =20 ret =3D vfio_init_container(container, group->fd, errp); if (ret) { diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index fd56420..975d12b 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -29,6 +29,7 @@ #ifdef CONFIG_LINUX #include #endif +#include "hw/iommu/iommu.h" =20 #define VFIO_MSG_PREFIX "vfio %s: " =20 @@ -75,6 +76,7 @@ typedef struct VFIOContainer { bool initialized; unsigned long pgsizes; QLIST_HEAD(, VFIOGuestIOMMU) giommu_list; + QLIST_HEAD(, VFIOIOMMUContext) iommu_ctx_list; QLIST_HEAD(, VFIOHostDMAWindow) hostwin_list; QLIST_HEAD(, VFIOGroup) group_list; QLIST_ENTRY(VFIOContainer) next; @@ -88,6 +90,13 @@ typedef struct VFIOGuestIOMMU { QLIST_ENTRY(VFIOGuestIOMMU) giommu_next; } VFIOGuestIOMMU; =20 +typedef struct VFIOIOMMUContext { + VFIOContainer *container; + IOMMUContext *iommu_ctx; + IOMMUCTXNotifier n; + QLIST_ENTRY(VFIOIOMMUContext) iommu_ctx_next; +} VFIOIOMMUContext; + typedef struct VFIOHostDMAWindow { hwaddr min_iova; hwaddr max_iova; --=20 2.7.4