All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Marcel Apfelbaum <marcel@redhat.com>,
	qemu-devel@nongnu.org, peterx@redhat.com
Subject: Re: [Qemu-devel] [PATCH V3] virtio: do not require IOMMU to be created in advance
Date: Thu, 9 Mar 2017 17:31:57 +0200	[thread overview]
Message-ID: <20170309172959-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <2add94d5-4d6f-6c62-4d63-085901afc63e@redhat.com>

On Thu, Mar 09, 2017 at 11:05:36AM +0100, Paolo Bonzini wrote:
> 
> 
> On 09/03/2017 10:58, Jason Wang wrote:
> > 
> > 
> > On 2017年03月09日 17:28, Igor Mammedov wrote:
> >> On Thu, 9 Mar 2017 10:32:44 +0800
> >> Jason Wang<jasowang@redhat.com>  wrote:
> >>
> >>> On 2017年03月09日 00:40, Igor Mammedov wrote:
> >>>> On Tue, 7 Mar 2017 14:47:30 +0200
> >>>> Marcel Apfelbaum<marcel@redhat.com>   wrote:
> >>>>  
> >>>>> On 03/07/2017 11:09 AM, Jason Wang wrote:
> >>>>>> After commit 96a8821d2141 ("virtio: unbreak virtio-pci with IOMMU
> >>>>>> after caching ring translations"), IOMMU was required to be
> >>>>>> created in
> >>>>>> advance. This is because we can only get the correct dma_as after pci
> >>>>>> IOMMU (e.g intel_iommu) was initialized. This is suboptimal and
> >>>>>> inconvenient for user. This patch releases this by:
> >>>>>>
> >>>>>> - introduce a bus_master_ready method for PCIDeviceClass and trigger
> >>>>>>     this during pci_init_bus_master
> >>>>>> - implement virtio-pci method and 1) reset the dma_as 2) re-register
> >>>>>>     the memory listener to the new dma_as
> >> Instead of trying to fix up later it's possible to refuse
> >> adding iommu device if other devices has been added before
> >> it with -device/device_add.
> >> That would match current CLI semantics where device that
> >> others depend on should be listed on CLI before that others
> >> are listed.
> > 
> > Yes, but it works by chance in the past for the device that does not
> > want bus_master_as in their realize. This change may surprise their users.
> 
> There is another posssibility.  Create the address space at init time
> and add a container region instead of the bus_master_enable_region
> alias.  Then at machine_done time you create the bus_master_enable_region.
> 
> This removes the need for the callbacks and makes the MemoryListener
> just work.
> 
> Paolo

That's definitely cleaner than a callback, though a bit tricky
so needs a good comment explaining what is going on.
And then I think we can revert
96a8821d21411f10d77ea994af369c6e5c35a2cc, right?

-- 
MST

  reply	other threads:[~2017-03-09 15:32 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07  9:09 [Qemu-devel] [PATCH V3] virtio: do not require IOMMU to be created in advance Jason Wang
2017-03-07  9:19 ` Peter Xu
2017-03-07 12:47 ` Marcel Apfelbaum
2017-03-08  2:43   ` Peter Xu
2017-03-08  3:15     ` Jason Wang
2017-03-08  8:17       ` Marcel Apfelbaum
2017-03-08  9:09         ` Peter Xu
2017-03-08  9:16           ` Peter Xu
2017-03-08 13:14             ` Marcel Apfelbaum
2017-03-08  9:57         ` Jason Wang
2017-03-08  8:24     ` Marcel Apfelbaum
2017-03-08 16:40   ` Igor Mammedov
2017-03-09  2:32     ` Jason Wang
2017-03-09  9:28       ` Igor Mammedov
2017-03-09  9:30         ` Paolo Bonzini
2017-03-09  9:58         ` Jason Wang
2017-03-09 10:05           ` Paolo Bonzini
2017-03-09 15:31             ` Michael S. Tsirkin [this message]
2017-03-09 15:32               ` Paolo Bonzini
2017-03-10 10:54                 ` Jason Wang

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=20170309172959-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=marcel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.