Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9564850ybi; Wed, 10 Jul 2019 12:32:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvemHG56ITp2W2LJVDNjPG8xuIhe1S4rPrKYp/4rrc/6cW8qXv5ObK9BS8MBQcaBOc17pa X-Received: by 2002:a63:5114:: with SMTP id f20mr39524226pgb.173.1562787169423; Wed, 10 Jul 2019 12:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562787169; cv=none; d=google.com; s=arc-20160816; b=QFFuHDwhttD7w45vzXR0ULiBUTJb9y2ZK/5mpegvbhnn3BpEuCwaCQKwOByTYC6HM+ 35TbX1KiWBhX/7iJp9xdavfeD83fAVNelcUu4b97Q06Ikr53zIXPn81vNZPHIi6RdU+y AOLeYBcF2S9zlBtdnHoAfqYwv3BSXl6/ka5KrCitbbFdEUZ8aazmg2Bczc2QVyE50AdC sfECFxuDuky9HftJOQKKBdW+LnWDWciDZgI+HUXtYlkJ45/pK7CK1L29oKq7mkHUMOev o+ZqWGV75NY29S4KbjpOLcPK4rWKSClThMv84EfmbyO2UbZCNEU8DPXjx6CkoJIIDyt/ Muhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:from :references:cc:to:subject; bh=Jm+B0NDGcf5E+KZa28wTh/6TcnljOB+d/mUr++GB+Ss=; b=WBDz9kHUEfdKpNKDP0HxoCZIjfZTnHgM7y2OBPYdiCXUgXvV4QcD1SnGu2jKSyRMVW vJIAy+qt28oLLH7tXVuWRezStcvZWkDjOsdyFT8WesiIQ8QKPpU8RUWzCgKB8youS5BQ idxwRgydhs+Rz6nAX+VJNrYid4TFBK3vAqmxvmKQ/kzhCZ1mz0WHUKohrbeXzaC7DLju ivG960AG7V4V3QhQWOM4IO127haebEhcbVh9yMmnCZCEM21Xr6l7tBT3vcR2tze+w7Tx tR/xuTYMDyCyjtyCBdXhdhh7ZvyYo6ecnVlwHwndXtibY6eb4g91v3kke5kcJuLK6qaJ lKbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Kpp1R694; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bf7si2582166plb.216.2019.07.10.12.32.33; Wed, 10 Jul 2019 12:32:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Kpp1R694; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728142AbfGJSLl (ORCPT + 99 others); Wed, 10 Jul 2019 14:11:41 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:10961 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727377AbfGJSLl (ORCPT ); Wed, 10 Jul 2019 14:11:41 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Wed, 10 Jul 2019 11:11:45 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Wed, 10 Jul 2019 11:11:40 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Wed, 10 Jul 2019 11:11:40 -0700 Received: from [10.24.71.30] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 10 Jul 2019 18:11:37 +0000 Subject: Re: [PATCH v3] mdev: Send uevents around parent device registration To: Alex Williamson , CC: , References: <156278027422.16516.5157992389394627876.stgit@gimli.home> X-Nvconfidentiality: public From: Kirti Wankhede Message-ID: <4f32e5e2-2bac-81f2-9fb6-3d0023ed009b@nvidia.com> Date: Wed, 10 Jul 2019 23:41:21 +0530 MIME-Version: 1.0 In-Reply-To: <156278027422.16516.5157992389394627876.stgit@gimli.home> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1562782305; bh=Jm+B0NDGcf5E+KZa28wTh/6TcnljOB+d/mUr++GB+Ss=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=Kpp1R694nKbrkkjAfYZt7UHmvADP1mGL54vOLzZpd9OmLia/W6dQojqtAXS0VYjb/ /QrYwBf4Vt++M9MhCSYhkDoK+OANyYj4D+U6XzDx6+zzVespP/019ey6D84QdX2Mc3 NeNy8SqsAC9KHtR8nn+4/6rR0qi7WhGsRJp4q+UzatUVB+95OVPqiSclKRfC/k/RSI BnCHuXfvl0K9r2bc84QX68bJqWheAnV8c2/HHytVb+u313eAHvq1pPAwJSQ980p3rB B/zQpfBLs9R863ojAWYsJAmJbblqg7Cvcdb/9n6I7tCsp3LSanQyCRom62RWflhXHQ s0uL8Gcgjnf2A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/10/2019 11:11 PM, Alex Williamson wrote: > This allows udev to trigger rules when a parent device is registered > or unregistered from mdev. > > Reviewed-by: Cornelia Huck > Signed-off-by: Alex Williamson > --- > > v3: Add Connie's R-b > Add comment clarifying expected device requirements for unreg > Reviewed-by: Kirti Wankhede Thanks, Kirti > drivers/vfio/mdev/mdev_core.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/vfio/mdev/mdev_core.c b/drivers/vfio/mdev/mdev_core.c > index ae23151442cb..23976db6c6c7 100644 > --- a/drivers/vfio/mdev/mdev_core.c > +++ b/drivers/vfio/mdev/mdev_core.c > @@ -146,6 +146,8 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops) > { > int ret; > struct mdev_parent *parent; > + char *env_string = "MDEV_STATE=registered"; > + char *envp[] = { env_string, NULL }; > > /* check for mandatory ops */ > if (!ops || !ops->create || !ops->remove || !ops->supported_type_groups) > @@ -197,6 +199,8 @@ int mdev_register_device(struct device *dev, const struct mdev_parent_ops *ops) > mutex_unlock(&parent_list_lock); > > dev_info(dev, "MDEV: Registered\n"); > + kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); > + > return 0; > > add_dev_err: > @@ -220,6 +224,8 @@ EXPORT_SYMBOL(mdev_register_device); > void mdev_unregister_device(struct device *dev) > { > struct mdev_parent *parent; > + char *env_string = "MDEV_STATE=unregistered"; > + char *envp[] = { env_string, NULL }; > > mutex_lock(&parent_list_lock); > parent = __find_parent_device(dev); > @@ -243,6 +249,9 @@ void mdev_unregister_device(struct device *dev) > up_write(&parent->unreg_sem); > > mdev_put_parent(parent); > + > + /* We still have the caller's reference to use for the uevent */ > + kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp); > } > EXPORT_SYMBOL(mdev_unregister_device); > >