From patchwork Fri Mar 1 13:43:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonah Palmer X-Patchwork-Id: 13578504 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 730FCC5475B for ; Fri, 1 Mar 2024 13:44:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg3B4-0001Uz-Lz; Fri, 01 Mar 2024 08:43:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B2-0001Sm-Bw; Fri, 01 Mar 2024 08:43:52 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B0-0004qb-Ik; Fri, 01 Mar 2024 08:43:52 -0500 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 421942Bm008853; Fri, 1 Mar 2024 13:43:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=+DWxfmWULHp2lp6mFB4cFUDT3YJ6mzUWzBGgnQuAkl4=; b=B9XUdLfL3h2sHx+eyUSFZgdgpFxaNxAP67P0yNBwG4l9v9a7W0sqqcRQff/JzlczMGcp S10ZAr77UhXH/HSLIjvNOUP9ik30l/lOV7EEYaKxqndsHNRKwMdc1q0lHlN9fxGL5YDn Hyn5SxxNP81GCOb2nPQ5dsEOWS17sax4X5a0bhFVG3C1kjdvEbARHBf9xj3YwGVVjH4/ 6tPuoFXjHHRd9FDN38nHGdjiIGThJ2TeMS6anZv4G6GLOCOXpeI1j9UU+xmbV1DoZ39K FslEkSYm6PCPoD2Mf49+h/o4/ZW5Fh3744vZdxHwDP/XsBi/J+ZSJh8s0fYoJDUuBTnu lg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf6ve8rcm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:35 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 421Bqo3x009428; Fri, 1 Mar 2024 13:43:35 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wjrqmtrb7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:35 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 421DhWAK026578; Fri, 1 Mar 2024 13:43:34 GMT Received: from jonah-ol8.us.oracle.com (dhcp-10-65-160-211.vpn.oracle.com [10.65.160.211]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wjrqmtr9m-2; Fri, 01 Mar 2024 13:43:34 +0000 From: Jonah Palmer 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, virtio-fs@lists.linux.dev Subject: [RFC 1/8] virtio/virtio-pci: Handle extra notification data Date: Fri, 1 Mar 2024 08:43:23 -0500 Message-Id: <20240301134330.4191007-2-jonah.palmer@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240301134330.4191007-1-jonah.palmer@oracle.com> References: <20240301134330.4191007-1-jonah.palmer@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-01_13,2024-03-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010114 X-Proofpoint-ORIG-GUID: PBJYUy23tsr-5kXTuQnQ_a8j8E6mk-I- X-Proofpoint-GUID: PBJYUy23tsr-5kXTuQnQ_a8j8E6mk-I- Received-SPF: pass client-ip=205.220.177.32; envelope-from=jonah.palmer@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add support to virtio-pci 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-pci device when this feature is enabled varies depending on the device's virtqueue layout. In a split virtqueue layout, this data includes: - upper 16 bits: last_avail_idx - lower 16 bits: virtqueue index In a packed virtqueue layout, this data includes: - upper 16 bits: 1-bit wrap counter & 15-bit last_avail_idx - lower 16 bits: virtqueue index Signed-off-by: Jonah Palmer --- hw/virtio/virtio-pci.c | 13 ++++++++++--- hw/virtio/virtio.c | 13 +++++++++++++ include/hw/virtio/virtio.h | 1 + 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 1a7039fb0c..c7c577b177 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -384,7 +384,7 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) { VirtIOPCIProxy *proxy = opaque; VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); - uint16_t vector; + uint16_t vector, vq_idx; hwaddr pa; switch (addr) { @@ -408,8 +408,15 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) vdev->queue_sel = val; break; case VIRTIO_PCI_QUEUE_NOTIFY: - if (val < VIRTIO_QUEUE_MAX) { - virtio_queue_notify(vdev, val); + if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { + vq_idx = val & 0xFFFF; + virtio_set_notification_data(vdev, vq_idx, val); + } else { + vq_idx = val; + } + + if (vq_idx < VIRTIO_QUEUE_MAX) { + virtio_queue_notify(vdev, vq_idx); } break; case VIRTIO_PCI_STATUS: diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index d229755eae..a61f69b7fd 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2052,6 +2052,19 @@ int virtio_set_status(VirtIODevice *vdev, uint8_t val) return 0; } +void virtio_set_notification_data(VirtIODevice *vdev, uint16_t i, uint32_t data) +{ + VirtQueue *vq = &vdev->vq[i]; + + if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) { + vq->last_avail_wrap_counter = (data >> 31) & 0x1; + vq->last_avail_idx = (data >> 16) & 0x7FFF; + } else { + vq->last_avail_idx = (data >> 16) & 0xFFFF; + } + vq->shadow_avail_idx = vq->last_avail_idx; +} + static enum virtio_device_endian virtio_default_endian(void) { if (target_words_bigendian()) { diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index c8f72850bc..c92d8afc42 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -345,6 +345,7 @@ void virtio_queue_reset(VirtIODevice *vdev, uint32_t queue_index); void virtio_queue_enable(VirtIODevice *vdev, uint32_t queue_index); void virtio_update_irq(VirtIODevice *vdev); int virtio_set_features(VirtIODevice *vdev, uint64_t val); +void virtio_set_notification_data(VirtIODevice *vdev, uint16_t i, uint32_t data); /* Base devices. */ typedef struct VirtIOBlkConf VirtIOBlkConf; From patchwork Fri Mar 1 13:43:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonah Palmer X-Patchwork-Id: 13578510 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EA507C54E49 for ; Fri, 1 Mar 2024 13:45:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg3B5-0001W6-Vj; Fri, 01 Mar 2024 08:43:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B3-0001TR-GW; Fri, 01 Mar 2024 08:43:53 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B0-0004qd-Iw; Fri, 01 Mar 2024 08:43:53 -0500 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4219Cgxq008866; Fri, 1 Mar 2024 13:43:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=YJCE5QKH769zOpMAk8sLNZG3G7yDrb7IR4KgiZTFWRQ=; b=IzsrzUj44gybyCr2teyvjpKfyYcFB8jQGmq1efI0fV3YJfQSVfXE7nDCTM2FuYf63T1n ZeBJ+jaJL/4X+WipoTyqQjb1NSxsSQfKpu/YG1celK6iZ9EoMybKmmkpl8hL/O31Juj3 /pFywVLUbYlbmQlZLnNwNIG/ivBu4VmIA5ICXF6Wc0hK0+n6kh8kMFitUGWLrNKi5GMd PepINFB+KfrkDQe0itYKu9MKPGjWIyuPIwayqvvkbCThjYLQya1KLw2EqZHqSMPaL9gf rT87K8NdZxavoTfqzX7wwmY+W1M6NckC+vTeanwhwENxTXq2vDi0QkSwfXhDMTWD145M TQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf6ve8rcq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:37 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 421C8Xix009723; Fri, 1 Mar 2024 13:43:36 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wjrqmtrc5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:36 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 421DhWAM026578; Fri, 1 Mar 2024 13:43:35 GMT Received: from jonah-ol8.us.oracle.com (dhcp-10-65-160-211.vpn.oracle.com [10.65.160.211]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wjrqmtr9m-3; Fri, 01 Mar 2024 13:43:35 +0000 From: Jonah Palmer 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, virtio-fs@lists.linux.dev Subject: [RFC 2/8] virtio-pci: Lock ioeventfd state with VIRTIO_F_NOTIFICATION_DATA Date: Fri, 1 Mar 2024 08:43:24 -0500 Message-Id: <20240301134330.4191007-3-jonah.palmer@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240301134330.4191007-1-jonah.palmer@oracle.com> References: <20240301134330.4191007-1-jonah.palmer@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-01_13,2024-03-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010114 X-Proofpoint-ORIG-GUID: bEMTRdtK5TMTQFef8TAicbmcbLd6UIIi X-Proofpoint-GUID: bEMTRdtK5TMTQFef8TAicbmcbLd6UIIi Received-SPF: pass client-ip=205.220.177.32; envelope-from=jonah.palmer@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Prevent ioeventfd from being enabled/disabled when a virtio-pci device has negotiated the VIRTIO_F_NOTIFICATION_DATA transport feature. Due to ioeventfd not being able to carry the extra data associated with this feature, the ioeventfd should be left in a disabled state for emulated virtio-pci devices using this feature. Signed-off-by: Jonah Palmer Reviewed-by: Eugenio Pérez --- hw/virtio/virtio-pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index c7c577b177..fd9717a0f5 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -420,13 +420,15 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) } break; case VIRTIO_PCI_STATUS: - if (!(val & VIRTIO_CONFIG_S_DRIVER_OK)) { + if (!(val & VIRTIO_CONFIG_S_DRIVER_OK) && + !virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { virtio_pci_stop_ioeventfd(proxy); } virtio_set_status(vdev, val & 0xFF); - if (val & VIRTIO_CONFIG_S_DRIVER_OK) { + if ((val & VIRTIO_CONFIG_S_DRIVER_OK) && + !virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { virtio_pci_start_ioeventfd(proxy); } From patchwork Fri Mar 1 13:43:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonah Palmer X-Patchwork-Id: 13578511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95BE8C5478C for ; Fri, 1 Mar 2024 13:46:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg3B7-0001XM-EQ; Fri, 01 Mar 2024 08:43:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B3-0001Tk-MS; Fri, 01 Mar 2024 08:43:53 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B0-0004rq-Jt; Fri, 01 Mar 2024 08:43:53 -0500 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42194h43008252; Fri, 1 Mar 2024 13:43:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=31MebaJvp72AKBEkEumWQRA9IcrmJO/cdo3sXTMK9X8=; b=OpNGK58W3L9ltpQn4Jz2mu+cvX0myaJM5G0LKA0qbSpUAoR0QlQtQAM3Yyw66mdc2pAT w9pIYulZ42co3PMTN4c5D4XEBRKhRaQAIM7gTZJL/LfKsQBWiwtFy5GeoU+p4ZzwgGoQ iwgrVI8YVJ03LI66SCsmDGlF10mKBVUJYPGEA5fZTcZ45rejqLoeBmJHehEoQI5cftHV eigcCQt9PgU6TIxZnqv1iE0Qmv5Fhnih++l1+JabGqF5WbdFryfaLPdwIQuduq+gkk3v crbhXVhkCi1ShzAL13cbsrK0e/GC5BoD+ibMXSVmoNJRRaKI1ypAN/Db58+f4KqmFGVi rA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf90vgw9s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:39 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 421BrKQp009391; Fri, 1 Mar 2024 13:43:37 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wjrqmtrd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:37 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 421DhWAO026578; Fri, 1 Mar 2024 13:43:37 GMT Received: from jonah-ol8.us.oracle.com (dhcp-10-65-160-211.vpn.oracle.com [10.65.160.211]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wjrqmtr9m-4; Fri, 01 Mar 2024 13:43:36 +0000 From: Jonah Palmer 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, virtio-fs@lists.linux.dev Subject: [RFC 3/8] virtio-mmio: Handle extra notification data Date: Fri, 1 Mar 2024 08:43:25 -0500 Message-Id: <20240301134330.4191007-4-jonah.palmer@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240301134330.4191007-1-jonah.palmer@oracle.com> References: <20240301134330.4191007-1-jonah.palmer@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-01_13,2024-03-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010114 X-Proofpoint-GUID: i9q_6TtIHurdUt5Q0ESFychCO9IUGOY- X-Proofpoint-ORIG-GUID: i9q_6TtIHurdUt5Q0ESFychCO9IUGOY- Received-SPF: pass client-ip=205.220.165.32; envelope-from=jonah.palmer@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add support to virtio-mmio 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-mmio device when this feature is enabled varies depending on the device's virtqueue layout. The data passed to the virtio-mmio device is in the same format as the data passed to virtio-pci devices. Signed-off-by: Jonah Palmer --- hw/virtio/virtio-mmio.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 22f9fbcf5a..2bac77460e 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -248,6 +248,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, { VirtIOMMIOProxy *proxy = (VirtIOMMIOProxy *)opaque; VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus); + uint16_t vq_idx; trace_virtio_mmio_write_offset(offset, value); @@ -407,8 +408,15 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, } break; case VIRTIO_MMIO_QUEUE_NOTIFY: - if (value < VIRTIO_QUEUE_MAX) { - virtio_queue_notify(vdev, value); + if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { + vq_idx = value & 0xFFFF; + virtio_set_notification_data(vdev, vq_idx, value); + } else { + vq_idx = value; + } + + if (vq_idx < VIRTIO_QUEUE_MAX) { + virtio_queue_notify(vdev, vq_idx); } break; case VIRTIO_MMIO_INTERRUPT_ACK: From patchwork Fri Mar 1 13:43:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonah Palmer X-Patchwork-Id: 13578512 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4CB95C5475B for ; Fri, 1 Mar 2024 13:46:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg3B5-0001VJ-5q; Fri, 01 Mar 2024 08:43:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B2-0001Sl-8U; Fri, 01 Mar 2024 08:43:52 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B0-0004ra-3Z; Fri, 01 Mar 2024 08:43:51 -0500 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42198usA012317; Fri, 1 Mar 2024 13:43:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=+yib/Zj3rSXJ1hKbXY1gPDcB2uxuzIu3Eyv0AgFx4+0=; b=WL0p0doH3CRMR1U0iyYXtNtPy0M6metfdQpU0LJjZzm+RJzfHOPrrqh2kWAk1CoVFOsQ pP9V91nm2z3PggTKrozaRqGVD4FnbufgUWDdLrM62gO0uabxYv65IpS01s55O97/Z9Gv jg2GJZsanksXTLiggot0AWyXRB/Bj4QsqL0HdTFzOQGpNIClI7aO0RquGsJB3hoCgY0w IkNpIj6PPB/dkJPjKKgSweV9CfJ6k3p3qu+uKFlRXoenQ5poshaqiH2N2qivT+IXnqGt rMnIlsTIhk0q08cpVrGnOXcPxME38GqpwBD8pgMCTxITRR610WlwoTOelYi4+oJLEpbN DQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf8gds5kd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:39 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 421CwuK4009384; Fri, 1 Mar 2024 13:43:39 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wjrqmtre6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:39 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 421DhWAQ026578; Fri, 1 Mar 2024 13:43:38 GMT Received: from jonah-ol8.us.oracle.com (dhcp-10-65-160-211.vpn.oracle.com [10.65.160.211]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wjrqmtr9m-5; Fri, 01 Mar 2024 13:43:38 +0000 From: Jonah Palmer 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, virtio-fs@lists.linux.dev Subject: [RFC 4/8] virtio-mmio: Lock ioeventfd state with VIRTIO_F_NOTIFICATION_DATA Date: Fri, 1 Mar 2024 08:43:26 -0500 Message-Id: <20240301134330.4191007-5-jonah.palmer@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240301134330.4191007-1-jonah.palmer@oracle.com> References: <20240301134330.4191007-1-jonah.palmer@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-01_13,2024-03-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010114 X-Proofpoint-ORIG-GUID: wAQDAHZ40iGWB_ja4NigNc5az8y-vd-z X-Proofpoint-GUID: wAQDAHZ40iGWB_ja4NigNc5az8y-vd-z Received-SPF: pass client-ip=205.220.177.32; envelope-from=jonah.palmer@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Prevent ioeventfd from being enabled/disabled when a virtio-mmio device has negotiated the VIRTIO_F_NOTIFICATION_DATA transport feature. Due to ioeventfd not being able to carry the extra data associated with this feature, the ioeventfd should be left in a disabled state for emulated virtio-mmio devices using this feature. Signed-off-by: Jonah Palmer --- hw/virtio/virtio-mmio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 2bac77460e..fc780a03b2 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -424,7 +424,8 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, virtio_update_irq(vdev); break; case VIRTIO_MMIO_STATUS: - if (!(value & VIRTIO_CONFIG_S_DRIVER_OK)) { + if (!(value & VIRTIO_CONFIG_S_DRIVER_OK) && + !virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { virtio_mmio_stop_ioeventfd(proxy); } @@ -436,7 +437,8 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, virtio_set_status(vdev, value & 0xff); - if (value & VIRTIO_CONFIG_S_DRIVER_OK) { + if ((value & VIRTIO_CONFIG_S_DRIVER_OK) && + !virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { virtio_mmio_start_ioeventfd(proxy); } From patchwork Fri Mar 1 13:43:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonah Palmer X-Patchwork-Id: 13578508 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B68C0C5475B for ; Fri, 1 Mar 2024 13:45:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg3BA-0001Zp-Q4; Fri, 01 Mar 2024 08:44:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B6-0001WR-C7; Fri, 01 Mar 2024 08:43:56 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B4-0004vP-S2; Fri, 01 Mar 2024 08:43:56 -0500 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4219HF06008892; Fri, 1 Mar 2024 13:43:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=PaI43ndrjRD5OnP84dRinUU3H33A1MbTTkbb0QQRCJk=; b=bS3kQmbjPGrjmQZ39irYso3QbXCZsfs+d1HLZyFkbjwKvJ2pWKwo6UVzcmz6q8f8iwiR SSUMF88hoKhXqImI4vCJAjYsP1aFN0VoZ7V48uEGNwXkZa2rOmbK36yy41qSZ+LntJIg JKx/Qp6ToMyre1rcRIIO2qI8nxPTt+tshK4n+nnl9Vo3KRM+Xjcq/akRlENe3cX8xnQ4 XoJXsNacxhhdFPJm62EVnzjZ0rW8MWtG+yg35My4oLRef8IfM3IkJYwql7z/i/drT/FQ WEUDMWc2LpRAMt4LWL3s3NXviGZ4N02eKP2xHwHuRFi1xXblLliDMuSqTYa7iJhBI7Lu Cw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf6ve8rcx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:41 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 421DYR72009409; Fri, 1 Mar 2024 13:43:40 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wjrqmtrf8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:40 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 421DhWAS026578; Fri, 1 Mar 2024 13:43:39 GMT Received: from jonah-ol8.us.oracle.com (dhcp-10-65-160-211.vpn.oracle.com [10.65.160.211]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wjrqmtr9m-6; Fri, 01 Mar 2024 13:43:39 +0000 From: Jonah Palmer 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, virtio-fs@lists.linux.dev Subject: [RFC 5/8] virtio-ccw: Handle extra notification data Date: Fri, 1 Mar 2024 08:43:27 -0500 Message-Id: <20240301134330.4191007-6-jonah.palmer@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240301134330.4191007-1-jonah.palmer@oracle.com> References: <20240301134330.4191007-1-jonah.palmer@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-01_13,2024-03-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010114 X-Proofpoint-ORIG-GUID: RWcT0g7MCBsYM4nEBpVwz38diSW9SsO_ X-Proofpoint-GUID: RWcT0g7MCBsYM4nEBpVwz38diSW9SsO_ Received-SPF: pass client-ip=205.220.177.32; envelope-from=jonah.palmer@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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. Signed-off-by: Jonah Palmer Acked-by: Thomas Huth --- hw/s390x/s390-virtio-ccw.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 62804cc228..b8e193956c 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; if (ioinst_disassemble_sch_ident(subch_id, &m, &cssid, &ssid, &schid)) { return -EINVAL; @@ -151,12 +153,20 @@ static int virtio_ccw_hcall_notify(const uint64_t *args) if (!sch || !css_subch_visible(sch)) { return -EINVAL; } - if (queue >= VIRTIO_QUEUE_MAX) { + + vdev = virtio_ccw_get_vdev(sch); + if (virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { + vq_idx = data & 0xFFFF; + virtio_set_notification_data(vdev, vq_idx, data); + } else { + vq_idx = data; + } + + if (vq_idx >= VIRTIO_QUEUE_MAX) { return -EINVAL; } - virtio_queue_notify(virtio_ccw_get_vdev(sch), queue); + virtio_queue_notify(vdev, vq_idx); return 0; - } static int virtio_ccw_hcall_early_printk(const uint64_t *args) From patchwork Fri Mar 1 13:43:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonah Palmer X-Patchwork-Id: 13578506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88C81C54E49 for ; Fri, 1 Mar 2024 13:44:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg3B8-0001Ye-C1; Fri, 01 Mar 2024 08:43:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B5-0001Vf-Lj; Fri, 01 Mar 2024 08:43:55 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B4-0004u0-2f; Fri, 01 Mar 2024 08:43:55 -0500 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4219ENqX018244; Fri, 1 Mar 2024 13:43:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=y0aq9S1lE+cQUzIKGkMXtJt2IAiv3F5q9jt5OURo9Z8=; b=dqGR18j42KPwyeiGh59bpvciw7myuQo3qTkllMC4P/vVkc27Ht2ih4cl3+b40lUT6XeU LdxywXg4kDfAzy2Frgq4eAAFhhft6cCueFoe4ARqHMTnDplpfQEzbwr9ZAGCFJYq83tO KfX9bq/a0bHx8w2d3+vkmnJSZ7dEr2NUPgSSHY760gFhLmT7VSMrP9eMmmGNr1UqBKOx IiXyLu6TpfpUrpxydouvHdPrTB5b+MkhfzIm6YoSz/t+jnuy2tx8pVIHGYB3EM/5mcBd eklubMtdvyNrps/iZD4dB57gd58vwnoN9Pq1qYxUKU45z2R0g6lSLJPGlyZkW88JdShB 6Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf7ccrwsy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:43 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 421D1Oa4009437; Fri, 1 Mar 2024 13:43:41 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wjrqmtrg3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:41 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 421DhWAU026578; Fri, 1 Mar 2024 13:43:41 GMT Received: from jonah-ol8.us.oracle.com (dhcp-10-65-160-211.vpn.oracle.com [10.65.160.211]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wjrqmtr9m-7; Fri, 01 Mar 2024 13:43:40 +0000 From: Jonah Palmer 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, virtio-fs@lists.linux.dev Subject: [RFC 6/8] virtio-ccw: Lock ioeventfd state with VIRTIO_F_NOTIFICATION_DATA Date: Fri, 1 Mar 2024 08:43:28 -0500 Message-Id: <20240301134330.4191007-7-jonah.palmer@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240301134330.4191007-1-jonah.palmer@oracle.com> References: <20240301134330.4191007-1-jonah.palmer@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-01_13,2024-03-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010114 X-Proofpoint-ORIG-GUID: 2p271CibnjvuBt7paDG8dzV2B62N_fQx X-Proofpoint-GUID: 2p271CibnjvuBt7paDG8dzV2B62N_fQx Received-SPF: pass client-ip=205.220.165.32; envelope-from=jonah.palmer@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Prevent ioeventfd from being enabled/disabled when a virtio-ccw device has negotiated the VIRTIO_F_NOTIFICATION_DATA transport feature. Due to the ioeventfd not being able to carry the extra data associated with this feature, the ioeventfd should be left in a disabled state for emulated virtio-ccw devices using this feature. Signed-off-by: Jonah Palmer Acked-by: Thomas Huth --- hw/s390x/virtio-ccw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index b4676909dd..936ba78fda 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -530,14 +530,16 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) if (ret) { break; } - if (!(status & VIRTIO_CONFIG_S_DRIVER_OK)) { + if (!(status & VIRTIO_CONFIG_S_DRIVER_OK) && + !virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { virtio_ccw_stop_ioeventfd(dev); } if (virtio_set_status(vdev, status) == 0) { if (vdev->status == 0) { virtio_ccw_reset_virtio(dev); } - if (status & VIRTIO_CONFIG_S_DRIVER_OK) { + if ((status & VIRTIO_CONFIG_S_DRIVER_OK) && + !virtio_vdev_has_feature(vdev, VIRTIO_F_NOTIFICATION_DATA)) { virtio_ccw_start_ioeventfd(dev); } sch->curr_status.scsw.count = ccw.count - sizeof(status); From patchwork Fri Mar 1 13:43:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonah Palmer X-Patchwork-Id: 13578509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EDF6BC54E58 for ; Fri, 1 Mar 2024 13:45:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg3BA-0001ZA-0a; Fri, 01 Mar 2024 08:44:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B7-0001Xg-KV; Fri, 01 Mar 2024 08:43:57 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3B6-0004w8-1i; Fri, 01 Mar 2024 08:43:57 -0500 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 42196u10032204; Fri, 1 Mar 2024 13:43:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=YZTaB4BLgLWIN66TyX4ZiYvDuW+we1ynBtHIQO7d92g=; b=V37erbWJVSjWtVbAlEnEN5Aj8q48Ubs4xYoCiRAM1qe38ry9Q3HovSibarmdjjP1e69R 0bt/MO1k9Hfd8rCr7v4ZZ1NtvOf1Hm8XU4ccGHSdcuHvvD2NmSUxdCdorwijMEJitBQ6 f74mNGrF/jTm3Aw5YuFPz6hXGXgPAQcTJcPyz7y8syiv8FURjqpe2osDjkkYbnDdCUal PLSBMxTvXWnZQGX0MnOye+JR4vy1RpdqH0G5G8wzbYZ17T8TuBtUORnZxsZYd2m1F67e CmL12fwut4KN75WOAd4Xvwg28iVobPxiG2GoEMfvStxVoSw7T05oRYSOnm80yXvip8aB iA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf784s1pg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:43 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 421CZnEG009598; Fri, 1 Mar 2024 13:43:43 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wjrqmtrgq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:43 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 421DhWAW026578; Fri, 1 Mar 2024 13:43:42 GMT Received: from jonah-ol8.us.oracle.com (dhcp-10-65-160-211.vpn.oracle.com [10.65.160.211]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wjrqmtr9m-8; Fri, 01 Mar 2024 13:43:42 +0000 From: Jonah Palmer 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, virtio-fs@lists.linux.dev Subject: [RFC 7/8] vhost/vhost-user: Add VIRTIO_F_NOTIFICATION_DATA to vhost feature bits Date: Fri, 1 Mar 2024 08:43:29 -0500 Message-Id: <20240301134330.4191007-8-jonah.palmer@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240301134330.4191007-1-jonah.palmer@oracle.com> References: <20240301134330.4191007-1-jonah.palmer@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-01_13,2024-03-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010114 X-Proofpoint-GUID: 2DM0J2jmhDYvSK3dhj0QjlwO1LWD5qig X-Proofpoint-ORIG-GUID: 2DM0J2jmhDYvSK3dhj0QjlwO1LWD5qig Received-SPF: pass client-ip=205.220.177.32; envelope-from=jonah.palmer@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add support for the VIRTIO_F_NOTIFICATION_DATA feature across a variety of vhost devices. The inclusion of VIRTIO_F_NOTIFICATION_DATA in the feature bits arrays for these devices ensures that the backend is capable of offering and providing support for this feature, and that it can be disabled if the backend does not support it. Signed-off-by: Jonah Palmer Reviewed-by: Eugenio Pérez --- hw/block/vhost-user-blk.c | 1 + hw/net/vhost_net.c | 2 ++ hw/scsi/vhost-scsi.c | 1 + hw/scsi/vhost-user-scsi.c | 1 + hw/virtio/vhost-user-fs.c | 2 +- hw/virtio/vhost-user-vsock.c | 1 + net/vhost-vdpa.c | 1 + 7 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index 6a856ad51a..983c0657da 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -51,6 +51,7 @@ static const int user_feature_bits[] = { VIRTIO_F_RING_PACKED, VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_RING_RESET, + VIRTIO_F_NOTIFICATION_DATA, VHOST_INVALID_FEATURE_BIT }; diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index e8e1661646..bb1f975b39 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -48,6 +48,7 @@ static const int kernel_feature_bits[] = { VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_RING_PACKED, VIRTIO_F_RING_RESET, + VIRTIO_F_NOTIFICATION_DATA, VIRTIO_NET_F_HASH_REPORT, VHOST_INVALID_FEATURE_BIT }; @@ -55,6 +56,7 @@ static const int kernel_feature_bits[] = { /* Features supported by others. */ static const int user_feature_bits[] = { VIRTIO_F_NOTIFY_ON_EMPTY, + VIRTIO_F_NOTIFICATION_DATA, VIRTIO_RING_F_INDIRECT_DESC, VIRTIO_RING_F_EVENT_IDX, diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 58a00336c2..b8048f18e9 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -38,6 +38,7 @@ static const int kernel_feature_bits[] = { VIRTIO_RING_F_EVENT_IDX, VIRTIO_SCSI_F_HOTPLUG, VIRTIO_F_RING_RESET, + VIRTIO_F_NOTIFICATION_DATA, VHOST_INVALID_FEATURE_BIT }; diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index a63b1f4948..0b050805a8 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -36,6 +36,7 @@ static const int user_feature_bits[] = { VIRTIO_RING_F_EVENT_IDX, VIRTIO_SCSI_F_HOTPLUG, VIRTIO_F_RING_RESET, + VIRTIO_F_NOTIFICATION_DATA, VHOST_INVALID_FEATURE_BIT }; diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c index cca2cd41be..ae48cc1c96 100644 --- a/hw/virtio/vhost-user-fs.c +++ b/hw/virtio/vhost-user-fs.c @@ -33,7 +33,7 @@ static const int user_feature_bits[] = { VIRTIO_F_RING_PACKED, VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_RING_RESET, - + VIRTIO_F_NOTIFICATION_DATA, VHOST_INVALID_FEATURE_BIT }; diff --git a/hw/virtio/vhost-user-vsock.c b/hw/virtio/vhost-user-vsock.c index 9431b9792c..802b44a07d 100644 --- a/hw/virtio/vhost-user-vsock.c +++ b/hw/virtio/vhost-user-vsock.c @@ -21,6 +21,7 @@ static const int user_feature_bits[] = { VIRTIO_RING_F_INDIRECT_DESC, VIRTIO_RING_F_EVENT_IDX, VIRTIO_F_NOTIFY_ON_EMPTY, + VIRTIO_F_NOTIFICATION_DATA, VHOST_INVALID_FEATURE_BIT }; diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3726ee5d67..2827d29ce7 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -62,6 +62,7 @@ const int vdpa_feature_bits[] = { VIRTIO_F_RING_PACKED, VIRTIO_F_RING_RESET, VIRTIO_F_VERSION_1, + VIRTIO_F_NOTIFICATION_DATA, VIRTIO_NET_F_CSUM, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, VIRTIO_NET_F_CTRL_MAC_ADDR, From patchwork Fri Mar 1 13:43:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonah Palmer X-Patchwork-Id: 13578505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D7C38C5475B for ; Fri, 1 Mar 2024 13:44:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rg3BE-0001br-SC; Fri, 01 Mar 2024 08:44:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3BC-0001Zw-A2; Fri, 01 Mar 2024 08:44:02 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rg3BA-0004yf-Pi; Fri, 01 Mar 2024 08:44:02 -0500 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4219HF07008892; Fri, 1 Mar 2024 13:43:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=+f7nvVstYTffuFY7BKfkWpyBMEsF/6r1qLbrm5HAKB4=; b=HgHTYns/czhop2ltUWseqaQUJ2TxhGlyrur8y8FmwOYm/cW7XvnSI/pVO4brP5VK6ktG Yq78Gu+Wc0Ct5ivUNB3m8X8DqfA7lHrj7exySM2aYIGtD/DStHkiIh6hHA0zmV6TD37h jSDDd6UF0JM5neoAtMyWajGngX8ffjwzQdwFJj4tmoxs5rTat963ALZZGoc++KzE5Ciu g+30IwL7q+3SLcMJtR45TLZE9GQX+Gu0UFMmqb65Js3WYPxVUBDrFHsslKu6ZcKQHBN8 MbkDpusqTTUFq2FmiPw8h5rl9LGCR91nm1HpcS0WU9ZtZ642ZLS1B8FLv4Tvg/luUwuB 8g== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf6ve8rd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:45 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 421CPbT4009471; Fri, 1 Mar 2024 13:43:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wjrqmtrhc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 01 Mar 2024 13:43:44 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 421DhWAY026578; Fri, 1 Mar 2024 13:43:43 GMT Received: from jonah-ol8.us.oracle.com (dhcp-10-65-160-211.vpn.oracle.com [10.65.160.211]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3wjrqmtr9m-9; Fri, 01 Mar 2024 13:43:43 +0000 From: Jonah Palmer 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, virtio-fs@lists.linux.dev Subject: [RFC 8/8] virtio: Add VIRTIO_F_NOTIFICATION_DATA property definition Date: Fri, 1 Mar 2024 08:43:30 -0500 Message-Id: <20240301134330.4191007-9-jonah.palmer@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240301134330.4191007-1-jonah.palmer@oracle.com> References: <20240301134330.4191007-1-jonah.palmer@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-01_13,2024-03-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010114 X-Proofpoint-ORIG-GUID: PY8udhnfaCqqo_Q0JNVpChPKYPWk95N1 X-Proofpoint-GUID: PY8udhnfaCqqo_Q0JNVpChPKYPWk95N1 Received-SPF: pass client-ip=205.220.177.32; envelope-from=jonah.palmer@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Extend the virtio device property definitions to include the VIRTIO_F_NOTIFICATION_DATA feature. The default state of this feature is disabled, allowing it to be explicitly enabled where it's supported. Signed-off-by: Jonah Palmer Reviewed-by: Eugenio Pérez --- include/hw/virtio/virtio.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index c92d8afc42..5772737dde 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -369,7 +369,9 @@ typedef struct VirtIORNGConf VirtIORNGConf; DEFINE_PROP_BIT64("packed", _state, _field, \ VIRTIO_F_RING_PACKED, false), \ DEFINE_PROP_BIT64("queue_reset", _state, _field, \ - VIRTIO_F_RING_RESET, true) + VIRTIO_F_RING_RESET, true), \ + DEFINE_PROP_BIT64("notification_data", _state, _field, \ + VIRTIO_F_NOTIFICATION_DATA, false) hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n); bool virtio_queue_enabled_legacy(VirtIODevice *vdev, int n);