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
Subject: Re: [Qemu-devel] [PATCH 2/3] hw/pci: Introduce msi_device_id()
Date: Tue, 13 Oct 2015 15:56:38 +0300	[thread overview]
Message-ID: <20151013125638.GA11421@redhat.com> (raw)
In-Reply-To: <2882d261daaeeee430bcf98ea59ce47aa2bdf920.1444737974.git.p.fedin@samsung.com>

On Tue, Oct 13, 2015 at 03:12:01PM +0300, Pavel Fedin wrote:
> We will need to get device IDs in KVM IRQ routing code too. This patch
> introduces reusable convenient way to obtain it from the device pointer.
> 
> Signed-off-by: Pavel Fedin <p.fedin@samsung.com>

What make this specific format an msi id?
I think this is some kvm specific hack.
If true it belongs there.

> ---
>  hw/pci/msi.c         | 2 +-
>  include/hw/pci/msi.h | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci/msi.c b/hw/pci/msi.c
> index f9c0484..f18bb56 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.stream_id = msi_device_id(dev);
>      address_space_stl_le(&dev->bus_master_as, msg.address, msg.data,
>                           attrs, NULL);
>  }
> diff --git a/include/hw/pci/msi.h b/include/hw/pci/msi.h
> index 50e452b..748bca1 100644
> --- a/include/hw/pci/msi.h
> +++ b/include/hw/pci/msi.h
> @@ -43,6 +43,11 @@ void msi_send_message(PCIDevice *dev, MSIMessage msg);
>  void msi_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len);
>  unsigned int msi_nr_vectors_allocated(const PCIDevice *dev);
>  
> +static inline uint16_t msi_device_id(PCIDevice *dev)
> +{
> +    return (pci_bus_num(dev->bus) << 8) | dev->devfn;
> +}
> +
>  static inline bool msi_present(const PCIDevice *dev)
>  {
>      return dev->cap_present & QEMU_PCI_CAP_MSI;
> -- 
> 2.4.4

  reply	other threads:[~2015-10-13 12:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 12:11 [Qemu-devel] [PATCH 0/3] Make KVM/MSI code device-ID-aware Pavel Fedin
2015-10-13 12:12 ` [Qemu-devel] [PATCH 1/3] kvm: Make KVM_CAP_SIGNAL_MSI globally available Pavel Fedin
2015-10-13 12:12 ` [Qemu-devel] [PATCH 2/3] hw/pci: Introduce msi_device_id() Pavel Fedin
2015-10-13 12:56   ` Michael S. Tsirkin [this message]
2015-10-13 13:24     ` Pavel Fedin
2015-10-13 12:12 ` [Qemu-devel] [PATCH 3/3] kvm: Pass PCI device pointer to MSI routing functions Pavel Fedin
2015-10-13 13:00 ` [Qemu-devel] [PATCH 0/3] Make KVM/MSI code device-ID-aware Michael S. Tsirkin
2015-10-13 13:49   ` Pavel Fedin
2015-10-13 14:03     ` Michael S. Tsirkin
2015-10-13 15:17       ` Pavel Fedin
2015-10-13 15:58         ` 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=20151013125638.GA11421@redhat.com \
    --to=mst@redhat.com \
    --cc=p.fedin@samsung.com \
    --cc=pbonzini@redhat.com \
    --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).