From nobody Mon Feb 9 20:11:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490692074947858.5290486521334; Tue, 28 Mar 2017 02:07:54 -0700 (PDT) Received: from localhost ([::1]:51845 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csn6X-00009p-MA for importer@patchew.org; Tue, 28 Mar 2017 05:07:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csn4s-0007QJ-Jb for qemu-devel@nongnu.org; Tue, 28 Mar 2017 05:06:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csn4o-0003y3-OR for qemu-devel@nongnu.org; Tue, 28 Mar 2017 05:06:10 -0400 Received: from ozlabs.ru ([107.173.13.209]:51570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csn4o-0003x6-IA; Tue, 28 Mar 2017 05:06:06 -0400 Received: from vpl2.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 2505F3A602E8; Tue, 28 Mar 2017 05:05:39 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Tue, 28 Mar 2017 20:05:28 +1100 Message-Id: <20170328090530.20052-2-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170328090530.20052-1-aik@ozlabs.ru> References: <20170328090530.20052-1-aik@ozlabs.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [RFC PATCH qemu 1/3] memory: Add get_fd() hook for IOMMU MR 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: Alexey Kardashevskiy , Alex Williamson , qemu-ppc@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Alexey Kardashevskiy --- include/exec/memory.h | 2 ++ hw/ppc/spapr_iommu.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index e39256ad03..925c10b35b 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -174,6 +174,8 @@ struct MemoryRegionIOMMUOps { void (*notify_flag_changed)(MemoryRegion *iommu, IOMMUNotifierFlag old_flags, IOMMUNotifierFlag new_flags); + /* Returns a kernel fd for IOMMU */ + int (*get_fd)(MemoryRegion *iommu); }; =20 typedef struct CoalescedMemoryRange CoalescedMemoryRange; diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index 9e30e148d6..b61c8f053e 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -170,6 +170,13 @@ static void spapr_tce_notify_flag_changed(MemoryRegion= *iommu, } } =20 +static int spapr_tce_get_fd(MemoryRegion *iommu) +{ + sPAPRTCETable *tcet =3D container_of(iommu, sPAPRTCETable, iommu); + + return tcet->fd; +} + static int spapr_tce_table_post_load(void *opaque, int version_id) { sPAPRTCETable *tcet =3D SPAPR_TCE_TABLE(opaque); @@ -251,6 +258,7 @@ static MemoryRegionIOMMUOps spapr_iommu_ops =3D { .translate =3D spapr_tce_translate_iommu, .get_min_page_size =3D spapr_tce_get_min_page_size, .notify_flag_changed =3D spapr_tce_notify_flag_changed, + .get_fd =3D spapr_tce_get_fd, }; =20 static int spapr_tce_table_realize(DeviceState *dev) --=20 2.11.0