From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 095AE1D5174 for ; Tue, 14 Jul 2026 21:15:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784063743; cv=none; b=dCyaxzPhIvxX3x8yVZDRqOquBn0soKwIaIPC/ngDGMRPuYAwT3D3NmRtir8HyyeoU4xQWWYvf4GyAj01WzjQTUbw3OCaZjoNhx9/6a7s3ksCaZSC96D+gS7ZdasF7WknHfN13+s/yjCULqlJDPhGz8KEdkxAWSl+BcKr1oSsRgk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784063743; c=relaxed/simple; bh=U/Sqnyq7Ngeq0UWldRwEeZ5DfruNPJrNjfLNLcJjf9g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bhHAqwF8EWW3AKU5yG6LtXgGpF3UZWJH+2eT49zJQCrjEfVxADJAHOiE92hPRuY0CQ0Cj7zW5xtVDHz3Knfk4UfXIoI+05qWf6TdS8n4Am64dHtLgXP3YgdXDkH0fIGBmEHZGXpPxJpb+MyUh1ZwP78Amm/EFuq12bUUISN7cPY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eGnXA3Pb; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eGnXA3Pb" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-493ae59eca6so8076275e9.1 for ; Tue, 14 Jul 2026 14:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784063740; x=1784668540; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=RCq7Nx8/0JTWLcWo9D6VA1wUiUAA6aMWpwH1k5hkv5c=; b=eGnXA3Pb+2yspAFxWRPeCZNW0kFA0j+KNYvY+3ZKq7/NAMKuwaN+jYTynDbdeZgrQC V5QWNScBZffjlc7RPpgiYKIXbSgIf11CLOucY+UVtnnJVrbU4RZuW2XXKkpA8F2+zLtr KA8/ocT9dTBkh9R5AKxjuf7UOw4Wt4527Y3/fA2S4SpSISfckT3Q5Bcm6YrRJf2tRJza pxmkFP5i2Sff4JUiRNloHIEx8j5ZkuqXamjJJvij0EE0HH+O5+zz3UNvyv/V9IUjqkuo UTW72NFenjaJVE+JShy7CAx/XjmsjW2sDu7qCYAhU6LGTCHT5ymJsRdU4MGqrqvbvyl9 qHJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784063740; x=1784668540; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=RCq7Nx8/0JTWLcWo9D6VA1wUiUAA6aMWpwH1k5hkv5c=; b=qnWrPq571+GaZhJmx1u+Z7wlbNUzMVHgRgH94IydnZ7gg3Mw2ssNI6cuCe0iH7xVYG sIO6+7SgHF39eu9CmW07LPFcUsO1Ue82nwUxhUWJ0+g50q2Mc4hGzmeLkC+l3ZoGWJNe C5ZPmGd8RL0X1qmcR5tXHWB0dJLriFYiFSDnKboKjPXoMJwMEvSnNhaG/BsNRvoUhISZ mYdSmHdcumBqwDAVs1bTgKm/tUahmsClQsqwspwiZqgAVMIpUqCZqOP149P4zY2JDg57 OTpjUK/w0KbMbNiT8kHRbE0hacl2jrcnj7YE0h25yXtXTZiVrwpAnnfpnRkSihc2ov5/ pm4Q== X-Gm-Message-State: AOJu0YwJXvcHT/PZufLW8YHZcGlBLWA/I46f11xfOOJ/8W5Fql90nBBR 7EON8RDIB0cDUq9uietD77tAMaIj8G0cExkANcf1rR/DB8hdzm8WXlftEl3//P+K X-Gm-Gg: AfdE7ck4OzZmuem4nIaRwi/i2GNs8wjb4EQrFHWHLwz1wwhsmk7Sa2fpDxdyyTaegxQ FxJeCPojrQB+R23u73bz8lQMdlVfEZZeCAKvpDTuh5dzppBPeimZ3sElvflbkIHReLPgkVXXr1O AetJkZ4aW++B4wUkAf5yCgjXVoECFxkqSP68SPR2yDqf0Dro5ZW1WbU9cW6at9P2tE9jHflbWZv zrWmDXNaKYlBdS7vAmNUsOq8oa5dpKmyugFb36JVL+rZRbMauldmx9MHa0+zkympf118xoaATGk bKzfVF0od+n69c4KmLMLVLTHjVOqWb1WYgNUoYUAydiljMeRZAOG6e9VoFav2sM0N1GTBnZehqZ XOVJGlEEw3HsT0jl29rtYhQaA0dfXcC+zNkzSl+A+xjkztzbY2dYoZEqHKaoQS2IPUbKAX6Zefl hxcFxrm34SoeTAU1I2PpRt X-Received: by 2002:a05:600c:6387:b0:492:7142:f46e with SMTP id 5b1f17b1804b1-493f87d8583mr168232975e9.2.1784063740186; Tue, 14 Jul 2026 14:15:40 -0700 (PDT) Received: from fedora ([94.205.182.68]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4950a32a2casm149843875e9.12.2026.07.14.14.15.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 14:15:38 -0700 (PDT) From: Mohamed Ahmed To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Lyude Paul , Danilo Krummrich , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Mary Guillemard , Milos Tijanic , nouveau@lists.freedesktop.org, Mohamed Ahmed Subject: [PATCH 0/6] drm/nouveau: GSP telemetry via RUSD, and fdinfo telemetry exposure Date: Wed, 15 Jul 2026 01:14:23 +0400 Message-ID: <20260714211429.238355-1-mohamedahmedegypt2001@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On the GSP firmware, nouveau reports nothing about the GPU. The GSP owns the sensors, so the legacy nvkm therm/clk/volt hwmon paths never run, and monitoring tools have no data to read. GSP on later firmware does publish all of it through a stable interface. It maintains a shared-memory region called "RM User Shared Data" (RUSD), which the firmware fills with all the relevant sensor readings like power, temperatures, clocks, and many others. Consuming it needs only two internal subdevice controls: INIT_USER_SHARED_DATA to register the buffer, and SET_DATA_POLL to tell the GSP which data groups to poll and how often. This series makes nouveau a RUSD client and exposes the data through two main surfaces: - hwmon, for the values that map onto standard channels: GPU and memory temperature, GPU/board/VRAM power, power cap. - sysfs, under /sys/class/drm/cardN/device/rusd/, for everything hwmon has no channel type for: clocks, utilisation, pstate, throttle reason, ECC counters, PCIe error counters, and everything exposed to hwmon as well. One value per file according to sysfs convention. Polling is demand-driven. GSP polls a group only while a client is reading it, and a group idles off after 10s after the last read. Polling costs power, so nothing is polled unless someone is looking. A section that has not been polled yet, or that the board does not support, reads -ENODATA. The sysfs interface is documented in Documentation/ABI/testing/sysfs-driver-nouveau. While the original scope was RUSD support only, monitoring tools needed two extra additions to complete the picture: - VRAM size and usage on sysfs (patch 5): since this series adds a sysfs interface for nouveau, it's better to expose VRAM metrics there rather than force monitoring apps to pull in libdrm for the GETPARAM memory ioctls. - fdinfo (patch 6): nouveau implemented none at all, and monitoring apps could not show per-process GPU and memory usage. It now reports per-client memory and per-engine busy time, accounted from the DRM scheduler that the EXEC/VM_BIND path already uses. Limitations, caveats, and additional considerations or questions: - RUSD needs r570 or newer GSP firmware; r535 does not have the needed controls. Pre-GSP and r535 behavior is identical to what it was: the rusd/ group is not created, and hwmon keeps its current behavior. - This is all read-only telemetry. Clock, voltage, or power control is through other interfaces out of scope of this series. - The sysfs interface exposed here should be stable and valid for nova as well. RUSD is stable and only grows more fields with newer GSP firmware (e.g., fan telemetry gets added in r580), so it is possible to keep the same interface as we use newer firmware or as we move to nova and any potential considerations should be ironed out before this gets merged and the interface gets frozen. - amdgpu offers a single binary blob with all the telemetry embedded in addition to the sysfs sensor files. This series currently only exposes sensor files, but it is possible to add a similar binary for a v2. This mainly offers a more efficient way to read the telemetry as clients would read only a few files instead of reading all of them. - The last two patches don't depend on RUSD and work on every GPU. But they are here because they complete the sensor telemetry story. I am happy to split them into their own series if that is preferred. Userspace WIP work built on this sysfs surface exists in form of nouveau backends for nvtop, LACT, and a NVK HUD: - nvtop: https://github.com/mohamexiety/nvtop/tree/nvtop-nouvtop - LACT: https://github.com/mohamexiety/LACT/tree/lnouvct - NVK HUD: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39898 None of these are merged yet and exist for testing only. Upstreaming will begin when this series gets merged and the interface is stable. Mohamed Ahmed (6): drm/nouveau/gsp: vendor the RUSD header drm/nouveau/gsp: add RUSD telemetry support drm/nouveau: add GSP hwmon support drm/nouveau: expose RUSD telemetry via sysfs drm/nouveau: expose global VRAM size and usage via sysfs drm/nouveau: expose per-client GPU usage via fdinfo .../ABI/testing/sysfs-driver-nouveau | 167 ++++++ MAINTAINERS | 1 + drivers/gpu/drm/nouveau/Kbuild | 1 + .../gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 33 ++ .../drm/nouveau/include/nvkm/subdev/rusd.h | 114 ++++ .../gpu/drm/nouveau/include/nvrm/nvtypes.h | 3 + drivers/gpu/drm/nouveau/nouveau_abi16.c | 16 + drivers/gpu/drm/nouveau/nouveau_chan.h | 2 + drivers/gpu/drm/nouveau/nouveau_drm.c | 22 + drivers/gpu/drm/nouveau/nouveau_drv.h | 29 + drivers/gpu/drm/nouveau/nouveau_exec.c | 3 + drivers/gpu/drm/nouveau/nouveau_gem.c | 16 + drivers/gpu/drm/nouveau/nouveau_hwmon.c | 375 ++++++++++--- drivers/gpu/drm/nouveau/nouveau_sched.c | 87 +++ drivers/gpu/drm/nouveau/nouveau_sched.h | 11 + drivers/gpu/drm/nouveau/nouveau_sysfs.c | 311 ++++++++++ drivers/gpu/drm/nouveau/nouveau_sysfs.h | 10 + .../drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c | 26 + .../drm/nouveau/nvkm/subdev/gsp/rm/r535/rm.c | 1 + .../nouveau/nvkm/subdev/gsp/rm/r570/Kbuild | 1 + .../nvkm/subdev/gsp/rm/r570/nvrm/rusd.h | 303 ++++++++++ .../drm/nouveau/nvkm/subdev/gsp/rm/r570/rm.c | 1 + .../nouveau/nvkm/subdev/gsp/rm/r570/rusd.c | 531 ++++++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h | 7 + 24 files changed, 1990 insertions(+), 81 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-nouveau create mode 100644 drivers/gpu/drm/nouveau/include/nvkm/subdev/rusd.h create mode 100644 drivers/gpu/drm/nouveau/nouveau_sysfs.c create mode 100644 drivers/gpu/drm/nouveau/nouveau_sysfs.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/nvrm/rusd.h create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/rusd.c -- 2.55.0