Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3918994pxj; Mon, 21 Jun 2021 09:21:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2FzXkN3OnzR2CChwoaTYSxTSU/qo57x3Xv5F32oF+IlK5l5BoD8mFvGXIXxw8kDPnYi8x X-Received: by 2002:a05:6402:1d07:: with SMTP id dg7mr14244098edb.298.1624292511694; Mon, 21 Jun 2021 09:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624292511; cv=none; d=google.com; s=arc-20160816; b=RUCIBbmus5yiDmla2KoohscKJx0W2u3yV1nPw3YqqvpOZYmiO+Syk4ohqSzddOUD5Q lrBxKwWtqm+uKWvaIZnf8f7qVbfxOomyJyeg/IvIJH0oMaSBsFnW4VZ7ZlaWKzmB9h+3 M4HhF2FfbQVWdY/A/Vkn5jBbI6Y9rokNXmYg4CdpnfP6kgJ8ExvPRdLxL3uTgiSDPpRQ St75lIF6BTq+KvRv6YjyscsV0iF6UuyUdJj78eDSCyThx6DBytemTPxOvyVsN3RkXjAY 9N1g9wUJinqVw0vwLa/tm5QAXMkrl5L3umBBuAN76sGuc0bgSzWFJ2ISwJluEVjCd2Gy +yfA== 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=8zCeNpGGVJUGJ1dyCpBC8Sau6d3aU7WUzBGoM8qO/YQ=; b=Bjb062WfiWbvalFAayz/FE6jwtJbesjbuje+9nAbn1t+ho2cGYqD+M9baA+VNNd+tV PFOsHUmOQtZqTuCRWgH4UZ7ZjI7F3KlRlRcmQ8OPKBZDZCDpesy6TJI2rbjP+iv/xVMs hryt/M7JCsQa8YLKaCjreimqNRPXxZ4rtVlERMujOhT7gSj1zuuDEMPPs78Vs5H8NWDR EF5Ipp2XS1k1qsJMWkSNmeMBoOHswyiLt3e4fAC7xL51XNlMcN5NU/JMlK86WtpkPqVc 7/xF8cshd8ZG+a4tMiQdDfJkMlFcXygr4lKds60qTs4i9vQaqSIl9D/DJRcQGRNqIdw6 VNsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=U6gWW3jr; 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 m18si2417492ejn.430.2021.06.21.09.21.29; Mon, 21 Jun 2021 09:21:51 -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=@linuxfoundation.org header.s=korg header.b=U6gWW3jr; 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 S231438AbhFUQV6 (ORCPT + 99 others); Mon, 21 Jun 2021 12:21:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:41818 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbhFUQUw (ORCPT ); Mon, 21 Jun 2021 12:20:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBF1761350; Mon, 21 Jun 2021 16:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292318; bh=Q+ztBa1LgiyBgJaK36fsAnH+BMlypUGENetaOljJfCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U6gWW3jrGIWaXzAP4bF6vQRo0o2zQyTfVxkMq1VyB+AAd3+HSKOAsUie5+KI4PGjo BFJUbzcMxra6+7L7JSzTJNpd2MiGYn/O/GMJtFbTrd1jCyugCb8zgunYWHHLMW/a1A ydq3f2cJs6Q2104BBEJdfjmXmDmM09ia8twqUnHM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Li , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 47/90] radeon: use memcpy_to/fromio for UVD fw upload Date: Mon, 21 Jun 2021 18:15:22 +0200 Message-Id: <20210621154905.723762433@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154904.159672728@linuxfoundation.org> References: <20210621154904.159672728@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: 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 1ad5c3b86b64..a18bf70a251e 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