qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] msix: Support specifying offsets, BARs, and capability location
Date: Wed, 13 Jun 2012 14:21:31 +0300	[thread overview]
Message-ID: <20120613112131.GE18001@redhat.com> (raw)
In-Reply-To: <4FD86EF1.9000305@siemens.com>

On Wed, Jun 13, 2012 at 12:44:01PM +0200, Jan Kiszka wrote:
> On 2012-06-12 22:03, Alex Williamson wrote:
> > msix_init has very little configurability as to how it lays out MSIX
> > for a device.  It claims to resize BARs, but doesn't actually do this
> > anymore.  This patch allows MSIX to be fully specified, which is
> > necessary both for emulated devices trying to match the physical
> > layout of a hardware device as well as for any kind of device
> > assignment.
> > 
> > New functions msix_init_bar & msix_uninit_bar provide wrappers around
> > the more detailed functions for drivers that just want a simple MSIX
> > setup.
> > 
> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> > ---
> > 
> >  hw/ivshmem.c    |    9 +-
> >  hw/msix.c       |  299 +++++++++++++++++++++++++++++++------------------------
> >  hw/msix.h       |   11 +-
> >  hw/pci.h        |   12 ++
> >  hw/virtio-pci.c |   15 +--
> >  5 files changed, 192 insertions(+), 154 deletions(-)
> > 
> > diff --git a/hw/ivshmem.c b/hw/ivshmem.c
> > index 05559b6..71c84a6 100644
> > --- a/hw/ivshmem.c
> > +++ b/hw/ivshmem.c
> > @@ -563,16 +563,13 @@ static uint64_t ivshmem_get_size(IVShmemState * s) {
> > 
> >  static void ivshmem_setup_msi(IVShmemState * s)
> >  {
> > -    memory_region_init(&s->msix_bar, "ivshmem-msix", 4096);
> > -    if (!msix_init(&s->dev, s->vectors, &s->msix_bar, 1, 0)) {
> > -        pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY,
> > -                         &s->msix_bar);
> > -        IVSHMEM_DPRINTF("msix initialized (%d vectors)\n", s->vectors);
> > -    } else {
> > +    if (msix_init_bar(&s->dev, s->vectors, &s->msix_bar, 1, "ivshmem-msix")) {
> 
> I don't think the callers of msix_init_bar should have to provide the
> memory region for that bar. That can be embedded into PCIDevice, just
> like you did for the table and PBA. That was my idea with msix_init_simple.
> 
> Back then, I only included a generic memory region name. That can be
> improved, but without bothering the caller. Just derive it from
> PCIDevice::name.
> 
> Jan

I think callers must initialize the BAR regions.
This is because BAR can include other stuff besides MSI-X.
MSI-X adds its own subregion.
It is a bit ugly that we provide both BAR region and BAR number.
We could register BAR and afterwards add subregions,
if we do, passing either BAR # or BAR region is enough.
To do this we need to add pci_unregister_bar
so we can handle msix_init failures gracefully.

Anyone sees any problems with this?


> -- 
> Siemens AG, Corporate Technology, CT T DE IT 1
> Corporate Competence Center Embedded Linux

  reply	other threads:[~2012-06-13 11:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12 20:03 [Qemu-devel] [PATCH] msix: Support specifying offsets, BARs, and capability location Alex Williamson
2012-06-13 10:44 ` Jan Kiszka
2012-06-13 11:21   ` Michael S. Tsirkin [this message]
2012-06-13 11:22     ` Jan Kiszka
2012-06-13 12:25       ` Michael S. Tsirkin
2012-06-13 12:38         ` Alex Williamson
2012-06-13 14:14           ` Michael S. Tsirkin
2012-06-13 12:30       ` Alex Williamson
2012-06-13 15:28         ` Michael S. Tsirkin
2012-06-13 16:48           ` Alex Williamson
2012-06-13 18:10             ` Michael S. Tsirkin
2012-06-13 12:27   ` Alex Williamson
2012-06-13 12:41     ` Jan Kiszka
2012-06-13 20:43 ` Michael S. Tsirkin
2012-06-13 23:05   ` Alex Williamson

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=20120613112131.GE18001@redhat.com \
    --to=mst@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=jan.kiszka@siemens.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 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).