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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D80F1C4743C for ; Mon, 14 Jun 2021 15:09:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B018861352 for ; Mon, 14 Jun 2021 15:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233178AbhFNPLH (ORCPT ); Mon, 14 Jun 2021 11:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233048AbhFNPLH (ORCPT ); Mon, 14 Jun 2021 11:11:07 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A92BC061574; Mon, 14 Jun 2021 08:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=T+/oxM+z1BUuHd3fgDap8qJ+RDgIJZUJGDdgz0iT8y8=; b=UD2xKWxDFJgEJoUuqCUKG+J+4x gWq3kpq6cAriv1lFqug/uPQKNwU636xe2RJsSlIjmgH5EsOqowCCn1KnUyy9Dqdytpvtz8ZlOtx4c dla2Igc7SYrWhvA5WDHmx2lVMATlN9H4QsjBu5jwOuMlTWJPknvXszcbiShKY+0Fs60rDr1WH7R6+ kwIkowdIqD/ZOX0U+NAbD04elyzTIx62jHbPQlZBXusqjf06Qz+dZm4lbySmocb5f9a5MM167pay0 QyS5037QYkhEQyMmQ9f1uqehXUsWY+f7S3/9llmEdo2w09JYVySoa1jiVyqyAtDsvdtfOQpHwFupm I+4A1btQ==; Received: from [2001:4bb8:19b:fdce:4b1a:b4aa:22d8:1629] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lsoCn-00EfeW-7E; Mon, 14 Jun 2021 15:08:49 +0000 From: Christoph Hellwig To: Greg Kroah-Hartman , Jason Gunthorpe , Alex Williamson , Kirti Wankhede Cc: David Airlie , Tony Krowiak , Christian Borntraeger , Cornelia Huck , Jonathan Corbet , Daniel Vetter , dri-devel@lists.freedesktop.org, Vasily Gorbik , Heiko Carstens , intel-gfx@lists.freedesktop.org, Jani Nikula , Jason Herne , Joonas Lahtinen , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-s390@vger.kernel.org, Halil Pasic , "Rafael J. Wysocki" , Rodrigo Vivi Subject: Allow mdev drivers to directly create the vfio_device (v2 / alternative) Date: Mon, 14 Jun 2021 17:08:36 +0200 Message-Id: <20210614150846.4111871-1-hch@lst.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org This is my alternative take on this series from Jason: https://lore.kernel.org/dri-devel/87czsszi9i.fsf@redhat.com/T/ The mdev/vfio parts are exactly the same, but this solves the driver core changes for the direct probing without the in/out flag that Greg hated, which cause a little more work, but probably make the result better. Original decription from Jason below: The mdev bus's core part for managing the lifecycle of devices is mostly as one would expect for a driver core bus subsystem. However instead of having a normal 'struct device_driver' and binding the actual mdev drivers through the standard driver core mechanisms it open codes this with the struct mdev_parent_ops and provides a single driver that shims between the VFIO core's struct vfio_device and the actual device driver. Instead, allow mdev drivers implement an actual struct mdev_driver and directly call vfio_register_group_dev() in the probe() function for the mdev. Arrange to bind the created mdev_device to the mdev_driver that is provided by the end driver. The actual execution flow doesn't change much, eg what was parent_ops->create is now device_driver->probe and it is called at almost the exact same time - except under the normal control of the driver core. Ultimately converting all the drivers unlocks a fair number of additional VFIO simplifications and cleanups. 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 X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4603BC2B9F4 for ; Mon, 14 Jun 2021 15:09:05 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9F5860240 for ; Mon, 14 Jun 2021 15:09:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9F5860240 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4022989A44; Mon, 14 Jun 2021 15:09:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BDAF89A44; Mon, 14 Jun 2021 15:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=T+/oxM+z1BUuHd3fgDap8qJ+RDgIJZUJGDdgz0iT8y8=; b=UD2xKWxDFJgEJoUuqCUKG+J+4x gWq3kpq6cAriv1lFqug/uPQKNwU636xe2RJsSlIjmgH5EsOqowCCn1KnUyy9Dqdytpvtz8ZlOtx4c dla2Igc7SYrWhvA5WDHmx2lVMATlN9H4QsjBu5jwOuMlTWJPknvXszcbiShKY+0Fs60rDr1WH7R6+ kwIkowdIqD/ZOX0U+NAbD04elyzTIx62jHbPQlZBXusqjf06Qz+dZm4lbySmocb5f9a5MM167pay0 QyS5037QYkhEQyMmQ9f1uqehXUsWY+f7S3/9llmEdo2w09JYVySoa1jiVyqyAtDsvdtfOQpHwFupm I+4A1btQ==; Received: from [2001:4bb8:19b:fdce:4b1a:b4aa:22d8:1629] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1lsoCn-00EfeW-7E; Mon, 14 Jun 2021 15:08:49 +0000 From: Christoph Hellwig To: Greg Kroah-Hartman , Jason Gunthorpe , Alex Williamson , Kirti Wankhede Date: Mon, 14 Jun 2021 17:08:36 +0200 Message-Id: <20210614150846.4111871-1-hch@lst.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Subject: [Intel-gfx] Allow mdev drivers to directly create the vfio_device (v2 / alternative) X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tony Krowiak , Jason Herne , kvm@vger.kernel.org, Vasily Gorbik , Jonathan Corbet , David Airlie , linux-s390@vger.kernel.org, Heiko Carstens , Cornelia Huck , linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, Halil Pasic , Christian Borntraeger , "Rafael J. Wysocki" , intel-gfx@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This is my alternative take on this series from Jason: https://lore.kernel.org/dri-devel/87czsszi9i.fsf@redhat.com/T/ The mdev/vfio parts are exactly the same, but this solves the driver core changes for the direct probing without the in/out flag that Greg hated, which cause a little more work, but probably make the result better. Original decription from Jason below: The mdev bus's core part for managing the lifecycle of devices is mostly as one would expect for a driver core bus subsystem. However instead of having a normal 'struct device_driver' and binding the actual mdev drivers through the standard driver core mechanisms it open codes this with the struct mdev_parent_ops and provides a single driver that shims between the VFIO core's struct vfio_device and the actual device driver. Instead, allow mdev drivers implement an actual struct mdev_driver and directly call vfio_register_group_dev() in the probe() function for the mdev. Arrange to bind the created mdev_device to the mdev_driver that is provided by the end driver. The actual execution flow doesn't change much, eg what was parent_ops->create is now device_driver->probe and it is called at almost the exact same time - except under the normal control of the driver core. Ultimately converting all the drivers unlocks a fair number of additional VFIO simplifications and cleanups. _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx