public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Shashidhar Patil <shashidhar.patil@gmail.com>, kvm@vger.kernel.org
Subject: Re: FreeBSD guest with VTD NIC not passing traffic
Date: Fri, 13 Jan 2012 14:56:20 -0700	[thread overview]
Message-ID: <1326491780.5945.57.camel@bling.home> (raw)
In-Reply-To: <4F10A320.1090202@web.de>

On Fri, 2012-01-13 at 22:33 +0100, Jan Kiszka wrote:
> On 2012-01-13 22:05, Alex Williamson wrote:
> > On Fri, 2012-01-13 at 22:00 +0100, Jan Kiszka wrote:
> >> On 2012-01-04 04:21, Alex Williamson wrote:
> >>> On Mon, 2011-12-19 at 19:49 +0530, Shashidhar Patil wrote:
> >>>> Hi,
> >>>>        I am running Ubuntu 10.10 (amd64) on a 2 socket  nehalem based
> >>>> server with IOH 5520. 5520 supports VTD.
> >>>> I enabled DMAR with intel_iommu=on. The box has intel 82599 adapter
> >>>> which I assigned through VT-D to FreeBSD 8.2 running
> >>>> as guest os. The ixgbe driver detects the device and the driver
> >>>> successfully configures the device. But the link
> >>>> never comes up. It looks like link up/down interrupts are not
> >>>> delivered. Then I checked kvm interrupt assignment and as expected
> >>>> kvm could not make MSI-X entries for the VT-d guest. So no output from
> >>>> "grep kvm /proc/interrupt". By enabling some debugs in the
> >>>> qemu-kvm I figured out that the MSI-x updates are not received
> >>>> properly. It does look like Linux updates MSI-X table in a batch
> >>>> fashion
> >>>> which qemu-kvm gets in  one shot and every thing works fine in case of
> >>>> linux. In case of FreeBSD PCIE updates come /MSI-X entry
> >>>> which qemu-kvm can't make use.
> >>>
> >>> That's right, Linux and Windows both seem to setup the MSI-X table then
> >>> enable it in one shot, so we only trigger the interrupt programming when
> >>> the enable bit is set.  We don't trigger changes on writes to the MSI-X
> >>> table... not very accurate emulation of mask bits.
> >>
> >> According to the PCI spec, updates that happen while a vector is
> >> unmasked, need not be considered by the hardware (thus the hypervisor
> >> here). Is that the scenario here?
> > 
> > I'm assuming the vector is masked in the MSI-X table.  So Linux/Windows
> > do:
> > 
> > a) program MSI-X table
> > b) enable MSI-X in capability register
> > 
> > Whereas FreeBSD does:
> > 
> > a) enable MSI-X in capability register (vectors masked in table)
> > b) program and unmask individual vectors
> 
> That should work with the current code. It checks the number of vectors
> on each config write, iterates the whole table, and then updates the
  ^^^^^^^^^^^^^^^^^^^^
> kernel configuration accordingly. It even requires the enable bit in the
> cap register to be set before doing this.

That's the problem, we only do it on config writes overlapping the MSI-X
flags.  We don't do anything for writes to the MSI-X table.  It might be
as simple as calling assigned_dev_update_msix() from msix_mmio_writel()
when the mask bit is toggled.  I'm not sure what might fall out of that
though.  Thanks,

Alex




  reply	other threads:[~2012-01-13 21:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-19 14:19 FreeBSD guest with VTD NIC not passing traffic Shashidhar Patil
2012-01-04  3:21 ` Alex Williamson
     [not found]   ` <CADve3d6aTAEK8FqjxVuRnLGu+Efy1rmsb0n5H5rq1G0Eu1s6PA@mail.gmail.com>
2012-01-13 20:26     ` Alex Williamson
2012-01-13 21:00   ` Jan Kiszka
2012-01-13 21:05     ` Alex Williamson
2012-01-13 21:33       ` Jan Kiszka
2012-01-13 21:56         ` Alex Williamson [this message]
2012-01-13 22:15           ` Jan Kiszka
2012-01-14  6:46             ` Shashidhar Patil
2012-01-14  9:23               ` Shashidhar Patil
2012-01-14 20:25                 ` Shashidhar Patil

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=1326491780.5945.57.camel@bling.home \
    --to=alex.williamson@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=shashidhar.patil@gmail.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