All of lore.kernel.org
 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>,
		nouveau@lists.freedesktop.org
Subject: Re: [PATCH 5/7] nouveau/gsp: fix vblank interrupts on GB20x
Date: Mon, 17 Aug 2026 18:59:03 -0400	[thread overview]
Message-ID: <996d2033b1522090867e50f181e9b4daaab19861.camel@redhat.com> (raw)
In-Reply-To: <20260814235705.59132-6-mohamedahmedegypt2001@gmail.com>

On Sat, 2026-08-15 at 03:57 +0400, Mohamed Ahmed wrote:
> 
> +
> +static const struct nvkm_head_func
> +gb202_head = {
> +	.state = r535_head_state,
> +	.vblank_get = gb202_head_vblank_get,
> +	.vblank_put = gb202_head_vblank_put,
> +};
> +

You should probably add these two as well:

	.state = gv100_head_state,
	.rgpos = gv100_head_rgpos,

I don't think they've actually changed in blackwell, but it's possible
maybe they do change in GB200x so you probably want to double check so
we don't lose precise vblank timestamps again.

>  static struct nvkm_conn *
>  r535_conn_new(struct nvkm_disp *disp, u32 id)
>  {
> @@ -1496,6 +1523,20 @@ r535_disp_intr(struct nvkm_inth *inth)
>  	return IRQ_HANDLED;
>  }
>  
> +static irqreturn_t
> +gb202_disp_intr(struct nvkm_inth *inth)
> +{
> +	struct nvkm_disp *disp = container_of(inth, typeof(*disp),
> engine.subdev.inth);
> +	irqreturn_t ret = r535_disp_intr(inth);
> +
> +	/* The FE interrupt vectors are message-based on NVD5.0. Re-
> arm the
> +	 * low-latency vector so it fires again for any event that
> latched
> +	 * while we were servicing.
> +	 */
> +	nvkm_wr32(disp->engine.subdev.device, 0x611f34, 0x00000001);
> +	return ret;
> +}
> +
>  static void
>  r535_disp_fini(struct nvkm_disp *disp, bool suspend)
>  {
> @@ -1568,7 +1609,9 @@ r535_disp_oneinit(struct nvkm_disp *disp)
>  	struct nvkm_device *device = disp->engine.subdev.device;
>  	struct nvkm_gsp *gsp = device->gsp;
>  	const struct nvkm_rm_api *rmapi = gsp->rm->api;
> +	const struct nvkm_rm_gpu *gpu = gsp->rm->gpu;
>  	NV2080_CTRL_INTERNAL_DISPLAY_WRITE_INST_MEM_PARAMS *ctrl;
> +	nvkm_inth_func intr_func;
>  	unsigned long mask;
>  	int ret, i;
>  
> @@ -1722,7 +1765,12 @@ r535_disp_oneinit(struct nvkm_disp *disp)
>  		nvkm_gsp_rm_ctrl_done(&disp->rm.objcom, ctrl);
>  
>  		for_each_set_bit(i, &disp->head.mask, disp->head.nr)
> {
> -			ret = nvkm_head_new_(&r535_head, disp, i);
> +			const struct nvkm_head_func *func =
> &r535_head;
> +
> +			if (gpu->disp.class.root >= GB202_DISP)
> +				func = &gb202_head;
> +
> +			ret = nvkm_head_new_(func, disp, i);
>  			if (ret)
>  				return ret;
>  		}
> @@ -1766,12 +1814,21 @@ r535_disp_oneinit(struct nvkm_disp *disp)
>  	if (ret)
>  		return ret;
>  
> -	ret = nvkm_gsp_intr_stall(gsp, disp->engine.subdev.type,
> disp->engine.subdev.inst);
> +	if (gpu->disp.class.root >= GB202_DISP) {
> +		/* GB20x deliver head-timing interrupts on the
> display's
> +		 * separate low-latency vector (interrupt table
> instance 1).
> +		 */
> +		ret = nvkm_gsp_intr_stall(gsp, disp-
> >engine.subdev.type, 1);
> +		intr_func = gb202_disp_intr;
> +	} else {
> +		ret = nvkm_gsp_intr_stall(gsp, disp-
> >engine.subdev.type, disp->engine.subdev.inst);
> +		intr_func = r535_disp_intr;
> +	}
>  	if (ret < 0)
>  		return ret;
>  
>  	ret = nvkm_inth_add(&device->vfn->intr, ret,
> NVKM_INTR_PRIO_NORMAL, &disp->engine.subdev,
> -			    r535_disp_intr, &disp-
> >engine.subdev.inth);
> +			    intr_func, &disp->engine.subdev.inth);
>  	if (ret)
>  		return ret;
>  
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
> b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
> index 996941c668ba..2590b22663cb 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
> @@ -44,6 +44,14 @@ r570_gsp_xlat_mc_engine_idx(u32 mc_engine_idx,
> enum nvkm_subdev_type *ptype, int
>  		*ptype = NVKM_ENGINE_DISP;
>  		*pinst = 0;
>  		return true;
> +	case MC_ENGINE_IDX_DISP_LOW:
> +		/* GB20x+ report a separate low-latency display
> vector, used
> +		 * for head-timing interrupts. Expose it as a second
> DISP
> +		 * interrupt instance.
> +		 */
> +		*ptype = NVKM_ENGINE_DISP;
> +		*pinst = 1;
> +		return true;
>  	case MC_ENGINE_IDX_CE0 ... MC_ENGINE_IDX_CE19:
>  		*ptype = NVKM_ENGINE_CE;
>  		*pinst = mc_engine_idx - MC_ENGINE_IDX_CE0;


WARNING: multiple messages have this Message-ID (diff)
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>,
	Simona Vetter <simona@ffwll.ch>, Mary Guillemard <mary@mary.zone>,
	nouveau@lists.freedesktop.org
Subject: Re: [PATCH 5/7] nouveau/gsp: fix vblank interrupts on GB20x
Date: Mon, 17 Aug 2026 18:59:03 -0400	[thread overview]
Message-ID: <996d2033b1522090867e50f181e9b4daaab19861.camel@redhat.com> (raw)
In-Reply-To: <20260814235705.59132-6-mohamedahmedegypt2001@gmail.com>

On Sat, 2026-08-15 at 03:57 +0400, Mohamed Ahmed wrote:
> 
> +
> +static const struct nvkm_head_func
> +gb202_head = {
> +	.state = r535_head_state,
> +	.vblank_get = gb202_head_vblank_get,
> +	.vblank_put = gb202_head_vblank_put,
> +};
> +

You should probably add these two as well:

	.state = gv100_head_state,
	.rgpos = gv100_head_rgpos,

I don't think they've actually changed in blackwell, but it's possible
maybe they do change in GB200x so you probably want to double check so
we don't lose precise vblank timestamps again.

>  static struct nvkm_conn *
>  r535_conn_new(struct nvkm_disp *disp, u32 id)
>  {
> @@ -1496,6 +1523,20 @@ r535_disp_intr(struct nvkm_inth *inth)
>  	return IRQ_HANDLED;
>  }
>  
> +static irqreturn_t
> +gb202_disp_intr(struct nvkm_inth *inth)
> +{
> +	struct nvkm_disp *disp = container_of(inth, typeof(*disp),
> engine.subdev.inth);
> +	irqreturn_t ret = r535_disp_intr(inth);
> +
> +	/* The FE interrupt vectors are message-based on NVD5.0. Re-
> arm the
> +	 * low-latency vector so it fires again for any event that
> latched
> +	 * while we were servicing.
> +	 */
> +	nvkm_wr32(disp->engine.subdev.device, 0x611f34, 0x00000001);
> +	return ret;
> +}
> +
>  static void
>  r535_disp_fini(struct nvkm_disp *disp, bool suspend)
>  {
> @@ -1568,7 +1609,9 @@ r535_disp_oneinit(struct nvkm_disp *disp)
>  	struct nvkm_device *device = disp->engine.subdev.device;
>  	struct nvkm_gsp *gsp = device->gsp;
>  	const struct nvkm_rm_api *rmapi = gsp->rm->api;
> +	const struct nvkm_rm_gpu *gpu = gsp->rm->gpu;
>  	NV2080_CTRL_INTERNAL_DISPLAY_WRITE_INST_MEM_PARAMS *ctrl;
> +	nvkm_inth_func intr_func;
>  	unsigned long mask;
>  	int ret, i;
>  
> @@ -1722,7 +1765,12 @@ r535_disp_oneinit(struct nvkm_disp *disp)
>  		nvkm_gsp_rm_ctrl_done(&disp->rm.objcom, ctrl);
>  
>  		for_each_set_bit(i, &disp->head.mask, disp->head.nr)
> {
> -			ret = nvkm_head_new_(&r535_head, disp, i);
> +			const struct nvkm_head_func *func =
> &r535_head;
> +
> +			if (gpu->disp.class.root >= GB202_DISP)
> +				func = &gb202_head;
> +
> +			ret = nvkm_head_new_(func, disp, i);
>  			if (ret)
>  				return ret;
>  		}
> @@ -1766,12 +1814,21 @@ r535_disp_oneinit(struct nvkm_disp *disp)
>  	if (ret)
>  		return ret;
>  
> -	ret = nvkm_gsp_intr_stall(gsp, disp->engine.subdev.type,
> disp->engine.subdev.inst);
> +	if (gpu->disp.class.root >= GB202_DISP) {
> +		/* GB20x deliver head-timing interrupts on the
> display's
> +		 * separate low-latency vector (interrupt table
> instance 1).
> +		 */
> +		ret = nvkm_gsp_intr_stall(gsp, disp-
> >engine.subdev.type, 1);
> +		intr_func = gb202_disp_intr;
> +	} else {
> +		ret = nvkm_gsp_intr_stall(gsp, disp-
> >engine.subdev.type, disp->engine.subdev.inst);
> +		intr_func = r535_disp_intr;
> +	}
>  	if (ret < 0)
>  		return ret;
>  
>  	ret = nvkm_inth_add(&device->vfn->intr, ret,
> NVKM_INTR_PRIO_NORMAL, &disp->engine.subdev,
> -			    r535_disp_intr, &disp-
> >engine.subdev.inth);
> +			    intr_func, &disp->engine.subdev.inth);
>  	if (ret)
>  		return ret;
>  
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
> b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
> index 996941c668ba..2590b22663cb 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c
> @@ -44,6 +44,14 @@ r570_gsp_xlat_mc_engine_idx(u32 mc_engine_idx,
> enum nvkm_subdev_type *ptype, int
>  		*ptype = NVKM_ENGINE_DISP;
>  		*pinst = 0;
>  		return true;
> +	case MC_ENGINE_IDX_DISP_LOW:
> +		/* GB20x+ report a separate low-latency display
> vector, used
> +		 * for head-timing interrupts. Expose it as a second
> DISP
> +		 * interrupt instance.
> +		 */
> +		*ptype = NVKM_ENGINE_DISP;
> +		*pinst = 1;
> +		return true;
>  	case MC_ENGINE_IDX_CE0 ... MC_ENGINE_IDX_CE19:
>  		*ptype = NVKM_ENGINE_CE;
>  		*pinst = mc_engine_idx - MC_ENGINE_IDX_CE0;


  parent reply	other threads:[~2026-08-17 22:59 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 23:56 [PATCH 0/7] nouveau: assorted display fixes (GB20x, r570 DP_CONFIG_STREAM, HF-EEODB EDIDs) Mohamed Ahmed
2026-08-14 23:56 ` Mohamed Ahmed
2026-08-14 23:56 ` [PATCH 1/7] nouveau/disp: add GB20x HDMI vendor infoframe writer Mohamed Ahmed
2026-08-14 23:56   ` Mohamed Ahmed
2026-08-15  0:08   ` sashiko-bot
2026-08-14 23:57 ` [PATCH 2/7] nouveau/gsp: fix HDMI vendor infoframes on GB20x Mohamed Ahmed
2026-08-14 23:57   ` Mohamed Ahmed
2026-08-15  0:08   ` sashiko-bot
2026-08-17 21:49   ` lyude
2026-08-17 21:49     ` lyude
2026-08-14 23:57 ` [PATCH 3/7] nouveau/gsp: fix HDMI GCP AVMute register offsets " Mohamed Ahmed
2026-08-14 23:57   ` Mohamed Ahmed
2026-08-14 23:57 ` [PATCH 4/7] nouveau/gsp: use per-version DP_CONFIG_STREAM params on r570 firmware Mohamed Ahmed
2026-08-14 23:57   ` Mohamed Ahmed
2026-08-15  0:13   ` sashiko-bot
2026-08-17 22:05   ` lyude
2026-08-17 22:05     ` lyude
2026-08-14 23:57 ` [PATCH 5/7] nouveau/gsp: fix vblank interrupts on GB20x Mohamed Ahmed
2026-08-14 23:57   ` Mohamed Ahmed
2026-08-15  0:08   ` sashiko-bot
2026-08-17 22:59   ` lyude [this message]
2026-08-17 22:59     ` lyude
2026-08-18 20:02     ` Mohamed Ahmed
2026-08-18 20:02       ` Mohamed Ahmed
2026-08-18 20:06       ` lyude
2026-08-18 20:06         ` lyude
2026-08-18 20:09         ` Mohamed Ahmed
2026-08-18 20:09           ` Mohamed Ahmed
2026-08-14 23:57 ` [PATCH 6/7] nouveau/dispnv50: program pixel clocks above 2.147GHz " Mohamed Ahmed
2026-08-14 23:57   ` Mohamed Ahmed
2026-08-17 22:43   ` lyude
2026-08-17 22:43     ` lyude
2026-08-14 23:57 ` [PATCH 7/7] nouveau: honor HF-EEODB EDIDs by converting to struct drm_edid Mohamed Ahmed
2026-08-14 23:57   ` Mohamed Ahmed
2026-08-15  0:08   ` sashiko-bot
2026-08-17 23:51   ` lyude
2026-08-17 23:51     ` lyude

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=996d2033b1522090867e50f181e9b4daaab19861.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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.