Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1178437rdf; Wed, 22 Nov 2023 07:34:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYHnadQDNuUdTo0JN5WMYjQLS9F+y+1bDnFoiPP44gqTjDji+ZQ7sILsXJFMolslkUItoz X-Received: by 2002:a17:902:f546:b0:1cc:2151:2b36 with SMTP id h6-20020a170902f54600b001cc21512b36mr2899474plf.55.1700667254731; Wed, 22 Nov 2023 07:34:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700667254; cv=none; d=google.com; s=arc-20160816; b=xffZcizvH4eOwPYGrOtf27IWR7gX8s3hdiVw0eSINRVORCp7eDZmNzdJRiIQDD7zHv QTq+PxEt7jQU6gVyxArbZN+EB8KH6+yL41fE0K8cIdgFqQM2nRDfFAo6fa5eDWiN+G26 qmJDSF2Zio2/Ki2W5L29TNJdSZBBJI4eWCdbA9ImAkbEJLscf1YwHJBtpQS7KZyepDR5 ybkuOvdlvGxxzqpZXnkRjdt5QqiNRtHSZIWdJfGNH/00I+tr7B/VajCNiOO2wBQV68M1 PJrtDVuTCSrEUjJXr1iYEuhppzJAHhsAXBfqo9aVq4NDn+rfMxfjPPHGSuig6xnbUd9u QaPA== 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=DKCpo3A77lOUDlOoplnbHcPw06t0N1QjI5t9doxknVY=; fh=dpMLQamN49cZKJvnNf6+PabRn1qRAE3NpbZc74G8/Wc=; b=GEL8sSYBhwre2uyzZjCXjdvvoFKFabDaqvehAVpEwQRmtSC1fim9uB5m+MusMwLgHK ZJ6ZO+Gs+tqLooeAj0U2wJNg9lES2FHgcxzn+XawKKaeDV8YHNHTac9Spi+S+dHPlEC+ LqGuTKFIjlWca8arld8q5Rwze3LLQhtMcRHanLSBRuea6zH96irdfOsXFjQPen2ml4Wv dUpjt8yOFoPyup75wlGm6HtgC9qELEp4squFsMfeCziB7X+/Sok64qeQy+a8EKophHEV y/BEW1j+EX7GMrwU4QGJ979uzdnj/3KJU9bfYoyVBxn9IR2WCWJMkA6YGKca9x/cVyih fsOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D6XKxktZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bd6-20020a170902830600b0019c354055d0si12461279plb.304.2023.11.22.07.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 07:34:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D6XKxktZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 89C008212AA6; Wed, 22 Nov 2023 07:34:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235174AbjKVPd4 (ORCPT + 99 others); Wed, 22 Nov 2023 10:33:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344495AbjKVPdk (ORCPT ); Wed, 22 Nov 2023 10:33:40 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F1BFD60; Wed, 22 Nov 2023 07:33:09 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9C83C433C8; Wed, 22 Nov 2023 15:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700667188; bh=2qTOvCWpzcEMq1BGkwO3St3fjrcWiejay2W1ytf8K8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D6XKxktZkMgA5PLXSJ9+b3S59k/JKezAkMR8ANMXwRdlL6PdxvWfuOEGR2+LvY64E ZCQj+E/2UCOB31CCUplCfAl9C28xUg9YeKl6fwVL63eFDAcRbfJ60Prcz+To4UcOYW zWWhr+1w+bawXE6HJ0JIIVQZWC4Ypk1Ouwr8iLjw1UOge6woVAPoC4gxVr7fv1kn/Z I7r5nJOCP/aG7bUi/QXNojOPhqYOgLBObaxOGOjdqAU1XJB20V7ouFEiMLx/k7rojK SkQFRE81pO67ijg/rqyvgVTxiGWri1XvF9KThGqJJceN7aIyJAh/VEHcXMdJsOJJdO l1gCXPGAEfWDQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Le Ma , Hawking Zhang , Alex Deucher , Sasha Levin , christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, Felix.Kuehling@amd.com, lijo.lazar@amd.com, rajneesh.bhardwaj@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.6 15/17] drm/amdgpu: finalizing mem_partitions at the end of GMC v9 sw_fini Date: Wed, 22 Nov 2023 10:31:44 -0500 Message-ID: <20231122153212.852040-15-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231122153212.852040-1-sashal@kernel.org> References: <20231122153212.852040-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.6.2 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 07:34:01 -0800 (PST) From: Le Ma [ Upstream commit bdb72185d310fc8049c7ea95221d640e9e7165e5 ] The valid num_mem_partitions is required during ttm pool fini, thus move the cleanup at the end of the function. Signed-off-by: Le Ma Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c index f9a5a2c0573e4..89550d3df68d8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -2220,8 +2220,6 @@ static int gmc_v9_0_sw_fini(void *handle) if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3)) amdgpu_gmc_sysfs_fini(adev); - adev->gmc.num_mem_partitions = 0; - kfree(adev->gmc.mem_partitions); amdgpu_gmc_ras_fini(adev); amdgpu_gem_force_release(adev); @@ -2235,6 +2233,9 @@ static int gmc_v9_0_sw_fini(void *handle) amdgpu_bo_free_kernel(&adev->gmc.pdb0_bo, NULL, &adev->gmc.ptr_pdb0); amdgpu_bo_fini(adev); + adev->gmc.num_mem_partitions = 0; + kfree(adev->gmc.mem_partitions); + return 0; } -- 2.42.0