Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3926867pxj; Mon, 21 Jun 2021 09:32:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8SnU5JyUShPVpjWH6a0Xy2DVO4PPj3xiAxwIFZGpo6G3OkX5uHvdXxUHKRqCfK/uj39V6 X-Received: by 2002:a6b:d113:: with SMTP id l19mr20177658iob.207.1624293129588; Mon, 21 Jun 2021 09:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624293129; cv=none; d=google.com; s=arc-20160816; b=nMfDYJ2az4qWNbzEcQ3UjCcm23eG9cqiiVpmZjAWHM998SEDtEtFeG1H4GRylW9bYv pdL4GJUFC6pJq/++QCF+XgnVN7K3YW/NyveImhdZGbrViEkbUq1neCO38hWXPQTlM2Kc BwL4WYZ9hFnuAUvCXuMOXw3Szyz4x1683tOCKuV7OdW639FbzhfLZS0jJTZjHeWNiGy8 IuQ6w0eq6/5QcChixEF0Y6TTU6BkY/Sh4pf9X1f78+q6I/JBl7Jw3uUI/0xYNq9K9m5S tHPLKjXRbvnGj1kSz1tg1AO8UnxuC8smEqBgRFTx1NnWIETi0JscBO27TmTeWaIETQCQ tWHg== 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=4+NbMza48om+QwM3ppVhE5IwDzu2h1knLJgcFZSTFQw=; b=shuDBoVdHTGKI8j1PozDUJ7wMQq29CskmRR/Cdp9d5BjxbuPtYV0am+jFfVKCs91NQ KvfvPgTMweJZzANXqt/NzdY3b0MdxymmODn2FymLccN2pbWTK2VqYhLDa5gt3mbMixHn lW6mShrPdIjCmqcsn4TEkDSxn1MNlX70u78WBgjS4nSEcxNqLwvB5CDwfY9LsXZhRurV V9E0ofZXdw3fmhVe4cud3NxyX11kNC9eecRLQ+506RmErm1ezU1tabNqRbXHxO5T+Txc tbGY0rQhadh25gF/YnVWXshy1g0r0QBR9L1JpXUEsG9iQHussFmFNA78WBGVZmFSpJP6 ib6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t8gMP9zT; 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 x17si20030995iow.76.2021.06.21.09.31.57; Mon, 21 Jun 2021 09:32:09 -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=t8gMP9zT; 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 S232094AbhFUQc3 (ORCPT + 99 others); Mon, 21 Jun 2021 12:32:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:49592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232528AbhFUQ3m (ORCPT ); Mon, 21 Jun 2021 12:29:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0DFEF610C7; Mon, 21 Jun 2021 16:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624292680; bh=6NxuvCGk51nsXq5pGEu5nJ8b/BYRPTFhx9c/hZs7Fm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t8gMP9zT4k7c/iSYlWlMsQx6z4cSTctgbBaQAgHOKgbXtA+BbwNRUGvTJBc6feqtH MqCzRFp8jy3Jzs/iqqzHAMJCjxNaqDKeCRNayqjLaAAjSI3EWv9hojCLJve9uaAcNl 8KJDNuqYjwevf4jdmv+k07hAK1szvD3H+3pRZ+C0= 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.10 091/146] radeon: use memcpy_to/fromio for UVD fw upload Date: Mon, 21 Jun 2021 18:15:21 +0200 Message-Id: <20210621154916.875583985@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154911.244649123@linuxfoundation.org> References: <20210621154911.244649123@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 57fb3eb3a4b4..1f4e3396d097 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