From mboxrd@z Thu Jan 1 00:00:00 1970 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 64FE4C433F5 for ; Tue, 4 Jan 2022 03:44:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231322AbiADDoY (ORCPT ); Mon, 3 Jan 2022 22:44:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23481 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbiADDoY (ORCPT ); Mon, 3 Jan 2022 22:44:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641267864; 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: in-reply-to:in-reply-to:references:references; bh=U3bRp9PDw2PtdlQN7RsHKxoF/g+6HtYTrwOQVxpYpkg=; b=ewJoEVH/asVTt1uuHPZuNvkintjY7r3X64UHDyxis0Y4qICDXE/MaFi1oUS6iMNgf2yx9n 2L0JGW/QlGFw0Dpy/2zUBwmH9Jw1u2Nxd1BhPONTIBTwR5bFcH7dbO0tvTv+gO4rTrtymp oZjojhIoy0X4fCVfa2padaL5W4ppxvg= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-66-Xdj5v5WjMFiGTsTS2dChQQ-1; Mon, 03 Jan 2022 22:44:22 -0500 X-MC-Unique: Xdj5v5WjMFiGTsTS2dChQQ-1 Received: by mail-lj1-f200.google.com with SMTP id o21-20020a2e9455000000b0022e43380cfdso634390ljh.10 for ; Mon, 03 Jan 2022 19:44:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=U3bRp9PDw2PtdlQN7RsHKxoF/g+6HtYTrwOQVxpYpkg=; b=novse0rgaCWGrPhl/xxVhwGsYr8JQA9EzL9qj7pM+d/J+YUqf+0RI9RlyIgePQ7HR2 rUjsQjybvMNIk5G4ucchJrjhqbBz31DF5eWi9cl5hBlzCVMiQKXxKbttrvZ145qwXlxW EJWKfwPMhlGgHis7+NwQCOgmtJL6fZqN4ZETIklqeqHJMW3nCUyGV/F96oJKykE9liWF /P810wu7PV4jo/5mgGhl+H6yCG7TOPEAAF/FG+7/wNn4AAPiHfT4aCbz++ibORFtCxAZ dcuDNvy9/M10DCMyDwSGoOfPxtcd/c3pwesmKVidCoDWCI+DmQsFmkIeMLT50c7pBeAv aRSg== X-Gm-Message-State: AOAM531FGX9sa5QY5eF1wYxYxTUVnCQUlJdCNY/6P8ui9kKhP5YAgD3x 3kym8fnbsLe1W1qWQiT+sTxQGWzlKTVpWOAD5fht48mzSN4O9Cr6Hi5/sl3CN5Vx8IHk8hbQ2DU jWcaYfREXd3BrAzgA1PUeWcaOZq8y X-Received: by 2002:a05:6512:22d6:: with SMTP id g22mr42525573lfu.199.1641267861276; Mon, 03 Jan 2022 19:44:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPfKa8UYDWk8yXRh/Tynib8SG3CWPXUC55CynDHAaf3IrbQwAAOOMAqfKLA5ICJGqVqiZgR88MAce8maqcssc= X-Received: by 2002:a05:6512:22d6:: with SMTP id g22mr42525557lfu.199.1641267861109; Mon, 03 Jan 2022 19:44:21 -0800 (PST) MIME-Version: 1.0 References: <20211224070404.54840-1-wang.yi59@zte.com.cn> In-Reply-To: <20211224070404.54840-1-wang.yi59@zte.com.cn> From: Jason Wang Date: Tue, 4 Jan 2022 11:44:10 +0800 Message-ID: Subject: Re: [PATCH v2] vdpa: regist vhost-vdpa dev class To: Yi Wang Cc: mst , Stefano Garzarella , kvm , virtualization , netdev , linux-kernel , xue.zhihong@zte.com.cn, wang.liang82@zte.com.cn, Zhang Min Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Fri, Dec 24, 2021 at 3:13 PM Yi Wang wrote: > > From: Zhang Min > > Some applications like kata-containers need to acquire MAJOR/MINOR/DEVNAME > for devInfo [1], so regist vhost-vdpa dev class to expose uevent. Hi: I think we need to be more verbose here e.g: 1) why can't we get major/minor with the current interface 2) what kind of the uevent is required and not supported currently Thanks > > 1. https://github.com/kata-containers/kata-containers/blob/main/src/runtime/virtcontainers/device/config/config.go > > Signed-off-by: Zhang Min > Signed-off-by: Yi Wang > --- > v2: remove redundant vhost_vdpa_class reset and pr_warn, adjust location > of *vhost_vdpa_class impl and class_destroy. > > drivers/vhost/vdpa.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c > index e3c4f059b21a..55e966c508c8 100644 > --- a/drivers/vhost/vdpa.c > +++ b/drivers/vhost/vdpa.c > @@ -53,6 +53,7 @@ struct vhost_vdpa { > static DEFINE_IDA(vhost_vdpa_ida); > > static dev_t vhost_vdpa_major; > +static struct class *vhost_vdpa_class; > > static void handle_vq_kick(struct vhost_work *work) > { > @@ -1140,6 +1141,7 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa) > v->dev.release = vhost_vdpa_release_dev; > v->dev.parent = &vdpa->dev; > v->dev.devt = MKDEV(MAJOR(vhost_vdpa_major), minor); > + v->dev.class = vhost_vdpa_class; > v->vqs = kmalloc_array(v->nvqs, sizeof(struct vhost_virtqueue), > GFP_KERNEL); > if (!v->vqs) { > @@ -1197,6 +1199,10 @@ static int __init vhost_vdpa_init(void) > { > int r; > > + vhost_vdpa_class = class_create(THIS_MODULE, "vhost-vdpa"); > + if (IS_ERR(vhost_vdpa_class)) > + return PTR_ERR(vhost_vdpa_class); > + > r = alloc_chrdev_region(&vhost_vdpa_major, 0, VHOST_VDPA_DEV_MAX, > "vhost-vdpa"); > if (r) > @@ -1211,6 +1217,7 @@ static int __init vhost_vdpa_init(void) > err_vdpa_register_driver: > unregister_chrdev_region(vhost_vdpa_major, VHOST_VDPA_DEV_MAX); > err_alloc_chrdev: > + class_destroy(vhost_vdpa_class); > return r; > } > module_init(vhost_vdpa_init); > @@ -1219,6 +1226,7 @@ static void __exit vhost_vdpa_exit(void) > { > vdpa_unregister_driver(&vhost_vdpa_driver); > unregister_chrdev_region(vhost_vdpa_major, VHOST_VDPA_DEV_MAX); > + class_destroy(vhost_vdpa_class); > } > module_exit(vhost_vdpa_exit); > > -- > 2.27.0 >