From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78B6E481B1 for ; Fri, 21 Aug 2026 21:31:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787347897; cv=none; b=pbfdaWVmI7bqn5iMUqepDTTzveq63n3MJ8Jwtj7Jf5hjmLIua19d+dvSCDE5oAdvAd2P95g378coAIKj9VMxfWPRhAcVwRVqj2WpxXRcwDrzv57NYWZKdB1gqRrgQo1MZVahuahys7sItqM4SQ9HV2EKE0iIKmgzRyeptJF5KGo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787347897; c=relaxed/simple; bh=tqxP+MjFWG48qq1A/KsXuhIx8Kiibw4zaiC+9yoIIH8=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=VxQA6lI76Ir9ElFFSVhnxdg0Av1HTGyydwqxiyOOyQIisWFsF/0W2U5oQlWcyIctKPGRhA3fcdKNKo/uvf22HNWSypR5gamz4WIxcbGTqNAMD4KFLhpLDjU0U6RKDGjjGF7w9M083GWUlQ/54OZrtKa1WqTziHP53/E5AgXbfaw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Od6qIWdG; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=k8RPZkuX; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Od6qIWdG"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="k8RPZkuX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787347894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+lJHW5Uuf0wtGywk/XA4axlvgeXcz2UVQQ73YnPogIk=; b=Od6qIWdGpX+DFX+K05MHILX0X5pQBw8HYOYEzIvVuqkrWmDA3fOCz7CyIgrDdGOY9NYAMC eml2A1yE4k/Mmr1CLXC53DlYpM9OpWmAn9A0OCVNRUmL75aRjeW94Hu89TJkWJ8MfMPQiw QHV9SdcA3fhD+W5utYj9PZgvwpiye6g= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-NG2yz_qcPbukNBIWdUSB2w-1; Fri, 21 Aug 2026 17:31:33 -0400 X-MC-Unique: NG2yz_qcPbukNBIWdUSB2w-1 X-Mimecast-MFC-AGG-ID: NG2yz_qcPbukNBIWdUSB2w_1787347893 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-90c4da3d504so9709756d6.0 for ; Fri, 21 Aug 2026 14:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1787347893; x=1787952693; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to:content-type; bh=+lJHW5Uuf0wtGywk/XA4axlvgeXcz2UVQQ73YnPogIk=; b=k8RPZkuXRrMHFsHu1CbxU8qrZ7wynvMrBdC9smxN1jmfbdp3zEKQJ7Eg2gNzVYKfGb ldEsZWDH8WClOsPs1+JPv/A4Kvw4xjQLQGuCtyUQDNYhye8BW3tNJSu0lrVGxWtBUmAa eGWAODKMpO4Nj2ZArWNgp3g/YCFaKL2hbvsaL1v4anxi+p4C6pzVwATvz9+WwhxzNR3p vphbxpy7p9DThP5aWm3X4cPQx8rQ3BOHXpVZkQ+VTN5y0xfKOD3W6g6q9rmNJ1svoCfr 4VkXdv3GNG7+brPHin4eg+2dgfgDbyM6bf+reNy8c0ZClNtw5ZmhWLxImzHO/FWYIEsP RsGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787347893; x=1787952693; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=+lJHW5Uuf0wtGywk/XA4axlvgeXcz2UVQQ73YnPogIk=; b=k0vWl1LOy09reBIsl2wbunNQJOCkq+LH+rcL5AIFBGIztqOG1yGsuuLkX5E344vQEI +LuapFdnUkpoP6bSeN8h61O2UaeuxIvQGE62L6J9eiZ0DgRUpXMJDERqGI1av99l8+5h 7XI4lx0ewNf1K95iFYJlJEdOTzIQGkPtHHx989G/1Qgm9GG77xAYbmRLD2mjGt5CcAmj 67wUMlA1fCdAIbHoB1J5uywZuZu5SaXjcjTuny+QEkazJqfeIcDh6x08LWsKrbg17Oqf uhyIY5FWktO/oEaRL86EiyR4ydDoWGVkn519E1ghIqRbXC2v6deOGPaYOKo3wW6z52s4 v92Q== X-Forwarded-Encrypted: i=1; AHgh+RqXmxEaPj2154wg1ogxAgOUuczBbqhhICvGQtkxgyeMxkDgmEhphZu3FAejL6e0HEbCnVYkw9MD6q0n1Qo=@vger.kernel.org X-Gm-Message-State: AFuF++lMhf5wNMwERv1EVlSAlaP4MTBVmsZcouQ0mRlK2YEHFQ/omyZu iV9ODd73M0uRkDFQemXJ6nXDxG6ucGSjqJedJkYwUpOBDEa7RG3yJjgLNhfSIr67RND7jOHxYL6 ITBXqORfYHhjPy6DIWRMc0FX/Z+RT0LhHWms6PY5c4dggVOFmmGqqWD76uCOWPuS3+w== X-Gm-Gg: AR+sD13bOaS3Qj+yZ9Q6/LAd7ZSn/gt8KMbGgAHhA1+XDYopbbPquYPr1/32L+JAMzX H/QQwAnTT6Aq+TFr/FzdI12Zm722ttcp94VQaxp2+JPOOUmWh3jGX1TBL4tvuIWoDpWzc/61BIC LP7kcp+PlBQ0M33tv5E8vtJFis8y8ur4qh8hpSytXFO5h42KT2lV3n4oFiaAzRZfXPKaCFQpThN he4gMw9L4/M5sEZTVcPFE+EXlCb9Ldgw7nNK0b+RX4vq+IPTXDWniu7hTNwbDE3sGrjD00/Xg8H wQAGGgFh4grPa/+F2TUgaR3sTrZYsholWuPqSimRxyoczyCXbTl/DhhnfIpH25q+hByTcZdF X-Received: by 2002:a05:6214:cc5:b0:8cc:d29:9f73 with SMTP id 6a1803df08f44-90c80c661f8mr90295536d6.21.1787347892638; Fri, 21 Aug 2026 14:31:32 -0700 (PDT) X-Received: by 2002:a05:6214:cc5:b0:8cc:d29:9f73 with SMTP id 6a1803df08f44-90c80c661f8mr90295106d6.21.1787347892151; Fri, 21 Aug 2026 14:31:32 -0700 (PDT) Received: from [192.168.8.4] ([100.0.180.93]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-90c5f2906afsm71653306d6.25.2026.08.21.14.31.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2026 14:31:31 -0700 (PDT) Message-ID: Subject: Re: [PATCH v2 01/10] drm/nouveau/disp: move GSP head-timing ISR and vblank helpers to tu102.c From: lyude@redhat.com To: Mohamed Ahmed , linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Danilo Krummrich , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Mary Guillemard , nouveau@lists.freedesktop.org Date: Fri, 21 Aug 2026 17:31:30 -0400 In-Reply-To: <20260820164929.17117-2-mohamedahmedegypt2001@gmail.com> References: <20260820164929.17117-1-mohamedahmedegypt2001@gmail.com> <20260820164929.17117-2-mohamedahmedegypt2001@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reviewed-by: Lyude Paul On Thu, 2026-08-20 at 20:49 +0400, Mohamed Ahmed wrote: > The GSP-RM display code in rm/r535/disp.c owns a handful of direct > MMIO > routines: the head-timing (vblank) interrupt handler and the per-head > vblank enable/disable. They program display registers, not RM, so > they > belong with the rest of the per-chip register code in engine/disp/. >=20 > Move them to tu102.c (Turing is the first GSP-capable generation) as > tu102_disp_intr() and tu102_head_vblank_get()/put(), exported for > rm/r535/disp.c, which keeps calling them by name for now. No > functional > change. >=20 > Signed-off-by: Mohamed Ahmed > --- > =C2=A0.../gpu/drm/nouveau/nvkm/engine/disp/head.h=C2=A0=C2=A0 |=C2=A0 3 += + > =C2=A0.../gpu/drm/nouveau/nvkm/engine/disp/priv.h=C2=A0=C2=A0 |=C2=A0 1 + > =C2=A0.../gpu/drm/nouveau/nvkm/engine/disp/tu102.c=C2=A0 | 50 > ++++++++++++++++++ > =C2=A0.../nouveau/nvkm/subdev/gsp/rm/r535/disp.c=C2=A0=C2=A0=C2=A0 | 52 += +--------------- > -- > =C2=A04 files changed, 57 insertions(+), 49 deletions(-) >=20 > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h > b/drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h > index b642729c254f..986043e87554 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h > @@ -56,6 +56,9 @@ int gv100_head_new(struct nvkm_disp *, int id); > =C2=A0void gv100_head_state(struct nvkm_head *head, struct nvkm_head_stat= e > *state); > =C2=A0void gv100_head_rgpos(struct nvkm_head *head, u16 *hline, u16 > *vline); > =C2=A0 > +void tu102_head_vblank_get(struct nvkm_head *); > +void tu102_head_vblank_put(struct nvkm_head *); > + > =C2=A0#define HEAD_MSG(h,l,f,a...) do > {=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \ > =C2=A0 struct nvkm_head *_h =3D > (h);=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 \ > =C2=A0 nvkm_##l(&_h->disp->engine.subdev, "head-%d: "f"\n", _h->id, > ##a);=C2=A0=C2=A0=C2=A0=C2=A0 \ > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h > b/drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h > index a3fd7cb7c488..722ec340e12a 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h > @@ -72,6 +72,7 @@ int gv100_disp_wndw_cnt(struct nvkm_disp *, > unsigned long *); > =C2=A0int gv100_disp_caps_new(const struct nvkm_oclass *, void *, u32, > struct nvkm_object **); > =C2=A0 > =C2=A0int tu102_disp_init(struct nvkm_disp *); > +irqreturn_t tu102_disp_intr(struct nvkm_inth *); > =C2=A0 > =C2=A0void nv50_disp_dptmds_war_2(struct nvkm_disp *, struct dcb_output > *); > =C2=A0void nv50_disp_dptmds_war_3(struct nvkm_disp *, struct dcb_output > *); > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c > b/drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c > index dcb9f8ba374c..7b70b466fa36 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c > @@ -104,6 +104,56 @@ tu102_sor_new(struct nvkm_disp *disp, int id) > =C2=A0 return nvkm_ior_new_(&tu102_sor, disp, SOR, id, hda & > BIT(id)); > =C2=A0} > =C2=A0 > +/* The GSP-RM display path leaves head-timing (vblank) interrupts > and their > + * enables to us. These program the RM head-timing line (bit 1 of > the > + * per-head enable, not the bit nvkm's own gv100 path uses). > + */ > +void > +tu102_head_vblank_put(struct nvkm_head *head) > +{ > + struct nvkm_device *device =3D head->disp- > >engine.subdev.device; > + > + nvkm_mask(device, 0x611d80 + (head->id * 4), 0x00000002, > 0x00000000); > +} > + > +void > +tu102_head_vblank_get(struct nvkm_head *head) > +{ > + struct nvkm_device *device =3D head->disp- > >engine.subdev.device; > + > + nvkm_wr32(device, 0x611800 + (head->id * 4), 0x00000002); > + nvkm_mask(device, 0x611d80 + (head->id * 4), 0x00000002, > 0x00000002); > +} > + > +static void > +tu102_disp_intr_head_timing(struct nvkm_disp *disp, int head) > +{ > + struct nvkm_subdev *subdev =3D &disp->engine.subdev; > + struct nvkm_device *device =3D subdev->device; > + u32 stat =3D nvkm_rd32(device, 0x611c00 + (head * 0x04)); > + > + if (stat & 0x00000002) { > + nvkm_disp_vblank(disp, head); > + > + nvkm_wr32(device, 0x611800 + (head * 0x04), > 0x00000002); > + } > +} > + > +irqreturn_t > +tu102_disp_intr(struct nvkm_inth *inth) > +{ > + struct nvkm_disp *disp =3D container_of(inth, typeof(*disp), > engine.subdev.inth); > + struct nvkm_subdev *subdev =3D &disp->engine.subdev; > + struct nvkm_device *device =3D subdev->device; > + unsigned long mask =3D nvkm_rd32(device, 0x611ec0) & > 0x000000ff; > + int head; > + > + for_each_set_bit(head, &mask, 8) > + tu102_disp_intr_head_timing(disp, head); > + > + return IRQ_HANDLED; > +} > + > =C2=A0int > =C2=A0tu102_disp_init(struct nvkm_disp *disp) > =C2=A0{ > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c > b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c > index e77733a5d9c3..8e57bb6519e5 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c > @@ -608,29 +608,12 @@ r535_sor_cnt(struct nvkm_disp *disp, unsigned > long *pmask) > =C2=A0 return 4; > =C2=A0} > =C2=A0 > -static void > -r535_head_vblank_put(struct nvkm_head *head) > -{ > - struct nvkm_device *device =3D head->disp- > >engine.subdev.device; > - > - nvkm_mask(device, 0x611d80 + (head->id * 4), 0x00000002, > 0x00000000); > -} > - > -static void > -r535_head_vblank_get(struct nvkm_head *head) > -{ > - struct nvkm_device *device =3D head->disp- > >engine.subdev.device; > - > - nvkm_wr32(device, 0x611800 + (head->id * 4), 0x00000002); > - nvkm_mask(device, 0x611d80 + (head->id * 4), 0x00000002, > 0x00000002); > -} > - > =C2=A0static const struct nvkm_head_func > =C2=A0r535_head =3D { > =C2=A0 .state =3D gv100_head_state, > =C2=A0 .rgpos =3D gv100_head_rgpos, > - .vblank_get =3D r535_head_vblank_get, > - .vblank_put =3D r535_head_vblank_put, > + .vblank_get =3D tu102_head_vblank_get, > + .vblank_put =3D tu102_head_vblank_put, > =C2=A0}; > =C2=A0 > =C2=A0static struct nvkm_conn * > @@ -1404,35 +1387,6 @@ static const struct nvkm_event_func > =C2=A0r535_disp_event =3D { > =C2=A0}; > =C2=A0 > -static void > -r535_disp_intr_head_timing(struct nvkm_disp *disp, int head) > -{ > - struct nvkm_subdev *subdev =3D &disp->engine.subdev; > - struct nvkm_device *device =3D subdev->device; > - u32 stat =3D nvkm_rd32(device, 0x611c00 + (head * 0x04)); > - > - if (stat & 0x00000002) { > - nvkm_disp_vblank(disp, head); > - > - nvkm_wr32(device, 0x611800 + (head * 0x04), > 0x00000002); > - } > -} > - > -static irqreturn_t > -r535_disp_intr(struct nvkm_inth *inth) > -{ > - struct nvkm_disp *disp =3D container_of(inth, typeof(*disp), > engine.subdev.inth); > - struct nvkm_subdev *subdev =3D &disp->engine.subdev; > - struct nvkm_device *device =3D subdev->device; > - unsigned long mask =3D nvkm_rd32(device, 0x611ec0) & > 0x000000ff; > - int head; > - > - for_each_set_bit(head, &mask, 8) > - r535_disp_intr_head_timing(disp, head); > - > - return IRQ_HANDLED; > -} > - > =C2=A0static void > =C2=A0r535_disp_fini(struct nvkm_disp *disp, bool suspend) > =C2=A0{ > @@ -1708,7 +1662,7 @@ r535_disp_oneinit(struct nvkm_disp *disp) > =C2=A0 return ret; > =C2=A0 > =C2=A0 ret =3D nvkm_inth_add(&device->vfn->intr, ret, > NVKM_INTR_PRIO_NORMAL, &disp->engine.subdev, > - =C2=A0=C2=A0=C2=A0 r535_disp_intr, &disp- > >engine.subdev.inth); > + =C2=A0=C2=A0=C2=A0 tu102_disp_intr, &disp- > >engine.subdev.inth); > =C2=A0 if (ret) > =C2=A0 return ret; > =C2=A0