From nobody Mon Feb 9 17:25:05 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1617875082; cv=none; d=zohomail.com; s=zohoarc; b=gsRwGNW1Mv1qhm3rOaCfdnS0zetpwaLaDLInPokPQ8ReDNTKTDcnVGYkv3dQVODwmWv79tfuFWqo12MvpLCQBAxL93YP+uxYCqOUXRoPerrU0kIFUAYFg4694tpAFz/8y8h8wnc24dwCr5nPxfQe3eDefmoC0wPYC6+sYQ+q9nc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617875082; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PEcKC2Yko0rz3J3ciQK5MVymGM2xuxXf9mgN9ZYEUaE=; b=SYVFBVzAhZF/hU7mg0eufmoNHiK0g3LAiZPV85XmRZ7GY6frLTA/cGl2dnpSns+GP4GwBjjY98FrG7V9imApAjHfzt9yfvpTspTA0qi6UTixpyu3PO/olELmPh9VBtj0YktCBDFsfzwkhetDajKdFH6Ov27paBJa0KYLCG0TidQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 161787508230986.97653124025919; Thu, 8 Apr 2021 02:44:42 -0700 (PDT) Received: from localhost ([::1]:59736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lURDM-0002wA-NA for importer@patchew.org; Thu, 08 Apr 2021 05:44:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUR7j-0006hS-3y for qemu-devel@nongnu.org; Thu, 08 Apr 2021 05:38:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52853) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lUR7g-0004NG-L4 for qemu-devel@nongnu.org; Thu, 08 Apr 2021 05:38:50 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-g8Oj3hVpNnOH9ISDabVC2Q-1; Thu, 08 Apr 2021 05:38:46 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9B7EAC7403 for ; Thu, 8 Apr 2021 09:38:45 +0000 (UTC) Received: from laptop.redhat.com (ovpn-13-72.pek2.redhat.com [10.72.13.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED6865D9DC; Thu, 8 Apr 2021 09:38:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617874727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PEcKC2Yko0rz3J3ciQK5MVymGM2xuxXf9mgN9ZYEUaE=; b=YvZP6Jy/XJxh5Pf/OwzoWCWSU4UYj/acYy2sawxFH8h3wBJlNsIwPxynDrr9e+ltGQw+3h ueSeCs6Z+4+wNL5CNDV5KMJrea4jjxAFqA3OiHsVN5esbUunMtW6Qy4gXoj1T6ndk2mw0o X/JMuEDMzVFWA2Lk7QLovGDsiaACeks= X-MC-Unique: g8Oj3hVpNnOH9ISDabVC2Q-1 From: Cindy Lu To: lulu@redhat.com, mst@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org Subject: [PATCH v5 4/6] vhost-vdpa: add support for configure interrupt Date: Thu, 8 Apr 2021 17:38:22 +0800 Message-Id: <20210408093824.14985-5-lulu@redhat.com> In-Reply-To: <20210408093824.14985-1-lulu@redhat.com> References: <20210408093824.14985-1-lulu@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lulu@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=lulu@redhat.com; helo=us-smtp-delivery-124.mimecast.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_HIGH=-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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add support for configure interrupt. Set the notifier's fd to the kernel driver when vdpa start. also set -1 while vdpa stop. then the kernel will release the related resource Signed-off-by: Cindy Lu --- hw/virtio/vhost-vdpa.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 9ba2a2bed4..7825366f64 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -467,11 +467,33 @@ static int vhost_vdpa_get_config(struct vhost_dev *de= v, uint8_t *config, } return ret; } - +static void vhost_vdpa_config_notify_start(struct vhost_dev *dev, + struct VirtIODevice *vdev, bool start) +{ + int fd =3D 0; + int r =3D 0; + if (!(dev->features & (0x1ULL << VIRTIO_NET_F_STATUS))) { + return; + } + if (start) { + fd =3D event_notifier_get_fd(&vdev->config_notifier); + r =3D dev->vhost_ops->vhost_set_config_call(dev, &fd); + if (!r) { + vdev->use_config_notifier =3D true; + event_notifier_set(&vdev->config_notifier); + } + } else { + fd =3D -1; + vdev->use_config_notifier =3D false; + r =3D dev->vhost_ops->vhost_set_config_call(dev, &fd); + } + return; +} static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) { struct vhost_vdpa *v =3D dev->opaque; trace_vhost_vdpa_dev_start(dev, started); + VirtIODevice *vdev =3D dev->vdev; if (started) { uint8_t status =3D 0; memory_listener_register(&v->listener, &address_space_memory); @@ -479,8 +501,10 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev,= bool started) vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); vhost_vdpa_call(dev, VHOST_VDPA_GET_STATUS, &status); =20 + vhost_vdpa_config_notify_start(dev, vdev, true); return !(status & VIRTIO_CONFIG_S_DRIVER_OK); } else { + vhost_vdpa_config_notify_start(dev, vdev, false); vhost_vdpa_reset_device(dev); vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER); --=20 2.21.3