All of lore.kernel.org
 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 v3 2/3] hw/pci: Introduce msi_requester_id()
Date: Wed, 14 Oct 2015 16:46:04 +0300	[thread overview]
Message-ID: <20151014164508-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <a5fcbc0c1178d33aa946f8afd294da096397fa0f.1444827228.git.p.fedin@samsung.com>

On Wed, Oct 14, 2015 at 03:59:58PM +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.
> 
> Since requester ID is an architecture-specific thing, the function can be
> overridden on per-architecture basis. Default stub just returns 0.
> 
> 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>

This is a pci requester id, not an msi requester id.

> ---
>  hw/pci/msi.c             |  2 +-
>  include/exec/memattrs.h  |  4 ++--
>  include/hw/pci/msi.h     |  1 +
>  stubs/Makefile.objs      |  1 +
>  stubs/msi.c              | 16 ++++++++++++++++
>  target-arm/Makefile.objs |  1 +
>  target-arm/msi.c         | 16 ++++++++++++++++
>  7 files changed, 38 insertions(+), 3 deletions(-)
>  create mode 100644 stubs/msi.c
>  create mode 100644 target-arm/msi.c
> 
> diff --git a/hw/pci/msi.c b/hw/pci/msi.c
> index f9c0484..ff7c28b 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 = msi_requester_id(dev);
>      address_space_stl_le(&dev->bus_master_as, msg.address, msg.data,
>                           attrs, NULL);
>  }
> 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/msi.h b/include/hw/pci/msi.h
> index 50e452b..75cf5e0 100644
> --- a/include/hw/pci/msi.h
> +++ b/include/hw/pci/msi.h
> @@ -42,6 +42,7 @@ void msi_notify(PCIDevice *dev, unsigned int vector);
>  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);
> +uint16_t msi_requester_id(PCIDevice *dev);
>  
>  static inline bool msi_present(const PCIDevice *dev)
>  {
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index 85e4e81..d2261d1 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -22,6 +22,7 @@ stub-obj-y += migr-blocker.o
>  stub-obj-y += mon-is-qmp.o
>  stub-obj-y += mon-printf.o
>  stub-obj-y += monitor-init.o
> +stub-obj-$(CONFIG_PCI) += msi.o
>  stub-obj-y += notify-event.o
>  stub-obj-$(CONFIG_SPICE) += qemu-chr-open-spice.o
>  stub-obj-y += qtest.o
> diff --git a/stubs/msi.c b/stubs/msi.c
> new file mode 100644
> index 0000000..cf4c7a0
> --- /dev/null
> +++ b/stubs/msi.c
> @@ -0,0 +1,16 @@
> +/*
> + * QEMU architecture-specific MSI functions
> + *
> + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
> + * Written by Pavel Fedin
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + */
> +#include "hw/pci/msi.h"
> +
> +uint16_t msi_requester_id(PCIDevice *dev)
> +{
> +    return 0;
> +}
> diff --git a/target-arm/Makefile.objs b/target-arm/Makefile.objs
> index 9460b40..9e75c66 100644
> --- a/target-arm/Makefile.objs
> +++ b/target-arm/Makefile.objs
> @@ -1,5 +1,6 @@
>  obj-y += arm-semi.o
>  obj-$(CONFIG_SOFTMMU) += machine.o
> +obj-$(CONFIG_PCI) += msi.o
>  obj-$(CONFIG_KVM) += kvm.o
>  obj-$(call land,$(CONFIG_KVM),$(call lnot,$(TARGET_AARCH64))) += kvm32.o
>  obj-$(call land,$(CONFIG_KVM),$(TARGET_AARCH64)) += kvm64.o
> diff --git a/target-arm/msi.c b/target-arm/msi.c
> new file mode 100644
> index 0000000..09b10b4
> --- /dev/null
> +++ b/target-arm/msi.c
> @@ -0,0 +1,16 @@
> +/*
> + * QEMU ARM specific MSI functions
> + *
> + * Copyright (c) 2015 Samsung Electronics Co., Ltd.
> + * Written by Pavel Fedin
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + *
> + */
> +#include "hw/pci/msi.h"
> +
> +uint16_t msi_requester_id(PCIDevice *dev)
> +{
> +    return (pci_bus_num(dev->bus) << 8) | dev->devfn;
> +}
> -- 
> 2.4.4

  reply	other threads:[~2015-10-14 13:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 12:59 [Qemu-devel] [PATCH v3 0/3] Make KVM/MSI code device-ID-aware Pavel Fedin
2015-10-14 12:59 ` [Qemu-devel] [PATCH v3 1/3] kvm: Make KVM_CAP_SIGNAL_MSI globally available Pavel Fedin
2015-10-14 12:59 ` [Qemu-devel] [PATCH v3 2/3] hw/pci: Introduce msi_requester_id() Pavel Fedin
2015-10-14 13:46   ` Michael S. Tsirkin [this message]
2015-10-14 12:59 ` [Qemu-devel] [PATCH v3 3/3] kvm: Pass PCI device pointer to MSI routing functions Pavel Fedin

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=20151014164508-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.