From: Eric Auger <eric.auger@redhat.com>
To: eric.auger.pro@gmail.com, eric.auger@redhat.com,
qemu-devel@nongnu.org, qemu-arm@nongnu.org,
peter.maydell@linaro.org, pbonzini@redhat.com,
alex.williamson@redhat.com, peterx@redhat.com, aik@ozlabs.ru,
david@gibson.dropbear.id.au
Cc: mst@redhat.com
Subject: [PATCH v3 0/2] Allow memory_region_register_iommu_notifier() to fail
Date: Mon, 23 Sep 2019 08:55:50 +0200 [thread overview]
Message-ID: <20190923065552.10602-1-eric.auger@redhat.com> (raw)
This series allows the memory_region_register_iommu_notifier()
to fail. As of now, when a MAP notifier is attempted to be
registered along with SMMUv3 or AMD IOMMU, we exit in the IOMMU
MR notify_flag_changed() callback.
In case of VFIO assigned device hotplug, this could be handled
more nicely directly within the VFIO code, simply rejecting
the hotplug without exiting. This is what the series achieves
by handling the memory_region_register_iommu_notifier() returned
value and Error object.
To propagate errors collected during vfio_listener_region_add()
we now store the error handle inside the VFIO container instead
of a returned value.
The message now is:
(QEMU) device_add id=hot0 driver=vfio-pci host=0000:89:00.0 bus=pcie.1
{"error": {"class": "GenericError", "desc": "vfio 0000:89:00.0: failed
to setup container for group 2: memory listener initialization failed:
Region smmuv3-iommu-memory-region-0-6: device 01.00.0 requires iommu MAP
notifier which is not currently supported"}}
Best Regards
Eric
This series can be found at:
https://github.com/eauger/qemu/tree/v4.1.0_register_iommu_notifier_fail_v3
History:
v2 -> v3:
- also pass an Error handle (suggested by Peter)
- VFIO container error becomes and Error handle
v1 -> v2:
- Intel IOMMU now handles the problem differently with machine init done
notifier and machine hotplug allowed hook.
- use assert(!ret)
- message rewording in SMMUv3
Follow-up of "VFIO/SMMUv3: Fail on VFIO/HW nested paging detection"
https://patchew.org/QEMU/20190829090141.21821-1-eric.auger@redhat.com/
Eric Auger (2):
vfio: Turn the container error into an Error handle
memory: allow memory_region_register_iommu_notifier() to fail
exec.c | 10 ++++--
hw/arm/smmuv3.c | 18 +++++-----
hw/i386/amd_iommu.c | 17 +++++----
hw/i386/intel_iommu.c | 8 +++--
hw/ppc/spapr_iommu.c | 8 +++--
hw/vfio/common.c | 67 +++++++++++++++++++++--------------
hw/vfio/spapr.c | 4 ++-
hw/virtio/vhost.c | 9 +++--
include/exec/memory.h | 21 ++++++++---
include/hw/vfio/vfio-common.h | 2 +-
memory.c | 31 ++++++++++------
11 files changed, 126 insertions(+), 69 deletions(-)
--
2.20.1
next reply other threads:[~2019-09-23 6:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-23 6:55 Eric Auger [this message]
2019-09-23 6:55 ` [PATCH v3 1/2] vfio: Turn the container error into an Error handle Eric Auger
2019-09-23 7:51 ` Peter Xu
2019-09-23 11:43 ` Auger Eric
2019-09-23 23:10 ` Alex Williamson
2019-09-23 23:49 ` Peter Xu
2019-09-23 23:05 ` Alex Williamson
2019-09-24 9:42 ` Auger Eric
2019-09-23 6:55 ` [PATCH v3 2/2] memory: allow memory_region_register_iommu_notifier() to fail Eric Auger
2019-09-23 7:59 ` Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190923065552.10602-1-eric.auger@redhat.com \
--to=eric.auger@redhat.com \
--cc=aik@ozlabs.ru \
--cc=alex.williamson@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=eric.auger.pro@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).