qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Pavel Fedin <p.fedin@samsung.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v5 2/3] hw/pci: Introduce pci_requester_id()
Date: Sun, 18 Oct 2015 11:29:08 +0300	[thread overview]
Message-ID: <20151018112813-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <2013065285bae9c2d72a419506e7cd5d16fcb74e.1444906971.git.p.fedin@samsung.com>

On Thu, Oct 15, 2015 at 02:05:16PM +0300, Pavel Fedin wrote:
> For GICv3 ITS implementation we are going to use requester IDs in KVM IRQ
> routing code. This patch introduces reusable convenient way to obtain this
> ID from the device pointer. The new function is now used in some places,
> where the same calculation was used.
> 
> MemTxAttrs.stream_id also renamed to requester_id in order to better
> reflect semantics of the field.
> 
> Signed-off-by: Pavel Fedin <p.fedin@samsung.com>


Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/i386/kvm/pci-assign.c | 2 +-
>  hw/pci/msi.c             | 2 +-
>  hw/pci/pcie_aer.c        | 2 +-
>  include/exec/memattrs.h  | 4 ++--
>  include/hw/pci/pci.h     | 5 +++++
>  5 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c
> index 44beee3..e48cae6 100644
> --- a/hw/i386/kvm/pci-assign.c
> +++ b/hw/i386/kvm/pci-assign.c
> @@ -1483,7 +1483,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp)
>           * error bits, leave the rest. */
>          status = pci_get_long(pci_dev->config + pos + PCI_X_STATUS);
>          status &= ~(PCI_X_STATUS_BUS | PCI_X_STATUS_DEVFN);
> -        status |= (pci_bus_num(pci_dev->bus) << 8) | pci_dev->devfn;
> +        status |= pci_requester_id(pci_dev);
>          status &= ~(PCI_X_STATUS_SPL_DISC | PCI_X_STATUS_UNX_SPL |
>                      PCI_X_STATUS_SPL_ERR);
>          pci_set_long(pci_dev->config + pos + PCI_X_STATUS, status);
> diff --git a/hw/pci/msi.c b/hw/pci/msi.c
> index f9c0484..c1dd531 100644
> --- a/hw/pci/msi.c
> +++ b/hw/pci/msi.c
> @@ -294,7 +294,7 @@ void msi_send_message(PCIDevice *dev, MSIMessage msg)
>  {
>      MemTxAttrs attrs = {};
>  
> -    attrs.stream_id = (pci_bus_num(dev->bus) << 8) | dev->devfn;
> +    attrs.requester_id = pci_requester_id(dev);
>      address_space_stl_le(&dev->bus_master_as, msg.address, msg.data,
>                           attrs, NULL);
>  }
> diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c
> index 46e0ad8..98d2c18 100644
> --- a/hw/pci/pcie_aer.c
> +++ b/hw/pci/pcie_aer.c
> @@ -979,7 +979,7 @@ static int do_pcie_aer_inject_error(Monitor *mon,
>          }
>      }
>      err.status = error_status;
> -    err.source_id = (pci_bus_num(dev->bus) << 8) | dev->devfn;
> +    err.source_id = pci_requester_id(dev);
>  
>      err.flags = 0;
>      if (correctable) {
> diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
> index f8537a8..e601061 100644
> --- a/include/exec/memattrs.h
> +++ b/include/exec/memattrs.h
> @@ -35,8 +35,8 @@ typedef struct MemTxAttrs {
>      unsigned int secure:1;
>      /* Memory access is usermode (unprivileged) */
>      unsigned int user:1;
> -    /* Stream ID (for MSI for example) */
> -    unsigned int stream_id:16;
> +    /* Requester ID (for MSI for example) */
> +    unsigned int requester_id:16;
>  } MemTxAttrs;
>  
>  /* Bus masters which don't specify any attributes will get this,
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index 551cb3d..f5e7fd8 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -677,6 +677,11 @@ static inline uint32_t pci_config_size(const PCIDevice *d)
>      return pci_is_express(d) ? PCIE_CONFIG_SPACE_SIZE : PCI_CONFIG_SPACE_SIZE;
>  }
>  
> +static inline uint16_t pci_requester_id(PCIDevice *dev)
> +{
> +    return (pci_bus_num(dev->bus) << 8) | dev->devfn;
> +}
> +
>  /* DMA access functions */
>  static inline AddressSpace *pci_get_address_space(PCIDevice *dev)
>  {
> -- 
> 2.4.4

  parent reply	other threads:[~2015-10-18  8:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 11:05 [Qemu-devel] [PATCH v5 0/3] Make KVM/MSI code device-ID-aware Pavel Fedin
2015-10-15 11:05 ` [Qemu-devel] [PATCH v5 1/3] kvm: Make KVM_CAP_SIGNAL_MSI globally available Pavel Fedin
2015-10-15 11:05 ` [Qemu-devel] [PATCH v5 2/3] hw/pci: Introduce pci_requester_id() Pavel Fedin
2015-10-15 13:11   ` Michael S. Tsirkin
2015-10-15 13:28     ` Pavel Fedin
2015-10-18  8:29   ` Michael S. Tsirkin [this message]
2015-10-15 11:05 ` [Qemu-devel] [PATCH v5 3/3] kvm: Pass PCI device pointer to MSI routing functions Pavel Fedin
2015-10-15 11:41   ` Cornelia Huck
2015-10-15 11:59     ` Pavel Fedin
2015-10-18  8:31 ` [Qemu-devel] [PATCH v5 0/3] Make KVM/MSI code device-ID-aware Michael S. Tsirkin

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=20151018112813-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=p.fedin@samsung.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).