Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp1415836rwp; Thu, 13 Jul 2023 10:28:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlHSdM3/p49PmcgFcqO9215sAhgBrcjBGOmTe/9bDkiTz2P5fPq4pGdE5sIDuxQIoFw/VS+M X-Received: by 2002:a9d:61d9:0:b0:6b7:5c4:42e9 with SMTP id h25-20020a9d61d9000000b006b705c442e9mr2289166otk.36.1689269306001; Thu, 13 Jul 2023 10:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689269305; cv=none; d=google.com; s=arc-20160816; b=wNx4mfBeR0yfLaAxCVvHdFrpmD7jWGqjZ9Bt2tOEyyrIJvZZbqeHeBJzH0VEu7Irhq z4N1cbcMpo0DvbNk5znudKyGp2aBT75O7AlmioXN0K5eC6eIgok76FZq+U9L01L/WjCw lSFMoKTfmv+PkWpvmqh0OqY81R+hfuDwgeYSf4QpJqVfgBX7CZshBvgm5OTe6qZGULgC euCQhr3GYPwJkzhAydG3nC7s/jp+UQVN2rMoZlEhtY4aDCObmiXQMQixivTyG/FvUCQJ Gmk3GKhCnr7hm5940+nyK6jmH4trEC3jZ08jjgYp3eIyDIq/L8w+huEaR6QJpG9KE8ix vKXQ== 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=grh6qrjW0oxu0S8zfHJMhxWLgUXiZ/TU2uoVe6KOi4w=; b=PwsOHWO7mB3J99S2gC3bUY7mrRpWbW7f5L2hbCm80J3+Xc4GL259MLMePPoMYoqzpi e/IRePeDL/pfkKm+9/0PYcRu2zG3jLjlMXnLuD6cEa+VKUzWVCK0pxzOsB8ZfwFaMAPP lz16rfr0+zKpNQBU49TbL2kLPGj5LQUTt5GjNy4WBh+wbSEKfu/g0hxtGtV412zfVqX4 PEj4LjeS0DqUblKZII2zRgaPOd26g6jjGYhad8KeZX7jHwvFhZWzo43FPftykiCuKIw8 tVUDgXmdrvFHUteKp30QfYlwe6CfC/RPZ9bDztHEpSdwiKCbY1NqwM69/Lcn9YBqlfxE 0IqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZTcpjlM9; 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 f1-20020a17090ac28100b00262e28866d4si13230163pjt.163.2023.07.13.10.28.13; Thu, 13 Jul 2023 10:28:25 -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=ZTcpjlM9; 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 S231310AbjGMRGn (ORCPT + 99 others); Thu, 13 Jul 2023 13:06:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231852AbjGMRGY (ORCPT ); Thu, 13 Jul 2023 13:06:24 -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 819C5273F for ; Thu, 13 Jul 2023 10:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689267932; 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=ZTcpjlM9lshkm5ZrXURl30Qr6ww4OW98SE2mRViYSkjxYYqAqCv3jDzqYzmDI6f5ZNrTRf imJqtyjvICOJtyTrCaSPXY2V+/WBzObIYSEyoBazU8Ij6knBf1n4SHSVDSizRO4gWDVkos gwOv6gk+Eja0PLabFqmgXbSrK2emSDc= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642-cPYyoq6vPreCOxGNkoRc9g-1; Thu, 13 Jul 2023 13:05:31 -0400 X-MC-Unique: cPYyoq6vPreCOxGNkoRc9g-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-51e02395cf3so547336a12.1 for ; Thu, 13 Jul 2023 10:05:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689267930; x=1691859930; 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=fnpRxPeozrp44kBU9dARHFtpSYNiyIlydfjOlUYoyuyCivOL8kYC+OYTat5OwDQ7gI O3Ywa4G93dtaEpvBU9vfknwacJ9uM7NBXtHZskC4vHKVl203mBFRsFGhUmG1B4qfM/es 9Yf04cqiyaqjhg5zTqGDTBadU//GKvfoDInc/RzN91fq6OToIU8GmeHKxyTa1pHoGRDx +6K0NVXTW73dJu4u5OamzmzK4ibb2Fuf6XQbC9t4YRPD1sNIbPL8FzVyqkXCDF67QWQv U5e5REmkHZYcnK3P1gjfcLYKzTB9whTsM3pi0x0PDA0gxl+UO6kAA17deeSLdlWk68He rvbQ== X-Gm-Message-State: ABy/qLYyjW1r2OK/iR5ljeA9JxjfABR7pYweRvlAtC8c6M4mAW4PtcJN dmFt5mt/f8IM7W18zwo6w7vmtfbcuKfuZ1CoCfQTmKAHWJ6PKnFCStqVeninQRYCLPcFP5WvTXi 5BbHSGZ0mb9LLCSHMkS/+x37d X-Received: by 2002:aa7:c58c:0:b0:51e:f83:6de3 with SMTP id g12-20020aa7c58c000000b0051e0f836de3mr1913972edq.17.1689267930202; Thu, 13 Jul 2023 10:05:30 -0700 (PDT) X-Received: by 2002:aa7:c58c:0:b0:51e:f83:6de3 with SMTP id g12-20020aa7c58c000000b0051e0f836de3mr1913942edq.17.1689267929984; Thu, 13 Jul 2023 10:05:29 -0700 (PDT) Received: from cassiopeiae.. ([2a02:810d:4b3f:de9c:642:1aff:fe31:a19f]) by smtp.gmail.com with ESMTPSA id n7-20020aa7c447000000b0051e22660835sm4557121edr.46.2023.07.13.10.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 10:05:29 -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, donald.robson@imgtec.com 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 v7 13/13] drm/nouveau: debugfs: implement DRM GPU VA debugfs Date: Thu, 13 Jul 2023 19:04:08 +0200 Message-ID: <20230713170429.2964-14-dakr@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713170429.2964-1-dakr@redhat.com> References: <20230713170429.2964-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_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 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