qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Gavin Shan <gwshan@linux.vnet.ibm.com>
Cc: aik@ozlabs.ru, peter.maydell@linaro.org, thuth@redhat.com,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v7 5/8] Obsolete PCI_MSIX_FLAGS_BIRMASK
Date: Tue, 1 Sep 2015 11:00:50 +1000	[thread overview]
Message-ID: <20150901010050.GN11475@voom.redhat.com> (raw)
In-Reply-To: <1440746120-21577-6-git-send-email-gwshan@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 6824 bytes --]

On Fri, Aug 28, 2015 at 05:15:17PM +1000, Gavin Shan wrote:
> This replaces PCI_MSIX_FLAGS_BIRMASK with PCI_MSIX_TABLE_BIR. Also,
> 3 more macros regarding MSIx table offset, MSIx PBA BAR index and
> MSIx PBA offset and this uses them. Besides, PCI_ERR_UNC_TRAIN is
> replaced with PCI_ERR_UNC_UND. The changes were introduced by
> below Linux upstream commits:
> 
>   commit 24bc69da ("PCI: Clean up MSI/MSI-X capability #defines")
>   commit 846fc709 ("PCI/AER: Rename PCI_ERR_UNC_TRAIN to PCI_ERR_UNC_UND")
> 
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/i386/kvm/pci-assign.c | 4 ++--
>  hw/pci/msix.c            | 2 +-
>  hw/pci/pcie_aer.c        | 2 +-
>  hw/s390x/s390-pci-bus.c  | 8 ++++----
>  hw/vfio/pci.c            | 8 ++++----
>  hw/xen/xen_pt_msi.c      | 4 ++--
>  tests/libqos/pci.c       | 8 ++++----
>  7 files changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> index 74d22f4..74154b1 100644
> --- a/hw/i386/kvm/pci-assign.c
> +++ b/hw/i386/kvm/pci-assign.c
> @@ -1320,8 +1320,8 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
>                       PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL);
>  
>          msix_table_entry = pci_get_long(pci_dev->config + pos + PCI_MSIX_TABLE);
> -        bar_nr = msix_table_entry & PCI_MSIX_FLAGS_BIRMASK;
> -        msix_table_entry &= ~PCI_MSIX_FLAGS_BIRMASK;
> +        bar_nr = msix_table_entry & PCI_MSIX_TABLE_BIR;
> +        msix_table_entry &= PCI_MSIX_TABLE_OFFSET;
>          dev->msix_table_addr = pci_region[bar_nr].base_addr + msix_table_entry;
>          dev->msix_max = msix_max;
>      }
> diff --git a/hw/pci/msix.c b/hw/pci/msix.c
> index 7716bf3..2788be2 100644
> --- a/hw/pci/msix.c
> +++ b/hw/pci/msix.c
> @@ -250,7 +250,7 @@ int msix_init(struct PCIDevice *dev, unsigned short nentries,
>           ranges_overlap(table_offset, table_size, pba_offset, pba_size)) ||
>          table_offset + table_size > memory_region_size(table_bar) ||
>          pba_offset + pba_size > memory_region_size(pba_bar) ||
> -        (table_offset | pba_offset) & PCI_MSIX_FLAGS_BIRMASK) {
> +        (table_offset | pba_offset) & PCI_MSIX_TABLE_BIR) {
>          return -EINVAL;
>      }
>  
> diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c
> index f1847ac..1def4a4 100644
> --- a/hw/pci/pcie_aer.c
> +++ b/hw/pci/pcie_aer.c
> @@ -828,7 +828,7 @@ typedef struct PCIEAERErrorName {
>  static const struct PCIEAERErrorName pcie_aer_error_list[] = {
>      {
>          .name = "TRAIN",
> -        .val = PCI_ERR_UNC_TRAIN,
> +        .val = PCI_ERR_UNC_UND,
>          .correctable = false,
>      }, {
>          .name = "DLP",
> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index 560b66a..7dac2c0 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -507,10 +507,10 @@ static int s390_pcihost_setup_msix(S390PCIBusDevice *pbdev)
>      pba = pci_host_config_read_common(pbdev->pdev, pos + PCI_MSIX_PBA,
>               pci_config_size(pbdev->pdev), sizeof(pba));
>  
> -    pbdev->msix.table_bar = table & PCI_MSIX_FLAGS_BIRMASK;
> -    pbdev->msix.table_offset = table & ~PCI_MSIX_FLAGS_BIRMASK;
> -    pbdev->msix.pba_bar = pba & PCI_MSIX_FLAGS_BIRMASK;
> -    pbdev->msix.pba_offset = pba & ~PCI_MSIX_FLAGS_BIRMASK;
> +    pbdev->msix.table_bar = table & PCI_MSIX_TABLE_BIR;
> +    pbdev->msix.table_offset = table & PCI_MSIX_TABLE_OFFSET;
> +    pbdev->msix.pba_bar = pba & PCI_MSIX_PBA_BIR;
> +    pbdev->msix.pba_offset = pba & PCI_MSIX_PBA_OFFSET;
>      pbdev->msix.entries = (ctrl & PCI_MSIX_FLAGS_QSIZE) + 1;
>      pbdev->msix.available = true;
>      return 0;
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index 4023d8e..0481d05 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -2244,10 +2244,10 @@ static int vfio_early_setup_msix(VFIOPCIDevice *vdev)
>      pba = le32_to_cpu(pba);
>  
>      vdev->msix = g_malloc0(sizeof(*(vdev->msix)));
> -    vdev->msix->table_bar = table & PCI_MSIX_FLAGS_BIRMASK;
> -    vdev->msix->table_offset = table & ~PCI_MSIX_FLAGS_BIRMASK;
> -    vdev->msix->pba_bar = pba & PCI_MSIX_FLAGS_BIRMASK;
> -    vdev->msix->pba_offset = pba & ~PCI_MSIX_FLAGS_BIRMASK;
> +    vdev->msix->table_bar = table & PCI_MSIX_TABLE_BIR;
> +    vdev->msix->table_offset = table & PCI_MSIX_TABLE_OFFSET;
> +    vdev->msix->pba_bar = pba & PCI_MSIX_PBA_BIR;
> +    vdev->msix->pba_offset = pba & PCI_MSIX_PBA_OFFSET;
>      vdev->msix->entries = (ctrl & PCI_MSIX_FLAGS_QSIZE) + 1;
>  
>      /*
> diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c
> index 263e051..ff84dbe 100644
> --- a/hw/xen/xen_pt_msi.c
> +++ b/hw/xen/xen_pt_msi.c
> @@ -555,8 +555,8 @@ int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base)
>                            & XC_PAGE_MASK);
>  
>      xen_host_pci_get_long(hd, base + PCI_MSIX_TABLE, &table_off);
> -    bar_index = msix->bar_index = table_off & PCI_MSIX_FLAGS_BIRMASK;
> -    table_off = table_off & ~PCI_MSIX_FLAGS_BIRMASK;
> +    bar_index = msix->bar_index = table_off & PCI_MSIX_TABLE_BIR;
> +    table_off = table_off & PCI_MSIX_TABLE_OFFSET;
>      msix->table_base = s->real_device.io_regions[bar_index].base_addr;
>      XEN_PT_LOG(d, "get MSI-X table BAR base 0x%"PRIx64"\n", msix->table_base);
>  
> diff --git a/tests/libqos/pci.c b/tests/libqos/pci.c
> index 4e630c2..55fe5bf 100644
> --- a/tests/libqos/pci.c
> +++ b/tests/libqos/pci.c
> @@ -110,16 +110,16 @@ void qpci_msix_enable(QPCIDevice *dev)
>      qpci_config_writew(dev, addr + PCI_MSIX_FLAGS, val | PCI_MSIX_FLAGS_ENABLE);
>  
>      table = qpci_config_readl(dev, addr + PCI_MSIX_TABLE);
> -    bir_table = table & PCI_MSIX_FLAGS_BIRMASK;
> +    bir_table = table & PCI_MSIX_TABLE_BIR;
>      offset = qpci_iomap(dev, bir_table, NULL);
> -    dev->msix_table = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK);
> +    dev->msix_table = offset + (table & PCI_MSIX_TABLE_OFFSET);
>  
>      table = qpci_config_readl(dev, addr + PCI_MSIX_PBA);
> -    bir_pba = table & PCI_MSIX_FLAGS_BIRMASK;
> +    bir_pba = table & PCI_MSIX_PBA_BIR;
>      if (bir_pba != bir_table) {
>          offset = qpci_iomap(dev, bir_pba, NULL);
>      }
> -    dev->msix_pba = offset + (table & ~PCI_MSIX_FLAGS_BIRMASK);
> +    dev->msix_pba = offset + (table & PCI_MSIX_PBA_OFFSET);
>  
>      g_assert(dev->msix_table != NULL);
>      g_assert(dev->msix_pba != NULL);

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-09-01  1:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28  7:15 [Qemu-devel] [PATCH v7 0/8] sPAPR: Support EEH Error Injection Gavin Shan
2015-08-28  7:15 ` [Qemu-devel] [PATCH v7 1/8] scripts: Allow include "stdint.h" in virtio headers Gavin Shan
2015-09-01  0:50   ` David Gibson
2015-08-28  7:15 ` [Qemu-devel] [PATCH v7 2/8] scripts: Include arch/powerpc/include/uapi/asm/eeh.h Gavin Shan
2015-09-01  0:51   ` David Gibson
2015-08-28  7:15 ` [Qemu-devel] [PATCH v7 3/8] scripts: Submit changes while updating linux headers Gavin Shan
2015-08-28 11:50   ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2015-08-28 12:30     ` Gavin Shan
2015-08-28 13:06       ` Gavin Shan
2015-08-31 12:37       ` Laurent Vivier
2015-08-31 23:11         ` Gavin Shan
2015-09-01  0:56   ` [Qemu-devel] " David Gibson
2015-08-28  7:15 ` [Qemu-devel] [PATCH v7 4/8] Synchronize Linux headers from kernel 4.2.0-rc8 Gavin Shan
2015-08-28  7:15 ` [Qemu-devel] [PATCH v7 5/8] Obsolete PCI_MSIX_FLAGS_BIRMASK Gavin Shan
2015-09-01  1:00   ` David Gibson [this message]
2015-08-28  7:15 ` [Qemu-devel] [PATCH v7 6/8] sPAPR: Introduce rtas_ldq() Gavin Shan
2015-09-01  1:05   ` David Gibson
2015-08-28  7:15 ` [Qemu-devel] [PATCH v7 7/8] sPAPR: Support RTAS call ibm, {open, close}-errinjct Gavin Shan
2015-09-01  1:06   ` David Gibson
2015-08-28  7:15 ` [Qemu-devel] [PATCH v7 8/8] sPAPR: Support RTAS call ibm,errinjct Gavin Shan
2015-09-04  4:53   ` [Qemu-devel] [PATCH v7 8/8] sPAPR: Support RTAS call ibm, errinjct David Gibson

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=20150901010050.GN11475@voom.redhat.com \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@redhat.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;
as well as URLs for NNTP newsgroup(s).