From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH 6/9] pci-assign: Proper initialization for MSI-X table Date: Tue, 31 Jan 2012 21:12:34 +0200 Message-ID: <20120131191233.GD3601@redhat.com> References: <20120128142104.25681.93072.stgit@bling.home> <20120128142209.25681.10074.stgit@bling.home> <20120131174042.GB3601@redhat.com> <1328036859.6937.101.camel@bling.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, jan.kiszka@siemens.com, shashidhar.patil@gmail.com To: Alex Williamson Return-path: Received: from mx1.redhat.com ([209.132.183.28]:39067 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753179Ab2AaTMi (ORCPT ); Tue, 31 Jan 2012 14:12:38 -0500 Content-Disposition: inline In-Reply-To: <1328036859.6937.101.camel@bling.home> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Jan 31, 2012 at 12:07:39PM -0700, Alex Williamson wrote: > On Tue, 2012-01-31 at 19:40 +0200, Michael S. Tsirkin wrote: > > On Sat, Jan 28, 2012 at 07:22:09AM -0700, Alex Williamson wrote: > > > Per the PCI spec, all vectors should be masked at handoff. > > > > > > Signed-off-by: Alex Williamson > > > --- > > > > > > hw/device-assignment.c | 20 +++++++++++++++++++- > > > 1 files changed, 19 insertions(+), 1 deletions(-) > > > > > > diff --git a/hw/device-assignment.c b/hw/device-assignment.c > > > index af614d3..6efa219 100644 > > > --- a/hw/device-assignment.c > > > +++ b/hw/device-assignment.c > > > @@ -1462,6 +1462,22 @@ static const MemoryRegionOps msix_mmio_ops = { > > > }, > > > }; > > > > > > +static void msix_reset(AssignedDevice *dev) > > > +{ > > > + MSIXTableEntry *entry; > > > + int i; > > > + > > > + if (!dev->msix_table) { > > > + return; > > > + } > > > + > > > + memset(dev->msix_table, 0, 0x1000); > > > + > > > + for (i = 0, entry = dev->msix_table; i < dev->msix_max; i++, entry++) { > > > + entry->ctrl = 0x1; /* Masked */ > > > > This is broken for BE hosts. > > Show me a BE host that even remotely works with this device assignment > implementation. Thanks, > > Alex I don't get it. Yes lots of cleanup is needed but why add more broken code? > > > + } > > > +} > > > + > > > static int assigned_dev_register_msix_mmio(AssignedDevice *dev) > > > { > > > dev->msix_table = mmap(NULL, 0x1000, PROT_READ|PROT_WRITE, > > > @@ -1470,7 +1486,9 @@ static int assigned_dev_register_msix_mmio(AssignedDevice *dev) > > > fprintf(stderr, "fail allocate msix_table! %s\n", strerror(errno)); > > > return -EFAULT; > > > } > > > - memset(dev->msix_table, 0, 0x1000); > > > + > > > + msix_reset(dev); > > > + > > > memory_region_init_io(&dev->mmio, &msix_mmio_ops, dev, > > > "assigned-dev-msix", MSIX_PAGE_SIZE); > > > return 0; > > > > > > -- > > > To unsubscribe from this list: send the line "unsubscribe kvm" in > > > the body of a message to majordomo@vger.kernel.org > > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html