From patchwork Fri Dec 6 09:43:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13896763 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1DCBE77182 for ; Fri, 6 Dec 2024 09:43:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2AEAF10F095; Fri, 6 Dec 2024 09:43:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Kcq+MBog"; dkim-atps=neutral Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD62B10F087 for ; Fri, 6 Dec 2024 09:43:23 +0000 (UTC) Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-30024c73101so14888571fa.1 for ; Fri, 06 Dec 2024 01:43:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1733478202; x=1734083002; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=AlZ85fU7bMEdCr3Ivk/JPNhlYCX1et1nGUUrgQd3Dz8=; b=Kcq+MBogSImjRuf0r23Di3TI20XBt+nBVqaeVQJ6UlqIZP+KIGfQGc+SrXDd+QsjwC +DwVjBKifDBAtPhCfAnOGNtRpfN0341JxXKcfb9Wf6b92TxintFvxRlZtPeiW+eGUOkF 0a9jvQxBm4uuaRj7xt/i4t3CPA1HNTgvX9PFozjFL7TbKGBgUdnadSnF/0LV+qQjkIVi HsciJdKkORS7q2r5TOSavGbEy/0DRusEvyubzIwge7d48b62yTRmJIUahLT/ULD+0sSh KISWI5QcXaTKwC8AphU6nZvEa1eCRt9X2s35hIA0rluPEi0j/b4UJ7yplv/RhGOAecJ4 Ty1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733478202; x=1734083002; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AlZ85fU7bMEdCr3Ivk/JPNhlYCX1et1nGUUrgQd3Dz8=; b=l3YDKvS7pxiN/wLwCkg4/n8VounkzyOx1X9D15+QafJRPoFumBZxgfWIBsXuvD2B6e oq2O+6F//diAGPiRuk/gR4E1fcHoH9IRbxT62cZ6xgYzeN1QHEFgNmUcG62b2h1KqL+5 3sEjWc3Irp29oGAnjmwiWc8R2WK1o/8cNrd7AUvGSGNWMOmeKTjmwXQUKhV4gCOXTWkw HIXIXST6aYd/QoYTKuHS4Smn4jlzhKOquGsHEKg/GjmXyKkUzBK1s2+RErRyGRc1Z3/t 8fOmhkIqJGHbBI3QQ0icItYIk6HcIPJJFCq84BpiFGOc+Jo4oaWri1E79rBJdB1j2Qd8 Oybg== X-Forwarded-Encrypted: i=1; AJvYcCXpeYKChSfFiDNNJ+HuogqCWaSAu+Soq8FhS+RH0Z5jk58SILcHBSxkYLzDeeOYXI8biZOHackHKXs=@lists.freedesktop.org X-Gm-Message-State: AOJu0YwxILY6vzbEmoM7J8oXmVVBUzeeUb7VlAhp1bY1FGadWCZi7E0u tyemOF18gU8bCWPrFZ2/v7a3x+BBCT3zA40DxeASqPZzGjKE9ir74DcsExMLFSI= X-Gm-Gg: ASbGncvIxk+pSyZsANozUBcZGWsNPcGNJtRPtfu4Mlp+zhJcLgshsf6fTypKPpvV/xN ZLeDCMXoeO76De0Z4PFuXly9f73uG9v5fOpbP9AaIGe8DVq3RTVT+g247KNzbFy69q1gdNbtd3N 7SpYKr3XrEtj4xT9i3Yf0YDRkTfN7L25n0fz28lFm4r3DvhfThgz8MT8qateCQwKF/nKDVV56bE zLpQQl90uXwiWZjzv4EO/50XtE8ueNCt2EYuXy7gOSiJymqkaG11kByXg== X-Google-Smtp-Source: AGHT+IGE6b4F5G8fB5UzCy612X2zS/z9Gws1TIKohedsOmxkKxomXTuE6wjdB8eKM7SaKj4xHi2otw== X-Received: by 2002:a2e:a9a6:0:b0:2ff:bf0a:2226 with SMTP id 38308e7fff4ca-3001eb8e67dmr19885601fa.17.1733478201781; Fri, 06 Dec 2024 01:43:21 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30020db3805sm4128441fa.50.2024.12.06.01.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Dec 2024 01:43:21 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 06 Dec 2024 11:43:07 +0200 Subject: [PATCH v2 04/10] drm/amd/display: use eld_mutex to protect access to connector->eld MIME-Version: 1.0 Message-Id: <20241206-drm-connector-eld-mutex-v2-4-c9bce1ee8bea@linaro.org> References: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> In-Reply-To: <20241206-drm-connector-eld-mutex-v2-0-c9bce1ee8bea@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Xinhui Pan , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1082; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=xBnYTDnWSnfj2+gm2t5bxnQqQ5FnybkVoMOlzhUTQDQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnUscueDleWgUKJKAcLnM9AVfyZmdn0HpKF5uCT kBmRHGm9H6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ1LHLgAKCRCLPIo+Aiko 1eleB/9rtsqyEXNmADXNUhLtuCtrT54s5AaOypZT19JWbxxkqIS98oj7wNLlcf7TA1rOQTNS5RC dvsjFVOL4cizIF20+Xp8TdJpnBVVRKORmoXxY/g+sGQsD+EyOh+b04CJUaXVrWxd8DJsAwzaO8w 75HquG2asaq4K33OkBPkZ85wATKlXdb9yjA+34HEfbGr4Dd71VsgTtQ3Ozs0zJ7lDxU778quIl/ b+/N+ADy5pyhsVGIAgmAr74L8TzRGdbpMnzmSPT2IwV7qsqdNr+KY8fyDGlhRaj2FA4wIhoLac1 9tx5/gz16qNpAiJ9A8ijUf1L2Ck59EMtUlTVlC/at/0sY+sa X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Reading access to connector->eld can happen at the same time the drm_edid_to_eld() updates the data. Take the newly added eld_mutex in order to protect connector->eld from concurrent access. Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 19a58630e774029767bf2a27eb4ddf17e3c21129..04c68c320252b5ce9647f0606fb86fe57f347639 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1037,8 +1037,10 @@ static int amdgpu_dm_audio_component_get_eld(struct device *kdev, int port, continue; *enabled = true; + mutex_lock(&connector->eld_mutex); ret = drm_eld_size(connector->eld); memcpy(buf, connector->eld, min(max_bytes, ret)); + mutex_unlock(&connector->eld_mutex); break; }