mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: lyude@redhat.com
To: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>,
	 linux-kernel@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org,
	Danilo Krummrich <dakr@kernel.org>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann	 <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>,
	Simona Vetter	 <simona@ffwll.ch>,
	Mary Guillemard <mary@mary.zone>,
	Milos Tijanic	 <mtijanic@nvidia.com>,
	nouveau@lists.freedesktop.org
Subject: Re: [PATCH 2/6] drm/nouveau/gsp: add RUSD telemetry support
Date: Tue, 21 Jul 2026 14:23:33 -0400	[thread overview]
Message-ID: <174e6951bd8216b76c2bc5fb42f1be8138b345ac.camel@redhat.com> (raw)
In-Reply-To: <20260714211429.238355-3-mohamedahmedegypt2001@gmail.com>

Some lil nitpicks

On Wed, 2026-07-15 at 01:14 +0400, Mohamed Ahmed wrote:
> +	case NVKM_GSP_RUSD_ROWREMAP_HIST_MAX ... NVKM_GSP_RUSD_ROWREMAP_FAILURE: {
> +		RUSD_MEM_ROW_REMAP remap;
> +
> +		ret = r570_rusd_read_section(gsp,
> +					     offsetof(NV00DE_SHARED_DATA, memRowRemap),
> +					     sizeof(remap), &remap);
> +		if (ret)
> +			return ret;
> +
> +		switch (item) {
> +		case NVKM_GSP_RUSD_ROWREMAP_HIST_MAX:
> +			*val = remap.info.histogramMax;
> +			break;
> +		case NVKM_GSP_RUSD_ROWREMAP_HIST_HIGH:
> +			*val = remap.info.histogramHigh;
> +			break;
> +		case NVKM_GSP_RUSD_ROWREMAP_HIST_PARTIAL:
> +			*val = remap.info.histogramPartial;
> +			break;
> +		case NVKM_GSP_RUSD_ROWREMAP_HIST_LOW:
> +			*val = remap.info.histogramLow;
> +			break;
> +		case NVKM_GSP_RUSD_ROWREMAP_HIST_NONE:
> +			*val = remap.info.histogramNone;
> +			break;
> +		case NVKM_GSP_RUSD_ROWREMAP_CORRECTABLE:
> +			*val = remap.info.correctableRows;
> +			break;
> +		case NVKM_GSP_RUSD_ROWREMAP_UNCORRECTABLE:
> +			*val = remap.info.uncorrectableRows;
> +			break;
> +		case NVKM_GSP_RUSD_ROWREMAP_PENDING:
> +			*val = remap.info.isPending;
> +			break;
> +		default: /* NVKM_GSP_RUSD_ROWREMAP_FAILURE */
> +			*val = remap.info.hasFailureOccurred;
> +			break;

Maybe this should be an explicit case instead of default, so we can
drm_WARN_ON_ONCE unknown values?

> +		}
> +		return 0;
> +	}
> +	case NVKM_GSP_RUSD_PCIE_GEN ... NVKM_GSP_RUSD_PCIE_UNSUPPORTED_REQUESTS: {
> +		RUSD_PCIE_DATA pcie;
> +
> +		int idx = item - NVKM_GSP_RUSD_PCIE_GEN;
> +
> +		ret = r570_rusd_read_section(gsp,
> +					     offsetof(NV00DE_SHARED_DATA, pciBusData),
> +					     sizeof(pcie), &pcie);
> +		if (ret)
> +			return ret;
> +
> +		*val = pcie.info.data[idx];
> +		return 0;
> +	}
> +	default:
> +		return -EINVAL;
> +	}
> +
> +	/* A reading of 0 mW is indistinguishable from "not supported on this
> +	 * board" (e.g. module power on Ampere/Hopper).
> +	 */
> +	if (!mw)
> +		return -ENODATA;
> +
> +	*val = (s64)mw * 1000;
> +	return 0;
> +}
> +
> +const struct nvkm_rm_api_rusd
> +r570_rusd = {
> +	.init = r570_rusd_init,
> +	.resume = r570_rusd_resume,
> +	.read = r570_rusd_read,
> +};
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h
> index a9af94adf9ef..1338b4a88f95 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h
> @@ -130,6 +130,12 @@ struct nvkm_rm_api {
>  			void (*fini)(struct r535_gr *);
>  		} scrubber;
>  	} *gr;
> +
> +	const struct nvkm_rm_api_rusd {
> +		int (*init)(struct nvkm_gsp *);
> +		void (*resume)(struct nvkm_gsp *);
> +		int (*read)(struct nvkm_gsp *, enum nvkm_gsp_rusd_item, s64 *);
> +	} *rusd;
>  };
>  
>  extern const struct nvkm_rm_impl r535_rm_tu102;
> @@ -188,4 +194,5 @@ extern const struct nvkm_rm_api_gr r570_gr;
>  int r570_gr_gpc_mask(struct nvkm_gsp *, u32 *mask);
>  int r570_gr_tpc_mask(struct nvkm_gsp *, int gpc, u32 *mask);
>  extern const struct nvkm_rm_api_engine r570_ofa;
> +extern const struct nvkm_rm_api_rusd r570_rusd;
>  #endif


  reply	other threads:[~2026-07-21 18:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 21:14 [PATCH 0/6] drm/nouveau: GSP telemetry via RUSD, and fdinfo telemetry exposure Mohamed Ahmed
2026-07-14 21:14 ` [PATCH 1/6] drm/nouveau/gsp: vendor the RUSD header Mohamed Ahmed
2026-07-14 21:14 ` [PATCH 2/6] drm/nouveau/gsp: add RUSD telemetry support Mohamed Ahmed
2026-07-21 18:23   ` lyude [this message]
2026-07-14 21:14 ` [PATCH 3/6] drm/nouveau: add GSP hwmon support Mohamed Ahmed
2026-07-21 18:36   ` lyude
2026-07-21 19:36     ` Mohamed Ahmed
2026-07-21 20:36       ` lyude
2026-07-14 21:14 ` [PATCH 4/6] drm/nouveau: expose RUSD telemetry via sysfs Mohamed Ahmed
2026-07-14 21:14 ` [PATCH 5/6] drm/nouveau: expose global VRAM size and usage " Mohamed Ahmed
2026-07-14 21:14 ` [PATCH 6/6] drm/nouveau: expose per-client GPU usage via fdinfo Mohamed Ahmed
2026-07-20 22:16 ` [PATCH 0/6] drm/nouveau: GSP telemetry via RUSD, and fdinfo telemetry exposure lyude
2026-07-21 10:39 ` Milos Tijanic
2026-07-21 15:11   ` Mohamed Ahmed
2026-07-21 20:40 ` lyude
2026-07-21 20:46   ` Mohamed Ahmed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=174e6951bd8216b76c2bc5fb42f1be8138b345ac.camel@redhat.com \
    --to=lyude@redhat.com \
    --cc=airlied@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mary@mary.zone \
    --cc=mohamedahmedegypt2001@gmail.com \
    --cc=mripard@kernel.org \
    --cc=mtijanic@nvidia.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®