From patchwork Mon Jan 9 11:55:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13093324 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 213B1C5479D for ; Mon, 9 Jan 2023 11:56:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0638110E3F2; Mon, 9 Jan 2023 11:56:53 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id EFDBC10E3F0; Mon, 9 Jan 2023 11:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=DBuZReBTswPUpkHGtl2GThMgMRVJ66ZxrpaQGAZnVao=; b=E2nqRunnNTEKP49fXvx5mrSzdm uOicFslGV8txjG1aQ+TvTc87jdArKo7GEgs6w3NgqGe5WlORziA7AW/i2b8yeq4b8C8Tz9fZ0UynV ZshJdUQO5oDsoW+Sv2sC0fztw66vSE5K/uRj5hc2crLK2LZAfFBo5EkOGlthVfGmM/f6/9JmFCdYK g15TrS/99d33DFJvmWxudTQeezBUaQvilXj/Z0Zz5aPwpuBTSJXbwaAhxxURLoLmw7o/44IaNVJaj +Jk5oZ1QAQobYOe8bNjxtQle6eKblF1Ttpw8DDgX5Wma/J3hiW4dxWPJqMiVz6bbwnNvIY979CZ4x nrJUNtSw==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pEqlW-003LkJ-1c; Mon, 09 Jan 2023 12:56:34 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: David Airlie , Daniel Vetter , Lucas Stach , Russell King , Christian Gmeiner , Emma Anholt , Alexey Brodkin , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Tomi Valkeinen Subject: [PATCH v2 1/7] drm/etnaviv: use new debugfs device-centered functions Date: Mon, 9 Jan 2023 08:55:15 -0300 Message-Id: <20230109115520.40088-2-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230109115520.40088-1-mcanal@igalia.com> References: <20230109115520.40088-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , Daniel Vetter , =?utf-8?q?Ma=C3=ADra_Canal?= , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Melissa Wen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_create_files() with the new drm_debugfs_add_files() function, which centers the debugfs files management on the drm_device instead of drm_minor. Moreover, remove the debugfs_init hook and add the debugfs files directly on etnaviv_bind(), before drm_dev_register(). Reviewed-by: Daniel Vetter Signed-off-by: Maíra Canal --- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 29 +++++++++++---------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c index 1d2b4fb4bcf8..2b265460672e 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c @@ -191,22 +191,22 @@ static int etnaviv_ring_show(struct etnaviv_gpu *gpu, struct seq_file *m) static int show_unlocked(struct seq_file *m, void *arg) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; int (*show)(struct drm_device *dev, struct seq_file *m) = - node->info_ent->data; + entry->file.data; return show(dev, m); } static int show_each_gpu(struct seq_file *m, void *arg) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; struct etnaviv_drm_private *priv = dev->dev_private; struct etnaviv_gpu *gpu; int (*show)(struct etnaviv_gpu *gpu, struct seq_file *m) = - node->info_ent->data; + entry->file.data; unsigned int i; int ret = 0; @@ -223,20 +223,13 @@ static int show_each_gpu(struct seq_file *m, void *arg) return ret; } -static struct drm_info_list etnaviv_debugfs_list[] = { +static struct drm_debugfs_info etnaviv_debugfs_list[] = { {"gpu", show_each_gpu, 0, etnaviv_gpu_debugfs}, {"gem", show_unlocked, 0, etnaviv_gem_show}, { "mm", show_unlocked, 0, etnaviv_mm_show }, {"mmu", show_each_gpu, 0, etnaviv_mmu_show}, {"ring", show_each_gpu, 0, etnaviv_ring_show}, }; - -static void etnaviv_debugfs_init(struct drm_minor *minor) -{ - drm_debugfs_create_files(etnaviv_debugfs_list, - ARRAY_SIZE(etnaviv_debugfs_list), - minor->debugfs_root, minor); -} #endif /* @@ -478,9 +471,6 @@ static const struct drm_driver etnaviv_drm_driver = { .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import_sg_table = etnaviv_gem_prime_import_sg_table, .gem_prime_mmap = drm_gem_prime_mmap, -#ifdef CONFIG_DEBUG_FS - .debugfs_init = etnaviv_debugfs_init, -#endif .ioctls = etnaviv_ioctls, .num_ioctls = DRM_ETNAVIV_NUM_IOCTLS, .fops = &fops, @@ -534,6 +524,11 @@ static int etnaviv_bind(struct device *dev) load_gpu(drm); +#ifdef CONFIG_DEBUG_FS + drm_debugfs_add_files(drm, etnaviv_debugfs_list, + ARRAY_SIZE(etnaviv_debugfs_list)); +#endif + ret = drm_dev_register(drm, 0); if (ret) goto out_unbind; From patchwork Mon Jan 9 11:55:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13093325 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8AED2C54EBD for ; Mon, 9 Jan 2023 11:56:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B1A410E3F0; Mon, 9 Jan 2023 11:56:56 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 361B510E3F1; Mon, 9 Jan 2023 11:56:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=LR2BmqUdwmoWBTz74beWCNgvi++bH5MdyHG+fcowqXI=; b=QQvI5nMAd8dVcIqOCFcuXgw7R9 1Q3kmAV9MWNTJKOeQqT6yAsCD00HSEfDcoaLng5Fz7YSofDEeljCjVJSIjD92i2urAH1QmxLWQQ80 HUuat5f0slPXaTRfLxKr/QKlAwr5t6Qd9BjfxXU4jjrUMpj2vQsfRHJ+42EBWcVmcObx1GrAnGgCg w5qQWM/IrTyvSS7xEjr9XBbVlgKNKoZa8s+ihfkbBIIIorj445ijm9c6Jm9NN0Q4cokhRFoRmGQHc Sh2anVJap3HVBG4NIxX+bCJP2YDfP+Lb4E+AmQmNYhitrYlruFgTwwRgY3xs2JbSZDh2XZFcz1gYH XYEN1lRA==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pEqlc-003LkJ-LI; Mon, 09 Jan 2023 12:56:41 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: David Airlie , Daniel Vetter , Lucas Stach , Russell King , Christian Gmeiner , Emma Anholt , Alexey Brodkin , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Tomi Valkeinen Subject: [PATCH v2 2/7] drm/pl111: use new debugfs device-centered functions Date: Mon, 9 Jan 2023 08:55:16 -0300 Message-Id: <20230109115520.40088-3-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230109115520.40088-1-mcanal@igalia.com> References: <20230109115520.40088-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , Daniel Vetter , =?utf-8?q?Ma=C3=ADra_Canal?= , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Melissa Wen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_create_files() with the new drm_debugfs_add_file() function, which centers the debugfs files management on the drm_device instead of drm_minor. Moreover, remove the debugfs_init hook and add the debugfs files directly on pl111_amba_probe(), before drm_dev_register(). Reviewed-by: Daniel Vetter Signed-off-by: Maíra Canal --- drivers/gpu/drm/pl111/Makefile | 4 ++-- drivers/gpu/drm/pl111/pl111_debugfs.c | 17 +++++------------ drivers/gpu/drm/pl111/pl111_drm.h | 2 +- drivers/gpu/drm/pl111/pl111_drv.c | 6 ++---- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/pl111/Makefile b/drivers/gpu/drm/pl111/Makefile index 67d430d433e0..8e4d53fdf314 100644 --- a/drivers/gpu/drm/pl111/Makefile +++ b/drivers/gpu/drm/pl111/Makefile @@ -1,9 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 pl111_drm-y += pl111_display.o \ pl111_versatile.o \ - pl111_drv.o + pl111_drv.o \ + pl111_debugfs.o pl111_drm-$(CONFIG_ARCH_NOMADIK) += pl111_nomadik.o -pl111_drm-$(CONFIG_DEBUG_FS) += pl111_debugfs.o obj-$(CONFIG_DRM_PL111) += pl111_drm.o diff --git a/drivers/gpu/drm/pl111/pl111_debugfs.c b/drivers/gpu/drm/pl111/pl111_debugfs.c index 6744fa16f464..d7cda31ceb2a 100644 --- a/drivers/gpu/drm/pl111/pl111_debugfs.c +++ b/drivers/gpu/drm/pl111/pl111_debugfs.c @@ -30,10 +30,10 @@ static const struct { REGDEF(CLCD_PL111_LCUR), }; -static int pl111_debugfs_regs(struct seq_file *m, void *unused) +static int __maybe_unused pl111_debugfs_regs(struct seq_file *m, void *unused) { - struct drm_info_node *node = (struct drm_info_node *)m->private; - struct drm_device *dev = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; struct pl111_drm_dev_private *priv = dev->dev_private; int i; @@ -46,14 +46,7 @@ static int pl111_debugfs_regs(struct seq_file *m, void *unused) return 0; } -static const struct drm_info_list pl111_debugfs_list[] = { - {"regs", pl111_debugfs_regs, 0}, -}; - -void -pl111_debugfs_init(struct drm_minor *minor) +void pl111_debugfs_init(struct drm_device *drm) { - drm_debugfs_create_files(pl111_debugfs_list, - ARRAY_SIZE(pl111_debugfs_list), - minor->debugfs_root, minor); + drm_debugfs_add_file(drm, "regs", pl111_debugfs_regs, NULL); } diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index 2a46b5bd8576..7fe74be917f1 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -157,6 +157,6 @@ struct pl111_drm_dev_private { int pl111_display_init(struct drm_device *dev); irqreturn_t pl111_irq(int irq, void *data); -void pl111_debugfs_init(struct drm_minor *minor); +void pl111_debugfs_init(struct drm_device *drm); #endif /* _PL111_DRM_H_ */ diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 00deba0b7271..c031eb4abc0d 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -228,10 +228,6 @@ static const struct drm_driver pl111_drm_driver = { .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import_sg_table = pl111_gem_import_sg_table, .gem_prime_mmap = drm_gem_prime_mmap, - -#if defined(CONFIG_DEBUG_FS) - .debugfs_init = pl111_debugfs_init, -#endif }; static int pl111_amba_probe(struct amba_device *amba_dev, @@ -304,6 +300,8 @@ static int pl111_amba_probe(struct amba_device *amba_dev, if (ret != 0) goto dev_put; + pl111_debugfs_init(drm); + ret = drm_dev_register(drm, 0); if (ret < 0) goto dev_put; From patchwork Mon Jan 9 11:55:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13093326 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CA7D1C54EBD for ; Mon, 9 Jan 2023 11:57:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E408410E3F4; Mon, 9 Jan 2023 11:56:59 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id D04D910E3F4; Mon, 9 Jan 2023 11:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7dSte2z1Mtl2v4PoQpzRSMquyCqk8sCGcS1bqRC+NmM=; b=IArct7bkaTCqF1aanZh1iKAr9D o0Ejbs1vdOEqIDGiqkPEXvKfiHOUkCrNhM4X2UjsHYwgEZx4Kgz4NzSIjbNZs6928IOQ87ZEk1ZtA qNjFhQkqIJ2HlbDqXQCdLspVbx9i3ufw3VxaOFhEZCwcAtZ/NLA/Boi2DWg/S2PpXzQtAjCCrMLF5 saSkbJvq03ieB+J/LWJdHIPyGUuBPvafT+NGZIABPJgY+JovVGUSC6Ndvuxu1Y3JPP7G6QKNjNiDU gw7rXVVbT9fMnsS82Z6T2vCbrpGikAElb6eq7vZTbnCnVAbr/kry7Gm1ljhApFD3Qs47Z7l2IhMy/ WsQgSXBw==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pEqlj-003LkJ-Bk; Mon, 09 Jan 2023 12:56:47 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: David Airlie , Daniel Vetter , Lucas Stach , Russell King , Christian Gmeiner , Emma Anholt , Alexey Brodkin , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Tomi Valkeinen Subject: [PATCH v2 3/7] drm/arc: use new debugfs device-centered functions Date: Mon, 9 Jan 2023 08:55:17 -0300 Message-Id: <20230109115520.40088-4-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230109115520.40088-1-mcanal@igalia.com> References: <20230109115520.40088-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , Daniel Vetter , =?utf-8?q?Ma=C3=ADra_Canal?= , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Melissa Wen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_create_files() with the new drm_debugfs_add_file() function, which centers the debugfs files management on the drm_device instead of drm_minor. Moreover, remove the debugfs_init hook and add the debugfs files directly on arcpgu_probe(), before drm_dev_register(). Reviewed-by: Daniel Vetter Signed-off-by: Maíra Canal Acked-by: Alexey Brodkin --- drivers/gpu/drm/tiny/arcpgu.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/tiny/arcpgu.c b/drivers/gpu/drm/tiny/arcpgu.c index 611bbee15071..88ceaf8c869c 100644 --- a/drivers/gpu/drm/tiny/arcpgu.c +++ b/drivers/gpu/drm/tiny/arcpgu.c @@ -335,11 +335,10 @@ static int arcpgu_unload(struct drm_device *drm) return 0; } -#ifdef CONFIG_DEBUG_FS -static int arcpgu_show_pxlclock(struct seq_file *m, void *arg) +static int __maybe_unused arcpgu_show_pxlclock(struct seq_file *m, void *arg) { - struct drm_info_node *node = (struct drm_info_node *)m->private; - struct drm_device *drm = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *drm = entry->dev; struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); unsigned long clkrate = clk_get_rate(arcpgu->clk); unsigned long mode_clock = arcpgu->pipe.crtc.mode.crtc_clock * 1000; @@ -349,18 +348,6 @@ static int arcpgu_show_pxlclock(struct seq_file *m, void *arg) return 0; } -static struct drm_info_list arcpgu_debugfs_list[] = { - { "clocks", arcpgu_show_pxlclock, 0 }, -}; - -static void arcpgu_debugfs_init(struct drm_minor *minor) -{ - drm_debugfs_create_files(arcpgu_debugfs_list, - ARRAY_SIZE(arcpgu_debugfs_list), - minor->debugfs_root, minor); -} -#endif - static const struct drm_driver arcpgu_drm_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC, .name = "arcpgu", @@ -371,9 +358,6 @@ static const struct drm_driver arcpgu_drm_driver = { .patchlevel = 0, .fops = &arcpgu_drm_ops, DRM_GEM_DMA_DRIVER_OPS, -#ifdef CONFIG_DEBUG_FS - .debugfs_init = arcpgu_debugfs_init, -#endif }; static int arcpgu_probe(struct platform_device *pdev) @@ -390,6 +374,8 @@ static int arcpgu_probe(struct platform_device *pdev) if (ret) return ret; + drm_debugfs_add_file(&arcpgu->drm, "clocks", arcpgu_show_pxlclock, NULL); + ret = drm_dev_register(&arcpgu->drm, 0); if (ret) goto err_unload; From patchwork Mon Jan 9 11:55:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13093327 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 84A0EC54EBD for ; Mon, 9 Jan 2023 11:57:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A41A10E3EF; Mon, 9 Jan 2023 11:57:05 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0025910E3F5; Mon, 9 Jan 2023 11:57:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=pqrbe98U4HcSnwGLvvhdazB5yysESNupfHxO+pMz1ZE=; b=KflhDs1qTn+6jqSQ7LoZsd4D66 RaIDI2FJDtyIH+qyWjDgFL+n0lNV6A90P1yTN67+LqKHF/nipmohwrSKL7SRcf7Ht+0CMmT3BlbeN VH8QxjQoM5ikIsOEVyzeMGAobyBLkNJiy9x8ODjXKXveBeXKJY3Xu69WkhvmszHUqlV2ut6141i6A SHyf7CCv4H/1y4reB8pLulGB7eJ5xDlH2BL3lBjCChj5pEnwrVA8hHTPX+Vmy5DwEDp9yaDBJdNko sXuiZUlBM/xf4Skibb4reNUcLdulO4t6oxAhdJ6IG/d3Eks14VSaATkc/ghktyZZq1dMGcCUg6ULU PzYD7uCg==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pEqlp-003LkJ-QR; Mon, 09 Jan 2023 12:56:54 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: David Airlie , Daniel Vetter , Lucas Stach , Russell King , Christian Gmeiner , Emma Anholt , Alexey Brodkin , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Tomi Valkeinen Subject: [PATCH v2 4/7] drm/virtio: use new debugfs device-centered functions Date: Mon, 9 Jan 2023 08:55:18 -0300 Message-Id: <20230109115520.40088-5-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230109115520.40088-1-mcanal@igalia.com> References: <20230109115520.40088-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , Daniel Vetter , =?utf-8?q?Ma=C3=ADra_Canal?= , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Melissa Wen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_create_files() with the new drm_debugfs_add_files() function, which centers the debugfs files management on the drm_device instead of drm_minor. Moreover, remove the debugfs_init hook and add the debugfs files directly on virtio_gpu_probe(), before drm_dev_register(). Reviewed-by: Daniel Vetter Signed-off-by: Maíra Canal --- drivers/gpu/drm/virtio/virtgpu_debugfs.c | 17 +++++++---------- drivers/gpu/drm/virtio/virtgpu_drv.c | 5 ++--- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c b/drivers/gpu/drm/virtio/virtgpu_debugfs.c index 853dd9aa397e..91c81b7429cc 100644 --- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c +++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c @@ -68,8 +68,8 @@ static int virtio_gpu_features(struct seq_file *m, void *data) static int virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct virtio_gpu_device *vgdev = node->minor->dev->dev_private; + struct drm_debugfs_entry *entry = m->private; + struct virtio_gpu_device *vgdev = entry->dev->dev_private; seq_printf(m, "fence %llu %lld\n", (u64)atomic64_read(&vgdev->fence_drv.last_fence_id), @@ -80,8 +80,8 @@ virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data) static int virtio_gpu_debugfs_host_visible_mm(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *)m->private; - struct virtio_gpu_device *vgdev = node->minor->dev->dev_private; + struct drm_debugfs_entry *entry = m->private; + struct virtio_gpu_device *vgdev = entry->dev->dev_private; struct drm_printer p; if (!vgdev->has_host_visible) { @@ -94,7 +94,7 @@ virtio_gpu_debugfs_host_visible_mm(struct seq_file *m, void *data) return 0; } -static struct drm_info_list virtio_gpu_debugfs_list[] = { +static struct drm_debugfs_info virtio_gpu_debugfs_list[] = { { "virtio-gpu-features", virtio_gpu_features }, { "virtio-gpu-irq-fence", virtio_gpu_debugfs_irq_info, 0, NULL }, { "virtio-gpu-host-visible-mm", virtio_gpu_debugfs_host_visible_mm }, @@ -102,10 +102,7 @@ static struct drm_info_list virtio_gpu_debugfs_list[] = { #define VIRTIO_GPU_DEBUGFS_ENTRIES ARRAY_SIZE(virtio_gpu_debugfs_list) -void -virtio_gpu_debugfs_init(struct drm_minor *minor) +void virtio_gpu_debugfs_init(struct drm_device *drm) { - drm_debugfs_create_files(virtio_gpu_debugfs_list, - VIRTIO_GPU_DEBUGFS_ENTRIES, - minor->debugfs_root, minor); + drm_debugfs_add_files(drm, virtio_gpu_debugfs_list, VIRTIO_GPU_DEBUGFS_ENTRIES); } diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c index ae97b98750b6..83aa77e5893b 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.c +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c @@ -98,6 +98,8 @@ static int virtio_gpu_probe(struct virtio_device *vdev) if (ret) goto err_free; + virtio_gpu_debugfs_init(dev); + ret = drm_dev_register(dev, 0); if (ret) goto err_deinit; @@ -179,9 +181,6 @@ static const struct drm_driver driver = { .dumb_create = virtio_gpu_mode_dumb_create, .dumb_map_offset = virtio_gpu_mode_dumb_mmap, -#if defined(CONFIG_DEBUG_FS) - .debugfs_init = virtio_gpu_debugfs_init, -#endif .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_mmap = drm_gem_prime_mmap, diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index af6ffb696086..fe90f0959063 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -472,7 +472,7 @@ struct drm_gem_object *virtgpu_gem_prime_import_sg_table( struct sg_table *sgt); /* virtgpu_debugfs.c */ -void virtio_gpu_debugfs_init(struct drm_minor *minor); +void virtio_gpu_debugfs_init(struct drm_device *drm); /* virtgpu_vram.c */ bool virtio_gpu_is_vram(struct virtio_gpu_object *bo); From patchwork Mon Jan 9 11:55:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13093328 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BC2E9C54EBD for ; Mon, 9 Jan 2023 11:57:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3F6010E3F6; Mon, 9 Jan 2023 11:57:13 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id CD77810E3F3; Mon, 9 Jan 2023 11:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=mwzmuGewpPnBlRUr/pGR8Yzj8U861U0BaTPqsZjVx9E=; b=f/5w/VWD88b0R8s0AxKtI3kFhq IRmtBI+NBFL3zQd4kH19/sP2Hq4INDVDmTtddGLMx7OuURKtEmz74qYf8ZQntzRS4gXEOvDRyXotV RtK71k1q+xoiTLoBZYnmbY6DK932KkN6j83hYYssPAxSWZIw/X+1m1SSSQgZdp8EhanCS1m8uC+nN rnnN0pnQk5gk8yd4t57wXV5uw3TL5TRG3SFViMhY6PRjdHQ0YUxmE/VAtVTkI9WlZaxzPk5RT0rCa MrQwGeYHDzoOCbtgj/LIbbeEYdF2p1ujZlW/ZSVaFjEWpIBuH0RFxQoxiKULD0KIxBV66G48vK0hC 6GgIZMlQ==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pEqlw-003LkJ-5F; Mon, 09 Jan 2023 12:57:00 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: David Airlie , Daniel Vetter , Lucas Stach , Russell King , Christian Gmeiner , Emma Anholt , Alexey Brodkin , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Tomi Valkeinen Subject: [PATCH v2 5/7] drm/omap: use new debugfs device-centered functions Date: Mon, 9 Jan 2023 08:55:19 -0300 Message-Id: <20230109115520.40088-6-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230109115520.40088-1-mcanal@igalia.com> References: <20230109115520.40088-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , Daniel Vetter , =?utf-8?q?Ma=C3=ADra_Canal?= , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Melissa Wen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_create_files() with the new drm_debugfs_add_files() function, which centers the debugfs files management on the drm_device instead of drm_minor. Moreover, remove the debugfs_init hook and add the debugfs files directly on omapdrm_init(), before drm_dev_register(). Reviewed-by: Daniel Vetter Signed-off-by: Maíra Canal --- drivers/gpu/drm/omapdrm/omap_debugfs.c | 29 +++++++++----------------- drivers/gpu/drm/omapdrm/omap_drv.c | 7 ++++--- drivers/gpu/drm/omapdrm/omap_drv.h | 2 +- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_debugfs.c b/drivers/gpu/drm/omapdrm/omap_debugfs.c index bfb2ccb40bd1..491aa74eb2ec 100644 --- a/drivers/gpu/drm/omapdrm/omap_debugfs.c +++ b/drivers/gpu/drm/omapdrm/omap_debugfs.c @@ -19,8 +19,8 @@ static int gem_show(struct seq_file *m, void *arg) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; struct omap_drm_private *priv = dev->dev_private; seq_printf(m, "All Objects:\n"); @@ -33,8 +33,8 @@ static int gem_show(struct seq_file *m, void *arg) static int mm_show(struct seq_file *m, void *arg) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; struct drm_printer p = drm_seq_file_printer(m); drm_mm_print(&dev->vma_offset_manager->vm_addr_space_mm, &p); @@ -45,8 +45,8 @@ static int mm_show(struct seq_file *m, void *arg) #ifdef CONFIG_DRM_FBDEV_EMULATION static int fb_show(struct seq_file *m, void *arg) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct drm_device *dev = node->minor->dev; + struct drm_debugfs_entry *entry = m->private; + struct drm_device *dev = entry->dev; struct omap_drm_private *priv = dev->dev_private; struct drm_framebuffer *fb; @@ -68,7 +68,7 @@ static int fb_show(struct seq_file *m, void *arg) #endif /* list of debufs files that are applicable to all devices */ -static struct drm_info_list omap_debugfs_list[] = { +static struct drm_debugfs_info omap_debugfs_list[] = { {"gem", gem_show, 0}, {"mm", mm_show, 0}, #ifdef CONFIG_DRM_FBDEV_EMULATION @@ -76,21 +76,12 @@ static struct drm_info_list omap_debugfs_list[] = { #endif }; -/* list of debugfs files that are specific to devices with dmm/tiler */ -static struct drm_info_list omap_dmm_debugfs_list[] = { - {"tiler_map", tiler_map_show, 0}, -}; - -void omap_debugfs_init(struct drm_minor *minor) +void omap_debugfs_init(struct drm_device *drm) { - drm_debugfs_create_files(omap_debugfs_list, - ARRAY_SIZE(omap_debugfs_list), - minor->debugfs_root, minor); + drm_debugfs_add_files(drm, omap_debugfs_list, ARRAY_SIZE(omap_debugfs_list)); if (dmm_is_available()) - drm_debugfs_create_files(omap_dmm_debugfs_list, - ARRAY_SIZE(omap_dmm_debugfs_list), - minor->debugfs_root, minor); + drm_debugfs_add_file(drm, "tiler_map", tiler_map_show, NULL); } #endif diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 699ed814e021..0565401e767f 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -653,9 +653,6 @@ static const struct drm_driver omap_drm_driver = { DRIVER_ATOMIC | DRIVER_RENDER, .open = dev_open, .lastclose = drm_fb_helper_lastclose, -#ifdef CONFIG_DEBUG_FS - .debugfs_init = omap_debugfs_init, -#endif .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import = omap_gem_prime_import, @@ -743,6 +740,10 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) omap_fbdev_init(ddev); +#ifdef CONFIG_DEBUG_FS + omap_debugfs_init(ddev); +#endif + drm_kms_helper_poll_init(ddev); /* diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index 825960fd3ea9..1e0d9e10cd6b 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -103,7 +103,7 @@ struct omap_drm_private { }; -void omap_debugfs_init(struct drm_minor *minor); +void omap_debugfs_init(struct drm_device *drm); struct omap_global_state * __must_check omap_get_global_state(struct drm_atomic_state *s); From patchwork Mon Jan 9 11:55:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13093329 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4CC17C5479D for ; Mon, 9 Jan 2023 11:57:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8FF7B10E3F7; Mon, 9 Jan 2023 11:57:20 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 930C510E3F5; Mon, 9 Jan 2023 11:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=V2Sga8W8H54grHYU1BZudixfV9fBRbe1j67/AT8fq7g=; b=Pt14+87EfHwxIH7IcP38Lua8rp 1JQnsZIvA5TMNFchtpINI0xBmoDgmD13yrpJmP3CIN4JwyNTsjMAvZ8mjrvPirrccIpKrfaW7Qs9a so88dwuw/NoUW1lGc9d/hTL7M1k1JwK1E4rM8Wi86AXtlQpv0wvIP4fPOSfsVfuSLyYwOOB4kL0LN ZHoRr0R80L7khbVqUdzqQOGvzumxQWIsa0JmtZsaIIsqvUrYSX6GqGWz0vo/gs61r4wZy/3pb3fpO n9uN3nmVzw3J2M4FiMeLyJY+WcAdB1uvSgqXhcrOmomcYfrkYE453P2TBEMDHMBsRkm3eU3H8rLYM PUELLu5g==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pEqm2-003LkJ-Gj; Mon, 09 Jan 2023 12:57:07 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: David Airlie , Daniel Vetter , Lucas Stach , Russell King , Christian Gmeiner , Emma Anholt , Alexey Brodkin , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Tomi Valkeinen Subject: [PATCH v2 6/7] drm/qxl: remove unused debugfs structure Date: Mon, 9 Jan 2023 08:55:20 -0300 Message-Id: <20230109115520.40088-7-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230109115520.40088-1-mcanal@igalia.com> References: <20230109115520.40088-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , Daniel Vetter , =?utf-8?q?Ma=C3=ADra_Canal?= , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Melissa Wen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current debugfs structure was introduced at commit f64122c1f6ad ("drm: add new QXL driver. (v1.4)") and it was never used by the driver. Considering the addition of more device-centered functions to the DRM core, remove the current debugfs structure. Reviewed-by: Daniel Vetter Signed-off-by: Maíra Canal --- drivers/gpu/drm/qxl/qxl_debugfs.c | 29 ----------------------------- drivers/gpu/drm/qxl/qxl_drv.h | 20 -------------------- 2 files changed, 49 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c b/drivers/gpu/drm/qxl/qxl_debugfs.c index 2d9ed3b94574..bdfce1a8f006 100644 --- a/drivers/gpu/drm/qxl/qxl_debugfs.c +++ b/drivers/gpu/drm/qxl/qxl_debugfs.c @@ -95,32 +95,3 @@ qxl_debugfs_init(struct drm_minor *minor) qxl_ttm_debugfs_init(dev); #endif } - -void qxl_debugfs_add_files(struct qxl_device *qdev, - struct drm_info_list *files, - unsigned int nfiles) -{ - unsigned int i; - - for (i = 0; i < qdev->debugfs_count; i++) { - if (qdev->debugfs[i].files == files) { - /* Already registered */ - return; - } - } - - i = qdev->debugfs_count + 1; - if (i > QXL_DEBUGFS_MAX_COMPONENTS) { - DRM_ERROR("Reached maximum number of debugfs components.\n"); - DRM_ERROR("Report so we increase QXL_DEBUGFS_MAX_COMPONENTS.\n"); - return; - } - qdev->debugfs[qdev->debugfs_count].files = files; - qdev->debugfs[qdev->debugfs_count].num_files = nfiles; - qdev->debugfs_count = i; -#if defined(CONFIG_DEBUG_FS) - drm_debugfs_create_files(files, nfiles, - qdev->ddev.primary->debugfs_root, - qdev->ddev.primary); -#endif -} diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index ea993d7162e8..0868d5d2a839 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -60,8 +60,6 @@ struct iosys_map; #define DRIVER_MINOR 1 #define DRIVER_PATCHLEVEL 0 -#define QXL_DEBUGFS_MAX_COMPONENTS 32 - extern int qxl_num_crtc; #define QXL_INTERRUPT_MASK (\ @@ -165,14 +163,6 @@ struct qxl_drm_image { struct list_head chunk_list; }; -/* - * Debugfs - */ -struct qxl_debugfs { - struct drm_info_list *files; - unsigned int num_files; -}; - struct qxl_device { struct drm_device ddev; @@ -228,10 +218,6 @@ struct qxl_device { wait_queue_head_t io_cmd_event; struct work_struct client_monitors_config_work; - /* debugfs */ - struct qxl_debugfs debugfs[QXL_DEBUGFS_MAX_COMPONENTS]; - unsigned int debugfs_count; - struct mutex update_area_mutex; struct idr surf_id_idr; @@ -256,8 +242,6 @@ struct qxl_device { #define to_qxl(dev) container_of(dev, struct qxl_device, ddev) -int qxl_debugfs_fence_init(struct qxl_device *rdev); - int qxl_device_init(struct qxl_device *qdev, struct pci_dev *pdev); void qxl_device_fini(struct qxl_device *qdev); @@ -430,10 +414,6 @@ void qxl_gem_prime_vunmap(struct drm_gem_object *obj, /* qxl_irq.c */ int qxl_irq_init(struct qxl_device *qdev); -void qxl_debugfs_add_files(struct qxl_device *qdev, - struct drm_info_list *files, - unsigned int nfiles); - int qxl_surface_id_alloc(struct qxl_device *qdev, struct qxl_bo *surf); void qxl_surface_id_dealloc(struct qxl_device *qdev, From patchwork Mon Jan 9 11:55:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 13093330 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C85ACC54EBD for ; Mon, 9 Jan 2023 11:57:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D76F910E3F8; Mon, 9 Jan 2023 11:57:25 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6DA7510E3F8; Mon, 9 Jan 2023 11:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=+g9FzGLxnzT1FKDArCdNffS+SgvDZ0w4DX89TYpKeAM=; b=pEFOz+rEU0BOR3jdla+myI1BIa Wd/QuANkdR2hZ8aWG9epHuu5HrjbM98GFHTfpPIugZ8GF+WrtH09q2CKfaH9LJxZlzu7Rmr0puK5p 4SOerCnY7QZCyOxZM1lxNVsShPggRa02QZpiS7tTGJhtv8tXDdo6YimBWVGji6T259nIxEU3DyJt7 p3P5lb7mz6z7k6tkQ31JHDPFUqr4DWqnTmrcbozKKOZm0ZTK8OXy6+ekNyF76Fr2hPne7Hh70nuod vkSqeYfdtjvvHDVDlUwN4Yocr8g0ZuVNIsDqXBLFaij+FMmcaEPBDKkV9PwpYlYb2HIziKEyn1xt6 8TL059eQ==; Received: from [187.36.234.139] (helo=bowie..) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1pEqm9-003LkJ-5N; Mon, 09 Jan 2023 12:57:13 +0100 From: =?utf-8?q?Ma=C3=ADra_Canal?= To: David Airlie , Daniel Vetter , Lucas Stach , Russell King , Christian Gmeiner , Emma Anholt , Alexey Brodkin , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Tomi Valkeinen Subject: [PATCH v2 7/7] drm/qxl: use new debugfs device-centered functions Date: Mon, 9 Jan 2023 08:55:21 -0300 Message-Id: <20230109115520.40088-8-mcanal@igalia.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230109115520.40088-1-mcanal@igalia.com> References: <20230109115520.40088-1-mcanal@igalia.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Andr=C3=A9_Almeida?= , Daniel Vetter , =?utf-8?q?Ma=C3=ADra_Canal?= , etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Melissa Wen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace the use of drm_debugfs_create_files() with the new drm_debugfs_add_files() function, which centers the debugfs files management on the drm_device instead of drm_minor. Moreover, remove the debugfs_init hook and add the debugfs files directly on qxl_pci_probe(), before drm_dev_register(). Reviewed-by: Daniel Vetter Signed-off-by: Maíra Canal --- drivers/gpu/drm/qxl/qxl_debugfs.c | 26 ++++++++++---------------- drivers/gpu/drm/qxl/qxl_drv.c | 5 ++--- drivers/gpu/drm/qxl/qxl_drv.h | 2 +- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c b/drivers/gpu/drm/qxl/qxl_debugfs.c index bdfce1a8f006..c33f1f37dca0 100644 --- a/drivers/gpu/drm/qxl/qxl_debugfs.c +++ b/drivers/gpu/drm/qxl/qxl_debugfs.c @@ -34,12 +34,11 @@ #include "qxl_drv.h" #include "qxl_object.h" -#if defined(CONFIG_DEBUG_FS) -static int +static int __maybe_unused qxl_debugfs_irq_received(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct qxl_device *qdev = to_qxl(node->minor->dev); + struct drm_debugfs_entry *entry = m->private; + struct qxl_device *qdev = to_qxl(entry->dev); seq_printf(m, "%d\n", atomic_read(&qdev->irq_received)); seq_printf(m, "%d\n", atomic_read(&qdev->irq_received_display)); @@ -49,11 +48,11 @@ qxl_debugfs_irq_received(struct seq_file *m, void *data) return 0; } -static int +static int __maybe_unused qxl_debugfs_buffers_info(struct seq_file *m, void *data) { - struct drm_info_node *node = (struct drm_info_node *) m->private; - struct qxl_device *qdev = to_qxl(node->minor->dev); + struct drm_debugfs_entry *entry = m->private; + struct qxl_device *qdev = to_qxl(entry->dev); struct qxl_bo *bo; list_for_each_entry(bo, &qdev->gem.objects, list) { @@ -76,22 +75,17 @@ qxl_debugfs_buffers_info(struct seq_file *m, void *data) return 0; } -static struct drm_info_list qxl_debugfs_list[] = { +static struct drm_debugfs_info qxl_debugfs_list[] = { { "irq_received", qxl_debugfs_irq_received, 0, NULL }, { "qxl_buffers", qxl_debugfs_buffers_info, 0, NULL }, }; #define QXL_DEBUGFS_ENTRIES ARRAY_SIZE(qxl_debugfs_list) -#endif -void -qxl_debugfs_init(struct drm_minor *minor) +void qxl_debugfs_init(struct drm_device *drm) { -#if defined(CONFIG_DEBUG_FS) - struct qxl_device *dev = to_qxl(minor->dev); + struct qxl_device *dev = to_qxl(drm); - drm_debugfs_create_files(qxl_debugfs_list, QXL_DEBUGFS_ENTRIES, - minor->debugfs_root, minor); + drm_debugfs_add_files(drm, qxl_debugfs_list, QXL_DEBUGFS_ENTRIES); qxl_ttm_debugfs_init(dev); -#endif } diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c index a3b83f89e061..3ae2db78f671 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.c +++ b/drivers/gpu/drm/qxl/qxl_drv.c @@ -116,6 +116,8 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (ret) goto unload; + qxl_debugfs_init(&qdev->ddev); + drm_kms_helper_poll_init(&qdev->ddev); /* Complete initialization. */ @@ -287,9 +289,6 @@ static struct drm_driver qxl_driver = { .dumb_create = qxl_mode_dumb_create, .dumb_map_offset = drm_gem_ttm_dumb_map_offset, -#if defined(CONFIG_DEBUG_FS) - .debugfs_init = qxl_debugfs_init, -#endif .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import_sg_table = qxl_gem_prime_import_sg_table, diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index 0868d5d2a839..cb84a3bebcec 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h @@ -397,7 +397,7 @@ int qxl_garbage_collect(struct qxl_device *qdev); /* debugfs */ -void qxl_debugfs_init(struct drm_minor *minor); +void qxl_debugfs_init(struct drm_device *drm); void qxl_ttm_debugfs_init(struct qxl_device *qdev); /* qxl_prime.c */