From patchwork Sat Oct 22 21:46:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1364605wrr; Sat, 22 Oct 2022 14:49:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ZJ1nFyG2PmpWt5SC/NEW2KrA7iHzZXi7Vc5ukUrZw1pAWR+o+Ux0ocf7T69/V4hvDEf2I X-Received: by 2002:a17:907:1c01:b0:79d:637c:7848 with SMTP id nc1-20020a1709071c0100b0079d637c7848mr7134237ejc.513.1666475353258; Sat, 22 Oct 2022 14:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666475353; cv=none; d=google.com; s=arc-20160816; b=GJAKYwwDitRXVFeOFFUdfD0NqowaVvk0aCMu/ctZ2UsvnkYL28poJFo1Kj3LELgBOz c87rpqfcjF4GjbKT9ZuUN6KYuXl+aFYTnhwFhpKDHKRaEQ6fXgf2WPmA1uqbu1n0FvLM Bo3Fq5Tp7EUIqqUwv3ZwoW+EG4jxfNIujAKW5sd+ijaO1UWCKMW9qmXCFuEDBCPVEr+k lW/reRUwTLKkXxUG6fXgawSuF2wFcVpG2JLFTgMr/1gWUGSeuTLzWcL4WSyNX5gTH7UB reXC/ItJ+oMwXo1lvgk/GTZ6Jqkg07CUrd/nUnFKliWysMP+9LGxx6XsqDp9IFf9w1i3 PPCw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Ser7jWtDcXu6XDnqgTMfGuHo8apnNYy5px4T8oFGaWw=; b=PlbZ71yMs8AijALb0uCvXwWsH2ItZlShr5LlK7k9HdljKjdVl8yDMAQhC/Wsxnhv8f FGE4yb6uT4aI3cG87i0k0cLSgrkGcds9zjdDchM7fcWtyG2u6kSMITvsOROFyK8/WRwD xbQaueSLWGdrI9UdDnRKN0u378lahNOUiBFMntto4di4D84Qh7CkoaaQRt2WWLTa1uhC GNmnuhTvlpZV4DXvY/28szWZxLPUPOFumKpPTjfbobKa/cGCgTWAkz17Aon2B1Ug3Zci 2zkLhX47T9oCvm/vQf+oXnYDW6Nhhn2MGRbA432/SHOTJ8bmQlrmrYKJ/lcYPwnJs3gM wnWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MDamo/zr"; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l15-20020a170906794f00b007882926848bsi24861482ejo.818.2022.10.22.14.48.50; Sat, 22 Oct 2022 14:49:13 -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=@kernel.org header.s=k20201202 header.b="MDamo/zr"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229690AbiJVVqi (ORCPT + 99 others); Sat, 22 Oct 2022 17:46:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbiJVVqe (ORCPT ); Sat, 22 Oct 2022 17:46:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FDB41025 for ; Sat, 22 Oct 2022 14:46:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D791C60ABB for ; Sat, 22 Oct 2022 21:46:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42D02C433D7; Sat, 22 Oct 2022 21:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666475192; bh=OMqxGbhs6IW6+TTHrfUolLyZ69ETq76ct24yDkL2rOo=; h=From:To:Cc:Subject:Date:From; b=MDamo/zrdlDpG6RPEK82w1JhW4mRCSqbP6ra3YGavNICs3uUXGccAnU/u7gGSEzzJ VqhNfRBNeRituLobc2g9e/rXcal70oiRPddpebg9cAx3W/aPcpIBoKK7IPf3ZtvPf1 Fj7qrXIeIO9Gtt1V/a6nC/wDHcRQE3EEjQbuxl56xsY/pkH4nFK8wBhBs+1jb+032k rnU2NOVFJQWSN9NGdAImiysyWjadGbaY38aK7AnM/ZdCzVAv8VZlSfs2fdvA95fIXE bovjvDAwqXPb99tPeDYX4cFS/R2ZpuhiQ+P+ULkm7/qprKR9SXYAaRVBK88mjVhE6T +pNfJc8hIm1zA== From: Oded Gabbay To: David Airlie , Daniel Vetter , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jason Gunthorpe , John Hubbard , Alex Deucher Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Yuji Ishikawa , Jiho Chu , Daniel Stone , Tvrtko Ursulin , Jeffrey Hugo , Christoph Hellwig , Kevin Hilman , Jagan Teki , Jacek Lawrynowicz , Maciej Kwapulinski Subject: [RFC PATCH 0/3] new subsystem for compute accelerator devices Date: Sun, 23 Oct 2022 00:46:19 +0300 Message-Id: <20221022214622.18042-1-ogabbay@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747426059919029194?= X-GMAIL-MSGID: =?utf-8?q?1747426059919029194?= In the last couple of months we had a discussion [1] about creating a new subsystem for compute accelerator devices in the kernel. After an analysis that was done by DRM maintainers and myself, and following a BOF session at the Linux Plumbers conference a few weeks ago [2], we decided to create a new subsystem that will use the DRM subsystem's code and functionality. i.e. the accel core code will be part of the DRM subsystem. This will allow us to leverage the extensive DRM code-base and collaborate with DRM developers that have experience with this type of devices. In addition, new features that will be added for the accelerator drivers can be of use to GPU drivers as well (e.g. RAS). As agreed in the BOF session, the accelerator devices will be exposed to user-space with a new, dedicated device char files and a dedicated major number (261), to clearly separate them from graphic cards and the graphic user-space s/w stack. Furthermore, the drivers will be located in a separate place in the kernel tree (drivers/accel/). This series of patches is the first step in this direction as it adds the necessary infrastructure for accelerator devices to DRM. The new devices will be exposed with the following convention: device char files - /dev/accel/accel* sysfs - /sys/class/accel/accel*/ debugfs - /sys/kernel/debug/accel/accel*/ I tried to reuse the existing DRM code as much as possible, while keeping it readable and maintainable. One thing that is missing from this series is defining a namespace for the new accel subsystem, while I'll add in the next iteration of this patch-set, after I will receive feedback from the community. As for drivers, once this series will be accepted (after adding the namespace), I will start working on migrating the habanalabs driver to the new accel subsystem. I have talked about it with Dave and we agreed that it will be a good start to simply move the driver as-is with minimal changes, and then start working on the driver's individual features that will be either added to the accel core code (with or without changes), or will be removed and instead the driver will use existing DRM code. In addition, I know of at least 3 or 4 drivers that were submitted for review and are good candidates to be included in this new subsystem, instead of being a drm render node driver or a misc driver. [1] https://lkml.org/lkml/2022/7/31/83 [2] https://airlied.blogspot.com/2022/09/accelerators-bof-outcomes-summary.html Thanks, Oded Oded Gabbay (3): drivers/accel: add new kconfig and update MAINTAINERS drm: define new accel major and register it drm: add dedicated minor for accelerator devices Documentation/admin-guide/devices.txt | 5 + MAINTAINERS | 8 + drivers/Kconfig | 2 + drivers/accel/Kconfig | 24 +++ drivers/gpu/drm/drm_drv.c | 214 +++++++++++++++++++++----- drivers/gpu/drm/drm_file.c | 69 ++++++--- drivers/gpu/drm/drm_internal.h | 5 +- drivers/gpu/drm/drm_sysfs.c | 81 +++++++++- include/drm/drm_device.h | 3 + include/drm/drm_drv.h | 8 + include/drm/drm_file.h | 21 ++- include/drm/drm_ioctl.h | 1 + 12 files changed, 374 insertions(+), 67 deletions(-) create mode 100644 drivers/accel/Kconfig --- 2.34.1