From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE633606A322 for ; Fri, 4 Dec 2026 14:24:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=K1ZkrWQD Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4CF13112FC8; Fri, 4 Dec 2026 14:24:36 +0000 (UTC) Received: from SN4PR0501CU005.outbound.protection.outlook.com (mail-southcentralusazon11011063.outbound.protection.outlook.com [40.93.194.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id A495A112FC8 for ; Fri, 4 Dec 2026 14:24:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZqRQac88aXlbuNR/OuogqtKvtDuvnW93qgFcAWrlhiyYIu+xiC8UXhv9N8mj5pFPbA8lk0NwuGGm50wOd2p6VpTFbVrEHFSfUZipvLBBt0B8598sr6U0SMWe14vHr0D36PSmbBMnD1ykV68/MOd8u3QM1PYOA+pTKoN9fFyCSW8OngMTlpLmzhovClxH1Wz6mHr8U2+8GNXg5SBEgA40ruwrmQLKWL2TF1rhlQ7iIqUAAmDRkMxltRkfdTaCoRkZHTsXVo3VhBpFqAUQ7DwcpqtNhqAkT2k5AYeT95gEeHnBEEuck9DdevKWrlfj8dQBjjhVIiwLkE98XVmEoUWzBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iKAf8PLm0E+xDSpA42j2w5ceCkf2h9NuO1jznbKM3LE=; b=yymFqbB1leLgZCBi6cIanf2a4+OUj0LqBaafNC2HI17ut/q3ZTf/KN9P+1kAJY8da9sQOPmDl8KDYdiScuA4Zdi0qNPRa87V1e5Ey48lWaSPZucYK8tf5+PBIHpGd3e4NeD6a5hX1VXGRUbR35KSDzmku3HAQncWRvmpLQ/eSlAy3dX4Ex8f2nfj+L80C1R+LRdYGT31jP0orryXLU2rwiQkjyHIl1hymz9XMMKGVlTsuqaHgRjk9GyFrBFerlJtR2p+neP9Xx8bu1iYZFH1lg/76uFSH39pJKJDsciv6jArTiy30KBgnGnuJAOckULj9qqo8jYXHT5ehcyCuNNlWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iKAf8PLm0E+xDSpA42j2w5ceCkf2h9NuO1jznbKM3LE=; b=K1ZkrWQDFBUz1bd8Hk6KnDvUihD6gBP3KFGXM0jSKEutwX4EKkZ5bNDEskXCWcHZlJl6ocKkVtH61LQzYsZHZ+pCJto/Uon/jtEsVSTfRsd4iG+K4UFo09PLp2yOR9vVL2YUjV89zC1oPA3WXBQCIAoDWFyU5tv5yhcB4gVnakk= Received: from BN9PR03CA0669.namprd03.prod.outlook.com (2603:10b6:408:10e::14) by MW4PR12MB6683.namprd12.prod.outlook.com (2603:10b6:303:1e2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.12; Fri, 4 Dec 2026 14:24:24 +0000 Received: from BN6PEPF00000074.namprd03.prod.outlook.com (2603:10b6:408:10e:cafe::9b) by BN9PR03CA0669.outlook.office365.com (2603:10b6:408:10e::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.13 via Frontend Transport; Fri, 4 Dec 2026 14:24:24 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by BN6PEPF00000074.mail.protection.outlook.com (10.167.248.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.709.6 via Frontend Transport; Fri, 4 Dec 2026 14:24:23 +0000 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Fri, 4 Dec 2026 08:24:20 -0600 Received: from vbox-mint22-o.amd.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Fri, 4 Dec 2026 08:24:20 -0600 From: Frank Min To: CC: Frank Min Subject: [PATCH 9/9] drm/amdgpu: fix mutex unlock position for ucode loading Date: Fri, 4 Dec 2026 22:24:08 +0800 Message-ID: <20261204142408.988734-9-Frank.Min@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261204142408.988734-1-Frank.Min@amd.com> References: <20261204142408.988734-1-Frank.Min@amd.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PEPF00000074:EE_|MW4PR12MB6683:EE_ X-MS-Office365-Filtering-Correlation-Id: 16364ae6-4a39-4715-0c3b-08df52124b8e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|23010399003|36860700016|82310400026|1800799024|56012099006|10067099003|261022075727099003|261009223027099003|261021123027099003|261021121427099003|261102123227099003|18002099003|22082099003|6133799003|11063799006|3023799007; X-Microsoft-Antispam-Message-Info: CPOyGXB6lfh7/SCWat4s79weqcb3P3mgGxeA4LjNvY518uzdoHLw2/u88QNaixFh832+Phei47mJZg7kcs86WxbHi98X6JACpS5kwtYNOm45UFaNAdjiVHeKC7PsP74OxRJWZT6fpNqtTy/lo0x814DpKGgBWjlYBvP8t5MuEpXaXelgFdlCzWGEvmfb71DHGGV/2bznI8WzZuv2vzgTz5+S19fgod0TjWxi2NUNSppnGTBjpLsYA8NWjr3j2rw4Mm11HI9cVia3cIiHpIzL2+3wZesSUYsG+zxY++HVp/y8VMPPzI1bASRwkQfpEk1l1IBzrFp6XYPKR79ADHBTsG3ZXoe5S5fdoh9XcgBCny6H5+XHJbnGEO8BVAz1fWrZFFhG8crF96s7kkMY7c/RQF/sLiwgGCeaTjiYf1ZwF1D+UUOelQ2UQmLAQJoBBITlarb3C570Xrfg8ulTUzKanB0MGBe38SEHd7lntFxcqRLuLux8bnUv4Knx/zQNjK/jEWwlmrmFnWe41YL+7EbULWKRB40+N09hNljvbdpihDcY3YmKqvua3XtWEKvbcIgQOVVb1i9N29wK16RbiSv/o5lYFlVe61Wzg9WERyPcgnDbTcYUV7dyVti5BloOClHAdrj/xF6DhcEYH5lGQzRZKsr5Os/xWxoDEvu+dFAuY/nEy5qg7QY0amSbz8473XTmFOYkK04ZbTXvh4UhpGAmzQ== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb08.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(23010399003)(36860700016)(82310400026)(1800799024)(56012099006)(10067099003)(261022075727099003)(261009223027099003)(261021123027099003)(261021121427099003)(261102123227099003)(18002099003)(22082099003)(6133799003)(11063799006)(3023799007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4wwDD2nQNdIvv1DY5NM5MyL3qa9OZYAqAhULHFGugnMPT7neVwlLBKF6Qm2/9buao418lcPl4SnRR5xKlyoTtrsmN9lslhmhz6iivPpHGYclDxzkq0MiiKQqPUN7XNuPZ06ty1EDG8wHt7iUwzpmGFg+zXl5kK+DfLKwpxcB0QeuYDIT9caka29F1qiMPYCRame8mROShLoF09lShRI1sq4Pvjc5MDxV8+iKislz089Jcd3nlNT9D+ZHJJfa/XmhvyyariRw7/UDK+vlaFslIiqJaDTqSC1Ahx6p9BIUDaoql4XcLK0bQwJnRnVbIPh3PzKbRdVTq58NdcpIj5JHDLC1S7sACiViKBag1UXYeaLMS7XzQEqysMHkVB71uPeruHUm2N00Z6Bs9GSyTuPDnapMsdsUC6Vy0gPvUtlTvfNB2MEsUtl930JKMxGd/w5W X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2026 14:24:23.9968 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16364ae6-4a39-4715-0c3b-08df52124b8e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN6PEPF00000074.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6683 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "amd-gfx" X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Reset the GRBM selection before dropping srbm_mutex. Fix gfx v11.0/v12.0/v12.1 and v13.0. Signed-off-by: Frank Min --- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v13_0.c | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index ea74defe7fea0..13ff74ec3a540 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -3030,8 +3030,8 @@ static int gfx_v11_0_config_mec_cache_rs64(struct amdgpu_device *adev, uint64_t WREG32_SOC15(GC, 0, regCP_CPC_IC_BASE_HI, upper_32_bits(addr)); } - mutex_unlock(&adev->srbm_mutex); soc21_grbm_select(adev, 0, 0, 0, 0); + mutex_unlock(&adev->srbm_mutex); /* Trigger an invalidation of the L1 instruction caches */ tmp = RREG32_SOC15(GC, 0, regCP_MEC_DC_OP_CNTL); @@ -3989,8 +3989,8 @@ static int gfx_v11_0_cp_compute_load_microcode_rs64(struct amdgpu_device *adev) WREG32_SOC15(GC, 0, regCP_CPC_IC_BASE_HI, upper_32_bits(adev->gfx.mec.mec_fw_gpu_addr)); } - mutex_unlock(&adev->srbm_mutex); soc21_grbm_select(adev, 0, 0, 0, 0); + mutex_unlock(&adev->srbm_mutex); /* Trigger an invalidation of the L1 instruction caches */ tmp = RREG32_SOC15(GC, 0, regCP_MEC_DC_OP_CNTL); diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c index 8d6e74167d1c4..02894a2bb4bf3 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c @@ -2860,8 +2860,8 @@ static int gfx_v12_0_cp_compute_load_microcode_rs64(struct amdgpu_device *adev) WREG32_SOC15(GC, 0, regCP_CPC_IC_BASE_HI, upper_32_bits(adev->gfx.mec.mec_fw_gpu_addr)); } - mutex_unlock(&adev->srbm_mutex); soc24_grbm_select(adev, 0, 0, 0, 0); + mutex_unlock(&adev->srbm_mutex); /* Trigger an invalidation of the L1 instruction caches */ tmp = RREG32_SOC15(GC, 0, regCP_MEC_DC_OP_CNTL); diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c index d393435e994b2..b200863bad906 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c @@ -2183,8 +2183,8 @@ static int gfx_v12_1_xcc_cp_compute_load_microcode_rs64(struct amdgpu_device *ad WREG32_SOC15(GC, GET_INST(GC, xcc_id), regCP_CPC_IC_BASE_HI, upper_32_bits(adev->gfx.mec.mec_fw_gpu_addr)); } - mutex_unlock(&adev->srbm_mutex); soc_v1_0_grbm_select(adev, 0, 0, 0, 0, GET_INST(GC, xcc_id)); + mutex_unlock(&adev->srbm_mutex); /* Trigger an invalidation of the L1 instruction caches */ tmp = RREG32_SOC15(GC, GET_INST(GC, xcc_id), regCP_MEC_DC_OP_CNTL); diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v13_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v13_0.c index 9ef249b95f916..439e51ded70ce 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v13_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v13_0.c @@ -2877,8 +2877,9 @@ static int gfx_v13_0_cp_compute_load_microcode_rs64(struct amdgpu_device *adev) upper_32_bits(adev->gfx.mec.mec_fw_gpu_addr)); } } - mutex_unlock(&adev->srbm_mutex); soc_v2_0_grbm_select(adev, 0, 0, 0, 0); + mutex_unlock(&adev->srbm_mutex); + /* Trigger an invalidation of the L1 instruction caches */ tmp = RREG32_SOC15(GC, 0, regCP_CPC_IC_OP_NATIVE_CNTL); tmp = REG_SET_FIELD(tmp, CP_CPC_IC_OP_NATIVE_CNTL, INVALIDATE_CACHE, 1); -- 2.43.0