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: 'Peter Maydell' <peter.maydell@linaro.org>,
	'QEMU Developers' <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] Add stream ID to MSI write
Date: Wed, 27 May 2015 13:28:15 +0200	[thread overview]
Message-ID: <20150527132750-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <012901d0986d$3574ab00$a05e0100$@samsung.com>

On Wed, May 27, 2015 at 02:06:40PM +0300, Pavel Fedin wrote:
> GICv3 ITS distinguishes between devices by using hardwired device IDs passed on the bus.
> This patch implements passing these IDs in qemu.
> SMMU is also known to use stream IDs, therefore this addition can also be useful for
> implementing platforms with SMMU.
> Unfortunately currently qemu does not seem to have such thing as bus number, therefore we
> use only devfn. This is OK for platforms with only one PCI bus instance. Perhaps
> additional property should be implemented when we emulate some GICv3-based machine with
> more than one bus.
> 
> Signed-off-by: Pavel Fedin <p.fedin@samsung.com>

There's pci_bus_num.

> ---
>  hw/pci/msix.c           | 4 +++-
>  include/exec/memattrs.h | 2 ++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci/msix.c b/hw/pci/msix.c
> index 9935f98..e85ce10 100644
> --- a/hw/pci/msix.c
> +++ b/hw/pci/msix.c
> @@ -433,6 +433,7 @@ int msix_enabled(PCIDevice *dev)
>  void msix_notify(PCIDevice *dev, unsigned vector)
>  {
>      MSIMessage msg;
> +    MemTxAttrs attrs = {};
>  
>      if (vector >= dev->msix_entries_nr || !dev->msix_entry_used[vector])
>          return;
> @@ -442,9 +443,10 @@ void msix_notify(PCIDevice *dev, unsigned vector)
>      }
>  
>      msg = msix_get_message(dev, vector);
> +    attrs.stream_id = dev->devfn; /* TODO: Add bus number here */
>  
>      address_space_stl_le(&dev->bus_master_as, msg.address, msg.data,
> -                         MEMTXATTRS_UNSPECIFIED, NULL);
> +                         attrs, NULL);
>  }
>  
>  void msix_reset(PCIDevice *dev)
> diff --git a/include/exec/memattrs.h b/include/exec/memattrs.h
> index 1389b4b..96dc440 100644
> --- a/include/exec/memattrs.h
> +++ b/include/exec/memattrs.h
> @@ -33,6 +33,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;
>  } MemTxAttrs;
>  
>  /* Bus masters which don't specify any attributes will get this,
> -- 
> 1.9.5.msysgit.0
> 

      reply	other threads:[~2015-05-27 11:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 11:06 [Qemu-devel] [PATCH] Add stream ID to MSI write Pavel Fedin
2015-05-27 11:28 ` Michael S. Tsirkin [this message]

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=20150527132750-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=p.fedin@samsung.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).