Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3940467pxj; Mon, 21 Jun 2021 09:49:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmoqN5ToVIUCGfj10uwHLrLY7yKT/N78aOKitKw9RI5Ik2QAFAdcyVsTUZpYnPL8x+vivs X-Received: by 2002:a17:906:78c:: with SMTP id l12mr15009788ejc.335.1624294175916; Mon, 21 Jun 2021 09:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624294175; cv=none; d=google.com; s=arc-20160816; b=QjnL3H6iyazFcy2iUR7c410paZxZqNAeBDOXuUgpqowhAK7M2csjUSyrSsjiNp8TvQ yZs/5O9b76IabU+18B6jBMbM8k8uwvwdkxaUHlTuUUqBhWA9v/RS9nJh6yG8zceyTNGM pZZVozDolZ4m6Cd1jf5O0kNW7ySPpM6rvIQC8vlY2OFrI8WJ2As/RO2WDa7IxMUQpAoG umxD/MF5P2I6DKamKBc2N0mxPwfMA9CnSqcOHf2DGrOvNxxRq7HU0O8tOGf2FgJ5ybos 8tbM/7rccNKcvzrtw3yZB9nlNGVBXIXbH+CDWklKiFavSwMJeLuQJbYaAZbLCEO/dFjM S8iA== 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=aXMli/3mTEvlo+fMBmezA67l5iGdYtvXOWnWfigpit4=; b=UODIiI+2LCidXXDFcq+jSqn09AOPRcmS7Ck8Md/t6LH5DOeGwH7mKrxIdh5ZL4J0hd DCqypsEGryq9OISCSwyOoELYJRms/zZpza1cdvy0+K2UdfdWwrwbRZ5OyyxZZwH3cyZS M9B6kVJ9Tz48LLgBOX0n/zgHgs+xX26yQ8LKg123yqBq569uh16/R1mye6Lh/N9AlHyq Rt01saOaW16D663lPiZyThJcT0YkyWwWIKdmQ0c1Ozn2yZ+YwKOmLXB6tHpMqT5GS6RK YfUd9gtcmPo4FIPRUZdFTzVb132fWpoNZ9nlF/+jF2pqOPuqru8tRf3fVz56PTYKFTam y+Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eLlVqgMV; 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 bf28si16946597edb.224.2021.06.21.09.49.13; Mon, 21 Jun 2021 09:49:35 -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=eLlVqgMV; 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 S231186AbhFUQsl (ORCPT + 99 others); Mon, 21 Jun 2021 12:48:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:37500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232391AbhFUQn5 (ORCPT ); Mon, 21 Jun 2021 12:43:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B2834613C5; Mon, 21 Jun 2021 16:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624293122; bh=dH7xJQayrZBIPMfOJf6UdvY+v0w6s/jfGmwldd66918=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eLlVqgMVptu/PEAflHQrH5ttN+baecFazx+ucAtDQ5ve/iZLkkoUrvfMe9ggyT8/Q Mkj5J7Xk6HctojhEDz/LJbni5+YBz6nvxFt0ZJ1JnLmJbPdko09zZmbYhjoOVhPTTl YaO52FofsRoZiPwbWg9E2ozoEjybV9ryPh8eNLzY= 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.12 107/178] radeon: use memcpy_to/fromio for UVD fw upload Date: Mon, 21 Jun 2021 18:15:21 +0200 Message-Id: <20210621154926.410094969@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154921.212599475@linuxfoundation.org> References: <20210621154921.212599475@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 dfa9fdbe98da..06bb24d7a9fe 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