Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp772629rwe; Wed, 31 Aug 2022 10:41:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR4vVJ6SsEgCgJZ3YznrQ4x0DRGpZOQRGB4oO0S2QE5i7jvrWMe8eaNoXduKeTzibyC2QH8C X-Received: by 2002:a05:6a00:1384:b0:538:73c5:91ff with SMTP id t4-20020a056a00138400b0053873c591ffmr11513915pfg.54.1661967684499; Wed, 31 Aug 2022 10:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661967684; cv=none; d=google.com; s=arc-20160816; b=j8X7JARsiBPlXRajAoXVDHHGcCL0PNvmMOski+97OrQvxi2sAgKAUNcnvw7prHe1UM BEdoIbHnCAXbZgww3XqcIsfIhnSm9Xy0HI4f45Vk3gwi/xHVGr12u3m2CwBZlxoydmoT RyE/Ml5jXtGrcYMWs9Vwx4nkxZ//qVP0DINsUVHRyPxSE0yrVAMhLRGxYuT7fosy7nlV dIi0lO5ED7aXAtIDUOFTw1aKUrP4X8/ucr9DDI2aw0MqsBmgyNCLT3cA2L/A3ilAVJSG zJMkHEYDrlwYUjZc5143JbiXKDdDsDgnZc9f6R8DNIgwHzzJd/YU+p7oI7mWTBiGOT5J o+nA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=3wNDRJb+y9GkEb33I7HiMe0aeP3rl6XFj5xgf5bJFgc=; b=horaeVgb0ZXMAltzwMGWWKwCcN/+TC5ahVUG4LcnP3dQhenkzLBlzqB4ziQQQmOtbm oLjG+ANT1+ncfVntKju7ctFWi6EK6puSfPfREOzxZGvCptIRAmwxKjBEOGe0wVLQStua 5OiH+k+OCiJiwl20FgjvCx2ImAU4Q9uVF3yt6UlmpllXg0KH15wZgkeFY6ZO1ZQvqKHP 76uEjLjqyDVZkhSNlggdQyC5K1LU1rpY2EmX9TCSvngjIz7X8DxkI8q+zuvFiVPnN/FG bHudgrlLsa6zzZ1HexGI90qnT023FEIJtdsoki8cv6R0jduCl6QC0OK8YExkFE6BDkKC RLIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b7wsog1x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a170903018b00b0016bee6785e3si14695917plg.35.2022.08.31.10.41.13; Wed, 31 Aug 2022 10:41:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b7wsog1x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231916AbiHaRQS (ORCPT + 99 others); Wed, 31 Aug 2022 13:16:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231342AbiHaRQP (ORCPT ); Wed, 31 Aug 2022 13:16:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7FC72B191 for ; Wed, 31 Aug 2022 10:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661966117; 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=3wNDRJb+y9GkEb33I7HiMe0aeP3rl6XFj5xgf5bJFgc=; b=b7wsog1x/991oo6422DmCbdsN+DI1gYzVgH6IFVSYVZmv/yuUeUTX2k07JC71yPJHWS5d5 t4qswtBS0aGeDxu9aF8uxltfixIWCfFlEz7PBM3tRHONB2Nr8NeOho4+DlmApr1wgvqwUg AF+Yih/bV5zQZu6kPkAeSSs0m/AI7Mc= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-468-ZAqGOTczOLamNWxCw6egsA-1; Wed, 31 Aug 2022 13:15:16 -0400 X-MC-Unique: ZAqGOTczOLamNWxCw6egsA-1 Received: by mail-il1-f198.google.com with SMTP id n13-20020a056e02140d00b002dfa5464967so10863745ilo.19 for ; Wed, 31 Aug 2022 10:15:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc; bh=3wNDRJb+y9GkEb33I7HiMe0aeP3rl6XFj5xgf5bJFgc=; b=hfts3jeI34HVQPYXJcMU+af9Y8xE7fB1g+m0LqjCO1UUbygFlitQFZXUL9HxvpypTy XscbjSbXvktYEnwZBRrfIRUOEDNtLcc6hXnxxRBzXBAkhB6VFl8jiZ/59Nq77vV3TsmC W8AZZLx2JGMVjhJ7xfDJkwdwnqksN0635SVhzFCd5n47/r/qgXlPwSHotAIs9NgNK4+v Xta5MH7gXfdJTQVqkfzS7TFKw7nY0Etv6Gz0hgBpflC9nVKsSVjY1dYJv5HeTn5YTOp0 QMUs/Q4+HlbSs0zn1GBZQtsp1fMsBMGByvY992RA6FkNPd2hknLr/3eA+t3lVLvaXd6k nLQQ== X-Gm-Message-State: ACgBeo2Alu2lHa7vKJkZySOcjhO+qD7bztAiVTYKjrIrRlCNZthEFlPD lrYJdmyIwum8R7rFdcKeEwDBigG/TBI8p9eIwRe9btPU6bNhkvEmVhth/hrDHtChQB8M8BvrbSf fHRNQraDMbtOQi/U9OKJNpMGi X-Received: by 2002:a05:6638:dd4:b0:349:ebfd:e705 with SMTP id m20-20020a0566380dd400b00349ebfde705mr15532670jaj.4.1661966114825; Wed, 31 Aug 2022 10:15:14 -0700 (PDT) X-Received: by 2002:a05:6638:dd4:b0:349:ebfd:e705 with SMTP id m20-20020a0566380dd400b00349ebfde705mr15532650jaj.4.1661966114600; Wed, 31 Aug 2022 10:15:14 -0700 (PDT) Received: from redhat.com ([38.15.36.239]) by smtp.gmail.com with ESMTPSA id u190-20020a0223c7000000b00343617e8368sm7084182jau.99.2022.08.31.10.15.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 10:15:14 -0700 (PDT) Date: Wed, 31 Aug 2022 11:15:12 -0600 From: Alex Williamson To: "Tian, Kevin" Cc: Jason Gunthorpe , Zhenyu Wang , "Wang, Zhi A" , Jani Nikula , "Joonas Lahtinen" , "Vivi, Rodrigo" , Tvrtko Ursulin , David Airlie , Daniel Vetter , Eric Farman , Matthew Rosato , Halil Pasic , Vineeth Vijayan , "Peter Oberparleiter" , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Tony Krowiak , Jason Herne , Harald Freudenberger , Diana Craciun , "Cornelia Huck" , Longfang Liu , "Shameer Kolothum" , Yishai Hadas , Eric Auger , Kirti Wankhede , Leon Romanovsky , Abhishek Sahu , "intel-gvt-dev@lists.freedesktop.org" , "intel-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , "linux-s390@vger.kernel.org" , "kvm@vger.kernel.org" , "Liu, Yi L" Subject: Re: [PATCH 15/15] vfio: Add struct device to vfio_device Message-ID: <20220831111512.4924e152.alex.williamson@redhat.com> In-Reply-To: References: <20220827171037.30297-1-kevin.tian@intel.com> <20220827171037.30297-16-kevin.tian@intel.com> <20220830161838.4aa47045.alex.williamson@redhat.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 31 Aug 2022 06:10:51 +0000 "Tian, Kevin" wrote: > > From: Jason Gunthorpe > > Sent: Wednesday, August 31, 2022 7:53 AM > > > > On Tue, Aug 30, 2022 at 04:18:38PM -0600, Alex Williamson wrote: > > > On Sun, 28 Aug 2022 01:10:37 +0800 > > > Kevin Tian wrote: > > > > > > > From: Yi Liu > > > > > > > > and replace kref. With it a 'vfio-dev/vfioX' node is created under the > > > > sysfs path of the parent, indicating the device is bound to a vfio > > > > driver, e.g.: > > > > > > > > /sys/devices/pci0000\:6f/0000\:6f\:01.0/vfio-dev/vfio0 > > > > > > > > It is also a preparatory step toward adding cdev for supporting future > > > > device-oriented uAPI. > > > > > > Shall we start Documentation/ABI/testing/vfio-dev now? Thanks. > > > > I always thought that was something to use when adding new custom > > sysfs attributes? > > > > Here we are just creating a standard struct device with its standard > > sysfs? > > > > There is nothing special for vfio-dev/vfioX. But from pci device p.o.v > this does introduce a custom node in the directory, which is probably > what Alex referred to? Yup, but not just for pci, we're adding a node into the device directory for any device bound to vfio. > Anyway if required following can be introduced: > > diff --git a/Documentation/ABI/testing/sysfs-devices-vfio-dev b/Documentation/ABI/testing/sysfs-devices-vfio-dev > new file mode 100644 > index 000000000000..dfe8baaf1ccb > --- /dev/null > +++ b/Documentation/ABI/testing/sysfs-devices-vfio-dev > @@ -0,0 +1,8 @@ > +What: /sys/...//vfio-dev/vfioX/ > +Date: September 2022 > +Contact: Yi Liu > +Description: > + This directory is created when the device is bound to a > + vfio driver. The layout under this directory matches what > + exists for a standard 'struct device'. 'X' is a random > + number marking this device in vfio. It's not really random, it's a unique index. Seems like a good starting point. > > At the start I thought it might make more sense to add it into an > existing vfio ABI file. But looks it doesn't exist. > > Curious why nobody asked for ABI doc for /dev/vfio/vfio, /sys/class/vfio, etc... Oversight, there should probably be a sysfs-class-vfio file. Thanks, Alex