Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp21385109rwd; Thu, 29 Jun 2023 15:31:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlEL7oAmsnUbjT/3qoXWBICclNdTwgN89xCsDk+I2nfz34v9F5Z1qJEedh0ExXLRDXWYEvNa X-Received: by 2002:a17:902:d4ca:b0:1b4:5699:aac1 with SMTP id o10-20020a170902d4ca00b001b45699aac1mr1517834plg.12.1688077867909; Thu, 29 Jun 2023 15:31:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688077867; cv=none; d=google.com; s=arc-20160816; b=cRBhNSOTeFHD7nUm9PPeA+iojbOzNdnlec5lAU/sSL7hdV/o41HW+Y88JWyaa5Hrde PpaSziIzQf+MgC9tvodV94CYLqNE9XfUT4lZvc+2UYCLSL8swG7j+ETYjM23KZiXJh2b 0oCPfYIzfbIxp80vezM10QmJ0AmTiOjqG0ZR1GFkh7GN/ZVYELCg3UMdbYOxNp9nyjBt /+LbMGnKDXPsgT3zBNCPZVJrzzMOGHDdQierZDbd55miCNjPOiV2rctQaLXGipD9jdCC tbG32K4a0vmudz/LwrbXhtdka3nDkWDxLYrOZZUohKn8zfLtdDkvuz2Yt6G54ErfGWNp XASQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VFFV/4pnGfS5xOgVl1lU4W1qf1MMs0lzrapLnGgOEpU=; fh=oJWNLif5KU//MMAojej1FrucSdQl6qHWc24CaRte2H4=; b=MWSCAgpU+OEdZL0yoTlAZPv3pDxaYC0k/VO9+u1yNcVGCyXkP6kp8Xfsprob9yDVJ2 SMI/pQfiqy+VSFjnJpUt/hfYEsmESsKrDv2y7zkfWD2oLTQdJcpUBIaIWfMiKUwf6joI C5QFGUKPkZrQ+kTBCjyUv/hrpha0pSoNvAn+uYolXGmxth2gT3cpNwfioeHnwUwa80Ny ZUkvGG/ik9Uf8GC5lrDrFTgAJnWezjAcmMeWLxhDszstfJ9VOEAB6hIetWkddFYhU1Yf 0UKCE+F5Y/uGPPLmzBDrYkKY4S0y8b4SEHeAmOfpI2eYsKcuOO3h9Y/IhJaSOQFTtsUP XKqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="QOe/kSWH"; 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 e3-20020a170902f10300b001b7f9862cdfsi8752154plb.257.2023.06.29.15.30.53; Thu, 29 Jun 2023 15:31:07 -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="QOe/kSWH"; 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 S232444AbjF2W3v (ORCPT + 99 others); Thu, 29 Jun 2023 18:29:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232200AbjF2W3N (ORCPT ); Thu, 29 Jun 2023 18:29:13 -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 51E433A89 for ; Thu, 29 Jun 2023 15:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688077673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VFFV/4pnGfS5xOgVl1lU4W1qf1MMs0lzrapLnGgOEpU=; b=QOe/kSWHa1KAhC5cFXz4CU4t6nSGIzKzeiRrmhMk3Cj844psaD9wepZbGHXgRIZxOUiQpb iQWajvkN7uQYItXcvZoMSyM67EB8y/yjlH6YfMtyBx0OXJQ99JYq5P7oXu2sp2jFa1hdu6 5EssJnIJHEpZxEK3NbQCftjT1PnXfqY= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-166-LXuHOmlTOZCmlaa3zGl9PA-1; Thu, 29 Jun 2023 18:27:52 -0400 X-MC-Unique: LXuHOmlTOZCmlaa3zGl9PA-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-3fb40ec952bso7290435e9.0 for ; Thu, 29 Jun 2023 15:27:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688077671; x=1690669671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VFFV/4pnGfS5xOgVl1lU4W1qf1MMs0lzrapLnGgOEpU=; b=SO7tznnxaC8ErVujCDUSXXblLZxki1HF/2SUFCJtBBDUnnUe8NF17XJfTot7eMUiOm An+yQ9AP4SL9Q9Eu5YSkMwKXS3We55e6cC3tqGmmBNqJQ9ZLRlS0Az2djHYLA7bOw5oD 4X75oeQLRyj3dt8FpIS38o3AUBe5katfNCBH+FE/GuXezYi+b3XNR40sDA9qB0ulPI6f sLNh05txqOLpl1mKmLd7hetvaq7l8d2oDH2KATeRSnnOKHhOlTGi0u4nx7/NIyF6K/qi 3k9o250X9rHXy1BX55cnpSrO8WdoYv7Wkh3mg7OeAnb3gQ1THnEdDVXka6aZNe5pwL50 xvxw== X-Gm-Message-State: AC+VfDw1cxXmvZH+xzQx8++aCUDcVqA99IDh62u6qO1WOBiOQ7udUCJn 5xZCG/SYWbn2tlp2dnaQI45aZF+MHKIpL6hMma2LGSsYelGxOznavMa/3SQn3oxJgt4f5zkCbWn fOl3h8tM/ovTYZ1A1ifn5MW16 X-Received: by 2002:a1c:7918:0:b0:3fa:abd8:fcc4 with SMTP id l24-20020a1c7918000000b003faabd8fcc4mr550310wme.35.1688077671212; Thu, 29 Jun 2023 15:27:51 -0700 (PDT) X-Received: by 2002:a1c:7918:0:b0:3fa:abd8:fcc4 with SMTP id l24-20020a1c7918000000b003faabd8fcc4mr550301wme.35.1688077671037; Thu, 29 Jun 2023 15:27:51 -0700 (PDT) Received: from cassiopeiae.. ([2a02:810d:4b3f:de9c:642:1aff:fe31:a19f]) by smtp.gmail.com with ESMTPSA id p23-20020a1c7417000000b003f9b0f640b1sm17419090wmc.22.2023.06.29.15.27.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jun 2023 15:27:50 -0700 (PDT) From: Danilo Krummrich To: airlied@gmail.com, daniel@ffwll.ch, tzimmermann@suse.de, mripard@kernel.org, corbet@lwn.net, christian.koenig@amd.com, bskeggs@redhat.com, Liam.Howlett@oracle.com, matthew.brost@intel.com, boris.brezillon@collabora.com, alexdeucher@gmail.com, ogabbay@kernel.org, bagasdotme@gmail.com, willy@infradead.org, jason@jlekstrand.net Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Danilo Krummrich Subject: [PATCH drm-next v6 13/13] drm/nouveau: debugfs: implement DRM GPU VA debugfs Date: Fri, 30 Jun 2023 00:25:29 +0200 Message-ID: <20230629222651.3196-14-dakr@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230629222651.3196-1-dakr@redhat.com> References: <20230629222651.3196-1-dakr@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 Provide the driver indirection iterating over all DRM GPU VA spaces to enable the common 'gpuvas' debugfs file for dumping DRM GPU VA spaces. Signed-off-by: Danilo Krummrich --- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c index 99d022a91afc..053f703f2f68 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c @@ -203,6 +203,44 @@ nouveau_debugfs_pstate_open(struct inode *inode, struct file *file) return single_open(file, nouveau_debugfs_pstate_get, inode->i_private); } +static void +nouveau_debugfs_gpuva_regions(struct seq_file *m, struct nouveau_uvmm *uvmm) +{ + MA_STATE(mas, &uvmm->region_mt, 0, 0); + struct nouveau_uvma_region *reg; + + seq_puts (m, " VA regions | start | range | end \n"); + seq_puts (m, "----------------------------------------------------------------------------\n"); + mas_for_each(&mas, reg, ULONG_MAX) + seq_printf(m, " | 0x%016llx | 0x%016llx | 0x%016llx\n", + reg->va.addr, reg->va.range, reg->va.addr + reg->va.range); +} + +static int +nouveau_debugfs_gpuva(struct seq_file *m, void *data) +{ + struct drm_info_node *node = (struct drm_info_node *) m->private; + struct nouveau_drm *drm = nouveau_drm(node->minor->dev); + struct nouveau_cli *cli; + + mutex_lock(&drm->clients_lock); + list_for_each_entry(cli, &drm->clients, head) { + struct nouveau_uvmm *uvmm = nouveau_cli_uvmm(cli); + + if (!uvmm) + continue; + + nouveau_uvmm_lock(uvmm); + drm_debugfs_gpuva_info(m, &uvmm->umgr); + seq_puts(m, "\n"); + nouveau_debugfs_gpuva_regions(m, uvmm); + nouveau_uvmm_unlock(uvmm); + } + mutex_unlock(&drm->clients_lock); + + return 0; +} + static const struct file_operations nouveau_pstate_fops = { .owner = THIS_MODULE, .open = nouveau_debugfs_pstate_open, @@ -214,6 +252,7 @@ static const struct file_operations nouveau_pstate_fops = { static struct drm_info_list nouveau_debugfs_list[] = { { "vbios.rom", nouveau_debugfs_vbios_image, 0, NULL }, { "strap_peek", nouveau_debugfs_strap_peek, 0, NULL }, + DRM_DEBUGFS_GPUVA_INFO(nouveau_debugfs_gpuva, NULL), }; #define NOUVEAU_DEBUGFS_ENTRIES ARRAY_SIZE(nouveau_debugfs_list) -- 2.41.0