virtio-fs.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Jonah Palmer <jonah.palmer@oracle.com>
To: qemu-devel@nongnu.org
Cc: mst@redhat.com, jasowang@redhat.com, eperezma@redhat.com,
	si-wei.liu@oracle.com, boris.ostrovsky@oracle.com,
	jonah.palmer@oracle.com, raphael@enfabrica.net, kwolf@redhat.com,
	hreitz@redhat.com, pasic@linux.ibm.com,
	borntraeger@linux.ibm.com, farman@linux.ibm.com,
	thuth@redhat.com, richard.henderson@linaro.org, david@redhat.com,
	iii@linux.ibm.com, cohuck@redhat.com, pbonzini@redhat.com,
	fam@euphon.net, stefanha@redhat.com, qemu-block@nongnu.org,
	qemu-s390x@nongnu.org, leiyang@redhat.com, schalla@marvell.com,
	vattunuru@marvell.com, jerinj@marvell.com, dtatulea@nvidia.com,
	virtio-fs@lists.linux.dev
Subject: [PATCH v2 4/6] virtio-ccw: Handle extra notification data
Date: Wed, 13 Mar 2024 07:54:10 -0400	[thread overview]
Message-ID: <20240313115412.3334962-5-jonah.palmer@oracle.com> (raw)
In-Reply-To: <20240313115412.3334962-1-jonah.palmer@oracle.com>

Add support to virtio-ccw devices for handling the extra data sent from
the driver to the device when the VIRTIO_F_NOTIFICATION_DATA transport
feature has been negotiated.

The extra data that's passed to the virtio-ccw device when this feature
is enabled varies depending on the device's virtqueue layout.

That data passed to the virtio-ccw device is in the same format as the
data passed to virtio-pci devices.

Tested-by: Lei Yang <leiyang@redhat.com>
Acked-by: Eric Farman <farman@linux.ibm.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
---
 hw/s390x/s390-virtio-ccw.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index b1dcb3857f..7631e4aa41 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -140,9 +140,11 @@ static void subsystem_reset(void)
 static int virtio_ccw_hcall_notify(const uint64_t *args)
 {
     uint64_t subch_id = args[0];
-    uint64_t queue = args[1];
+    uint64_t data = args[1];
     SubchDev *sch;
+    VirtIODevice *vdev;
     int cssid, ssid, schid, m;
+    uint16_t vq_idx = data;
 
     if (ioinst_disassemble_sch_ident(subch_id, &m, &cssid, &ssid, &schid)) {
         return -EINVAL;
@@ -151,12 +153,18 @@ static int virtio_ccw_hcall_notify(const uint64_t *args)
     if (!sch || !css_subch_visible(sch)) {
         return -EINVAL;
     }
-    if (queue >= VIRTIO_QUEUE_MAX) {
+
+    if (vq_idx >= VIRTIO_QUEUE_MAX) {
         return -EINVAL;
     }
-    virtio_queue_notify(virtio_ccw_get_vdev(sch), queue);
-    return 0;
 
+    vdev = virtio_ccw_get_vdev(sch);
+    if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) {
+        virtio_queue_set_shadow_avail_data(vdev, data);
+    }
+
+    virtio_queue_notify(vdev, vq_idx);
+    return 0;
 }
 
 static int virtio_ccw_hcall_early_printk(const uint64_t *args)
-- 
2.39.3


  parent reply	other threads:[~2024-03-13 11:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 11:54 [PATCH v2 0/6] virtio,vhost: Add VIRTIO_F_NOTIFICATION_DATA support Jonah Palmer
2024-03-13 11:54 ` [PATCH v2 1/6] virtio/virtio-pci: Handle extra notification data Jonah Palmer
2024-03-14  3:01   ` Jason Wang
2024-03-14 12:16     ` Jonah Palmer
2024-03-14 14:55       ` Eugenio Perez Martin
2024-03-14 16:05         ` Jonah Palmer
2024-03-14 19:05           ` Eugenio Perez Martin
2024-03-14 20:23             ` Jonah Palmer
2024-03-15  9:23               ` Eugenio Perez Martin
2024-03-13 11:54 ` [PATCH v2 2/6] virtio: Prevent creation of device using notification-data with ioeventfd Jonah Palmer
2024-03-13 14:35   ` Eugenio Perez Martin
2024-03-13 14:44     ` Jonah Palmer
2024-03-13 11:54 ` [PATCH v2 3/6] virtio-mmio: Handle extra notification data Jonah Palmer
2024-03-13 11:54 ` Jonah Palmer [this message]
2024-03-13 11:54 ` [PATCH v2 5/6] vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits Jonah Palmer
2024-03-13 11:54 ` [PATCH v2 6/6] virtio: Add VIRTIO_F_NOTIFICATION_DATA property definition Jonah Palmer

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=20240313115412.3334962-5-jonah.palmer@oracle.com \
    --to=jonah.palmer@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=dtatulea@nvidia.com \
    --cc=eperezma@redhat.com \
    --cc=fam@euphon.net \
    --cc=farman@linux.ibm.com \
    --cc=hreitz@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=jasowang@redhat.com \
    --cc=jerinj@marvell.com \
    --cc=kwolf@redhat.com \
    --cc=leiyang@redhat.com \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=raphael@enfabrica.net \
    --cc=richard.henderson@linaro.org \
    --cc=schalla@marvell.com \
    --cc=si-wei.liu@oracle.com \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    --cc=vattunuru@marvell.com \
    --cc=virtio-fs@lists.linux.dev \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).