public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Weidong Han <weidong.han@intel.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: 'Avi Kivity' <avi@redhat.com>,
	"'iommu@lists.linux-foundation.org'"
	<iommu@lists.linux-foundation.org>, 'kvm' <kvm@vger.kernel.org>,
	"Kay, Allen M" <allen.m.kay@intel.com>
Subject: Re: [PATCH] VT-d: fix PCI device detach from virtual machine
Date: Thu, 17 Jun 2010 17:15:58 +0800	[thread overview]
Message-ID: <4C19E7CE.1090309@intel.com> (raw)
In-Reply-To: <1276764596.5664.17.camel@macbook.infradead.org>

David Woodhouse wrote:
> On Thu, 2010-06-17 at 11:35 +0800, Weidong Han wrote:
>   
>> David Woodhouse wrote:
>>     
>>> So why do we bother setting up a context in the IOMMU for the device
>>> itself, when no DMA will ever appear to come from this device? And
>>>   
>>>       
>> if the device is behind PCI Express-to-PCI/PCI-X bridge, the source-id 
>> may be the device bdf or the source-id provided by the bridge. so it
>> needs to map the device itself.
>>     
>
> Ah, that makes some sense, and matches what Jörg said about the AMD
> IOMMU spec. Thanks.
>
>   
>>> likewise why do we bother setting up a context for intermediate PCI
>>> bridges?
>>>   
>>>       
>> I'm not sure if the intermediate PCI bridges are necessary. need to 
>> check PCI spec.
>>     
>
> FWIW, the AMD IOMMU doesn't do this; it only sets up the mapping for the
> original device and for its 'proxy'.
>
>   
>>> Why not just jump straight to the 'DMA proxy' device, and use that
>>> _only_?
>>>   
>>>       
>> What's the 'DMA proxy' device? is it the upstream pcie-to-pci bridge?
>>     
>
> Yes. Or, in the case of a certain buggy Ricoh multi-function device, it
> is function zero -- all other functions do their DMA as if it came from
> function zero.
>
> This is why I'm looking at whether we need the whole tree-walking thing,
> or whether we can just have a single 'proxy' device (or 'alias' as it's
> called in the AMD code).
>
>   
>> all the device behind a pcie-to-pci bridge must be co-assigned to a 
>> single domain. So it also require users to detach them together.
>>     
>
> Do we even _have_ an API for KVM to assign multiple devices at the same
> time? Or an API for KVM to _determine_ which devices are behind the same
> 'proxy'?
>   
No. I think it's better to add some checks in management tool (e.g. 
libvirt) to determine if the devices can be assigned or not before 
device assignment, such as all devices behind same 'proxy' are 
co-assigned (checking command line), and devices can be reset (FLR, 
secondary bus reset, D0->D3 etc.) I think libvirt already has these 
checks for device assignment.


> We could even have a new device hotplugged after the assignment has been
> done.
>   

yes, but for these legacy devices, they only can be assigned and 
de-assigned at the same time.

Regards,
Weidong


      reply	other threads:[~2010-06-17  9:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-26  9:31 [PATCH] VT-d: fix PCI device detach from virtual machine Han, Weidong
2010-06-14 23:19 ` David Woodhouse
2010-06-15 14:10   ` Joerg Roedel
2010-06-15 14:52     ` David Woodhouse
2010-06-17  3:35   ` Weidong Han
2010-06-17  8:49     ` David Woodhouse
2010-06-17  9:15       ` Weidong Han [this message]

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=4C19E7CE.1090309@intel.com \
    --to=weidong.han@intel.com \
    --cc=allen.m.kay@intel.com \
    --cc=avi@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=kvm@vger.kernel.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