All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Knut Omang <knut.omang@oracle.com>
Cc: "jroedel@suse.de" <jroedel@suse.de>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Marcel Apfelbaum" <marcel.a@redhat.com>,
	"Michael Tokarev" <mjt@tls.msk.ru>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Alexander Graf" <agraf@suse.de>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Andreas Färber" <andreas.faerber@web.de>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Anthony Liguori" <aliguori@amazon.com>,
	"Stefan Weil" <sw@weilnetz.de>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 0/2] intel_iommu: Add support for translation for devices behind bridges
Date: Tue, 21 Oct 2014 15:20:34 +0300	[thread overview]
Message-ID: <20141021122034.GB23466@redhat.com> (raw)
In-Reply-To: <1413891453.8961.17.camel@ori.omang.mine.nu>

On Tue, Oct 21, 2014 at 01:37:33PM +0200, Knut Omang wrote:
> On Tue, 2014-10-21 at 14:26 +0300, Michael S. Tsirkin wrote:
> > On Tue, Oct 21, 2014 at 01:15:14PM +0200, Alexander Graf wrote:
> > > 
> > > 
> > > On 21.10.14 11:35, Knut Omang wrote:
> > > > On Tue, 2014-10-21 at 11:07 +0200, Alexander Graf wrote:
> > > >>
> > > >>
> > > >>> Am 21.10.2014 um 07:26 schrieb Knut Omang <knut.omang@oracle.com>:
> > > >>>
> > > >>>> On Tue, 2014-10-21 at 01:29 +0200, Alexander Graf wrote:
> > > >>>>
> > > >>>>
> > > >>>>> Am 21.10.2014 um 00:34 schrieb Knut Omang <knut.omang@oracle.com>:
> > > >>>>>
> > > >>>>> This patch set changes the data structure used to handle address spaces within
> > > >>>>> the emulated Intel iommu to support traversal also if bus numbers are dynamically
> > > >>>>> allocated, as is the case for devices that sit behind root ports or downstream switches.
> > > >>>>> This means that we cannot use bus number as index, instead a QLIST is used.
> > > >>>>>
> > > >>>>> This requires a change in the API for setup of IOMMUs which is taken care of by 
> > > >>>>> the first patch. The second patch implements the fix.
> > > >>>>
> > > >>>> Are you sure that this works on real hardware? How does that one
> > > >>>> communicate sub-bridge liodns to the iommu? How do they get indexed
> > > >>>> from software?
> > > >>>
> > > >>> I do not claim to fully understand the details of how this is
> > > >>> implemented in hardware, but I believe the implementation I propose here
> > > >>> should be functionally equivalent to what the Intel IOMMU offers, and
> > > >>> similar to the original implementation here, except that the data
> > > >>> structure is valid also before enumeration when behind buses.
> > > >>
> > > >> Can you please give me a pointer to the vt-d spec's section that explains iommu behavior behind bridges?
> > > >>
> > > >> I've also added Alex W who has played with PCI bridges behind iommus quite a bit recently.
> > > >>
> > > >>>
> > > >>> After enumeration, the only difference would be that during
> > > >>> invalidation, there is a list search for the right bus rather than an
> > > >>> index lookup as before, slightly less efficient but at the benefit of
> > > >>> being independent of bus numbering during setup.
> > > >>
> > > >> I don't think the implementation is bad, I'm just not sure that it follows the spec, 
> > > >> so I want to confirm :).
> > > > 
> > > > http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/vt-directed-io-spec.pdf
> > > 
> > > So if I understand that document correctly, a PCIe / PCI-X bridge can
> > > swizzle the requester id depending on a device behind itself. PCI
> > > bridges can not - there everything behind the bridge will appear as if
> > > the DMA originated from the bridge device.
> > > 
> > > So conceptually, PCIe / PCI-X bridges should probably be the ones
> > > converting requester IDs.
> > > 
> > > 
> > > Alex
> > 
> > To avoid confusion, when you say PCIe / PCI-X you really mean
> > PCI-Express-to-PCI/PCI-X.
> > 
> > I think you got this right.
> > 
> > I'd like to add that regular PCIe to PCIe bridges just forward everything
> > without changes. This applies to root complex and downstream ports.
> 
> My test case for this patch set has been just the root port/downstream
> port case, where as you say the requester ID seen by the device in the
> root port is always the same as the one used/enumerated by the host.
> 
> Knut
> 

So pci/pci and pcie/pci cases are still TBD.
Again, if we can't make it in time for 2.2,
I'm fine with disallowing these configurations.

-- 
MST

  reply	other threads:[~2014-10-21 12:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-20 22:34 [Qemu-devel] [PATCH 0/2] intel_iommu: Add support for translation for devices behind bridges Knut Omang
2014-10-20 22:34 ` [Qemu-devel] [PATCH 1/2] iommu: Replace bus+devfn arguments with PCIDevice* in PCIIOMMUFunc Knut Omang
2014-10-20 22:34 ` [Qemu-devel] [PATCH 2/2] intel_iommu: Add support for translation for devices behind bridges Knut Omang
2014-10-25 11:36   ` Jan Kiszka
2014-10-25 12:24     ` Jan Kiszka
2014-10-26  4:46       ` Knut Omang
2014-10-25 12:28   ` Jan Kiszka
2014-10-26 12:06   ` Jan Kiszka
2014-10-26 13:15     ` Knut Omang
2014-10-26 15:20       ` Michael S. Tsirkin
2014-10-20 23:29 ` [Qemu-devel] [PATCH 0/2] " Alexander Graf
2014-10-21  5:26   ` Knut Omang
2014-10-21  9:07     ` Alexander Graf
2014-10-21  9:35       ` Knut Omang
2014-10-21 11:15         ` Alexander Graf
2014-10-21 11:26           ` Michael S. Tsirkin
2014-10-21 11:37             ` Knut Omang
2014-10-21 12:20               ` Michael S. Tsirkin [this message]
2014-10-21 15:07           ` Alex Williamson
2014-10-21 22:26             ` Michael S. Tsirkin

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=20141021122034.GB23466@redhat.com \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=andreas.faerber@web.de \
    --cc=armbru@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=jroedel@suse.de \
    --cc=knut.omang@oracle.com \
    --cc=marcel.a@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=sw@weilnetz.de \
    /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.