Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2348918pxa; Mon, 24 Aug 2020 11:36:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDSWCtTGLLATZVVZS9GP74X/aMcSrrqVQBbTJAQ5ltdDg7w8xO545eLjKqoJwd+8x4JNql X-Received: by 2002:a17:906:7715:: with SMTP id q21mr6641042ejm.251.1598294178532; Mon, 24 Aug 2020 11:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598294178; cv=none; d=google.com; s=arc-20160816; b=KG5VRVojil2lflPvvHwR7xY/xjou/j4KadO9K02uTH+DUOyLfcH3WjZTOF3Eg6KBlB iOkp1WOIWrGMkdID6i0yY5a5Jk8bZIK+3/KWKREMSeWak4XLMSZ401EjRzMzsU+IkUcs k3E2XltKV2SY2yE+kHcCIi1eNOXFm0dA7LTImqUEa4XkFqmmau2Pbd5a2CRtBONZNItx Yfd5d5Qw+gmkS38VbTia+uUXVSooBimSjSJD7G/M9qF/sJpx7DTQIVg18EADXpmF46O4 nv5yHkIKyhKc0DcT7wbPGh59q7ywoiOx71ijtAu11E5sV1Xyp8c4n3xHqVdD3tX78nPf orsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ygt9wEnux5G4zAvsw/hJsnQUsV+fTkUJXjsJAkh4+/g=; b=Lo4lDq0Ntwy5sVbADO3+kosQOZ4MEHTsSJYQYRIgUX3SJM95kQvVCJNtslQNSykb0C x1Y5S6JN9HXF1O2nfw4w8DaT6W+GVE9kp6hDvYOeWhfLamTX1G4a0rEcvG7Dcp2/FQ7x PIBmdEdLpGOQ8Y7ixpNfJh3SmM+cPoQZ0Ix+3F/4xM2RHCSxqcAVXeGJgb97cyS74VkQ OvEjUTwp7cnVQRigUzmOAgWxSQ99hnwx7WmU0qiywRwi/Km1+ZQSdAmSGMyG1F4UFjIS UT78vbS310IanU0YISTLcKp6GxyRVa3y3LLV/JIliXev3uJ76pU4VGNX86CZB1Zphk1N jnrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cXUorzid; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si6996491edq.44.2020.08.24.11.35.55; Mon, 24 Aug 2020 11:36:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cXUorzid; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726306AbgHXSdK (ORCPT + 99 others); Mon, 24 Aug 2020 14:33:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30738 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725962AbgHXSdH (ORCPT ); Mon, 24 Aug 2020 14:33:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598293985; 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=Ygt9wEnux5G4zAvsw/hJsnQUsV+fTkUJXjsJAkh4+/g=; b=cXUorzidyiBV2BZiJl90kn6j+8mjQIG9/hJyknQPZ5u2QyI6pbjdkcB9Nl6C27WTwSuAA5 NJnhyyg/lWorp6Kc5TMbRaOtONKPXfWnEnXGbEifsQAjl+mYxArK+QSVC4wxX1kLb7Indj AmlVUpDmbSdW8zTgqVSZE+bYbtHWcGs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-419-Az4be31dN5iaqoMY_9Jylw-1; Mon, 24 Aug 2020 14:33:04 -0400 X-MC-Unique: Az4be31dN5iaqoMY_9Jylw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B31D91DDEC; Mon, 24 Aug 2020 18:33:01 +0000 (UTC) Received: from Whitewolf.redhat.com (ovpn-114-60.rdu2.redhat.com [10.10.114.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBF0E5C1DA; Mon, 24 Aug 2020 18:32:59 +0000 (UTC) From: Lyude Paul To: nouveau@lists.freedesktop.org, Sasha Levin Cc: stable@vger.kernel.org, Ben Skeggs , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org (open list:DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/2] drm/nouveau/kms/nv50-: Program notifier offset before requesting disp caps Date: Mon, 24 Aug 2020 14:32:52 -0400 Message-Id: <20200824183253.826343-2-lyude@redhat.com> In-Reply-To: <20200824183253.826343-1-lyude@redhat.com> References: <20200824183253.826343-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Not entirely sure why this never came up when I originally tested this (maybe some BIOSes already have this setup?) but the ->caps_init vfunc appears to cause the display engine to throw an exception on driver init, at least on my ThinkPad P72: nouveau 0000:01:00.0: disp: chid 0 mthd 008c data 00000000 0000508c 0000102b This is magic nvidia speak for "You need to have the DMA notifier offset programmed before you can call NV507D_GET_CAPABILITIES." So, let's fix this by doing that, and also perform an update afterwards to prevent racing with the GPU when reading capabilities. Changes since v1: * Don't just program the DMA notifier offset, make sure to actually perform an update Signed-off-by: Lyude Paul Fixes: 4a2cb4181b07 ("drm/nouveau/kms/nv50-: Probe SOR and PIOR caps for DP interlacing support") Cc: # v5.8+ --- drivers/gpu/drm/nouveau/dispnv50/core507d.c | 25 ++++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/core507d.c b/drivers/gpu/drm/nouveau/dispnv50/core507d.c index e341f572c2696..5e86feec3b720 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/core507d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/core507d.c @@ -65,13 +65,26 @@ core507d_ntfy_init(struct nouveau_bo *bo, u32 offset) int core507d_caps_init(struct nouveau_drm *drm, struct nv50_disp *disp) { - u32 *push = evo_wait(&disp->core->chan, 2); + struct nv50_core *core = disp->core; + u32 interlock[NV50_DISP_INTERLOCK__SIZE] = {0}; + u32 *push; - if (push) { - evo_mthd(push, 0x008c, 1); - evo_data(push, 0x0); - evo_kick(push, &disp->core->chan); - } + core->func->ntfy_init(disp->sync, NV50_DISP_CORE_NTFY); + + push = evo_wait(&core->chan, 4); + if (!push) + return 0; + + evo_mthd(push, 0x0084, 1); + evo_data(push, 0x80000000 | NV50_DISP_CORE_NTFY); + evo_mthd(push, 0x008c, 1); + evo_data(push, 0x0); + evo_kick(push, &core->chan); + + core->func->update(core, interlock, false); + if (core->func->ntfy_wait_done(disp->sync, NV50_DISP_CORE_NTFY, + core->chan.base.device)) + NV_ERROR(drm, "core notifier timeout\n"); return 0; } -- 2.26.2