Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1940018ybv; Fri, 14 Feb 2020 08:34:23 -0800 (PST) X-Google-Smtp-Source: APXvYqx9A1YPGSSLv150g+xPX8vpyhYHxgmVDNwpcwpOMYFmzXEEEMnCfIH4VItGKKpOq0Lzw6SG X-Received: by 2002:aca:d484:: with SMTP id l126mr2362205oig.114.1581698063659; Fri, 14 Feb 2020 08:34:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698063; cv=none; d=google.com; s=arc-20160816; b=F7Ds9DHd0dfLtwEKDQVeETcoe5BAxrIgPuFgNf2Ig3c1iwBlzk+cva7snK7/K3cdnU jsl9RktZz7Ggoz0PVO76uv2QZ4WNdYr6/u6fqrBb64TTpoyxK/Wq+K4XDFXVHNsd4iEf f9H204+/QRQ6dVUUe0jxZKvIGjA2Lmhi+ek7DezlNcyo0Xufr29rSMjqVc0s8av/2h+c KkCajwmS6trFXKHQ+CIKPkAKg4YD8RnHlU2xNe47EwJSSlvFqkjRTQAszedbKmQX552W 5GIV0cyeK8i6yO0gK2fxXFudhOk7xSdADDG7DYxXzr0oAcYW0Og4FQ9yBwajjDa7ShmE GCWA== 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=Sb0Vkcf3mlkOb0g+G4X9cKxcwql+YE8/opNa4GEWMAg=; b=YEvOLxi0LZO7tALcIbYh0z9j0MhgAMJuhJu1OOQm/UZd8fehXezSf6befCsdaRf2K4 l+tpY0fIGDRa4z5PlqdUl49Sh4NFBt3smeBKzgj+a1YtA6wVw1Dnwr04183y9HekivXu eudYVgnQTAHXj7s7LeaAfOMftygAa9BljBBgtrrm18kiE7buLl3LEjAn3RD2zIbvbEdS ZwCqFABzh/BgPr8NOv2Q+Inw9ahWjAWbB+kyZj9Z4vb9j6CziyOGx5T0oGCER7/7DMep ab0D4rCSKmV9SbB3XHq0BP54CPNAMPFBXO6QQ9CIwhes5xOin2kPq6EEjMZXwyKjhlrr WWRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2VJ57DNB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si3021851otp.258.2020.02.14.08.34.10; Fri, 14 Feb 2020 08:34:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2VJ57DNB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406125AbgBNQZa (ORCPT + 99 others); Fri, 14 Feb 2020 11:25:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:59710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405645AbgBNQXZ (ORCPT ); Fri, 14 Feb 2020 11:23:25 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ABE1424779; Fri, 14 Feb 2020 16:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697405; bh=A5JhqAJW0/T19P0pXEctJKdutmGn5EGnPtPBSXQsXo4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2VJ57DNB1LaD+FdkGkLIJ4l/5GOdxiaWmt+m53vV+sWyThDHHIxBFEsbF+qCy9TCq aNZTV2Jm+PGQAhRWCUwqLpUZSrV0xu1mOJvTxY6ZXkdTbnzuG9hKOmZsRibYqFsWJ/ k+durQsuieTW7GT2w1I8FPWb0P9gUq9tYOqaJCHw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ben Skeggs , Sasha Levin , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.9 098/141] drm/nouveau/gr/gk20a,gm200-: add terminators to method lists read from fw Date: Fri, 14 Feb 2020 11:20:38 -0500 Message-Id: <20200214162122.19794-98-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Skeggs [ Upstream commit 7adc77aa0e11f25b0e762859219c70852cd8d56f ] Method init is typically ordered by class in the FW image as ThreeD, TwoD, Compute. Due to a bug in parsing the FW into our internal format, we've been accidentally sending Twod + Compute methods to the ThreeD class, as well as Compute methods to the TwoD class - oops. Signed-off-by: Ben Skeggs Signed-off-by: Sasha Levin --- .../gpu/drm/nouveau/nvkm/engine/gr/gk20a.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c index de8b806b88fd9..7618b2eb4fdfd 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c @@ -143,23 +143,24 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name, nent = (fuc.size / sizeof(struct gk20a_fw_av)); - pack = vzalloc((sizeof(*pack) * max_classes) + - (sizeof(*init) * (nent + 1))); + pack = vzalloc((sizeof(*pack) * (max_classes + 1)) + + (sizeof(*init) * (nent + max_classes + 1))); if (!pack) { ret = -ENOMEM; goto end; } - init = (void *)(pack + max_classes); + init = (void *)(pack + max_classes + 1); - for (i = 0; i < nent; i++) { - struct gf100_gr_init *ent = &init[i]; + for (i = 0; i < nent; i++, init++) { struct gk20a_fw_av *av = &((struct gk20a_fw_av *)fuc.data)[i]; u32 class = av->addr & 0xffff; u32 addr = (av->addr & 0xffff0000) >> 14; if (prevclass != class) { - pack[classidx].init = ent; + if (prevclass) /* Add terminator to the method list. */ + init++; + pack[classidx].init = init; pack[classidx].type = class; prevclass = class; if (++classidx >= max_classes) { @@ -169,10 +170,10 @@ gk20a_gr_av_to_method(struct gf100_gr *gr, const char *fw_name, } } - ent->addr = addr; - ent->data = av->data; - ent->count = 1; - ent->pitch = 1; + init->addr = addr; + init->data = av->data; + init->count = 1; + init->pitch = 1; } *ppack = pack; -- 2.20.1