Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3120043rwb; Mon, 15 Aug 2022 18:36:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR6LR+kDsaympXWAIHptuCRmf6N6WsSrK3T/9poyV2Nuwuk6z2YAhrqFwLQ/aDpxP7GVpW31 X-Received: by 2002:a17:902:8c92:b0:170:aff6:e3a0 with SMTP id t18-20020a1709028c9200b00170aff6e3a0mr19742898plo.54.1660613794013; Mon, 15 Aug 2022 18:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660613794; cv=none; d=google.com; s=arc-20160816; b=GyFrZS0USE5eJxfgHP/p0xasUL1NG2umdEIWiC4idksZDONlfShUYUc+jmcYmQgvbu 2/z0eKQAASNnDOYuPEjizdhUM7i3HBjTrHQ0fVFKr/1u6ZVd0P9+xi6jL/ys4cbeGHB5 gn7p84qbfLp6iPn2NUF0EkdE5Ol6yTZgM0DMzcd0T1+EmbOFCBOzubKaGyrNI8NA11HZ naTFivvcAb+UxIlET5bGdrvqxklHS+j35rmNKMnGGoG4pQ6ZNpuS5Z3LLg4n28Lq2lBc r/ZVV0S2kvkf6RT+xD5sOJVq/XvQDEJreRW//xmkaDVjCE8HEDXlvEkasjgPUp1TGjNa T1xQ== 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=VnoMC0om5McbiycQ8EAVnKksFVJ29SgteNnPugRfqiA=; b=tNkqptXUvdR6c77V4uuAdWGhPlz+KWBA+QeWWsrIQqchZGmFYgRremGnjF1P6iZ8OU kUJ8i+YOnn/LSAV1mMJttk3U7ueXzVl3dg6DQ+QYDbIbtaVKnv8FI56RcUBNXNU88heS IrjvDm2cbYw9KEQAW+79PB2IdZ3MQFCPO+4dOhCvI+hhI+AYSbvyPDyqSwNpHS/WY7iS ZhY4MqqczkALNkp8kvWdJfd2x4jz5WwqsSikOLU8ZiDi8QgXPC5FYa6OhOeRycUOlpou WTc+JGIg6/4gAZDPJvz2sWvK5WaGs5i4adEs2q+1r2fBAZF9W0YRGoRepN7xnmS2M+We tp/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vsfKAxEk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020a056a00169100b005284d10c1d3si12445189pfc.333.2022.08.15.18.36.22; Mon, 15 Aug 2022 18:36:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vsfKAxEk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S244914AbiHOXhN (ORCPT + 99 others); Mon, 15 Aug 2022 19:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346396AbiHOXao (ORCPT ); Mon, 15 Aug 2022 19:30:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC85D14F950; Mon, 15 Aug 2022 13:08:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 01260B81142; Mon, 15 Aug 2022 20:08:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E109C433D6; Mon, 15 Aug 2022 20:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594083; bh=9i1Nhb73CtqsJWc2qLjCq0sOYWBXl+56IWMx6l6gBc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vsfKAxEkxCDY2jxlXQ39saGmKBgRkoTRiTN3m65L5EsZluuQ6eQZK+f9WIelkfFmj Ete00OiEZIF9fVuih7X6XTGv3Fo49dlmgkMjPY3ZPuZBe42RKuSK/V2waiMcuzyD5V XkTYu09ideW7wkndfd3HuMaL2Wq9c3AIg9kCrV0Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, ZhenGuo Yin , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 0343/1157] drm/amdgpu: fix scratch register access method in SRIOV Date: Mon, 15 Aug 2022 19:54:59 +0200 Message-Id: <20220815180453.413724273@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: ZhenGuo Yin [ Upstream commit 851dd8625320fb626b6ab6399b2402fd84abcdfb ] The scratch register should be accessed through MMIO instead of RLCG in SRIOV, since it being used in RLCG register access function. Fixes: d54762cc3e6a ("drm/amdgpu: nuke dynamic gfx scratch reg allocation") Signed-off-by: ZhenGuo Yin Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index c5f46d264b23..ecbaf92759b7 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -3780,11 +3780,12 @@ static void gfx_v10_0_wait_reg_mem(struct amdgpu_ring *ring, int eng_sel, static int gfx_v10_0_ring_test_ring(struct amdgpu_ring *ring) { struct amdgpu_device *adev = ring->adev; + uint32_t scratch = SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG0); uint32_t tmp = 0; unsigned i; int r; - WREG32_SOC15(GC, 0, mmSCRATCH_REG0, 0xCAFEDEAD); + WREG32(scratch, 0xCAFEDEAD); r = amdgpu_ring_alloc(ring, 3); if (r) { DRM_ERROR("amdgpu: cp failed to lock ring %d (%d).\n", @@ -3793,13 +3794,13 @@ static int gfx_v10_0_ring_test_ring(struct amdgpu_ring *ring) } amdgpu_ring_write(ring, PACKET3(PACKET3_SET_UCONFIG_REG, 1)); - amdgpu_ring_write(ring, SOC15_REG_OFFSET(GC, 0, mmSCRATCH_REG0) - + amdgpu_ring_write(ring, scratch - PACKET3_SET_UCONFIG_REG_START); amdgpu_ring_write(ring, 0xDEADBEEF); amdgpu_ring_commit(ring); for (i = 0; i < adev->usec_timeout; i++) { - tmp = RREG32_SOC15(GC, 0, mmSCRATCH_REG0); + tmp = RREG32(scratch); if (tmp == 0xDEADBEEF) break; if (amdgpu_emu_mode == 1) -- 2.35.1