Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp404573pxu; Tue, 1 Dec 2020 14:25:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNFA2eOhBCC7j9mzzScwuV0TOBp+0A+izhqyHmbhE3G2/uA4skW3IM++jtPLDAv0/Wz8rd X-Received: by 2002:aa7:dc5a:: with SMTP id g26mr5319899edu.35.1606861504719; Tue, 01 Dec 2020 14:25:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606861504; cv=none; d=google.com; s=arc-20160816; b=pgOA2rqZtxZFbQyG+pdw6kX/BtoktgZW5ZJM73j0MsD7CaXZ6pnYAzFCQU4OfY3ncY RgKcEDV+5Vc3BEd5O7XYc5Nr+Xp/6VbHvM6wHnoCSrYfndAL2Suc97D5XCqrEfJkUrfA UCKzGGNhE98wtci5FoPG3po/+rWhCf52rymWdOlmBaIgOj6uR8qvHSJGJGe9lBg+NqRT pDBVpOsQNvWGomxDKBDTUO7x0PK4oOZOeTbkx4xJDNeP43cCdfrNNj0osRCxVnbN/e2r nSmPD9YSvIxJbg96WJWe4sRLvn5Xm8nZrD+rYmGSjaaHUZhMnsF3Ns8jKATCnAJ2QZEs 2WrA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+PX/hR3tJgzOWiGyngli9h7MAGYb3S7dgvJ0LHYsJvQ=; b=QFiWXXWqcN4VDA11yEPNT9Amhr8qxYR4RoaNDR/+yLlpe9uCL8AO10fmMAHvnn5A7d sutLX/+gXJZBeXC69paiPnSWiQsOBZno5LT5o7dRvuGWQSxoo1sUvtf64kgiuVFpEBKu FmOLkv+/NiWxoTbARqH+or/OR3GYfsmVcpzSG8A+avwDLOSROXb2v2UXY7zLXsWMsG4j X+qlQ+mUCjo1cnGglD9BtgG+0kUqJJuPQzSXj8SS6QWhHpmm7Hc4ZwcCzQlMb8wZ5jve VQlp1oL5fOyzjyBmeCZixVpmMQHh36Z4sEcGWc55CSUMszmPiI6VeQudm90k+FZFM/iC qCTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZAOM3w+T; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r17si826208edq.47.2020.12.01.14.24.42; Tue, 01 Dec 2020 14:25:04 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=ZAOM3w+T; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389589AbgLAJJw (ORCPT + 99 others); Tue, 1 Dec 2020 04:09:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:46448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389355AbgLAJI5 (ORCPT ); Tue, 1 Dec 2020 04:08:57 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B1BDD22240; Tue, 1 Dec 2020 09:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813696; bh=p9E9dNyuQyJnJCXjhLmFzsg30ehB84WlzPKOQR3JwgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZAOM3w+T7EWGjdqpATcgTxXRAHrG8ZfH4Hbu6918ZZp5AXM3KYIw+/6kTBDszui8p n303jyx1ywpmb1Bd+lm/ey6yoy9o3hP+LzxmuAPZxyZrC0xoA/Fyi+v7WYwpYKOuCa ME+QPs1RA3AhFO8d/xd9MsiOyi/OrVxF865CoVBc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sonny Jiang , Leo Liu , Alex Deucher Subject: [PATCH 5.9 028/152] drm/amdgpu: fix SI UVD firmware validate resume fail Date: Tue, 1 Dec 2020 09:52:23 +0100 Message-Id: <20201201084715.567792556@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084711.707195422@linuxfoundation.org> References: <20201201084711.707195422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sonny Jiang commit 4d6a95366117b241bb3298e1c318a36ebb7544d0 upstream. The SI UVD firmware validate key is stored at the end of firmware, which is changed during resume while playing video. So get the key at sw_init and store it for fw validate using. Signed-off-by: Sonny Jiang Reviewed-by: Leo Liu Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h | 1 + drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h @@ -67,6 +67,7 @@ struct amdgpu_uvd { unsigned harvest_config; /* store image width to adjust nb memory state */ unsigned decode_image_width; + uint32_t keyselect; }; int amdgpu_uvd_sw_init(struct amdgpu_device *adev); --- a/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v3_1.c @@ -277,15 +277,8 @@ static void uvd_v3_1_mc_resume(struct am */ static int uvd_v3_1_fw_validate(struct amdgpu_device *adev) { - void *ptr; - uint32_t ucode_len, i; - uint32_t keysel; - - ptr = adev->uvd.inst[0].cpu_addr; - ptr += 192 + 16; - memcpy(&ucode_len, ptr, 4); - ptr += ucode_len; - memcpy(&keysel, ptr, 4); + int i; + uint32_t keysel = adev->uvd.keyselect; WREG32(mmUVD_FW_START, keysel); @@ -550,6 +543,8 @@ static int uvd_v3_1_sw_init(void *handle struct amdgpu_ring *ring; struct amdgpu_device *adev = (struct amdgpu_device *)handle; int r; + void *ptr; + uint32_t ucode_len; /* UVD TRAP */ r = amdgpu_irq_add_id(adev, AMDGPU_IRQ_CLIENTID_LEGACY, 124, &adev->uvd.inst->irq); @@ -560,6 +555,13 @@ static int uvd_v3_1_sw_init(void *handle if (r) return r; + /* Retrieval firmware validate key */ + ptr = adev->uvd.inst[0].cpu_addr; + ptr += 192 + 16; + memcpy(&ucode_len, ptr, 4); + ptr += ucode_len; + memcpy(&adev->uvd.keyselect, ptr, 4); + ring = &adev->uvd.inst->ring; sprintf(ring->name, "uvd"); r = amdgpu_ring_init(adev, ring, 512, &adev->uvd.inst->irq, 0,