From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
Blue Swirl <blauwirbel@gmail.com>,
Stefan Weil <weil@mail.berlios.de>, Avi Kivity <avi@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH (repost) RFC 2/2] virtio-pci: recall and return msix notifications on ISR read
Date: Thu, 03 Nov 2011 12:42:55 +0100 [thread overview]
Message-ID: <4EB27E3F.2030503@siemens.com> (raw)
In-Reply-To: <6dc9aa9764b1cfddf557a98f269e0f7d31ce03ac.1320259840.git.mst@redhat.com>
On 2011-11-02 21:11, Michael S. Tsirkin wrote:
> MSIX spec requires that device can be operated with
> all vectors masked, by polling pending bits.
> Add APIs to recall an msix notification, and make polling
> mode possible in virtio-pci by clearing the
> pending bits and setting ISR appropriately on ISR read.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/msix.c | 26 ++++++++++++++++++++++++++
> hw/msix.h | 3 +++
> hw/virtio-pci.c | 11 ++++++++++-
> 3 files changed, 39 insertions(+), 1 deletions(-)
>
> diff --git a/hw/msix.c b/hw/msix.c
> index 63b41b9..fe967c9 100644
> --- a/hw/msix.c
> +++ b/hw/msix.c
> @@ -349,6 +349,32 @@ void msix_notify(PCIDevice *dev, unsigned vector)
> stl_le_phys(address, data);
> }
>
> +/* Recall outstanding MSI-X notifications for a vector, if possible.
> + * Return true if any were outstanding. */
> +bool msix_recall(PCIDevice *dev, unsigned vector)
> +{
> + bool ret;
> + if (vector >= dev->msix_entries_nr)
> + return false;
> + ret = msix_is_pending(dev, vector);
> + msix_clr_pending(dev, vector);
> + return ret;
> +}
I would prefer to have a single API instead to clarify the tight relation:
bool msi[x]_set_notify(PCIDevice *dev, unsigned vector, unsigned level)
Would return true for level=1 if the message was either sent directly or
queued (we could deliver false if it was already queued, but I see no
use case for this yet).
Also, I don't see the generic value of some msix_recall_all. I think
it's better handled in a single loop over all vectors at caller site,
clearing the individual interrupt reason bits on a per-vector basis
there. msix_recall_all is only useful in the virtio case where you have
one vector of reason A and all the rest of B. Once you had multiple
reason C vectors as well, it would not help anymore.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
WARNING: multiple messages have this Message-ID (diff)
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Rusty Russell <rusty@rustcorp.com.au>,
Alexander Graf <agraf@suse.de>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
Blue Swirl <blauwirbel@gmail.com>,
Stefan Weil <weil@mail.berlios.de>, Avi Kivity <avi@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH (repost) RFC 2/2] virtio-pci: recall and return msix notifications on ISR read
Date: Thu, 03 Nov 2011 12:42:55 +0100 [thread overview]
Message-ID: <4EB27E3F.2030503@siemens.com> (raw)
In-Reply-To: <6dc9aa9764b1cfddf557a98f269e0f7d31ce03ac.1320259840.git.mst@redhat.com>
On 2011-11-02 21:11, Michael S. Tsirkin wrote:
> MSIX spec requires that device can be operated with
> all vectors masked, by polling pending bits.
> Add APIs to recall an msix notification, and make polling
> mode possible in virtio-pci by clearing the
> pending bits and setting ISR appropriately on ISR read.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> hw/msix.c | 26 ++++++++++++++++++++++++++
> hw/msix.h | 3 +++
> hw/virtio-pci.c | 11 ++++++++++-
> 3 files changed, 39 insertions(+), 1 deletions(-)
>
> diff --git a/hw/msix.c b/hw/msix.c
> index 63b41b9..fe967c9 100644
> --- a/hw/msix.c
> +++ b/hw/msix.c
> @@ -349,6 +349,32 @@ void msix_notify(PCIDevice *dev, unsigned vector)
> stl_le_phys(address, data);
> }
>
> +/* Recall outstanding MSI-X notifications for a vector, if possible.
> + * Return true if any were outstanding. */
> +bool msix_recall(PCIDevice *dev, unsigned vector)
> +{
> + bool ret;
> + if (vector >= dev->msix_entries_nr)
> + return false;
> + ret = msix_is_pending(dev, vector);
> + msix_clr_pending(dev, vector);
> + return ret;
> +}
I would prefer to have a single API instead to clarify the tight relation:
bool msi[x]_set_notify(PCIDevice *dev, unsigned vector, unsigned level)
Would return true for level=1 if the message was either sent directly or
queued (we could deliver false if it was already queued, but I see no
use case for this yet).
Also, I don't see the generic value of some msix_recall_all. I think
it's better handled in a single loop over all vectors at caller site,
clearing the individual interrupt reason bits on a per-vector basis
there. msix_recall_all is only useful in the virtio case where you have
one vector of reason A and all the rest of B. Once you had multiple
reason C vectors as well, it would not help anymore.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2011-11-03 11:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-02 19:02 [PATCH RFC 0/2] virtio-pci: polling mode support Michael S. Tsirkin
2011-11-02 19:02 ` [Qemu-devel] " Michael S. Tsirkin
2011-11-02 20:11 ` [PATCH (repost) RFC 1/2] virtio: ISR bit constants Michael S. Tsirkin
2011-11-02 20:11 ` [Qemu-devel] " Michael S. Tsirkin
2011-11-02 20:11 ` [PATCH (repost) RFC 2/2] virtio-pci: recall and return msix notifications on ISR read Michael S. Tsirkin
2011-11-02 20:11 ` [Qemu-devel] " Michael S. Tsirkin
2011-11-03 11:42 ` Jan Kiszka [this message]
2011-11-03 11:42 ` Jan Kiszka
2011-11-03 12:07 ` Michael S. Tsirkin
2011-11-03 12:07 ` [Qemu-devel] " Michael S. Tsirkin
2011-11-03 16:52 ` Jan Kiszka
2011-11-03 16:52 ` [Qemu-devel] " Jan Kiszka
2011-11-03 0:56 ` [PATCH RFC 0/2] virtio-pci: polling mode support Rusty Russell
2011-11-03 0:56 ` [Qemu-devel] " Rusty Russell
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=4EB27E3F.2030503@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=virtualization@lists.linux-foundation.org \
--cc=weil@mail.berlios.de \
/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.