From: Alex Williamson <alex.williamson@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: Peter Xu <peterx@redhat.com>,
tianyu.lan@intel.com, kevin.tian@intel.com, mst@redhat.com,
jan.kiszka@siemens.com, bd.aviv@gmail.com, qemu-devel@nongnu.org,
david@gibson.dropbear.id.au
Subject: Re: [Qemu-devel] [PATCH v3] intel_iommu: allow dynamic switch of IOMMU region
Date: Tue, 3 Jan 2017 14:20:35 -0700 [thread overview]
Message-ID: <20170103142035.7c946abf@t450s.home> (raw)
In-Reply-To: <f37cf386-8fe4-ded8-0341-dc765882cf72@redhat.com>
On Mon, 26 Dec 2016 10:45:55 +0800
Jason Wang <jasowang@redhat.com> wrote:
> On 2016年12月23日 11:26, Peter Xu wrote:
> > On Thu, Dec 22, 2016 at 07:34:10PM +0800, Jason Wang wrote:
> >>
> >> On 2016年12月22日 19:04, Peter Xu wrote:
> >>> On Thu, Dec 22, 2016 at 05:52:58PM +0800, Jason Wang wrote:
> >>>> On 2016年12月22日 17:48, Peter Xu wrote:
> >>>>> /* Handle Translation Enable/Disable */
> >>>>> static void vtd_handle_gcmd_te(IntelIOMMUState *s, bool en)
> >>>>> {
> >>>>> + if (s->dmar_enabled == en) {
> >>>>> + return;
> >>>>> + }
> >>>>> +
> >>>>> VTD_DPRINTF(CSR, "Translation Enable %s", (en ? "on" : "off"));
> >>>>> if (en) {
> >>>>> @@ -1196,6 +1237,8 @@ static void vtd_handle_gcmd_te(IntelIOMMUState *s, bool en)
> >>>>> /* Ok - report back to driver */
> >>>>> vtd_set_clear_mask_long(s, DMAR_GSTS_REG, VTD_GSTS_TES, 0);
> >>>>> }
> >>>>> +
> >>>>> + vtd_switch_address_space_all(s, en);
> >>>>> }
> >>>> We may need something like notifier here to tell e.g vhost to stop device
> >>>> IOTLB. (Since it's likely this series were applied after device IOTLB
> >>>> patches)
> >>> Yes, I missed vhost case.
> >>>
> >>> To notify vhost, IMO we should be able to use memory listeners just
> >>> like how vfio devices do (please refer to vfio_memory_listener).
> >> Just for switching? This seems an overkill since we don't depends on it for
> >> all other things. Guest should setup correct mappings by explicitly notify
> >> device IOTLB. A quick glance at ATS spec, for enabling and disabling, looks
> >> like it was done through enable bit of ASTctl instead of here.
> >>
> >> So we are probably ok here :)
> > So we need a more general way to notify ATS about this, right? (e.g.,
> > for future devices that support ATS as well, not only vhost)
>
> Yes, if we want to make ATS visible to guest. But looks like it needs
> more e.g VFIO support for device IOTLB invalidation.
ATS is already visible for vfio-pci devices, it will be enabled if the
host IOMMU supports ATS. If the host IOMMU does not support ATS,
enabling it on the device by the guest will generate unsupported
requests. This is yet another case, along with address width, where
it's potentially really complicated and not amenable to hotplug to have
a guest IOMMU. AFAICT, there's nothing to be added to vfio for device
iotlb invalidations, this occurs automatically between the host IOMMU
and device when a DMA unmap occurs. Thanks,
Alex
next prev parent reply other threads:[~2017-01-03 21:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-22 9:48 [Qemu-devel] [PATCH v3] intel_iommu: allow dynamic switch of IOMMU region Peter Xu
2016-12-22 9:52 ` Jason Wang
2016-12-22 11:04 ` Peter Xu
2016-12-22 11:34 ` Jason Wang
2016-12-23 3:26 ` Peter Xu
2016-12-26 2:45 ` Jason Wang
2017-01-03 21:20 ` Alex Williamson [this message]
2017-01-05 4:36 ` Tian, Kevin
2017-01-05 3:30 ` Tian, Kevin
2017-01-05 3:52 ` Peter Xu
2017-01-05 4:15 ` Tian, Kevin
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=20170103142035.7c946abf@t450s.home \
--to=alex.williamson@redhat.com \
--cc=bd.aviv@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=jan.kiszka@siemens.com \
--cc=jasowang@redhat.com \
--cc=kevin.tian@intel.com \
--cc=mst@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=tianyu.lan@intel.com \
/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).