Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp977817rdb; Tue, 19 Sep 2023 16:49:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEk3Mg2CnaLCp8hL0GSjOswvPOkXNauDI1H4bYqruQcrEKQssAxHN5+WFC8sJwLP5NMr6Dl X-Received: by 2002:a17:903:244f:b0:1c4:375c:110a with SMTP id l15-20020a170903244f00b001c4375c110amr1222928pls.19.1695167378155; Tue, 19 Sep 2023 16:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695167378; cv=none; d=google.com; s=arc-20160816; b=DiTWGUxBOc5NmakKUS+gO+Im+LkL7sWmzCmsoZWr0CaPF7DFX6+3Q344Xe2Bfgis/m cFJ9mdCiYHkAYRJhUCUQV45pmJBjY5wrWOdlPnyvB865C+CIm/7NCVkJ9iA1kJNgewIY Q+USzROi+ZZqisXUXxk9EVTRiqU9ahQhbzdalgZ1yzCfymm1mGCVzI90tAws1ku+SBeK 5f18K3s/aJsiIyUWqgwmjCfL5v/SR9d4qWFU4E4OS5p7OtXAZa1LEjrvWl8fQ8wp/2s/ 5oGv9VHDLq+DGftWWq21KG/HgigpBLPZUFAAiLk/d0mbKqn979TYfUMxYcDknJYBZ6t/ 7ezA== 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=BEnneeu2hwwJ1GjkrrSDN/AAquNA7OmmStlB2xLOjaI=; fh=2SXWb2ts99eE+OYESnujeGpShOsteg1KtZEhV4aGij8=; b=tlNCF2u1Cq7iXRZKHcG5wqYWb67XLpeAfKeDUoTsfp1Pv2mR6f+JG7JsNdkUrE74sg NleOucnqFVpPI9qZLV4+Icwp0YwVKGSbUu38ocm1SA24o9nMoPXdkZ9H6+EDpTrQbugw Kf51ZmuLt914UAAcj4d4Aux+Ynk1GDIvDRhh89THXZrT0bWQsTgKlUevRrvxucMBGX1z NVMG5m//WGFpm9Jf37ajZt1Ji+JhW+2tysKhBpcvk8kWxE+J4QuLh0RzjDL2hHL2a7Lz 7dd+eI/nw+pysYFhqF0elB7GR2IZr80BoJ5c/tBVngAriSH5RZuSIO5eRBF+QuG4V8X7 FzrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LnBSjOdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id p12-20020a170902e74c00b001bbc84f3ba7si10877939plf.282.2023.09.19.16.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 16:49:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LnBSjOdA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 1F05B829D258; Tue, 19 Sep 2023 15:11:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233538AbjISWKj (ORCPT + 99 others); Tue, 19 Sep 2023 18:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233535AbjISWKi (ORCPT ); Tue, 19 Sep 2023 18:10:38 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63FC71BE3 for ; Tue, 19 Sep 2023 15:07:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695161241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BEnneeu2hwwJ1GjkrrSDN/AAquNA7OmmStlB2xLOjaI=; b=LnBSjOdA/bj2klYOs/lewgadHFO7Gnss+SkyCEG05tufOwgYVCB7FVCecVnLh1JMN3XB65 WDOdx+id4t14zyw/W9sG7ps5nE2cjTpU97S13NHObYtlKEVhgdb8UDntbS8z9bic5yKLkK BtAiWvb/bpU0vqMru2Pem9BkwH8x9h4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-26-WdTEKt6FN3y18QQQEhAaUQ-1; Tue, 19 Sep 2023 18:07:19 -0400 X-MC-Unique: WdTEKt6FN3y18QQQEhAaUQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1C05E101A53B; Tue, 19 Sep 2023 22:07:19 +0000 (UTC) Received: from emerald.lyude.net (unknown [10.22.18.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF58F40C2064; Tue, 19 Sep 2023 22:07:18 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Cc: Ben Skeggs , Danilo Krummrich , Karol Herbst , David Airlie , Daniel Vetter , Kees Cook , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 34/44] drm/nouveau/disp: add dp sst config method Date: Tue, 19 Sep 2023 17:56:29 -0400 Message-ID: <20230919220442.202488-35-lyude@redhat.com> In-Reply-To: <20230919220442.202488-1-lyude@redhat.com> References: <20230919220442.202488-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 19 Sep 2023 15:11:16 -0700 (PDT) From: Ben Skeggs This is presently unused on HW, we read a bunch of regs and calculate the watermark during the second supervisor interrupt. I don't want to change this yet as I need to re-remember how older HW works exactly, but RM wants this info via RPC. Signed-off-by: Ben Skeggs Reviewed-by: Lyude Paul Acked-by: Danilo Krummrich Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/include/nvif/if0012.h | 12 +++++++++++ drivers/gpu/drm/nouveau/include/nvif/outp.h | 1 + drivers/gpu/drm/nouveau/nvif/outp.c | 18 ++++++++++++++++ .../gpu/drm/nouveau/nvkm/engine/disp/ior.h | 2 ++ .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c | 21 +++++++++++++++++++ 5 files changed, 54 insertions(+) diff --git a/drivers/gpu/drm/nouveau/include/nvif/if0012.h b/drivers/gpu/drm/nouveau/include/nvif/if0012.h index 00ce0a46c152b..6fb297b65ae87 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/if0012.h +++ b/drivers/gpu/drm/nouveau/include/nvif/if0012.h @@ -36,6 +36,7 @@ union nvif_outp_args { #define NVIF_OUTP_V0_DP_RATES 0x72 #define NVIF_OUTP_V0_DP_TRAIN 0x73 #define NVIF_OUTP_V0_DP_DRIVE 0x74 +#define NVIF_OUTP_V0_DP_SST 0x75 #define NVIF_OUTP_V0_DP_MST_VCPI 0x78 union nvif_outp_detect_args { @@ -222,6 +223,17 @@ union nvif_outp_dp_drive_args { } v0; }; +union nvif_outp_dp_sst_args { + struct nvif_outp_dp_sst_v0 { + __u8 version; + __u8 head; + __u8 pad02[2]; + __u32 watermark; + __u32 hblanksym; + __u32 vblanksym; + } v0; +}; + union nvif_outp_dp_mst_vcpi_args { struct nvif_outp_dp_mst_vcpi_v0 { __u8 version; diff --git a/drivers/gpu/drm/nouveau/include/nvif/outp.h b/drivers/gpu/drm/nouveau/include/nvif/outp.h index b4f97fabecbdc..881cbed5f0ee3 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/outp.h +++ b/drivers/gpu/drm/nouveau/include/nvif/outp.h @@ -68,6 +68,7 @@ int nvif_outp_dp_train(struct nvif_outp *, u8 dpcd[DP_RECEIVER_CAP_SIZE], u8 lttprs, u8 link_nr, u32 link_bw, bool mst, bool post_lt_adj, bool retrain); int nvif_outp_dp_drive(struct nvif_outp *, u8 link_nr, u8 pe[4], u8 vs[4]); +int nvif_outp_dp_sst(struct nvif_outp *, int head, u32 watermark, u32 hblanksym, u32 vblanksym); int nvif_outp_dp_mst_vcpi(struct nvif_outp *, int head, u8 start_slot, u8 num_slots, u16 pbn, u16 aligned_pbn); #endif diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c index 5fe5523587e6a..952103aa93b78 100644 --- a/drivers/gpu/drm/nouveau/nvif/outp.c +++ b/drivers/gpu/drm/nouveau/nvif/outp.c @@ -46,6 +46,24 @@ nvif_outp_dp_mst_vcpi(struct nvif_outp *outp, int head, return ret; } +int +nvif_outp_dp_sst(struct nvif_outp *outp, int head, u32 watermark, u32 hblanksym, u32 vblanksym) +{ + struct nvif_outp_dp_sst_v0 args; + int ret; + + args.version = 0; + args.head = head; + args.watermark = watermark; + args.hblanksym = hblanksym; + args.vblanksym = vblanksym; + ret = nvif_object_mthd(&outp->object, NVIF_OUTP_V0_DP_SST, &args, sizeof(args)); + NVIF_ERRON(ret, &outp->object, + "[DP_SST head:%d watermark:%d hblanksym:%d vblanksym:%d]", + args.head, args.watermark, args.hblanksym, args.vblanksym); + return ret; +} + int nvif_outp_dp_drive(struct nvif_outp *outp, u8 link_nr, u8 pe[4], u8 vs[4]) { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h index 8686e5c044a5d..9beb9d1e86334 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h @@ -84,6 +84,8 @@ struct nvkm_ior_func { void (*pattern)(struct nvkm_ior *, int pattern); void (*drive)(struct nvkm_ior *, int ln, int pc, int dc, int pe, int tx_pu); + int (*sst)(struct nvkm_ior *, int head, bool ef, + u32 watermark, u32 hblanksym, u32 vblanksym); void (*vcpi)(struct nvkm_ior *, int head, u8 slot, u8 slot_nr, u16 pbn, u16 aligned); void (*audio)(struct nvkm_ior *, int head, bool enable); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c index b634e76c2a9ba..225f88fbdae0f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c @@ -45,6 +45,26 @@ nvkm_uoutp_mthd_dp_mst_vcpi(struct nvkm_outp *outp, void *argv, u32 argc) return 0; } +static int +nvkm_uoutp_mthd_dp_sst(struct nvkm_outp *outp, void *argv, u32 argc) +{ + union nvif_outp_dp_sst_args *args = argv; + struct nvkm_disp *disp = outp->disp; + struct nvkm_ior *ior = outp->ior; + + if (argc != sizeof(args->v0) || args->v0.version != 0) + return -ENOSYS; + + if (!ior->func->dp || !nvkm_head_find(disp, args->v0.head)) + return -EINVAL; + if (!ior->func->dp->sst) + return 0; + + return ior->func->dp->sst(ior, args->v0.head, + outp->dp.dpcd[DPCD_RC02] & DPCD_RC02_ENHANCED_FRAME_CAP, + args->v0.watermark, args->v0.hblanksym, args->v0.vblanksym); +} + static int nvkm_uoutp_mthd_dp_drive(struct nvkm_outp *outp, void *argv, u32 argc) { @@ -461,6 +481,7 @@ nvkm_uoutp_mthd_acquired(struct nvkm_outp *outp, u32 mthd, void *argv, u32 argc) case NVIF_OUTP_V0_HDA_ELD : return nvkm_uoutp_mthd_hda_eld (outp, argv, argc); case NVIF_OUTP_V0_DP_TRAIN : return nvkm_uoutp_mthd_dp_train (outp, argv, argc); case NVIF_OUTP_V0_DP_DRIVE : return nvkm_uoutp_mthd_dp_drive (outp, argv, argc); + case NVIF_OUTP_V0_DP_SST : return nvkm_uoutp_mthd_dp_sst (outp, argv, argc); case NVIF_OUTP_V0_DP_MST_VCPI : return nvkm_uoutp_mthd_dp_mst_vcpi (outp, argv, argc); default: break; -- 2.41.0