From nobody Mon Dec 15 13:05:05 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FDBEC6FA83 for ; Mon, 26 Sep 2022 11:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237357AbiIZLGq (ORCPT ); Mon, 26 Sep 2022 07:06:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234052AbiIZLFx (ORCPT ); Mon, 26 Sep 2022 07:05:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F1994F650; Mon, 26 Sep 2022 03:33:56 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 02A6960B60; Mon, 26 Sep 2022 10:32:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED5D7C433C1; Mon, 26 Sep 2022 10:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188338; bh=3/2K3H93sz3A/W5h2g23S4x5Atb3f1yd+wC6xCWNrFg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HFpb12IAa2oDFXwsWSmJ3x3WAJZX7NsbooLFj2mslPINX4gN7lLPNjwHa7zSGzNf/ BudkslG/Tn1zS3/YIltHruNviHLtwE5fseY5RxipOYK8xi+QJElte3iNjtWAlDRSLK S1bOwt+mNPspp3Xk1K0JMs74fMrrrJqqtnSq3YSQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jingwen Chen , Horace Chen , Alex Deucher Subject: [PATCH 5.10 116/141] drm/amd/amdgpu: fixing read wrong pf2vf data in SRIOV Date: Mon, 26 Sep 2022 12:12:22 +0200 Message-Id: <20220926100758.659227043@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100754.639112000@linuxfoundation.org> References: <20220926100754.639112000@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jingwen Chen commit 9a458402fb69bda886aa6cbe067311b6e3d9c52a upstream. [Why] This fixes 892deb48269c ("drm/amdgpu: Separate vf2pf work item init from vi= rt data exchange"). we should read pf2vf data based at mman.fw_vram_usage_va after gmc sw_init. commit 892deb48269c breaks this logic. [How] calling amdgpu_virt_exchange_data in amdgpu_virt_init_data_exchange to set the right base in the right sequence. v2: call amdgpu_virt_init_data_exchange after gmc sw_init to make data exchange workqueue run v3: clean up the code logic v4: add some comment and make the code more readable Fixes: 892deb48269c ("drm/amdgpu: Separate vf2pf work item init from virt d= ata exchange") Signed-off-by: Jingwen Chen Reviewed-by: Horace Chen Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -2224,7 +2224,7 @@ static int amdgpu_device_ip_init(struct } =20 if (amdgpu_sriov_vf(adev)) - amdgpu_virt_exchange_data(adev); + amdgpu_virt_init_data_exchange(adev); =20 r =3D amdgpu_ib_pool_init(adev); if (r) { --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c @@ -584,20 +584,20 @@ void amdgpu_virt_init_data_exchange(stru adev->virt.fw_reserve.p_vf2pf =3D NULL; adev->virt.vf2pf_update_interval_ms =3D 0; =20 - if (adev->bios !=3D NULL) { - adev->virt.vf2pf_update_interval_ms =3D 2000; + if (adev->mman.fw_vram_usage_va !=3D NULL) { + /* go through this logic in ip_init and reset to init workqueue*/ + amdgpu_virt_exchange_data(adev); =20 + INIT_DELAYED_WORK(&adev->virt.vf2pf_work, amdgpu_virt_update_vf2pf_work_= item); + schedule_delayed_work(&(adev->virt.vf2pf_work), msecs_to_jiffies(adev->v= irt.vf2pf_update_interval_ms)); + } else if (adev->bios !=3D NULL) { + /* got through this logic in early init stage to get necessary flags, e.= g. rlcg_acc related*/ adev->virt.fw_reserve.p_pf2vf =3D (struct amd_sriov_msg_pf2vf_info_header *) (adev->bios + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB << 10)); =20 amdgpu_virt_read_pf2vf_data(adev); } - - if (adev->virt.vf2pf_update_interval_ms !=3D 0) { - INIT_DELAYED_WORK(&adev->virt.vf2pf_work, amdgpu_virt_update_vf2pf_work_= item); - schedule_delayed_work(&(adev->virt.vf2pf_work), msecs_to_jiffies(adev->v= irt.vf2pf_update_interval_ms)); - } } =20 =20 @@ -633,12 +633,6 @@ void amdgpu_virt_exchange_data(struct am if (adev->virt.ras_init_done) amdgpu_virt_add_bad_page(adev, bp_block_offset, bp_block_size); } - } else if (adev->bios !=3D NULL) { - adev->virt.fw_reserve.p_pf2vf =3D - (struct amd_sriov_msg_pf2vf_info_header *) - (adev->bios + (AMD_SRIOV_MSG_PF2VF_OFFSET_KB << 10)); - - amdgpu_virt_read_pf2vf_data(adev); } }