Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2086308pxb; Mon, 8 Mar 2021 13:52:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyP5OjHvMn2ISIuCH8Cp+djksw/8U02MrETzYdDvvP2qQRC0ZMB6YM2OggXgop5l1s0HqUb X-Received: by 2002:a17:906:2db2:: with SMTP id g18mr17393684eji.73.1615240359781; Mon, 08 Mar 2021 13:52:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615240359; cv=none; d=google.com; s=arc-20160816; b=QetIfd/YPNUKKBCwBuVaLOuP/o/I5UFgwi9K+RnRUfRKjaHbTceCyfhpSFPcp8JbKV 4HT2iK1YWG+E9JP8TwAMi3A1dG9o0v9sHkbMhiZdIW9meO1/KDUKRkmi/7mLlpcciCGo wIfuU1JpV2keFHXjZuInevBhJ9nYs2TXqsNvjBX93wO+IMz4BzH1GDt5i/PYEjnoNbr7 xeO/uvsR6RMevgCGUqvTm+DJqbeIrl/1nGpFpqZORZ7FBBtL/P16qXwxyR6X5e5slf4J t059KFrgwpU5MBKbJkH2S3lhp6BvSMGWUzGyMZDRX3F5TMqTCUfsKO6B641HjwJhDpU0 hN2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=RiD+X3RrWWZTnpp+Wb9slelJucGP/OyLw2+qHNm3UaM=; b=HcPrBC6LvO5DUY9mRvpL2yl6JV6FicvLNtpp/spT1uK06LpcDx0jIfmUpwy0QibXpL pUEu7QTRU9llf2HqC6mX6ookozyPfZw9XP++aGpaY/uO6F7rG9CxHyg2jSkMU0AAi7kH 94s8BMv4e9z3XTkUicxbVPj0V++A3+NwHB7JpniqwY047nY1AYVG6aE7RVtgDNkKIK2B eT5ZgAYEFNbDTHS4zC4MrvBLcbtlebgqmjcIi2fXBN4itqvfAKmMI6ZIlYTmxiJcioNZ 5vRmuNXOATfvbylMcpQapaMo0g30rNJ7KeZdbX6Z3wjYxwMDgLj+BoGLQqiH5r1asPiS JVUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ErSWn7wx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z17si7377643eji.221.2021.03.08.13.52.17; Mon, 08 Mar 2021 13:52:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ErSWn7wx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231812AbhCHVtU (ORCPT + 99 others); Mon, 8 Mar 2021 16:49:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:50338 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231908AbhCHVsw (ORCPT ); Mon, 8 Mar 2021 16:48:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615240132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RiD+X3RrWWZTnpp+Wb9slelJucGP/OyLw2+qHNm3UaM=; b=ErSWn7wxFJxhPC6ZHOjdTol915tRV5n2CIoYHnaM8JqAk5jvqI/YksGyLca0y1ZigiTm8X RXtxKEAG5cJtM1+hN6idSKNtAUVT9XiskVOHgiPhIQQ1MgYoGGNUhVZV1XizzGSXuzgAlx bcrr3XkRua372ZB78dJPAQgaNVVpba8= 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-518-UH31uqmPPWerh-gcH3_cYQ-1; Mon, 08 Mar 2021 16:48:49 -0500 X-MC-Unique: UH31uqmPPWerh-gcH3_cYQ-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 DDEE58018B3; Mon, 8 Mar 2021 21:48:48 +0000 (UTC) Received: from gimli.home (ovpn-112-255.phx2.redhat.com [10.3.112.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69D9B5C27C; Mon, 8 Mar 2021 21:48:42 +0000 (UTC) Subject: [PATCH v1 08/14] vfio/pci: Notify on device release From: Alex Williamson To: alex.williamson@redhat.com Cc: cohuck@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, jgg@nvidia.com, peterx@redhat.com Date: Mon, 08 Mar 2021 14:48:42 -0700 Message-ID: <161524012206.3480.6390372271074364981.stgit@gimli.home> In-Reply-To: <161523878883.3480.12103845207889888280.stgit@gimli.home> References: <161523878883.3480.12103845207889888280.stgit@gimli.home> User-Agent: StGit/0.21-2-g8ef5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Trigger a release notifier call when open reference count is zero. Signed-off-by: Alex Williamson --- drivers/vfio/pci/vfio_pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 585895970e9c..bee9318b46ed 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -560,6 +560,7 @@ static void vfio_pci_release(void *device_data) mutex_lock(&vdev->reflck->lock); if (!(--vdev->refcnt)) { + vfio_device_notifier_call(vdev->device, VFIO_DEVICE_RELEASE); vfio_pci_vf_token_user_add(vdev, -1); vfio_spapr_pci_eeh_release(vdev->pdev); vfio_pci_disable(vdev);