Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2138889rwd; Mon, 15 May 2023 07:46:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zZ9RFEttxw3vvSWEwgAwHhtm6XJvyi8nEP8azZSBC3cWs80EhZn9KNZRrmU+ccN1ILdiD X-Received: by 2002:a17:903:64c:b0:1ac:3303:daf5 with SMTP id kh12-20020a170903064c00b001ac3303daf5mr34267054plb.27.1684162001003; Mon, 15 May 2023 07:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684162000; cv=none; d=google.com; s=arc-20160816; b=Q8JC3hRSDCMJSOw42CbCLPRr34Bs+DFY8uhUU7mzAYt8RkOVUlYN7rg4EL2KgrMqVP 0TDiIH56VSJ6/6QB8wGaGu/tGJweKulfePqF2yU7P46Q0XCzT/aJIfzPFSFsLyKG68zf sDyRjnTe5kiPx6rAft0sNl/jlcacbrKUX8zQZHYL6G8QlLxdRMVXKvuhrMkqdtCBUVLw qocacmZ9juxTiISFL6+tRkDVldK7gLzyUzjb3/p2DP2LGtK8R3ZFuwLYfu2aSc7GXilB lAmNtDgzw+KESbh3xbG+fk7kDgfbfPCnMagYMRYqdTtIAsT9INUOGEwd448ImReZdf1B WLsA== 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=J+eFaAuv5DwnuMYT4MLpA+IW5y413fK5e+lMgmHpaqM=; b=BshIMmB0c8l/+G5CXaGPRthdz15P9JAium4w+VxeKU9qwdBYugNPFDJDyaFMGOM4pR SoaZS2f55G7C1gie6GdhkCFBXc1WE7aZlyrWIoVqBQJewLFZ3jHzgVEid4XZzpGP/RKf UxUBolHqM97WTvoEmdCa80c23ipAlIEL5/cxkueB72vGdOZwA/2TT2W8yHf/i2GcznUt 9wB3gARrfLr+qmtHMccT6FzLf263A/hcTLa8ncGmfWlbP0gabL44xjFuZVwuoyx5woYW a+9Rbd77Ln56JrOfjVpiI04DFVrkWpcs4FKt4tObf68Id0msPJ1RtZQKJgoqFcZrK/5k NE6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=bLYk0iTR; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ix9-20020a170902f80900b001a94b91f402si15527229plb.218.2023.05.15.07.45.56; Mon, 15 May 2023 07:46:40 -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=@gmail.com header.s=20221208 header.b=bLYk0iTR; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241573AbjEOObK (ORCPT + 99 others); Mon, 15 May 2023 10:31:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241376AbjEOObC (ORCPT ); Mon, 15 May 2023 10:31:02 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C17E32D4D for ; Mon, 15 May 2023 07:30:57 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1adc913094aso45769625ad.0 for ; Mon, 15 May 2023 07:30:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684161057; x=1686753057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=J+eFaAuv5DwnuMYT4MLpA+IW5y413fK5e+lMgmHpaqM=; b=bLYk0iTRvozgHkHd57YIP5u30BVW3qkKKsSYng6dMI2zSNSuvZ0hd5Z7GmUhqUzfYc 6sqINwqp8IQkBjx0HU4Iwve9ZRKyu+7rAchvR48XmE9OS/sp3Rz5yUcZ0/bbsymk3Ju1 y37nZ35DM3V8U2+uGGCk4itjv/wHKGRxj/nJjyJz1dEZv/K0sAmH5Ry/KGN/ATCDJBu9 kjuvxlSQtOJ+mzWV2rvAXPDUfbcxtrjrWoifs1r/tw8FpihTuJ3aK5rf8YlSvj5dGVPv BZ6oqv/3wDLmiBMojFiyZAZdZz6e7LzHy6MI8OvHwKWzs18rTEe4nHmFlSLF1AQwLzNv 4jZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684161057; x=1686753057; 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=J+eFaAuv5DwnuMYT4MLpA+IW5y413fK5e+lMgmHpaqM=; b=Q/8rVarjClwT5fZHoZabOSRIsTdPwqXDtQmqJMUxT8n5j8qDKkNpxGtgil1MDBjqv/ CB3LqCX8JiBBPnfC6g0exFrLwvmcUqR4NeFyhwleKuEKYOsrOq5hoI1jUggMf6tfyNx+ cfZ70VzJD04ZEDbZbs67A2FR0S4i7w9r0cAjbkuYpIycCfYMOYWVZnTXGfWDUpXV8jI3 JUhpfAfwhk0OWv+1ghBw77U7u72VGFylUEuJ1ypnn2kBx2qPLW5qyLkiHHQe8bHqLY/a 2T8Tb2e0SVmN7k/DqzP301sf63FOx/xzQwV63NEuI4bz6SOhIa1Ppxdb/MAQji9kuufs d5Tw== X-Gm-Message-State: AC+VfDx1k7qeWLI7xujyYo0A6DruME4EKZm//UJdegWQx33JBGoWl4BB e6R1SRUuatRe6hasNxtFw7E= X-Received: by 2002:a17:902:da88:b0:1a6:d9de:1887 with SMTP id j8-20020a170902da8800b001a6d9de1887mr44100368plx.53.1684161057060; Mon, 15 May 2023 07:30:57 -0700 (PDT) Received: from localhost ([2a00:79e1:abd:4a00:61b:48ed:72ab:435b]) by smtp.gmail.com with ESMTPSA id m2-20020a1709026bc200b001a045f45d49sm13541803plt.281.2023.05.15.07.30.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:30:56 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, Daniel Vetter , Tvrtko Ursulin , Boris Brezillon , Christopher Healy , Emil Velikov , =?UTF-8?q?Christian=20K=C3=B6nig?= , Rob Clark , Alex Deucher , "Pan, Xinhui" , David Airlie , Mario Limonciello , =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= , Guchun Chen , YiPeng Chai , =?UTF-8?q?Michel=20D=C3=A4nzer?= , Jim Cromie , Peter Maucher , Shashank Sharma , Tvrtko Ursulin , Arunpravin Paneer Selvam , amd-gfx@lists.freedesktop.org (open list:RADEON and AMDGPU DRM DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v4 4/9] drm/amdgpu: Switch to fdinfo helper Date: Mon, 15 May 2023 07:30:11 -0700 Message-Id: <20230515143023.801167-5-robdclark@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515143023.801167-1-robdclark@gmail.com> References: <20230515143023.801167-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 From: Rob Clark Signed-off-by: Rob Clark Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c | 16 ++++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.h | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index f5ffca24def4..6c0e0c614b94 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2745,21 +2745,21 @@ static const struct file_operations amdgpu_driver_kms_fops = { .flush = amdgpu_flush, .release = drm_release, .unlocked_ioctl = amdgpu_drm_ioctl, .mmap = drm_gem_mmap, .poll = drm_poll, .read = drm_read, #ifdef CONFIG_COMPAT .compat_ioctl = amdgpu_kms_compat_ioctl, #endif #ifdef CONFIG_PROC_FS - .show_fdinfo = amdgpu_show_fdinfo + .show_fdinfo = drm_show_fdinfo, #endif }; int amdgpu_file_to_fpriv(struct file *filp, struct amdgpu_fpriv **fpriv) { struct drm_file *file; if (!filp) return -EINVAL; @@ -2800,20 +2800,21 @@ static const struct drm_driver amdgpu_kms_driver = { DRIVER_SYNCOBJ_TIMELINE, .open = amdgpu_driver_open_kms, .postclose = amdgpu_driver_postclose_kms, .lastclose = amdgpu_driver_lastclose_kms, .ioctls = amdgpu_ioctls_kms, .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms), .dumb_create = amdgpu_mode_dumb_create, .dumb_map_offset = amdgpu_mode_dumb_mmap, .fops = &amdgpu_driver_kms_fops, .release = &amdgpu_driver_release_kms, + .show_fdinfo = amdgpu_show_fdinfo, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import = amdgpu_gem_prime_import, .gem_prime_mmap = drm_gem_prime_mmap, .name = DRIVER_NAME, .desc = DRIVER_DESC, .date = DRIVER_DATE, .major = KMS_DRIVER_MAJOR, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c index 99a7855ab1bc..c2fdd5e448d1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.c @@ -46,23 +46,22 @@ static const char *amdgpu_ip_name[AMDGPU_HW_IP_NUM] = { [AMDGPU_HW_IP_COMPUTE] = "compute", [AMDGPU_HW_IP_DMA] = "dma", [AMDGPU_HW_IP_UVD] = "dec", [AMDGPU_HW_IP_VCE] = "enc", [AMDGPU_HW_IP_UVD_ENC] = "enc_1", [AMDGPU_HW_IP_VCN_DEC] = "dec", [AMDGPU_HW_IP_VCN_ENC] = "enc", [AMDGPU_HW_IP_VCN_JPEG] = "jpeg", }; -void amdgpu_show_fdinfo(struct seq_file *m, struct file *f) +void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file) { - struct drm_file *file = f->private_data; struct amdgpu_device *adev = drm_to_adev(file->minor->dev); struct amdgpu_fpriv *fpriv = file->driver_priv; struct amdgpu_vm *vm = &fpriv->vm; uint64_t vram_mem = 0, gtt_mem = 0, cpu_mem = 0; ktime_t usage[AMDGPU_HW_IP_NUM]; uint32_t bus, dev, fn, domain; unsigned int hw_ip; int ret; @@ -79,25 +78,22 @@ void amdgpu_show_fdinfo(struct seq_file *m, struct file *f) amdgpu_bo_unreserve(vm->root.bo); amdgpu_ctx_mgr_usage(&fpriv->ctx_mgr, usage); /* * ****************************************************************** * For text output format description please see drm-usage-stats.rst! * ****************************************************************** */ - seq_printf(m, "pasid:\t%u\n", fpriv->vm.pasid); - seq_printf(m, "drm-driver:\t%s\n", file->minor->dev->driver->name); - seq_printf(m, "drm-pdev:\t%04x:%02x:%02x.%d\n", domain, bus, dev, fn); - seq_printf(m, "drm-client-id:\t%Lu\n", vm->immediate.fence_context); - seq_printf(m, "drm-memory-vram:\t%llu KiB\n", vram_mem/1024UL); - seq_printf(m, "drm-memory-gtt: \t%llu KiB\n", gtt_mem/1024UL); - seq_printf(m, "drm-memory-cpu: \t%llu KiB\n", cpu_mem/1024UL); + drm_printf(p, "pasid:\t%u\n", fpriv->vm.pasid); + drm_printf(p, "drm-memory-vram:\t%llu KiB\n", vram_mem/1024UL); + drm_printf(p, "drm-memory-gtt: \t%llu KiB\n", gtt_mem/1024UL); + drm_printf(p, "drm-memory-cpu: \t%llu KiB\n", cpu_mem/1024UL); for (hw_ip = 0; hw_ip < AMDGPU_HW_IP_NUM; ++hw_ip) { if (!usage[hw_ip]) continue; - seq_printf(m, "drm-engine-%s:\t%Ld ns\n", amdgpu_ip_name[hw_ip], + drm_printf(p, "drm-engine-%s:\t%Ld ns\n", amdgpu_ip_name[hw_ip], ktime_to_ns(usage[hw_ip])); } } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.h index e86834bfea1d..0398f5a159ef 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fdinfo.h @@ -30,13 +30,13 @@ #include #include #include #include #include "amdgpu_sync.h" #include "amdgpu_ring.h" #include "amdgpu_ids.h" uint32_t amdgpu_get_ip_count(struct amdgpu_device *adev, int id); -void amdgpu_show_fdinfo(struct seq_file *m, struct file *f); +void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file); #endif -- 2.40.1