From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbcTN-0007ly-So for qemu-devel@nongnu.org; Mon, 04 Jun 2012 14:57:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbcTM-0006Lg-2O for qemu-devel@nongnu.org; Mon, 04 Jun 2012 14:57:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32670) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbcTL-0006Kv-Q5 for qemu-devel@nongnu.org; Mon, 04 Jun 2012 14:57:47 -0400 Date: Mon, 4 Jun 2012 21:57:46 +0300 From: "Michael S. Tsirkin" Message-ID: <20120604185746.GB1199@redhat.com> References: <20120604144837.GA30538@redhat.com> <4FCCCBFC.5080303@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FCCCBFC.5080303@siemens.com> Subject: Re: [Qemu-devel] [PATCH v4 8/8] msi: Use msi/msix_present more consistently List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: qemu-devel On Mon, Jun 04, 2012 at 04:53:48PM +0200, Jan Kiszka wrote: > On 2012-06-04 16:48, Michael S. Tsirkin wrote: > > On Fri, May 11, 2012 at 11:42:41AM -0300, Jan Kiszka wrote: > >> Replace some open-coded msi/msix_present checks. > >> > >> Signed-off-by: Jan Kiszka > > > > This last one doesn't apply but I don't expect this blocks > > anything. Applied 1-7 for now. > > Hmm, might have rebased here but forgot to send: > > ---8<---- > > Replace some open-coded msi/msix_present checks. > > Signed-off-by: Jan Kiszka Applied, thanks. > --- > hw/msi.c | 2 +- > hw/msix.c | 13 ++++++++----- > 2 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/hw/msi.c b/hw/msi.c > index 556c7c4..5233204 100644 > --- a/hw/msi.c > +++ b/hw/msi.c > @@ -175,7 +175,7 @@ void msi_uninit(struct PCIDevice *dev) > uint16_t flags; > uint8_t cap_size; > > - if (!(dev->cap_present & QEMU_PCI_CAP_MSI)) { > + if (!msi_present(dev)) { > return; > } > flags = pci_get_word(dev->config + msi_flags_off(dev)); > diff --git a/hw/msix.c b/hw/msix.c > index 339e652..ded3c55 100644 > --- a/hw/msix.c > +++ b/hw/msix.c > @@ -319,8 +319,9 @@ static void msix_free_irq_entries(PCIDevice *dev) > /* Clean up resources for the device. */ > int msix_uninit(PCIDevice *dev, MemoryRegion *bar) > { > - if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) > + if (!msix_present(dev)) { > return 0; > + } > pci_del_capability(dev, PCI_CAP_ID_MSIX, MSIX_CAP_LENGTH); > dev->msix_cap = 0; > msix_free_irq_entries(dev); > @@ -339,7 +340,7 @@ void msix_save(PCIDevice *dev, QEMUFile *f) > { > unsigned n = dev->msix_entries_nr; > > - if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) { > + if (!msix_present(dev)) { > return; > } > > @@ -353,7 +354,7 @@ void msix_load(PCIDevice *dev, QEMUFile *f) > unsigned n = dev->msix_entries_nr; > unsigned int vector; > > - if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) { > + if (!msix_present(dev)) { > return; > } > > @@ -407,8 +408,9 @@ void msix_notify(PCIDevice *dev, unsigned vector) > > void msix_reset(PCIDevice *dev) > { > - if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) > + if (!msix_present(dev)) { > return; > + } > msix_free_irq_entries(dev); > dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &= > ~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET]; > @@ -447,8 +449,9 @@ void msix_vector_unuse(PCIDevice *dev, unsigned vector) > > void msix_unuse_all_vectors(PCIDevice *dev) > { > - if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) > + if (!msix_present(dev)) { > return; > + } > msix_free_irq_entries(dev); > } > > -- > 1.7.3.4