From nobody Sun May 19 22:19:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1575518322; cv=none; d=zohomail.com; s=zohoarc; b=bxZ9zdRAiTYUv+CIYZHIWhx0z5rh6ULOx+OoNu6NgNxugtpyp5iRSBx3WIZhgQADYbY4hTL25oD5b8968GqBXEBEaobjmLSZGKWjfoSy05LGYH0Z/RO1pe0snMkmZklQ9pUvKkm8Z0oy7Rt2YVDmqoqy1A/wswvwlEt3ud18qhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575518322; 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=ed61bzLCXc3PhkCdDXkkwrnD/NS7cQBoEUtyAlQ8lLk=; b=iXjjFrhtBJ60npzEPbE6REp1q+CjvRs1vIz146LiOh+NA7Ywic8xm344ZJxE2VgsgMP+MbwN2YS028XLlfZ+BVebE7xEgz2uMlUZAD06sHdG5XBSPtQ2WTfbR2jn7OJ0sXpp1M4pBqnozKF5tIUCdMrvnyqzQc06XyvCch8ls9I= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.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 157551832296767.75969157572047; Wed, 4 Dec 2019 19:58:42 -0800 (PST) Received: from localhost ([::1]:49692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iciHp-0001BB-Rt for importer@patchew.org; Wed, 04 Dec 2019 22:58:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36242) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iciDE-0005Gg-1R for qemu-devel@nongnu.org; Wed, 04 Dec 2019 22:53:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iciDC-00018t-0T for qemu-devel@nongnu.org; Wed, 04 Dec 2019 22:53:55 -0500 Received: from mga01.intel.com ([192.55.52.88]:12053) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iciDB-00015L-MF for qemu-devel@nongnu.org; Wed, 04 Dec 2019 22:53:53 -0500 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2019 19:53:51 -0800 Received: from joy-optiplex-7040.sh.intel.com ([10.239.13.9]) by orsmga008.jf.intel.com with ESMTP; 04 Dec 2019 19:53:50 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,279,1571727600"; d="scan'208";a="205633342" From: Yan Zhao To: alex.williamson@redhat.com Subject: [RFC PATCH 1/2] hw/vfio: add a 'disablable' flag to sparse mmaped region Date: Wed, 4 Dec 2019 22:45:32 -0500 Message-Id: <20191205034532.30229-1-yan.y.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205034451.30181-1-yan.y.zhao@intel.com> References: <20191205034451.30181-1-yan.y.zhao@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.88 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: kevin.tian@intel.com, Yan Zhao , cohuck@redhat.com, qemu-devel@nongnu.org, zhenyuw@linux.intel.com, shaopeng.he@intel.com, zhi.a.wang@intel.com 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" add a 'disablable' flag to each each sparse mmaped region and this flag is = by default off. vfio_region_disablable_mmaps_set_enabled() will enable/disable mmapped subregions if its 'disablable' flag is on. Cc: Kevin Tian Signed-off-by: Yan Zhao --- hw/vfio/common.c | 28 +++++++++++++++++++++++++++- hw/vfio/trace-events | 3 ++- include/hw/vfio/vfio-common.h | 2 ++ linux-headers/linux/vfio.h | 2 ++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 6f36b02e3e..79f694dd19 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -883,11 +883,13 @@ static int vfio_setup_region_sparse_mmaps(VFIORegion = *region, for (i =3D 0, j =3D 0; i < sparse->nr_areas; i++) { trace_vfio_region_sparse_mmap_entry(i, sparse->areas[i].offset, sparse->areas[i].offset + - sparse->areas[i].size); + sparse->areas[i].size, + sparse->areas[i].disablable); =20 if (sparse->areas[i].size) { region->mmaps[j].offset =3D sparse->areas[i].offset; region->mmaps[j].size =3D sparse->areas[i].size; + region->mmaps[j].disablable =3D sparse->areas[i].disablable; j++; } } @@ -1084,6 +1086,30 @@ void vfio_region_mmaps_set_enabled(VFIORegion *regio= n, bool enabled) enabled); } =20 +/** + * enable/disable vfio regions with mmaped subregions + * It only disable mmapped subregions with disablable flag on + */ +void vfio_region_disablable_mmaps_set_enabled(VFIORegion *region, bool ena= bled) +{ + int i; + + if (!region->mem) { + return; + } + + for (i =3D 0; i < region->nr_mmaps; i++) { + if (region->mmaps[i].mmap && region->mmaps[i].disablable) { + memory_region_set_enabled(®ion->mmaps[i].mem, enabled); + trace_vfio_region_disablable_mmaps_set_enabled( + memory_region_name(region->mem), + region->mmaps[i].offset, + region->mmaps[i].offset + region->mmaps[i].size, + enabled); + } + } +} + void vfio_reset_handler(void *opaque) { VFIOGroup *group; diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index 414a5e69ec..7b2d07529e 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -113,7 +113,7 @@ vfio_region_finalize(const char *name, int index) "Devi= ce %s, region %d" vfio_region_mmaps_set_enabled(const char *name, bool enabled) "Region %s m= maps enabled: %d" vfio_region_unmap(const char *name, unsigned long offset, unsigned long en= d) "Region %s unmap [0x%lx - 0x%lx]" vfio_region_sparse_mmap_header(const char *name, int index, int nr_areas) = "Device %s region %d: %d sparse mmap entries" -vfio_region_sparse_mmap_entry(int i, unsigned long start, unsigned long en= d) "sparse entry %d [0x%lx - 0x%lx]" +vfio_region_sparse_mmap_entry(int i, unsigned long start, unsigned long en= d, bool disablable) "sparse entry %d [0x%lx - 0x%lx] disablable %d" vfio_get_dev_region(const char *name, int index, uint32_t type, uint32_t s= ubtype) "%s index %d, %08x/%0x8" vfio_dma_unmap_overflow_workaround(void) "" =20 @@ -161,3 +161,4 @@ vfio_load_device_config_state(char *name) " (%s)" vfio_load_state(char *name, uint64_t data) " (%s) data 0x%"PRIx64 vfio_load_state_device_data(char *name, uint64_t data_offset, uint64_t dat= a_size) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64 vfio_get_dirty_page_list(char *name, uint64_t start, uint64_t pfn_count, u= int64_t page_size) " (%s) start 0x%"PRIx64" pfn_count 0x%"PRIx64 " page siz= e 0x%"PRIx64 +vfio_region_disablable_mmaps_set_enabled(const char *name, unsigned long o= ffset, unsigned long end, bool enabled) "Region %s mmaps [0x%lx - 0x%lx] se= t to %d" diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 41ff5ebba2..8cfe46c681 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -45,6 +45,7 @@ typedef struct VFIOMmap { void *mmap; off_t offset; size_t size; + bool disablable; /* whether this region is able to get diabled */ } VFIOMmap; =20 typedef struct VFIORegion { @@ -187,6 +188,7 @@ int vfio_region_setup(Object *obj, VFIODevice *vbasedev= , VFIORegion *region, int index, const char *name); int vfio_region_mmap(VFIORegion *region); void vfio_region_mmaps_set_enabled(VFIORegion *region, bool enabled); +void vfio_region_disablable_mmaps_set_enabled(VFIORegion *region, bool ena= bled); void vfio_region_unmap(VFIORegion *region); void vfio_region_exit(VFIORegion *region); void vfio_region_finalize(VFIORegion *region); diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h index 4bc0236b08..f9f0ea8eda 100644 --- a/linux-headers/linux/vfio.h +++ b/linux-headers/linux/vfio.h @@ -258,6 +258,8 @@ struct vfio_region_info { struct vfio_region_sparse_mmap_area { __u64 offset; /* Offset of mmap'able area within region */ __u64 size; /* Size of mmap'able area */ + __u32 disablable; /* whether this mmap'able are able to + be dynamically disbled */ }; =20 struct vfio_region_info_cap_sparse_mmap { --=20 2.17.1 From nobody Sun May 19 22:19:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1575518195; cv=none; d=zohomail.com; s=zohoarc; b=bMjP69RMkeh3AZTs2Y2oCRzGFMBNuXvcWfNbZ3zU0cR/bUe9Ro8BdDYiIDLM4hTJ0YVItst8kJ0V5SFTplph+jWvrFYoh5nfRqa4TW7EZU+91wMpGClw5iinbkwJUMMobzUGBs8s1xnO2OVLkz7qpzCr1+yftzwB9kq62xKLpyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575518195; 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=JJktQbE1DLlQF97kRU679FWC5IMOLHYjdMFwAXDC9W8=; b=ArpiZRUxChKmIvdnBbccMl1PPUQ/ejfG2p640V7lJzK+IwlMCP4ytnszkG8YD4H9nNwM/T0spIsQfmoHS2R+Hpi+Ztvrtjf2g4hdPF6Zc7zCKzvbNsAuML0Id5gaSjmKkV+LPs+gsYAsk9SiXJUHHQlOkuY9lLvPBwIuRliGZm8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.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 1575518195510773.9489082649573; Wed, 4 Dec 2019 19:56:35 -0800 (PST) Received: from localhost ([::1]:49678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iciFl-0007Np-RY for importer@patchew.org; Wed, 04 Dec 2019 22:56:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36819) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iciDO-0005OY-6H for qemu-devel@nongnu.org; Wed, 04 Dec 2019 22:54:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iciDL-0001Q5-4a for qemu-devel@nongnu.org; Wed, 04 Dec 2019 22:54:06 -0500 Received: from mga11.intel.com ([192.55.52.93]:23251) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iciDK-0001NE-Qi for qemu-devel@nongnu.org; Wed, 04 Dec 2019 22:54:03 -0500 Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2019 19:54:01 -0800 Received: from joy-optiplex-7040.sh.intel.com ([10.239.13.9]) by orsmga008.jf.intel.com with ESMTP; 04 Dec 2019 19:53:59 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,279,1571727600"; d="scan'208";a="205633364" From: Yan Zhao To: alex.williamson@redhat.com Subject: [RFC PATCH 2/2] hw/vfio/pci: init dynamic-trap-bar-info region Date: Wed, 4 Dec 2019 22:45:47 -0500 Message-Id: <20191205034547.30276-1-yan.y.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191205034451.30181-1-yan.y.zhao@intel.com> References: <20191205034451.30181-1-yan.y.zhao@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: kevin.tian@intel.com, Yan Zhao , cohuck@redhat.com, qemu-devel@nongnu.org, zhenyuw@linux.intel.com, shaopeng.he@intel.com, zhi.a.wang@intel.com 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" for devices that support device region of type VFIO_REGION_TYPE_DYNAMIC_TRAP_BAR_INFO and subtype VFIO_REGION_SUBTYPE_DYNAMIC_TRAP_BAR_INFO, probe and init a dynamic-trap-bar-info region which holds info of (1) fd of eventfd, (2) to trap/untrap of sparse mmaped pci bars. Vendor driver first should specify device pci bars to be sparse mmapped, which means those bars are sparsely passthroughed. And if it wants certain sub-regions to be dynamically trapped, it should also set 'disablable' flag for those sub-regions. When vendor driver signals the eventfd, QEMU reads 'trap' field of this dynamic trap bar info region, then disable/enable disablable subregions of pci bar regions. Cc: Kevin Tian Signed-off-by: Yan Zhao --- hw/vfio/pci.c | 117 +++++++++++++++++++++++++++++++++++++ hw/vfio/pci.h | 5 ++ hw/vfio/trace-events | 1 + linux-headers/linux/vfio.h | 11 ++++ 4 files changed, 134 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index c04f4bcfb8..3837f77185 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2638,6 +2638,120 @@ int vfio_populate_vga(VFIOPCIDevice *vdev, Error **= errp) return 0; } =20 +static void vfio_dt_notifier_handler(void *opaque) +{ + VFIOPCIDevice *vdev =3D opaque; + int i; + __u32 dt_state; + + if (!event_notifier_test_and_clear(&vdev->dt_notifier)) { + return; + } + + if (vdev->dt_offset < 0) { + return; + } + + if (pread(vdev->vbasedev.fd, &dt_state, + sizeof(dt_state), + vdev->dt_offset + + offsetof(struct vfio_device_dt_bar_info_region, trap)) + !=3D sizeof(dt_state)) { + error_report("vfio failed to read from dt region"); + return; + } + + if (dt_state =3D=3D vdev->dt_state) { + return; + } + + for (i =3D VFIO_PCI_BAR0_REGION_INDEX; i < VFIO_PCI_ROM_REGION_INDEX; = i++) { + vfio_region_disablable_mmaps_set_enabled(&vdev->bars[i].region, + !dt_state); + } + + vdev->dt_state =3D dt_state; + +} + +static void vfio_register_dt_notifier(VFIOPCIDevice *vdev) +{ + if (vdev->enable_dt) { + return; + } + + if (event_notifier_init(&vdev->dt_notifier, 0)) { + error_report("vfio: unable to init event notifier for dynamic trap= "); + return; + } + + qemu_set_fd_handler(event_notifier_get_fd(&vdev->dt_notifier), + vfio_dt_notifier_handler, NULL, vdev); +} + +static void vfio_unregister_dt_notifier(VFIOPCIDevice *vdev) +{ + if (!vdev->enable_dt) { + return; + } + + qemu_set_fd_handler(event_notifier_get_fd(&vdev->dt_notifier), + NULL, NULL, vdev); + event_notifier_cleanup(&vdev->dt_notifier); + vdev->enable_dt =3D false; + vdev->dt_offset =3D -1; + vdev->dt_state =3D false; +} + +/** + * init a dynamic trap bar info region + * this region is used for qemu to communicate to vendor driver + * + * if this device region is queried from vendor driver, qemu will + * create an eventfd and write fd of this eventfd to dt_fd field of + * this region. + * + * when vendor driver notifys this dt_fd, qemu first read trap field + * of this region to get trap/untrap info. Then qemu will disable/enable + * mmaped subregions of pci bar regions according to this info. + * + */ +static void init_dt_region(VFIOPCIDevice *vdev) +{ + struct vfio_region_info *reg_info; + int ret; + uint32_t dt_fd; + vdev->dt_state =3D false; + + ret =3D vfio_get_dev_region_info(&vdev->vbasedev, + VFIO_REGION_TYPE_DYNAMIC_TRAP_BAR_INFO, + VFIO_REGION_SUBTYPE_DYNAMIC_TRAP_BAR_INFO, + ®_info); + if (ret || reg_info->size < sizeof(dt_fd)) { + goto out; + } + + vdev->dt_offset =3D reg_info->offset; + + vfio_register_dt_notifier(vdev); + dt_fd =3D event_notifier_get_fd(&vdev->dt_notifier); + + trace_vfio_init_dt_region(vdev->vbasedev.name, vdev->vendor_id, + vdev->device_id, reg_info->offset, + reg_info->offset + reg_info->size - 1, dt_fd= ); + + if (pwrite(vdev->vbasedev.fd, &dt_fd, + sizeof(dt_fd), + vdev->dt_offset) !=3D sizeof(dt_fd)) { + error_report("vfio failed to write to dt region"); + vfio_unregister_dt_notifier(vdev); + } + vdev->enable_dt =3D true; +out: + g_free(reg_info); +} + + static void vfio_populate_device(VFIOPCIDevice *vdev, Error **errp) { VFIODevice *vbasedev =3D &vdev->vbasedev; @@ -3173,6 +3287,8 @@ static void vfio_realize(PCIDevice *pdev, Error **err= p) vdev->vbasedev.name); } =20 + init_dt_region(vdev); + vfio_register_err_notifier(vdev); vfio_register_req_notifier(vdev); vfio_setup_resetfn_quirk(vdev); @@ -3214,6 +3330,7 @@ static void vfio_exitfn(PCIDevice *pdev) =20 vfio_unregister_req_notifier(vdev); vfio_unregister_err_notifier(vdev); + vfio_unregister_dt_notifier(vdev); pci_device_set_intx_routing_notifier(&vdev->pdev, NULL); vfio_disable_interrupts(vdev); if (vdev->intx.mmap_timer) { diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h index 834a90d646..981d81b516 100644 --- a/hw/vfio/pci.h +++ b/hw/vfio/pci.h @@ -168,6 +168,11 @@ typedef struct VFIOPCIDevice { bool no_vfio_ioeventfd; bool enable_ramfb; VFIODisplay *dpy; + EventNotifier dt_notifier; + bool enable_dt; /*is dynamically trap enabled*/ + bool dt_state; /* trap or untrap. default state is untrap */ + off_t dt_offset; /* Offset of dt region within device fd */ + } VFIOPCIDevice; =20 uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len); diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index 7b2d07529e..b445887d85 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -162,3 +162,4 @@ vfio_load_state(char *name, uint64_t data) " (%s) data = 0x%"PRIx64 vfio_load_state_device_data(char *name, uint64_t data_offset, uint64_t dat= a_size) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64 vfio_get_dirty_page_list(char *name, uint64_t start, uint64_t pfn_count, u= int64_t page_size) " (%s) start 0x%"PRIx64" pfn_count 0x%"PRIx64 " page siz= e 0x%"PRIx64 vfio_region_disablable_mmaps_set_enabled(const char *name, unsigned long o= ffset, unsigned long end, bool enabled) "Region %s mmaps [0x%lx - 0x%lx] se= t to %d" +vfio_init_dt_region(char *name, uint32_t vendor_id, uint32_t device_id, un= signed long offset, unsigned long size, uint32_t dt_fd) "(%s %x %x) init dt= region [0x%lx - 0x%lx] dt_fd=3D%d" diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h index f9f0ea8eda..1743ce68e5 100644 --- a/linux-headers/linux/vfio.h +++ b/linux-headers/linux/vfio.h @@ -378,6 +378,7 @@ struct vfio_region_gfx_edid { #define VFIO_REGION_TYPE_MIGRATION (3) #define VFIO_REGION_SUBTYPE_MIGRATION (1) =20 + /** * Structure vfio_device_migration_info is placed at 0th offset of * VFIO_REGION_SUBTYPE_MIGRATION region to get/set VFIO device related mig= ration @@ -522,6 +523,16 @@ struct vfio_device_migration_info { #define VFIO_DEVICE_DIRTY_PFNS_ALL (~0ULL) } __attribute__((packed)); =20 + +/* Region type and sub-type to hold info to dynamically trap bars */ +#define VFIO_REGION_TYPE_DYNAMIC_TRAP_BAR_INFO (4) +#define VFIO_REGION_SUBTYPE_DYNAMIC_TRAP_BAR_INFO (1) + +struct vfio_device_dt_bar_info_region { + __u32 dt_fd; /* fd of eventfd to notify qemu trap/untrap bars */ + __u32 trap; /* trap/untrap bar regions */ +}; + /* * The MSIX mappable capability informs that MSIX data of a BAR can be mma= pped * which allows direct access to non-MSIX registers which happened to be w= ithin --=20 2.17.1