Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3831508pxv; Mon, 28 Jun 2021 14:06:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvgo303/B+pveRGw7RCFpr+hqLF0CndrDej1Bh8XwZRCpjx59/UtNHTduh9bJu4NZTTdMC X-Received: by 2002:a05:6638:3398:: with SMTP id h24mr1330338jav.128.1624914381609; Mon, 28 Jun 2021 14:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624914381; cv=none; d=google.com; s=arc-20160816; b=vNalXJ/tG6fjFGpjFGzztjzzkRCQTIcf7fRKKMs69mSoU5FOIXGowUQFTIgp5ch1FP aolow44GHo1mFeMx9hvPzd3xGnEtgh0zQdUc3ZCw/UQ5XTbjYOyKVQdrg4iUJHwbgZyi G0qzOENAdAjrQ9FdfTxZEp4TGUaJw+P+rGsFFD5Ey8Ye9T4Y1iVRghJ5bIcVtB/HVwMB pVhSxdbpy/rB8fuge2jkkl/IOFFwWDzqA9G0EDbRTvGmfoDPQ3gbN9XRO9uzpq2ZUnqb fC0k1MxNUdDBFc5Ph3WxCLLElNPA7vpncbdkxmsD71v5dLF1BMv4r8vm8HK0O2nV1Fyd FhQA== 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=yjvpDKf/qArpqZQ+abua+GtqYSQunYcJiNqHnb0yNCU=; b=wpuW4NGe56Emn0eIa7CgHVz8RrkCQvyFgaggoNZf+jfygO/32dDXFkgTTRGT7lcAeW s32q2CflGbVAqoeKYpWB8Th0YLRF7xVaLXsnibw5rvxtq5BlWY0YE+aHwaW981ufWljU JM3mm+Onp9Mt1Jaomp/PSNvvo+wNKYQfTy1TJX0zPETepaqgWz/bOSHBDHHWmexSMrOq DygQyJorfHwZbFON+W2HLQPyq+TtGNT0WawX8UjqJlWCTJs5d1TkZ31QIZdT4hfL1jUu 7zWZCfZbSVKeUWWqFzVBW9Oao5gEqEsDrntUZ/Fkmq/swX+uAndgR+HI1N61sqP0X+1w fOtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="G25xqKA/"; 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 l17si13960531jas.38.2021.06.28.14.06.03; Mon, 28 Jun 2021 14:06:21 -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="G25xqKA/"; 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 S235025AbhF1PLT (ORCPT + 99 others); Mon, 28 Jun 2021 11:11:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:54462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235525AbhF1Ou5 (ORCPT ); Mon, 28 Jun 2021 10:50:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B4BB061D2C; Mon, 28 Jun 2021 14:37:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624891026; bh=XIYvHSSButC67HzU6fduVakbD0ni65gR3K7el6VrxOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G25xqKA/eEuK0n8inIqEn8w5AbeAfSuIYcscvX0fwfcr4IBvHHt1WbuYdYkMC7omA KoRFKljxewFCgzmwwirpb2O+oAhtk3W8vgFfl3BE0iqXoRN0ZDwuS2LlbV53s/dbA2 f9KSEsTPCjYRJsTy7boXKfYhD7tWRElnSA7nriFDCc0Ugrf5EkpFhSPsCbnuPxu3bH LgESfVQFHeAelNBq9nsfUgpTtnNJ8eQwWuj0LV/WL6DAFkNzf2AJY3YeWLfQIzs4ep NorE8Aa843ZZEwpT2z94bdAqxjiA0HfIXtRDfLrMkmOznMUd23Zd1fDsFp1M6cwdIz 0R2ovgQzTQlvg== 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.14 41/88] radeon: use memcpy_to/fromio for UVD fw upload Date: Mon, 28 Jun 2021 10:35:41 -0400 Message-Id: <20210628143628.33342-42-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628143628.33342-1-sashal@kernel.org> References: <20210628143628.33342-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.14.238-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.238-rc1 X-KernelTest-Deadline: 2021-06-30T14:36+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 95f4db70dd22..fde9c69ecc86 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