Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3838321pxv; Mon, 28 Jun 2021 14:19:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0jUQkQrjjUvNIYvLhxiCZo1/dT9G19zFa6tt8RAQTuRzg3Ng8SCkdHj4d0/GnmfH8Ar34 X-Received: by 2002:a05:6602:140e:: with SMTP id t14mr1175584iov.42.1624915144404; Mon, 28 Jun 2021 14:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624915144; cv=none; d=google.com; s=arc-20160816; b=qvexdBBGm6kwTlUasZiL+gPIgfY27GxI+bM0O/OkJK6USHW/f3FLm1fLX4EVV5IOp3 GlpdtYnNoNluQB9JSWFCHmX7tB6b2avAUbFKmYjSlt+wo4pmNXy++8Sp1FUtvFp6SaTN x8Qlk+2RGg4UdP/oW6zYUGqh/ogOChRLk13TdjlR960k7kfEOBCYDC38FrYDs6jw5obS 5lnRmAqGPR2hIknw4lRzULMH5BRL6s1r1jqgmE3XvaRstMgKxis0eK1ZMgFnDQdjbeeT Kwr5Le9XB+KkE/skGyeThIOlvA0qjE1J1WVdumUIR9tkaArV46cvCA7dAvYMJPI49PCH cHSg== 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=eL7YrzNaz0TM4qkWbn9JW54IgFVHTlq+gmwhAklYFKw=; b=PtcPxLTK8rUZvpa67wiafis+VAutWIdOIf53MLKmNYabSmtYqzfoMjiI4KdP8T3t5J uzzITzu49+mfhg4kOoLEUK9PWQnCE90ZsINSoFuV0pFKyUc/QZBp4THzl3o9ew10ExMc oJfsrPv2Fp7WFKfjEFY6R8JprSPz2/So47aQvGY0qH0AeUOjNYrJkrwVQsTlaCl92+NU 0hbKdHgGR2cF9Sdlc+24UcaEfAfT1KUOy/v7cbony5kSIXrzSUeTkbd+oBTzj0ze5q/U WWlZhy4CIt/4KD5ke+YEfcLt8v5hVnGr4s2uW+qjmjFpFSoB2SfZZegkSxOqINydTEkH njeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Ct5az0/w"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x6si20019792ilv.67.2021.06.28.14.18.50; Mon, 28 Jun 2021 14:19:04 -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=@kernel.org header.s=k20201202 header.b="Ct5az0/w"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237047AbhF1PWi (ORCPT + 99 others); Mon, 28 Jun 2021 11:22:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:34936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235265AbhF1O6g (ORCPT ); Mon, 28 Jun 2021 10:58:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E94D561D59; Mon, 28 Jun 2021 14:40:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891237; bh=6i1YjUFRA8gMsuP5+Mq6nTgsQgS+2zzqxMkUp3Q3QnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ct5az0/wfqQzraa6ZuVmPu//+v5j3hbUXn3rdYcMbYGoiu9+Jh3EIy2OmOVMolnR6 8hE6EH1biv+Z7sxOXegOIAoqllYH9ZHIz7lZirKnHXuqEpj57O+3eNCx5joKdLx/Fi XYwqyzDZEDyxkfUrEpTXDJdoBzUOi188pnvcsbiNqtw8+go1w8nf4y5R/mXV46JvwA J6qJ6VbS1TOK9tS9RkVYyIMy1IrnxBWMT+UTR5YTKBjPr3cJ2EBLaX7Yr4X762bObo wr+tUr+qoCvj9C36RR/gcVQzoO1y220KYpwpwr4BoLrF7BTAZBcKvNP38YqAgUg1aF u1BN3Mmb6ezQQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chen Li , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Sasha Levin Subject: [PATCH 4.9 37/71] radeon: use memcpy_to/fromio for UVD fw upload Date: Mon, 28 Jun 2021 10:39:29 -0400 Message-Id: <20210628144003.34260-38-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628144003.34260-1-sashal@kernel.org> References: <20210628144003.34260-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.274-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.9.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.9.274-rc1 X-KernelTest-Deadline: 2021-06-30T14:39+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen Li [ Upstream commit ab8363d3875a83f4901eb1cc00ce8afd24de6c85 ] I met a gpu addr bug recently and the kernel log tells me the pc is memcpy/memset and link register is radeon_uvd_resume. As we know, in some architectures, optimized memcpy/memset may not work well on device memory. Trival memcpy_toio/memset_io can fix this problem. BTW, amdgpu has already done it in: commit ba0b2275a678 ("drm/amdgpu: use memcpy_to/fromio for UVD fw upload"), that's why it has no this issue on the same gpu and platform. Signed-off-by: Chen Li Reviewed-by: Christian König Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/radeon/radeon_uvd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 16239b07ce45..2610919eb709 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c @@ -286,7 +286,7 @@ int radeon_uvd_resume(struct radeon_device *rdev) if (rdev->uvd.vcpu_bo == NULL) return -EINVAL; - memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); + memcpy_toio((void __iomem *)rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); size = radeon_bo_size(rdev->uvd.vcpu_bo); size -= rdev->uvd_fw->size; @@ -294,7 +294,7 @@ int radeon_uvd_resume(struct radeon_device *rdev) ptr = rdev->uvd.cpu_addr; ptr += rdev->uvd_fw->size; - memset(ptr, 0, size); + memset_io((void __iomem *)ptr, 0, size); return 0; } -- 2.30.2