From patchwork Wed Mar 2 18:03:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Lopez Pascual X-Patchwork-Id: 12766494 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42A71C433EF for ; Wed, 2 Mar 2022 18:06:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244250AbiCBSGx (ORCPT ); Wed, 2 Mar 2022 13:06:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233092AbiCBSGv (ORCPT ); Wed, 2 Mar 2022 13:06:51 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 73B4714083 for ; Wed, 2 Mar 2022 10:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646244367; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=efzJa6/W9diGcwuLPP5Fb7/4uwCddpKtVjz83/Ys+RU=; b=LmLiMnMqabjvBGU8UuuthEm0ZjKe/P2QOC+nF8mNVbwclHjHnn7CID7upG4z2tLx46J4HH reZHykzhcOPsEGaR6Bx8DK2ewjbi5oMWgOx3oMt7fq07prEyK+ir4UBzcJyJCHHC5EDoix aRpbT7pQxY3tP4g5mPqiLzUC48c3wug= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-319-lgg1CI-KMH2_ETjoBeQRZw-1; Wed, 02 Mar 2022 13:06:06 -0500 X-MC-Unique: lgg1CI-KMH2_ETjoBeQRZw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92F74801DDB; Wed, 2 Mar 2022 18:06:04 +0000 (UTC) Received: from toolbox.redhat.com (unknown [10.33.36.14]) by smtp.corp.redhat.com (Postfix) with ESMTP id 864A37DE2F; Wed, 2 Mar 2022 18:05:03 +0000 (UTC) From: Sergio Lopez To: qemu-devel@nongnu.org Cc: Halil Pasic , Richard Henderson , David Hildenbrand , Paolo Bonzini , Thomas Huth , Stefan Hajnoczi , "Michael S. Tsirkin" , Alex Williamson , qemu-block@nongnu.org, vgoyal@redhat.com, Christian Borntraeger , kvm@vger.kernel.org, Elena Ufimtseva , Cornelia Huck , qemu-s390x@nongnu.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Kevin Wolf , Eric Farman , Matthew Rosato , Fam Zheng , John G Johnson , Hanna Reitz , Jagannathan Raman , Sergio Lopez Subject: [PATCH v2 2/3] vhost: use wfd on functions setting vring call fd Date: Wed, 2 Mar 2022 19:03:17 +0100 Message-Id: <20220302180318.28893-3-slp@redhat.com> In-Reply-To: <20220302180318.28893-1-slp@redhat.com> References: <20220302180318.28893-1-slp@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org When ioeventfd is emulated using qemu_pipe(), only EventNotifier's wfd can be used for writing. Use the recently introduced event_notifier_get_wfd() function to obtain the fd that our peer must use to signal the vring. Signed-off-by: Sergio Lopez --- hw/virtio/vhost.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 7b03efccec..b643f42ea4 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1287,7 +1287,7 @@ static int vhost_virtqueue_init(struct vhost_dev *dev, return r; } - file.fd = event_notifier_get_fd(&vq->masked_notifier); + file.fd = event_notifier_get_wfd(&vq->masked_notifier); r = dev->vhost_ops->vhost_set_vring_call(dev, &file); if (r) { VHOST_OPS_DEBUG(r, "vhost_set_vring_call failed"); @@ -1542,9 +1542,9 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n, if (mask) { assert(vdev->use_guest_notifier_mask); - file.fd = event_notifier_get_fd(&hdev->vqs[index].masked_notifier); + file.fd = event_notifier_get_wfd(&hdev->vqs[index].masked_notifier); } else { - file.fd = event_notifier_get_fd(virtio_queue_get_guest_notifier(vvq)); + file.fd = event_notifier_get_wfd(virtio_queue_get_guest_notifier(vvq)); } file.index = hdev->vhost_ops->vhost_get_vq_index(hdev, n);